drivers/lps22h: Use machine.idle for power saving.

All machine modules should have an idle function.
This commit is contained in:
iabdalkader 2022-07-07 17:00:09 +02:00 committed by Damien George
parent 6753c53318
commit 474c47d595
1 changed files with 1 additions and 9 deletions

View File

@ -53,14 +53,6 @@ class LPS22H:
self.addr = address
self.oneshot = oneshot
self.buf = bytearray(1)
if hasattr(machine, "idle"):
self._go_idle = machine.idle()
else:
import time
self._go_idle = lambda: time.sleep_ms(1)
# ODR=1 EN_LPFP=1 BDU=1
self._write_reg(_LPS22_CTRL_REG1, 0x1A)
self.set_oneshot_mode(self.oneshot)
@ -86,7 +78,7 @@ class LPS22H:
while True:
if self._read_reg(_LPS22_STATUS) & b:
return
self._go_idle()
machine.idle()
def set_oneshot_mode(self, oneshot):
self._read_reg(_LPS22_CTRL_REG1)