Skip to content

Commit 36247d1

Browse files
authored
Merge pull request #68 from mikeysklar/low-power
2 parents 2bf5c7f + 1e6efda commit 36247d1

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

adafruit_lsm6ds/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ def accelerometer_data_rate(self, value: int) -> None:
345345
if not Rate.is_valid(value):
346346
raise AttributeError("accelerometer_data_rate must be a `Rate`")
347347

348+
# ISM330DHCX requires enabling low-power mode for 1.6 Hz ODR
349+
if value == Rate.RATE_1_6_HZ and getattr(self, "_supports_low_power_odr", False):
350+
self.low_power_mode = True
351+
348352
self._accel_data_rate = value
349353
# sleep(.2) # needed to let new range settle
350354

adafruit_lsm6ds/ism330dhcx.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
pass
1919

2020
_LSM6DS_CTRL2_G = const(0x11)
21+
_ISM330DHCX_CTRL6_C = const(0x15)
2122

2223

2324
class ISM330DHCX(LSM6DS):
@@ -56,6 +57,8 @@ class ISM330DHCX(LSM6DS):
5657

5758
CHIP_ID = 0x6B
5859
_gyro_range_4000dps = RWBit(_LSM6DS_CTRL2_G, 0)
60+
_supports_low_power_odr = True
61+
low_power_mode = RWBit(_ISM330DHCX_CTRL6_C, 4)
5962

6063
def __init__(self, i2c_bus: I2C, address: int = LSM6DS_DEFAULT_ADDRESS) -> None:
6164
GyroRange.add_values(

0 commit comments

Comments
 (0)