diff options
author | Devin Lu <Devin.Lu@quantatw.com> | 2020-08-06 19:05:07 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-11 04:35:24 +0000 |
commit | 8eb404edade37c86a879564a7c32356dd7902416 (patch) | |
tree | 6776b52fb0f14e0649b3a5f975cf5154ba97d7de /board/drawcia | |
parent | 76d37a8137e8585e01e99db1764c12f8d1ceb3a7 (diff) | |
download | chrome-ec-8eb404edade37c86a879564a7c32356dd7902416.tar.gz |
drawcia: Correct accelerometer orientation
BUG=none
BRANCH=none
TEST=On Drawcia mockup, check the screen rotation was normally.
Make sure x-y-z axis direction is indeed.
Signed-off-by: Devin Lu <Devin.Lu@quantatw.com>
Change-Id: I383a00d69e2a4ceec22a12bb0b9b15d262c39336
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2341082
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'board/drawcia')
-rw-r--r-- | board/drawcia/board.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/board/drawcia/board.c b/board/drawcia/board.c index 797f0ddce3..0b31b28e0e 100644 --- a/board/drawcia/board.c +++ b/board/drawcia/board.c @@ -446,6 +446,19 @@ static struct mutex g_base_mutex; static struct accelgyro_saved_data_t g_bma253_data; static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA; +/* Matrix to rotate accelrator into standard reference frame */ +static const mat33_fp_t base_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 lid_standard_ref = { + { FLOAT_TO_FP(1), 0, 0}, + { 0, FLOAT_TO_FP(-1), 0}, + { 0, 0, FLOAT_TO_FP(-1)} +}; + /* Drivers */ struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { @@ -459,7 +472,7 @@ struct motion_sensor_t motion_sensors[] = { .drv_data = &g_bma253_data, .port = I2C_PORT_SENSOR, .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS, - .rot_standard_ref = NULL, + .rot_standard_ref = &lid_standard_ref, .default_range = 2, .min_frequency = BMA255_ACCEL_MIN_FREQ, .max_frequency = BMA255_ACCEL_MAX_FREQ, @@ -486,7 +499,7 @@ struct motion_sensor_t motion_sensors[] = { .flags = MOTIONSENSE_FLAG_INT_SIGNAL, .port = I2C_PORT_SENSOR, .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, - .rot_standard_ref = NULL, + .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g */ .min_frequency = LSM6DSM_ODR_MIN_VAL, .max_frequency = LSM6DSM_ODR_MAX_VAL, |