summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-08-30 21:30:15 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-21 01:13:55 -0700
commit6f06cd5f7b78e4624618d67bf0142015c4d51298 (patch)
tree33d94b8fb026ad024a6dc26221e0a3c9bb78aec9
parent8139114897c2eab41fd71e66368d861f9e5db2ba (diff)
downloadchrome-ec-6f06cd5f7b78e4624618d67bf0142015c4d51298.tar.gz
ryu: Enable Significant motion
Enable significant motion in BMI160 and from the host. BRANCH=smaug BUG=b:23570481 TEST=On Ryu, check significant motion (not still) is detected. Change-Id: I7d524576f18829f79991d731c5691b3d2bba5d36 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/296215
-rw-r--r--board/ryu/board.c16
-rw-r--r--board/ryu/board.h11
2 files changed, 17 insertions, 10 deletions
diff --git a/board/ryu/board.c b/board/ryu/board.c
index 24402d42fc..9370493893 100644
--- a/board/ryu/board.c
+++ b/board/ryu/board.c
@@ -298,15 +298,15 @@ struct motion_sensor_t motion_sensors[] = {
.odr = 0,
.ec_rate = 0,
},
- /* EC does not need accel in S0 */
+ /* EC needs accel for activity recognition. */
[SENSOR_CONFIG_EC_S0] = {
- .odr = 0,
+ .odr = 12500,
+ /* Interrupt driven, no polling */
.ec_rate = 0,
},
/* Used for double tap */
[SENSOR_CONFIG_EC_S3] = {
.odr = 100000,
- /* Interrupt driven, no polling */
.ec_rate = 0,
},
[SENSOR_CONFIG_EC_S5] = {
@@ -315,7 +315,6 @@ struct motion_sensor_t motion_sensors[] = {
},
},
},
-
{.name = "Gyro",
.active_mask = SENSOR_ACTIVE_S0_S3,
.chip = MOTIONSENSE_CHIP_BMI160,
@@ -333,7 +332,7 @@ struct motion_sensor_t motion_sensors[] = {
.odr = 0,
.ec_rate = 0,
},
- /* EC does not need accel in S0 */
+ /* EC does not need gyro in S0 */
[SENSOR_CONFIG_EC_S0] = {
.odr = 0,
.ec_rate = 0,
@@ -349,7 +348,6 @@ struct motion_sensor_t motion_sensors[] = {
},
},
},
-
{.name = "Mag",
.active_mask = SENSOR_ACTIVE_S0_S3,
.chip = MOTIONSENSE_CHIP_BMI160,
@@ -367,7 +365,7 @@ struct motion_sensor_t motion_sensors[] = {
.odr = 0,
.ec_rate = 0,
},
- /* EC does not need accel in S0 */
+ /* EC does not need compass in S0 */
[SENSOR_CONFIG_EC_S0] = {
.odr = 0,
.ec_rate = 0,
@@ -400,7 +398,7 @@ struct motion_sensor_t motion_sensors[] = {
.odr = 0,
.ec_rate = 0,
},
- /* EC to use to set led brightness */
+ /* EC needs sensor for light adaptive brightness */
[SENSOR_CONFIG_EC_S0] = {
.odr = 1000,
.ec_rate = 1000,
@@ -433,7 +431,7 @@ struct motion_sensor_t motion_sensors[] = {
.odr = 0,
.ec_rate = 0,
},
- /* EC does not need accel in S0 */
+ /* EC does not need proximity in S0 */
[SENSOR_CONFIG_EC_S0] = {
.odr = 0,
.ec_rate = 0,
diff --git a/board/ryu/board.h b/board/ryu/board.h
index aac0a766d4..db06bf1e1a 100644
--- a/board/ryu/board.h
+++ b/board/ryu/board.h
@@ -154,15 +154,24 @@
/* Sensor support */
#define CONFIG_ACCELGYRO_BMI160
#define CONFIG_GESTURE_DETECTION
-#define CONFIG_GESTURE_HW_DETECTION
+#define CONFIG_GESTURE_HOST_DETECTION
+/* First sensor is motion_sensor is used for significant motion */
+#define CONFIG_GESTURE_SIGMO 0
+#define CONFIG_GESTURE_SIGMO_PROOF_MS 500
+#define CONFIG_GESTURE_SIGMO_SKIP_MS 3000
+#define CONFIG_GESTURE_SIGMO_THRES_MG 500
#define CONFIG_GESTURE_SENSOR_BATTERY_TAP 0
#define CONFIG_GESTURE_TAP_THRES_MG 200
+#define CONFIG_GESTURE_DETECTION_MASK \
+ ((1 << CONFIG_GESTURE_SIGMO) | \
+ (1 << CONFIG_GESTURE_SENSOR_BATTERY_TAP))
#define CONFIG_MAG_BMI160_BMM150
#define CONFIG_ALS_SI114X 0x41
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT TASK_EVENT_CUSTOM(4)
#define CONFIG_ALS_SI114X_INT_EVENT TASK_EVENT_CUSTOM(8)
/* event 2 to 9 are reserved for hardware interrupt */
#define CONFIG_GESTURE_TAP_EVENT TASK_EVENT_CUSTOM(1024)
+#define CONFIG_GESTURE_SIGMO_EVENT TASK_EVENT_CUSTOM(2048)
#define CONFIG_ACCEL_INTERRUPTS
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO