From 440146ca1170ef4fa11d7dbab28bd81d0d833310 Mon Sep 17 00:00:00 2001 From: Scott Collyer Date: Tue, 23 May 2017 16:35:44 -0700 Subject: [PATCH] eve: Enable double tap gesture The LED spec requires a double tap gesture. This CL adds the appropriate CONFIG options to enable double tap gesture for Eve and enables the interrupt for the bmi160. The board specific function in this CL is just a placeholder. BUG=b:35584895 BRANCH=none TEST=Manual Verifed double tap is detected by seeing the console print that's generated each time a double tap event occurs. Change-Id: If3506cf1fbcfc2b380ac36c9d3039e0a8823eba1 Signed-off-by: Scott Collyer Reviewed-on: https://chromium-review.googlesource.com/516547 Commit-Ready: Scott Collyer Tested-by: Scott Collyer Reviewed-by: Gwendal Grignou Reviewed-by: Duncan Laurie --- board/eve/board.c | 17 ++++++++++++----- board/eve/board.h | 11 +++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/board/eve/board.c b/board/eve/board.c index deb6f99786..01975ac869 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -25,6 +25,7 @@ #include "driver/tcpm/tcpm.h" #include "driver/temp_sensor/bd99992gw.h" #include "extpower.h" +#include "gesture.h" #include "gpio.h" #include "hooks.h" #include "host_command.h" @@ -728,6 +729,12 @@ int board_get_version(void) return ver; } +void sensor_board_proc_double_tap(void) +{ + /* TODO: Call led update function */ + CPRINTS("Call LED status update"); +} + /* Base Sensor mutex */ static struct mutex g_base_mutex; @@ -792,7 +799,7 @@ struct motion_sensor_t motion_sensors[] = { [BASE_ACCEL] = { .name = "Base Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, + .active_mask = SENSOR_ACTIVE_S0_S3_S5, .chip = MOTIONSENSE_CHIP_BMI160, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_BASE, @@ -813,18 +820,18 @@ struct motion_sensor_t motion_sensors[] = { }, /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, + .odr = TAP_ODR, .ec_rate = 100 * MSEC, }, /* Sensor on for lid angle detection */ [SENSOR_CONFIG_EC_S3] = { - .odr = 10000 | ROUND_UP_FLAG, + .odr = TAP_ODR, .ec_rate = 100 * MSEC, }, /* Sensor off in S5 */ [SENSOR_CONFIG_EC_S5] = { - .odr = 0, - .ec_rate = 0 + .odr = TAP_ODR, + .ec_rate = 100 * MSEC, }, }, }, diff --git a/board/eve/board.h b/board/eve/board.h index a018e9f96c..29967c07ef 100644 --- a/board/eve/board.h +++ b/board/eve/board.h @@ -140,6 +140,17 @@ /* Depends on how fast the AP boots and typical ODRs */ #define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3) +/* Enable double tap detection */ +#define CONFIG_GESTURE_DETECTION +#define CONFIG_GESTURE_HOST_DETECTION +#define CONFIG_GESTURE_SENSOR_BATTERY_TAP 1 +#define CONFIG_GESTURE_SAMPLING_INTERVAL_MS 5 +#define CONFIG_GESTURE_TAP_THRES_MG 100 +#define CONFIG_GESTURE_TAP_MAX_INTERSTICE_T 500 +#define CONFIG_GESTURE_DETECTION_MASK \ + (1 << CONFIG_GESTURE_SENSOR_BATTERY_TAP) +#define CONFIG_GESTURE_TAP_EVENT TASK_EVENT_CUSTOM(1024) + /* USB */ #define CONFIG_USB_CHARGER #define CONFIG_USB_PD_ALT_MODE