summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-09-28 09:39:09 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-29 00:09:41 -0700
commit18295c9bb2649b6e0b4a177d8e6c409ed9e9ba60 (patch)
treed367339065a9a3f72912ccc4ed410d957e0ce580 /driver
parentfec7aea0bf11912fae03dc6c9f9292395c141294 (diff)
downloadchrome-ec-18295c9bb2649b6e0b4a177d8e6c409ed9e9ba60.tar.gz
board: ryu: Match Samus double tap behavior.
Increase the change of false positive, but make double feels like Samus: - increase time beetwen tap to 500ms - decrease tap threshold to 100mg (actually 62.5mg) - increase ODR during TAP. BRANCH=smaug BUG=b:24440423 TEST=check Ryu and Samus side by side, their tap behavior is more similar. run cts -c android.hardware.cts.SingleSensorTests Change-Id: I260ad95136cb2be71ef4d71efc4bee0b28afa8e0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/302627 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/accelgyro_bmi160.c2
-rw-r--r--driver/accelgyro_bmi160.h5
2 files changed, 7 insertions, 0 deletions
diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c
index 650620af9f..d32ac3c582 100644
--- a/driver/accelgyro_bmi160.c
+++ b/driver/accelgyro_bmi160.c
@@ -748,6 +748,8 @@ static int config_interrupt(const struct motion_sensor_t *s)
raw_write8(s->addr, BMI160_CMD_REG, BMI160_CMD_INT_RESET);
#ifdef CONFIG_GESTURE_SENSOR_BATTERY_TAP
+ raw_write8(s->addr, BMI160_INT_TAP_0,
+ BMI160_TAP_TH(s, CONFIG_GESTURE_TAP_MAX_INTERSTICE_T));
ret = raw_write8(s->addr, BMI160_INT_TAP_1,
BMI160_TAP_TH(s, CONFIG_GESTURE_TAP_THRES_MG));
#endif
diff --git a/driver/accelgyro_bmi160.h b/driver/accelgyro_bmi160.h
index 7d875d6675..6c57a3c4d3 100644
--- a/driver/accelgyro_bmi160.h
+++ b/driver/accelgyro_bmi160.h
@@ -321,6 +321,11 @@ enum fifo_header {
(MIN(__fls((_ms) / 250), BMI160_MOTION_PROOF_MASK))
#define BMI160_INT_TAP_0 0x63
+#define BMI160_TAP_DUR(_s, _ms) \
+ ((_ms) <= 250 ? MAX((_ms), 50) / 50 - 1 : \
+ (_ms) <= 500 ? 4 + ((_ms) - 250) / 125 : \
+ (_ms) < 700 ? 6 : 7)
+
#define BMI160_INT_TAP_1 0x64
#define BMI160_TAP_TH(_s, _mg) \
(MIN(((_mg) * 1000) / ((_s)->drv->get_range(_s) * 31250), 0x1f))