summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/ec_features.c2
-rw-r--r--common/motion_sense.c2
-rw-r--r--include/config.h24
3 files changed, 27 insertions, 1 deletions
diff --git a/common/ec_features.c b/common/ec_features.c
index 8d364118e0..fb45789a63 100644
--- a/common/ec_features.c
+++ b/common/ec_features.c
@@ -125,7 +125,7 @@ uint32_t get_feature_flags1(void)
#ifdef CONFIG_CEC
| EC_FEATURE_MASK_1(EC_FEATURE_CEC)
#endif
-#ifdef CONFIG_ACCEL_FIFO
+#ifdef CONFIG_SENSOR_TIGHT_TIMESTAMPS
| EC_FEATURE_MASK_1(EC_FEATURE_MOTION_SENSE_TIGHT_TIMESTAMPS)
#endif
#if defined(CONFIG_LID_ANGLE) && defined(CONFIG_TABLET_MODE)
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 9601970f7b..4b4d996cc2 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -180,7 +180,9 @@ void motion_sense_fifo_add_data(struct ec_response_motion_sensor_data *data,
struct motion_sensor_t *sensor,
int valid_data,
uint32_t time) {
+#ifdef CONFIG_SENSOR_TIGHT_TIMESTAMPS
motion_sense_insert_timestamp(time);
+#endif
motion_sense_fifo_add_unit(data, sensor, valid_data);
}
diff --git a/include/config.h b/include/config.h
index 5607fecde2..bd31e034fd 100644
--- a/include/config.h
+++ b/include/config.h
@@ -151,6 +151,30 @@
/* Specify type of Gyrometers attached. */
#undef CONFIG_GYRO_L3GD20H
+/*
+ * If this is defined, motion_sense sends sensor events to the AP in the format
+ * +-----------+
+ * | Timestamp |
+ * | Payload |
+ * | Timestamp |
+ * | Payload |
+ * | ... |
+ * +-----------+
+ *
+ * If this is not defined, the events will be sent in the format
+ * +-----------+
+ * | Payload |
+ * | Payload |
+ * | Payload |
+ * | ... |
+ * | Timestamp |
+ * +-----------+
+ *
+ * The former format enables improved filtering of sensor event timestamps on
+ * the AP, but comes with stricter jitter requirements.
+ */
+#define CONFIG_SENSOR_TIGHT_TIMESTAMPS
+
/* Sync event driver */
#undef CONFIG_SYNC