summaryrefslogtreecommitdiff
path: root/driver/accelgyro_lsm6ds0.h
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2015-04-15 17:03:22 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-04-20 18:46:08 +0000
commitd02620a05d071dabdeebe83a1e17091c89748e99 (patch)
tree85c29f99dfa289a3b585772d1ec379c7272c3ec2 /driver/accelgyro_lsm6ds0.h
parenta97af9a8b22c16a8427c960a0ab423c4fdfdf435 (diff)
downloadchrome-ec-d02620a05d071dabdeebe83a1e17091c89748e99.tar.gz
lsm6ds0: Cache ODR and range on EC.
For the driver functions get_range and get_data_rate, each call would end up executing an i2c transaction even if the value had not changed. Therefore, I modified the lsm6ds0 driver to cache the output data rate as well as the range. This prevents unecessary i2c transactions from occuring. BUG=chromium:476226 TEST=Flashed EC on samus and verified that the accelrange and accelrate commands still worked and that the sensors were functional. TEST=Verified Double Tap still worked. TEST=make -j buildall tests BRANCH=none Change-Id: Ie432979266dc4e4892978005de5d1df62cc0654f Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/265933 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'driver/accelgyro_lsm6ds0.h')
-rw-r--r--driver/accelgyro_lsm6ds0.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/driver/accelgyro_lsm6ds0.h b/driver/accelgyro_lsm6ds0.h
index c71fc37767..9f8953395d 100644
--- a/driver/accelgyro_lsm6ds0.h
+++ b/driver/accelgyro_lsm6ds0.h
@@ -116,6 +116,14 @@ enum lsm6ds0_bdu {
/* Sensor resolution in number of bits. This sensor has fixed resolution. */
#define LSM6DS0_RESOLUTION 16
+/* Run-time configurable parameters */
+struct lsm6ds0_data {
+ /* Current range */
+ int sensor_range;
+ /* Current output data rate */
+ int sensor_odr;
+};
+
extern const struct accelgyro_drv lsm6ds0_drv;
#endif /* __CROS_EC_ACCEL_LSM6DS0_H */