summaryrefslogtreecommitdiff
path: root/driver/accel_lis2dh.h
diff options
context:
space:
mode:
authorPaul Ma <magf@bitland.corp-partner.google.com>2018-06-22 18:11:04 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-06-27 22:07:33 -0700
commite013aaa016fd883a6ac545c851ecb1f5b1e60874 (patch)
treef77fd7dd49db24cc1fa45a2a8cf1c6887aff158f /driver/accel_lis2dh.h
parent29bcf334faf89986816127690a9c99459d74a801 (diff)
downloadchrome-ec-e013aaa016fd883a6ac545c851ecb1f5b1e60874.tar.gz
phaser: fix lis2de resolution and sensor value output
lis2de only support 8-bit resolution. This is what is different from lis2dh. This patch add two defines (CONFIG_ACCEL_LIS2DH and CONFIG_ACCEL_LIS2DE) to defferientiate them. For calculate_lid_angle() reliable calculation, code asks for 16 bits sensor value output, this patch fix that as well. Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> BRANCH=none BUG=b:110604678 TEST=boot phaser360 board, use 'accelinfo on' to watch lid output and angle output, lid axis value should be 16 bit range and angle is correct. Change-Id: If77954ecf477736b9168b3a3b6805396a3201a57 Reviewed-on: https://chromium-review.googlesource.com/1111775 Commit-Ready: Paul Ma <magf@bitland.corp-partner.google.com> Tested-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'driver/accel_lis2dh.h')
-rw-r--r--driver/accel_lis2dh.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/driver/accel_lis2dh.h b/driver/accel_lis2dh.h
index 0421f79503..fe8d17641e 100644
--- a/driver/accel_lis2dh.h
+++ b/driver/accel_lis2dh.h
@@ -102,11 +102,15 @@ enum lis2dh_odr {
#define LIS2DH_FS_TO_REG(_fs) (__fls(_fs) - 1)
/* Sensor resolution in number of bits
- * This sensor has variable precision (8/10/12 bits) depending Power Mode
- * selected
- * TODO: Only Normal Power mode supported (10 bits)
+ * lis2dh has variable precision (8/10/12 bits) depending Power Mode
+ * selected, here Only Normal Power mode supported (10 bits).
+ * But for lis2de, it has only one 8bit resolution.
*/
+#ifdef CONFIG_ACCEL_LIS2DE
+#define LIS2DH_RESOLUTION 8
+#elif defined(CONFIG_ACCEL_LIS2DH)
#define LIS2DH_RESOLUTION 10
+#endif
extern const struct accelgyro_drv lis2dh_drv;