diff options
author | Ricky Liang <jcliang@chromium.org> | 2016-03-04 12:27:18 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-03-04 11:35:54 -0800 |
commit | dc73b3ed742a25dd11480a7ec6e3ab1393fc7def (patch) | |
tree | b5a1e0ce0feca7ec41c12ccd5c3b41a268b94331 | |
parent | 9d472018f90ae95e3919e22124e924eb950e14e4 (diff) | |
download | chrome-ec-dc73b3ed742a25dd11480a7ec6e3ab1393fc7def.tar.gz |
oak: set up base accelerometer rotation matrix
The base accelerometer on oak rev5 needs to be rotated 180 degrees
along the z-axis to match the standard reference frame.
BUG=chrome-os-partner:50312
BRANCH=none
TEST=manually rotate my oak rev5 and verify that `ectool motionsense`
reports correct accelerometer readings
Change-Id: I05a377b5f0827e2aad47d388dc3264d451580989
Signed-off-by: Ricky Liang <jcliang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/330484
Reviewed-by: Rong Chang <rongchang@chromium.org>
-rw-r--r-- | board/oak/board.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/board/oak/board.c b/board/oak/board.c index 5a8cee9fb1..420f423aec 100644 --- a/board/oak/board.c +++ b/board/oak/board.c @@ -646,6 +646,13 @@ static struct mutex g_lid_mutex; #endif #ifdef CONFIG_ACCELGYRO_BMI160 static struct mutex g_base_mutex; + +/* Matrix to rotate accelrator into standard reference frame */ +const matrix_3x3_t base_standard_ref = { + { FLOAT_TO_FP(-1), 0, 0}, + { 0, FLOAT_TO_FP(-1), 0}, + { 0, 0, FLOAT_TO_FP(1)} +}; #endif /* KX022 private data */ @@ -669,7 +676,7 @@ struct motion_sensor_t motion_sensors[] = { .mutex = &g_base_mutex, .drv_data = &g_bmi160_data, .addr = 1, - .rot_standard_ref = NULL, /* Identity matrix. */ + .rot_standard_ref = &base_standard_ref, .default_range = 2, /* g, enough for laptop. */ .config = { /* AP: by default use EC settings */ |