From dc73b3ed742a25dd11480a7ec6e3ab1393fc7def Mon Sep 17 00:00:00 2001 From: Ricky Liang Date: Fri, 4 Mar 2016 12:27:18 +0800 Subject: [PATCH] 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 Reviewed-on: https://chromium-review.googlesource.com/330484 Reviewed-by: Rong Chang --- board/oak/board.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 */