diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2014-10-23 16:58:21 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-10-29 22:23:54 +0000 |
commit | 66164f2784b1ca34d9a10febd39c19db064c1750 (patch) | |
tree | 965c82a6d0826de677ff5c95e8191f53a01cd9e0 /board/samus | |
parent | d5b32aa6e1e9ac206f4cbdd6cf4452a08dc2ec36 (diff) | |
download | chrome-ec-66164f2784b1ca34d9a10febd39c19db064c1750.tar.gz |
Samus: Split motion sense and lid angle
Split motion_sense.c.
Translate the accel data in the Android coordinate right away.
BUG=chrome-os-partner:32002
BRANCH=ToT
TEST=On samus, check lid angle are still correct.
Change-Id: If743e25245dc1ce4cdacb8a4d5af22616c4a79e4
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/225486
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'board/samus')
-rw-r--r-- | board/samus/board.c | 32 | ||||
-rw-r--r-- | board/samus/board.h | 5 |
2 files changed, 22 insertions, 15 deletions
diff --git a/board/samus/board.c b/board/samus/board.c index 08dae68780..e6682d4717 100644 --- a/board/samus/board.c +++ b/board/samus/board.c @@ -28,6 +28,7 @@ #include "lid_switch.h" #include "lightbar.h" #include "motion_sense.h" +#include "motion_lid.h" #include "peci.h" #include "power.h" #include "power_button.h" @@ -264,6 +265,19 @@ static struct mutex g_lid_mutex; struct kxcj9_data g_kxcj9_data; /* Four Motion sensors */ +/* Matrix to rotate accelrator into standard reference frame */ +const matrix_3x3_t base_standard_ref = { + {-1, 0, 0}, + { 0, -1, 0}, + { 0, 0, -1} +}; + +const matrix_3x3_t lid_standard_ref = { + { 0, 1, 0}, + {-1, 0, 0}, + { 0, 0, -1} +}; + struct motion_sensor_t motion_sensors[] = { /* @@ -274,30 +288,23 @@ struct motion_sensor_t motion_sensors[] = { {SENSOR_ACTIVE_S0_S3_S5, "Base", SENSOR_CHIP_LSM6DS0, SENSOR_ACCELEROMETER, LOCATION_BASE, &lsm6ds0_drv, &g_base_mutex, NULL, - LSM6DS0_ADDR1, 119000, 2}, + LSM6DS0_ADDR1, &base_standard_ref, 119000, 2}, {SENSOR_ACTIVE_S0, "Lid", SENSOR_CHIP_KXCJ9, SENSOR_ACCELEROMETER, LOCATION_LID, &kxcj9_drv, &g_lid_mutex, &g_kxcj9_data, - KXCJ9_ADDR0, 100000, 2}, + KXCJ9_ADDR0, &lid_standard_ref, 100000, 2}, {SENSOR_ACTIVE_S0, "Base Gyro", SENSOR_CHIP_LSM6DS0, SENSOR_GYRO, LOCATION_BASE, &lsm6ds0_drv, &g_base_mutex, NULL, - LSM6DS0_ADDR1, 119000, 2000}, + LSM6DS0_ADDR1, NULL, 119000, 2000}, }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); /* Define the accelerometer orientation matrices. */ const struct accel_orientation acc_orient = { - /* Lid and base sensor are already aligned. */ - .rot_align = { - { 0, -1, 0}, - { 1, 0, 0}, - { 0, 0, 1} - }, - /* Hinge aligns with y axis. */ .rot_hinge_90 = { { 1, 0, 0}, @@ -309,10 +316,5 @@ const struct accel_orientation acc_orient = { { 0, 1, 0}, { 0, 0, 1} }, - .rot_standard_ref = { - {-1, 0, 0}, - { 0, -1, 0}, - { 0, 0, -1} - }, .hinge_axis = {0, 1, 0}, }; diff --git a/board/samus/board.h b/board/samus/board.h index a203b94a9b..757f0ca950 100644 --- a/board/samus/board.h +++ b/board/samus/board.h @@ -21,11 +21,13 @@ #define CONFIG_ALS_ISL29035 #define CONFIG_BOARD_VERSION #define CONFIG_CMD_ACCELS +#define CONFIG_CMD_ACCEL_INFO #define CONFIG_POWER_COMMON #define CONFIG_CHIPSET_CAN_THROTTLE #define CONFIG_KEYBOARD_BOARD_CONFIG #define CONFIG_KEYBOARD_PROTOCOL_8042 #define CONFIG_KEYBOARD_COL2_INVERTED +#define CONFIG_LID_ANGLE #define CONFIG_LIGHTBAR_POWER_RAILS #define CONFIG_LOW_POWER_IDLE #define CONFIG_POWER_BUTTON @@ -189,6 +191,9 @@ int board_discharge_on_ac(int enable); #define CONFIG_GESTURE_TAP_MIN_INTERSTICE_T 120 #define CONFIG_GESTURE_TAP_MAX_INTERSTICE_T 500 +#define CONFIG_SENSOR_BASE 0 +#define CONFIG_SENSOR_LID 1 + #endif /* !__ASSEMBLER__ */ #endif /* __BOARD_H */ |