From 474c47d5958f2a445cd28654297d418f7cc15400 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Thu, 7 Jul 2022 17:00:09 +0200 Subject: [PATCH] drivers/lps22h: Use machine.idle for power saving. All machine modules should have an idle function. --- drivers/lps22h/lps22h.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/lps22h/lps22h.py b/drivers/lps22h/lps22h.py index 8d90b29178..ca29efce2d 100644 --- a/drivers/lps22h/lps22h.py +++ b/drivers/lps22h/lps22h.py @@ -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)