summaryrefslogtreecommitdiff
path: root/board/woomax/board.c
diff options
context:
space:
mode:
authorMichael5 Chen <michael5_chen1@pegatron.corp-partner.google.com>2020-07-21 16:50:28 +0800
committerCommit Bot <commit-bot@chromium.org>2020-07-22 09:44:27 +0000
commitc02e23c66b17a67b24f970c56ba115a55b572df7 (patch)
treee6fe932c2a9909c77f190c4298d10dc7ad81342b /board/woomax/board.c
parent9652e15a8dd64e6546ba418cc9058e96375ba919 (diff)
downloadchrome-ec-c02e23c66b17a67b24f970c56ba115a55b572df7.tar.gz
woomax: Config lid and base rotation matrix.
Config lid and base rotation matrix. BUG=b:160933251 BRANCH=master TEST=manual Enable ec console "accelinfo on" and check angle from 0 to 360 degree. Signed-off-by: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: I2e8e8a7c7e31c831aa386013b473184569bbcd39 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2309527 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'board/woomax/board.c')
-rw-r--r--board/woomax/board.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/board/woomax/board.c b/board/woomax/board.c
index 2a56852173..5ed21fa03a 100644
--- a/board/woomax/board.c
+++ b/board/woomax/board.c
@@ -50,6 +50,19 @@ static struct mutex g_base_mutex;
static struct kionix_accel_data g_kx022_data;
static struct bmi_drv_data_t g_bmi160_data;
+/* Rotation matrix for the lid accelerometer */
+static const mat33_fp_t lid_standard_ref = {
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) },
+};
+
+static const mat33_fp_t base_standard_ref = {
+ { 0, FLOAT_TO_FP(-1), 0},
+ { FLOAT_TO_FP(-1), 0, 0},
+ { 0, 0, FLOAT_TO_FP(-1)},
+};
+
/* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -63,7 +76,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv_data = &g_kx022_data,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
- .rot_standard_ref = NULL,
+ .rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
.max_frequency = KX022_ACCEL_MAX_FREQ,
@@ -92,7 +105,7 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 2, /* g, enough for laptop */
- .rot_standard_ref = NULL,
+ .rot_standard_ref = &base_standard_ref,
.min_frequency = BMI_ACCEL_MIN_FREQ,
.max_frequency = BMI_ACCEL_MAX_FREQ,
.config = {