summaryrefslogtreecommitdiff
path: root/include/motion_sense.h
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2014-07-31 13:44:30 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-19 06:59:28 +0000
commita048d76e0df9244e2deb104201e14afc80e0864c (patch)
tree236a1dbd34def4b73ced8957c27a450531d98af2 /include/motion_sense.h
parentbe060242e310090a421f70caa5917e2808f26433 (diff)
downloadchrome-ec-a048d76e0df9244e2deb104201e14afc80e0864c.tar.gz
Refactor accel / gyro driver to accomodate various configurations
Previously our accel / gyro drivers assumed that we had exactly two of each identical part in the system. Some systems may have different configurations, so allow this to be specified at the board-level. Note that our motion_sense algorithm currently assumes that we have one accelerometer in the lid and one in the base -- we'll need to fix that in another CL. BUG=chrome-os-partner:27320 TEST=Compile-only. Tested in future Samus commit. BRANCH=None. Change-Id: I1fae1f6c578fedebe78b473a5d66a5794ccaae00 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/212321 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'include/motion_sense.h')
-rw-r--r--include/motion_sense.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/motion_sense.h b/include/motion_sense.h
index 3a3b9b5121..0319514fd7 100644
--- a/include/motion_sense.h
+++ b/include/motion_sense.h
@@ -92,5 +92,21 @@ void accel_int_lid(enum gpio_signal signal);
*/
void accel_int_base(enum gpio_signal signal);
+enum sensor_location_t {
+ LOCATION_BASE,
+ LOCATION_LID,
+};
+
+struct motion_sensor_t {
+ char *name;
+ enum sensor_location_t location;
+ const struct accelgyro_info *drv;
+ void *drv_data;
+ uint8_t i2c_addr;
+};
+
+/* Defined at board level. */
+extern const struct motion_sensor_t motion_sensors[];
+extern const unsigned int motion_sensor_count;
#endif /* __CROS_EC_MOTION_SENSE_H */