summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKo_Ko <Ko_Ko@compal.corp-partner.google.com>2020-09-15 13:53:03 +0800
committerCommit Bot <commit-bot@chromium.org>2020-09-18 05:28:16 +0000
commit6d06a136a9185ec7582bdb380d92e911db01a079 (patch)
tree66c6b26b61f21a3a8e9c4ae34bf72f1579dcf7e3
parentda34f6f3e53ae59c3a2edc9faeb7a9e68b95f0b5 (diff)
downloadchrome-ec-6d06a136a9185ec7582bdb380d92e911db01a079.tar.gz
Madoo: Add rotation matrices for sensors
This commit adds the needed rotation matrices for the sensors to place the measurements into the standard reference frame. BUG=b:167940144 BRANCH=none TEST=Build and flash madoo. Compare accel readings against released chromebooks and verify that they match in orientation and sign. Signed-off-by: Ko_Ko <Ko_Ko@compal.corp-partner.google.com> Change-Id: I2579f3e1eeb301815e8759621dea228fa888b361 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2409719 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Ko Ko <ko_ko@compal.corp-partner.google.com> Tested-by: Ko Ko <ko_ko@compal.corp-partner.google.com>
-rw-r--r--board/madoo/board.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/board/madoo/board.c b/board/madoo/board.c
index e53c7e10d4..a181908d83 100644
--- a/board/madoo/board.c
+++ b/board/madoo/board.c
@@ -291,8 +291,14 @@ static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
static const mat33_fp_t lid_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)}
+};
+
+static const mat33_fp_t base_standard_ref = {
+ { FLOAT_TO_FP(1), 0, 0},
+ { 0, 0, FLOAT_TO_FP(1)},
+ { 0, FLOAT_TO_FP(1), 0},
};
static struct accelgyro_saved_data_t g_bma253_data;
@@ -337,7 +343,7 @@ struct motion_sensor_t motion_sensors[] = {
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
- .rot_standard_ref = NULL,
+ .rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
.max_frequency = LSM6DSM_ODR_MAX_VAL,
@@ -367,7 +373,7 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
- .rot_standard_ref = NULL,
+ .rot_standard_ref = &base_standard_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
.max_frequency = LSM6DSM_ODR_MAX_VAL,
},