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:
Matt Thompson 2018-02-14 20:27:48 +00:00 committed by Gregory Nutt
parent b8a47f9b0f
commit 75f68b9d3a
2 changed files with 2 additions and 1 deletions

View File

@ -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 */

View File

@ -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)