summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathew King <mathewk@chromium.org>2020-01-21 13:25:13 -0700
committerCommit Bot <commit-bot@chromium.org>2020-01-22 21:04:44 +0000
commit15ea40d83fb22bf4655ecb2b2c4fb66bce90cb92 (patch)
tree56bbe63047b22e65773b97d95ea4d0303e3ce058
parent0195a23ec69c08bc1ed5adea270776b33b1731bf (diff)
downloadchrome-ec-15ea40d83fb22bf4655ecb2b2c4fb66bce90cb92.tar.gz
drallion: Set the rotation matrix for base accel
On Drallion the LNG2DM accelerometer is rotated 270 degrees from the same sensor on Arcada. Change the rotation matrix for the sensor to account for this difference. BUG=b:147715895 TEST=run 'ectool --name=cros_ish motionsense' with lid at 180 degrees. Verify that base and lid are in sync at various rotations. BRANCH=none Change-Id: Icc997ae864fb47fef398ca140e96719b39ec054e Signed-off-by: Mathew King <mathewk@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2013649 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Mike Wiitala <mwiitala@google.com>
-rw-r--r--board/drallion_ish/board.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/board/drallion_ish/board.c b/board/drallion_ish/board.c
index a36b4e5644..c9a683e36d 100644
--- a/board/drallion_ish/board.c
+++ b/board/drallion_ish/board.c
@@ -42,6 +42,13 @@ static struct lsm6dsm_data lsm6dsm_a_data = LSM6DSM_DATA;
static struct stprivate_data g_lis2dh_data;
static struct lis2mdl_private_data lis2mdl_a_data;
+/* Matrix to rotate base sensor into standard reference frame */
+const mat33_fp_t base_rot_ref = {
+ { 0, FLOAT_TO_FP(1), 0},
+ { FLOAT_TO_FP(-1), 0, 0},
+ { 0, 0, FLOAT_TO_FP(1)}
+};
+
/* Drivers */
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -105,7 +112,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv_data = &g_lis2dh_data,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LNG2DM_ADDR0_FLAGS,
- .rot_standard_ref = NULL, /* Identity matrix */
+ .rot_standard_ref = &base_rot_ref,
/* We only use 2g because its resolution is only 8-bits */
.default_range = 2, /* g */
.min_frequency = LIS2DH_ODR_MIN_VAL,