diff --git a/wasp/drivers/nrf_rtc.py b/wasp/drivers/nrf_rtc.py index 100bacd..e68b957 100644 --- a/wasp/drivers/nrf_rtc.py +++ b/wasp/drivers/nrf_rtc.py @@ -45,6 +45,7 @@ class RTC(object): self._uptime = 0 self.set_localtime((2020, 3, 1, 3, 0, 0, 0, 0)) + @micropython.native def update(self): """Check for counter updates. @@ -59,10 +60,12 @@ class RTC(object): self.lastcount += split self.lastcount &= (1 << 24) - 1 + uptime = self._uptime self._uptime += split machine.mem32[0x200039c8] = self._uptime * 125 - return True + # Has the seconds count changed + return bool((self._uptime ^ uptime) & 0x08) def set_localtime(self, t): """Set the current wall time. @@ -103,6 +106,7 @@ class RTC(object): localtime = self.get_localtime() return localtime[3:6] + @micropython.native def time(self): """Get time in the same format as time.time""" return self.offset + (self._uptime >> 3) diff --git a/wasp/wasp.py b/wasp/wasp.py index 6c3e4ef..eaf3737 100644 --- a/wasp/wasp.py +++ b/wasp/wasp.py @@ -430,6 +430,7 @@ class Manager(): watch.touch.reset_touch_data() + @micropython.native def _tick(self): """Handle the system tick.