summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYilun Lin <yllin@google.com>2018-12-07 16:20:01 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-12-13 19:27:57 -0800
commit4bf4a6ab644b7217dffa0b31bb572db7e8409411 (patch)
treed693a245c6ee274046c05c4ea43621417694297d
parent8f13e78bae71940b6ad7c427611b52eddfb19287 (diff)
downloadchrome-ec-4bf4a6ab644b7217dffa0b31bb572db7e8409411.tar.gz
kukui: Calibrate motion sensors.
Fix reference point according to the bmi160 and bmm150 datasheet and kukui p1 board file. Also, minor fix for typos and incorrect variable naming. TEST=1.) Run arc++ sensor apps. Run "ectool motionsense odr 2 10000" to enable magnetometer manually. See that the magnetometer is moved accordingly. 2.) Flip kukui and see that the UI also flips accordingly. BUG=b:120467401 BRANCH=None Change-Id: If4091366cde3a98bf08aec5b81f6f48595fdc8f5 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1369504 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r--board/kukui/board.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/board/kukui/board.c b/board/kukui/board.c
index c2b866bd0a..adabd38ef9 100644
--- a/board/kukui/board.c
+++ b/board/kukui/board.c
@@ -325,21 +325,21 @@ int board_get_version(void)
/* Motion sensors */
/* Mutexes */
#ifdef SECTION_IS_RW
-static struct mutex g_base_mutex;
+static struct mutex g_lid_mutex;
static struct bmi160_drv_data_t g_bmi160_data;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
+const mat33_fp_t lid_standard_ref = {
+ { FLOAT_TO_FP(1), 0, 0},
+ { 0, FLOAT_TO_FP(1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
/* Matrix to rotate accelrator into standard reference frame */
const mat33_fp_t mag_standard_ref = {
+ { 0, FLOAT_TO_FP(-1), 0},
{ FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
};
@@ -356,11 +356,11 @@ struct motion_sensor_t motion_sensors[] = {
.type = MOTIONSENSE_TYPE_ACCEL,
.location = MOTIONSENSE_LOC_LID,
.drv = &bmi160_drv,
- .mutex = &g_base_mutex,
+ .mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
.addr = BMI160_ADDR0,
- .rot_standard_ref = &base_standard_ref,
+ .rot_standard_ref = &lid_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -379,12 +379,12 @@ struct motion_sensor_t motion_sensors[] = {
.type = MOTIONSENSE_TYPE_GYRO,
.location = MOTIONSENSE_LOC_LID,
.drv = &bmi160_drv,
- .mutex = &g_base_mutex,
+ .mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
.addr = BMI160_ADDR0,
.default_range = 1000, /* dps */
- .rot_standard_ref = &base_standard_ref,
+ .rot_standard_ref = &lid_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
.max_frequency = BMI160_GYRO_MAX_FREQ,
},
@@ -395,13 +395,12 @@ struct motion_sensor_t motion_sensors[] = {
.type = MOTIONSENSE_TYPE_MAG,
.location = MOTIONSENSE_LOC_LID,
.drv = &bmi160_drv,
- .mutex = &g_base_mutex,
+ .mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
.addr = BMI160_ADDR0,
.default_range = 1 << 11, /* 16LSB / uT, fixed */
.rot_standard_ref = &mag_standard_ref,
- .rot_standard_ref = NULL,
.min_frequency = BMM150_MAG_MIN_FREQ,
.max_frequency = BMM150_MAG_MAX_FREQ(SPECIAL),
},