diff options
-rw-r--r-- | common/motion_sense.c | 6 | ||||
-rw-r--r-- | driver/accelgyro_bmi160.c | 10 | ||||
-rw-r--r-- | include/config.h | 4 |
3 files changed, 14 insertions, 6 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c index 9966cf9dd4..98c2979da1 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -727,7 +727,7 @@ static void check_and_queue_gestures(uint32_t *event) /* Run gesture recognition engine */ gesture_calc(event); #endif -#ifdef CONFIG_GESTURE_SENSOR_BATTERY_TAP +#ifdef CONFIG_GESTURE_DETECTION_MASK if (*event & TASK_EVENT_MOTION_ACTIVITY_INTERRUPT( MOTIONSENSE_ACTIVITY_DOUBLE_TAP)) { #ifdef CONFIG_GESTURE_HOST_DETECTION @@ -738,7 +738,11 @@ static void check_and_queue_gestures(uint32_t *event) * AP is ignoring double tap event, do no wake up and no * automatic disable. */ +#ifdef CONFIG_GESTURE_SENSOR_BATTERY_TAP vector.flags = 0; +#else + vector.flags = MOTIONSENSE_SENSOR_FLAG_WAKEUP; +#endif vector.activity = MOTIONSENSE_ACTIVITY_DOUBLE_TAP; vector.state = 1; /* triggered */ vector.sensor_num = MOTION_SENSE_ACTIVITY_SENSOR_ID; diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c index 79107cc6ee..41ac393b23 100644 --- a/driver/accelgyro_bmi160.c +++ b/driver/accelgyro_bmi160.c @@ -772,7 +772,7 @@ int manage_activity(const struct motion_sensor_t *s, break; } #endif -#ifdef CONFIG_GESTURE_SENSOR_BATTERY_TAP +#ifdef CONFIG_GESTURE_DETECTION_MASK case MOTIONSENSE_ACTIVITY_DOUBLE_TAP: { int tmp; /* Set double tap interrupt */ @@ -1059,7 +1059,7 @@ static int config_interrupt(const struct motion_sensor_t *s) raw_write8(s->port, s->i2c_spi_addr_flags, BMI160_CMD_REG, BMI160_CMD_INT_RESET); -#ifdef CONFIG_GESTURE_SENSOR_BATTERY_TAP +#ifdef CONFIG_GESTURE_DETECTION_MASK raw_write8(s->port, s->i2c_spi_addr_flags, BMI160_INT_TAP_0, BMI160_TAP_DUR(s, CONFIG_GESTURE_TAP_MAX_INTERSTICE_T)); @@ -1099,7 +1099,7 @@ static int config_interrupt(const struct motion_sensor_t *s) #ifdef CONFIG_GESTURE_SIGMO tmp |= BMI160_INT_ANYMOTION; #endif -#ifdef CONFIG_GESTURE_SENSOR_BATTERY_TAP +#ifdef CONFIG_GESTURE_DETECTION_MASK tmp |= BMI160_INT_D_TAP; #endif #ifdef CONFIG_BMI160_ORIENTATION_SENSOR @@ -1207,7 +1207,7 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event) if (rv) return rv; -#ifdef CONFIG_GESTURE_SENSOR_BATTERY_TAP +#ifdef CONFIG_GESTURE_DETECTION_MASK if (interrupt & BMI160_D_TAP_INT) *event |= TASK_EVENT_MOTION_ACTIVITY_INTERRUPT( MOTIONSENSE_ACTIVITY_DOUBLE_TAP); @@ -1311,7 +1311,7 @@ static int init(const struct motion_sensor_t *s) data->disabled_activities |= 1 << MOTIONSENSE_ACTIVITY_SIG_MOTION; #endif -#ifdef CONFIG_GESTURE_SENSOR_BATTERY_TAP +#ifdef CONFIG_GESTURE_DETECTION_MASK data->disabled_activities |= 1 << MOTIONSENSE_ACTIVITY_DOUBLE_TAP; #endif diff --git a/include/config.h b/include/config.h index 64b3ca064c..138a19b6d4 100644 --- a/include/config.h +++ b/include/config.h @@ -1929,12 +1929,16 @@ /* enable gesture host interface */ #undef CONFIG_GESTURE_HOST_DETECTION + /* Sensor sampling interval for gesture recognition */ #undef CONFIG_GESTURE_SAMPLING_INTERVAL_MS /* Which sensor to look for battery tap recognition */ #undef CONFIG_GESTURE_SENSOR_BATTERY_TAP +/* Which sensor to look for double tap recognition */ +#undef CONFIG_GESTURE_SENSOR_DOUBLE_TAP + /* * Double tap detection parameters * Double tap works by looking for two isolated Z-axis accelerometer impulses |