diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/kevin/board.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/board/kevin/board.c b/board/kevin/board.c index dac0fb61b4..9336b681cb 100644 --- a/board/kevin/board.c +++ b/board/kevin/board.c @@ -351,6 +351,19 @@ static struct mutex g_lid_mutex; struct bma2x2_accel_data g_bma255_data = { .variant = BMA255, }; + +/* Matrix to rotate accelrator into standard reference frame */ +const matrix_3x3_t base_standard_ref = { + { 0, FLOAT_TO_FP(-1), 0}, + { FLOAT_TO_FP(-1), 0, 0}, + { 0, 0, FLOAT_TO_FP(1)} +}; + +const matrix_3x3_t lid_standard_ref = { + { 0, FLOAT_TO_FP(-1), 0}, + { FLOAT_TO_FP(1), 0, 0}, + { 0, 0, FLOAT_TO_FP(-1)} +}; #endif struct motion_sensor_t motion_sensors[] = { @@ -369,7 +382,11 @@ struct motion_sensor_t motion_sensors[] = { .drv_data = &g_bmi160_data, .port = CONFIG_SPI_ACCEL_PORT, .addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT), +#ifdef BOARD_KEVIN + .rot_standard_ref = &base_standard_ref, +#else .rot_standard_ref = NULL, /* Identity matrix. */ +#endif .default_range = 2, /* g, enough for laptop. */ .config = { /* AP: by default use EC settings */ @@ -406,7 +423,11 @@ struct motion_sensor_t motion_sensors[] = { .port = CONFIG_SPI_ACCEL_PORT, .addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT), .default_range = 1000, /* dps */ - .rot_standard_ref = NULL, /* Identity Matrix. */ +#ifdef BOARD_KEVIN + .rot_standard_ref = &base_standard_ref, /* Identity Matrix. */ +#else + .rot_standard_ref = NULL, /* Identity matrix. */ +#endif .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -442,7 +463,7 @@ struct motion_sensor_t motion_sensors[] = { .drv_data = &g_bma255_data, .port = I2C_PORT_ACCEL, .addr = BMA2x2_I2C_ADDR1, - .rot_standard_ref = NULL, /* Identity matrix. */ + .rot_standard_ref = &lid_standard_ref, .default_range = 2, /* g, enough for laptop. */ .config = { /* AP: by default use EC settings */ |