woomax: Config lid and base rotation matrix.
Config lid and base rotation matrix.
BRANCH=master
TEST=manual
Enable ec console "accelinfo on" and check angle from 0 to 360 degree.
@@ -50,6 +50,19 @@ static struct mutex g_base_mutex;
static struct kionix_accel_data g_kx022_data;
static struct bmi_drv_data_t g_bmi160_data;
+/* Rotation matrix for the lid accelerometer */
+static 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) },
+};
+
+static const mat33_fp_t base_standard_ref = {
+ { 0, FLOAT_TO_FP(-1), 0},
+ { FLOAT_TO_FP(-1), 0, 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] = {
@@ -63,7 +76,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv_data = &g_kx022_data,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
- .rot_standard_ref = NULL,
+ .rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
.max_frequency = KX022_ACCEL_MAX_FREQ,
@@ -92,7 +105,7 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 2, /* g, enough for laptop */
- .rot_standard_ref = NULL,
+ .rot_standard_ref = &base_standard_ref,
.min_frequency = BMI_ACCEL_MIN_FREQ,
.max_frequency = BMI_ACCEL_MAX_FREQ,
.config = {
