summaryrefslogtreecommitdiff
path: root/driver/accel_lis2dh.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2017-03-30 15:12:44 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-03-19 19:21:18 -0700
commit47f344713e3792b5b75ccd8d8d0f3797208e2de7 (patch)
treecde7cc10be1a00e593673335b220c0515ec06348 /driver/accel_lis2dh.c
parent1f4d4f8a4ec219e84e9d1554f765ec6a4feb6039 (diff)
downloadchrome-ec-47f344713e3792b5b75ccd8d8d0f3797208e2de7.tar.gz
driver: lsm6dsm/lsm6dsl/lis2dh: Use STM MEMs common functions
LSM6DSM now use STM MEMs common functions already used by LIS2DH12 device. Added st_raw_read_n_noinc function to read i2c data not using auto increment protocol. BUG=b:73546254 BRANCH=master TEST=Tested on discovery BOARD with LSM6DSM sensor connected on I2C master bus interface of target board. Using motion sense console commands is possible to enable, set data rate, set full scale and show data from sensor (acc and gyro). Commons function works properly for LSM6DSM. Change-Id: I7a987306135a85abcfa9c1d3ba596fb70598fadc Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/465376
Diffstat (limited to 'driver/accel_lis2dh.c')
-rw-r--r--driver/accel_lis2dh.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/driver/accel_lis2dh.c b/driver/accel_lis2dh.c
index 017621ff6a..e937205755 100644
--- a/driver/accel_lis2dh.c
+++ b/driver/accel_lis2dh.c
@@ -19,6 +19,9 @@
#include "driver/accel_lis2dh.h"
#include "driver/stm_mems_common.h"
+#define CPUTS(outstr) cputs(CC_ACCEL, outstr)
+#define CPRINTF(format, args...) cprintf(CC_ACCEL, format, ## args)
+
#ifdef CONFIG_ACCEL_FIFO
/**
* enable_fifo - Enable/Disable FIFO in LIS2DH
@@ -317,10 +320,6 @@ static int read(const struct motion_sensor_t *s, vector_3_t v)
/* Transform from LSB to real data with rotation and gain */
st_normalize(s, v, raw);
- /* apply offset in the device coordinates */
- for (i = X; i <= Z; i++)
- v[i] += (data->offset[i] << 5) / data->base.range;
-
return EC_SUCCESS;
}