diff options
author | Keith Short <keithshort@chromium.org> | 2020-05-13 10:22:25 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-05-16 02:02:09 +0000 |
commit | e74dcecdf0dab2eeda2c16e927af6fef3f680e0c (patch) | |
tree | 09c17343b5b0db8cca1a9d09a63aa49c5c7c050d /board/volteer/sensors.c | |
parent | 2afbf01e37f4937905b28586a7bf55b1822c6f68 (diff) | |
download | chrome-ec-e74dcecdf0dab2eeda2c16e927af6fef3f680e0c.tar.gz |
volteer: enable lid angle support
Fix rotation matrix for the lid sensor and enable lid angle detection.
BUG=b:146144170, b:146081522
BRANCH=none
TEST=make buildall
TEST=Run "ectool motionsense lid_angle" and verify readings. Also verify
keyboard is disabled when lid angle exceeds 180 degrees.
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: I3e336be4aa633894f353758383ea0120e1f363bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2199039
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'board/volteer/sensors.c')
-rw-r--r-- | board/volteer/sensors.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/board/volteer/sensors.c b/board/volteer/sensors.c index f59c199e07..42d492269c 100644 --- a/board/volteer/sensors.c +++ b/board/volteer/sensors.c @@ -15,6 +15,7 @@ #include "hooks.h" #include "i2c.h" #include "task.h" +#include "tablet_mode.h" #include "util.h" /******************************************************************************/ @@ -83,14 +84,10 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = { }; /* Rotation matrix for the lid accelerometer */ -/* TODO: b/146144170 - the accelerometer is on the motherboard for proto1 - * for testing. Once the sensor moves to the lid, the rotation matrix needs - * to be updated for correct behavior. - */ static const mat33_fp_t lid_standard_ref = { - { 0, FLOAT_TO_FP(-1), 0}, { FLOAT_TO_FP(-1), 0, 0}, - { 0, 0, FLOAT_TO_FP(-1)} + { 0, FLOAT_TO_FP(1), 0}, + { 0, 0, FLOAT_TO_FP(1)} }; const mat33_fp_t base_standard_ref = { @@ -241,3 +238,18 @@ static void baseboard_sensors_init(void) gpio_enable_interrupt(GPIO_EC_IMU_INT_L); } DECLARE_HOOK(HOOK_INIT, baseboard_sensors_init, HOOK_PRIO_DEFAULT); + +#ifndef TEST_BUILD +void lid_angle_peripheral_enable(int enable) +{ + /* + * If the lid is in tablet position via other sensors, + * ignore the lid angle, which might be faulty then + * disable keyboard. + */ + if (tablet_get_mode()) + enable = 0; + + keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE); +} +#endif |