summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLu Zhang <lu.zhang@bitland.corp-partner.google.com>2020-02-28 12:09:58 +0800
committerCommit Bot <commit-bot@chromium.org>2020-03-04 03:52:33 +0000
commitc50e60b416e58281a452de562fb9add0167ea97e (patch)
tree4bc87ab4fc0583e94f85de11e9cfa1425f0f7962
parent91b40f83bf2d990b88fbbbebc6f4155a97c9328f (diff)
downloadchrome-ec-c50e60b416e58281a452de562fb9add0167ea97e.tar.gz
dalboz: fix rotation matrix
The rotation matrix needs be filled out into standard reference frame. BUG=b:149968926 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. Signed-off-by: Lu Zhang <lu.zhang@bitland.corp-partner.google.com> Change-Id: I349141c6128687b38f375b67086eb5fe611ce1ed Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2078817 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
-rw-r--r--board/dalboz/board.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/board/dalboz/board.c b/board/dalboz/board.c
index b813a96bc7..e4397b1522 100644
--- a/board/dalboz/board.c
+++ b/board/dalboz/board.c
@@ -34,6 +34,13 @@ static struct mutex g_base_mutex;
static struct stprivate_data g_lis2dwl_data;
static struct lsm6dsm_data g_lsm6dsm_data = LSM6DSM_DATA;
+/* Matrix to rotate accelrator into standard reference frame */
+static const mat33_fp_t base_standard_ref = {
+ { FLOAT_TO_FP(-1), 0, 0},
+ { 0, FLOAT_TO_FP(-1), 0},
+ { 0, 0, FLOAT_TO_FP(1)}
+};
+
/* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -78,7 +85,7 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 4, /* g, enough for laptop */
- .rot_standard_ref = NULL,
+ .rot_standard_ref = &base_standard_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
.max_frequency = LSM6DSM_ODR_MAX_VAL,
.config = {
@@ -110,7 +117,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,
},