diff options
author | Joey Castillo <joeycastillo@utexas.edu> | 2022-01-09 12:02:58 -0500 |
---|---|---|
committer | Joey Castillo <joeycastillo@utexas.edu> | 2022-01-09 12:02:58 -0500 |
commit | 5ceec26d5a4a4ae8fe1a3a5df4e4f6904b59d53a (patch) | |
tree | 9038d2c8f3e4b7310cb97e173678fe6c46e26a62 | |
parent | 1ea476ca24fc1cc621a76694f71df9d812ffd44c (diff) | |
download | Sensor-Watch-5ceec26d5a4a4ae8fe1a3a5df4e4f6904b59d53a.tar.gz Sensor-Watch-5ceec26d5a4a4ae8fe1a3a5df4e4f6904b59d53a.tar.bz2 Sensor-Watch-5ceec26d5a4a4ae8fe1a3a5df4e4f6904b59d53a.zip |
start in low power mode
-rw-r--r-- | watch-library/driver/lis2dw.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/watch-library/driver/lis2dw.c b/watch-library/driver/lis2dw.c index 73b54aaf..f9cd5cc1 100644 --- a/watch-library/driver/lis2dw.c +++ b/watch-library/driver/lis2dw.c @@ -31,8 +31,8 @@ bool lis2dw_begin(void) { } watch_i2c_write8(LIS2DW_ADDRESS, LIS2DW_REG_CTRL2, LIS2DW_CTRL2_VAL_BOOT); watch_i2c_write8(LIS2DW_ADDRESS, LIS2DW_REG_CTRL2, LIS2DW_CTRL2_VAL_SOFT_RESET); - // Start at 100 Hz data rate - watch_i2c_write8(LIS2DW_ADDRESS, LIS2DW_REG_CTRL1, LIS2DW_CTRL1_VAL_ODR_100HZ | LIS2DW_CTRL1_VAL_MODE_HIGH_PERFORMANCE); + // Start at lowest possible data rate and lowest possible power mode + watch_i2c_write8(LIS2DW_ADDRESS, LIS2DW_REG_CTRL1, LIS2DW_CTRL1_VAL_ODR_LOWEST | LIS2DW_CTRL1_VAL_MODE_LOW_POWER | LIS2DW_CTRL1_VAL_LPMODE_4); // Enable block data update (output registers not updated until MSB and LSB have been read) and address autoincrement watch_i2c_write8(LIS2DW_ADDRESS, LIS2DW_REG_CTRL2, LIS2DW_CTRL2_VAL_BDU | LIS2DW_CTRL2_VAL_IF_ADD_INC); // Set range to ±2G @@ -65,10 +65,6 @@ lis2dw_reading lis2dw_get_raw_reading(void) { retval.z = buffer[4]; retval.z |= ((uint16_t)buffer[5]) << 8; - retval.x >>= 2; - retval.y >>= 2; - retval.z >>= 2; - return retval; } |