diff --git a/adafruit_lsm6ds/__init__.py b/adafruit_lsm6ds/__init__.py index f2d7ee5..a5bd533 100644 --- a/adafruit_lsm6ds/__init__.py +++ b/adafruit_lsm6ds/__init__.py @@ -345,6 +345,10 @@ def accelerometer_data_rate(self, value: int) -> None: if not Rate.is_valid(value): raise AttributeError("accelerometer_data_rate must be a `Rate`") + # ISM330DHCX requires enabling low-power mode for 1.6 Hz ODR + if value == Rate.RATE_1_6_HZ and getattr(self, "_supports_low_power_odr", False): + self.low_power_mode = True + self._accel_data_rate = value # sleep(.2) # needed to let new range settle diff --git a/adafruit_lsm6ds/ism330dhcx.py b/adafruit_lsm6ds/ism330dhcx.py index 4e33f7f..113139c 100644 --- a/adafruit_lsm6ds/ism330dhcx.py +++ b/adafruit_lsm6ds/ism330dhcx.py @@ -18,6 +18,7 @@ pass _LSM6DS_CTRL2_G = const(0x11) +_ISM330DHCX_CTRL6_C = const(0x15) class ISM330DHCX(LSM6DS): @@ -56,6 +57,8 @@ class ISM330DHCX(LSM6DS): CHIP_ID = 0x6B _gyro_range_4000dps = RWBit(_LSM6DS_CTRL2_G, 0) + _supports_low_power_odr = True + low_power_mode = RWBit(_ISM330DHCX_CTRL6_C, 4) def __init__(self, i2c_bus: I2C, address: int = LSM6DS_DEFAULT_ADDRESS) -> None: GyroRange.add_values(