Skip to content

Commit 8035854

Browse files
committed
adding low power flag
1 parent 52a561a commit 8035854

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

adafruit_icm20x.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ class ICM20X: # pylint:disable=too-many-instance-attributes
166166
_bank_reg = UnaryStruct(_ICM20X_REG_BANK_SEL, "<B")
167167
_reset = RWBit(_ICM20X_PWR_MGMT_1, 7)
168168
_sleep = RWBit(_ICM20X_PWR_MGMT_1, 6)
169+
_low_power_en = RWBit(_ICM20X_PWR_MGMT_1, 5)
169170
_clock_source = RWBits(3, _ICM20X_PWR_MGMT_1, 0)
170171

171172
_raw_accel_data = Struct(_ICM20X_ACCEL_XOUT_H, ">hhh")
@@ -265,6 +266,17 @@ def gyro_dlpf_cutoff(self, cutoff_frequency):
265266
self._gyro_dlpf_enable = True
266267
self._gyro_dlpf_config = cutoff_frequency
267268

269+
@property
270+
def low_power(self):
271+
"""Enables or disables a low power mode for the sensors digital circuitry"""
272+
self._bank = 0
273+
return self._low_power_en
274+
275+
@low_power.setter
276+
def low_power(self, enabled):
277+
self._bank = 0
278+
self._low_power_en = enabled
279+
268280
@property
269281
def _bank(self):
270282
return self._bank_reg >> 4

0 commit comments

Comments
 (0)