diff options
author | David Huang <david.huang@quanta.corp-partner.google.com> | 2020-03-30 16:06:12 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-31 17:18:14 +0000 |
commit | 80f3f86932805b824473d3a4ff1cfe3f2c040012 (patch) | |
tree | 317c0d108cc263375609bb4cf0714508288dfcb1 | |
parent | f74b98accc39b60f8c95746d04aae2b5b89efe40 (diff) | |
download | chrome-ec-80f3f86932805b824473d3a4ff1cfe3f2c040012.tar.gz |
Ezkinil: Fix rotation matrices of base/lid accel config
Fix rotation matrices of base/lid accel
BUG=b:152722116
BRANCH=ezkinil
TEST=Use "ectool motionsense lid_angle" or console "accelinfo on"
verified lid angle correct.
Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com>
Change-Id: I040cbf00817d9a2c2c2cb8dddcf0234d306556c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2126629
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
-rw-r--r-- | board/ezkinil/board.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/board/ezkinil/board.c b/board/ezkinil/board.c index 089ecf2bdc..219a02e668 100644 --- a/board/ezkinil/board.c +++ b/board/ezkinil/board.c @@ -40,6 +40,18 @@ static struct mutex g_base_mutex; static struct kionix_accel_data g_kx022_data; static struct bmi160_drv_data_t g_bmi160_data; +/* Matrix to rotate accelrator into standard reference frame */ +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)} +}; +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)} +}; + /* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */ struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { @@ -53,7 +65,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, @@ -82,7 +94,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 = BMI160_ACCEL_MIN_FREQ, .max_frequency = BMI160_ACCEL_MAX_FREQ, .config = { @@ -110,7 +122,7 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_SENSOR, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ - .rot_standard_ref = NULL, + .rot_standard_ref = &base_standard_ref, .min_frequency = BMI160_GYRO_MIN_FREQ, .max_frequency = BMI160_GYRO_MAX_FREQ, }, |