]> git.earman.xyz Git - sensor-watch.git/commitdiff
lis2dh driver: make the implicit explicit
authorJoey Castillo <joeycastillo@utexas.edu>
Tue, 30 Nov 2021 16:55:16 +0000 (11:55 -0500)
committerJoey Castillo <joeycastillo@utexas.edu>
Tue, 30 Nov 2021 16:55:16 +0000 (11:55 -0500)
watch-library/driver/lis2dh.c

index 24534481b7df0d7b70fdef4c6f0c70bb1a2f2372..2593fc69f8f41a04e5ca773d894fab31f4862ee3 100644 (file)
@@ -34,8 +34,8 @@ bool lis2dh_begin() {
                                                        LIS2DH_CTRL1_VAL_YEN |
                                                        LIS2DH_CTRL1_VAL_ZEN |
                                                        LIS2DH_CTRL1_VAL_ODR_1HZ);
-    // Enable block data update (output registers not updated until MSB and LSB have been read)
-    watch_i2c_write8(LIS2DH_ADDRESS, LIS2DH_REG_CTRL4, LIS2DH_CTRL4_VAL_BDU);
+    // Set range to ±2G and enable block data update (output registers not updated until MSB and LSB have been read)
+    watch_i2c_write8(LIS2DH_ADDRESS, LIS2DH_REG_CTRL4, LIS2DH_CTRL4_VAL_BDU | LIS2DH_RANGE_2_G);
 
     return true;
 }