diff options
author | lu zhang <lu.zhang@bitland.corp-partner.google.com> | 2019-08-30 13:48:50 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-31 05:01:02 +0000 |
commit | 2fdaf6623c5c73c694b0a1c1b3750b7cb1987584 (patch) | |
tree | 73bea460b101f62b2078282d6273ea4930a13357 | |
parent | 391afeceb5a603fd19f523ffe5906dedf2b39d80 (diff) | |
download | chrome-ec-2fdaf6623c5c73c694b0a1c1b3750b7cb1987584.tar.gz |
treeya: fix rotation matrices of lid and base sensors
Now there are two sets of lid/base sensors in proto phase. Both of rotation
matrices need to be fixed.
BUG=b:138744661
BRANCH=none
TEST=Using ec console 'accelinfo on' verified lid angle now goes
from 0 to 360 and swtiches to tablet mode after crossing 180 threshold.
Change-Id: I93a89a878cf064071eb5f3786f4f5f5475ba2de2
Signed-off-by: lu zhang <lu.zhang@bitland.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1773032
Reviewed-by: Paul Ma <magf@bitland.corp-partner.google.com>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Tested-by: Paul Ma <magf@bitland.corp-partner.google.com>
-rw-r--r-- | board/treeya/board.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/board/treeya/board.c b/board/treeya/board.c index 61c7180632..16816e5068 100644 --- a/board/treeya/board.c +++ b/board/treeya/board.c @@ -54,16 +54,21 @@ static struct lsm6dsm_data g_lsm6dsm_data; /* Matrix to rotate accelrator into standard reference frame */ static const mat33_fp_t lsm6dsm_base_standard_ref = { - { 0, FLOAT_TO_FP(1), 0}, { FLOAT_TO_FP(-1), 0, 0}, + { 0, FLOAT_TO_FP(-1), 0}, { 0, 0, FLOAT_TO_FP(1)} }; -/* just a placeholder, will revise when board is out */ static const mat33_fp_t lis2dwl_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 treeya_standard_ref = { { 0, FLOAT_TO_FP(-1), 0}, - { FLOAT_TO_FP(-1), 0, 0}, - { 0, 0, FLOAT_TO_FP(-1)} + { FLOAT_TO_FP(1), 0, 0}, + { 0, 0, FLOAT_TO_FP(1)} }; struct motion_sensor_t lid_accel_1 = { @@ -145,10 +150,11 @@ struct motion_sensor_t base_gyro_1 = { .max_frequency = LSM6DSM_ODR_MAX_VAL, }; -/* sku_id a8-a9 use ST sensors */ static int board_use_st_sensor(void) { + /* sku_id 0xa8-0xa9 use ST sensors */ uint32_t sku_id = system_get_sku_id(); + return sku_id == 0xa8 || sku_id == 0xa9; } @@ -163,6 +169,11 @@ void board_update_sensor_config_from_sku(void) motion_sensors[LID_ACCEL] = lid_accel_1; motion_sensors[BASE_ACCEL] = base_accel_1; motion_sensors[BASE_GYRO] = base_gyro_1; + } else{ + /*Need to change matrix for treeya*/ + motion_sensors[LID_ACCEL].rot_standard_ref = &treeya_standard_ref; + motion_sensors[BASE_ACCEL].rot_standard_ref = &treeya_standard_ref; + motion_sensors[BASE_GYRO].rot_standard_ref = &treeya_standard_ref; } /* Enable Gyro interrupts */ |