Merged in extent3d/nuttx/lis3dh-fix (pull request #600)
LIS3DH: Fix missing shift when writing output data rate to register Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
parent
b8a47f9b0f
commit
75f68b9d3a
@ -644,7 +644,7 @@ static int lis3dh_set_odr(FAR struct lis3dh_dev_s *dev, uint8_t odr)
|
||||
}
|
||||
|
||||
lis3dh_read_register(dev, LIS3DH_CTRL_REG1, &ctrl1);
|
||||
ctrl1 |= odr & LIS3DH_CTRL_REG1_ODR_MASK;
|
||||
ctrl1 |= LIS3DH_CTRL_REG1_ODR(odr) & LIS3DH_CTRL_REG1_ODR_MASK;
|
||||
lis3dh_write_register(dev, LIS3DH_CTRL_REG1, ctrl1);
|
||||
|
||||
/* Cache the current ODR in the device structure */
|
||||
|
@ -124,6 +124,7 @@
|
||||
|
||||
#define LIS3DH_CTRL_REG1_ODR_SHIFT (4)
|
||||
#define LIS3DH_CTRL_REG1_ODR_MASK (0xf << LIS3DH_CTRL_REG1_ODR_SHIFT)
|
||||
#define LIS3DH_CTRL_REG1_ODR(n) ((n) << LIS3DH_CTRL_REG1_ODR_SHIFT)
|
||||
#define LIS3DH_CTRL_REG1_ODR_POWER_DOWN (0)
|
||||
#define LIS3DH_CTRL_REG1_ODR_1HZ (0x1 << LIS3DH_CTRL_REG1_ODR_SHIFT)
|
||||
#define LIS3DH_CTRL_REG1_ODR_10HZ (0x2 << LIS3DH_CTRL_REG1_ODR_SHIFT)
|
||||
|
Loading…
Reference in New Issue
Block a user