Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions adafruit_lsm6ds/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions adafruit_lsm6ds/ism330dhcx.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
pass

_LSM6DS_CTRL2_G = const(0x11)
_ISM330DHCX_CTRL6_C = const(0x15)


class ISM330DHCX(LSM6DS):
Expand Down Expand Up @@ -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(
Expand Down