summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Cross <sean@xobs.io>2020-05-20 16:44:18 +0800
committerSean Cross <sean@xobs.io>2020-05-20 16:44:18 +0800
commit4cca455c9b5651d7b846b9e1a8b49ea81adc8cd7 (patch)
tree74a4a5bdcb43761bc869ff2a8aac22b9b97bf19d
parent2c2b53303d17e07daa8f7a61740835d30f671a18 (diff)
nrf: reset rtc as part of port_reset()
On NRF, the `rtc_reset()` function is never called. As a result, calls to `time.time()` return a cryptic error> ``` >>> import time >>> time.time() '' object has no attribute 'datetime' >>> ``` This is because `MP_STATE_VM(rtc_time_source)` is not initialized due to `rtc_reset()` never being called. If `CIRCUITPY_RTC` is enabled, call `rtc_reset()` as part of the `reset_port()` call. This ensures that `time.time()` works as expected. Signed-off-by: Sean Cross <sean@xobs.io>
-rw-r--r--ports/nrf/supervisor/port.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c
index 4edb78f7c..e88b6c26f 100644
--- a/ports/nrf/supervisor/port.c
+++ b/ports/nrf/supervisor/port.c
@@ -161,6 +161,10 @@ void reset_port(void) {
pulsein_reset();
#endif
+#if CIRCUITPY_RTC
+ rtc_reset();
+#endif
+
timers_reset();
#if CIRCUITPY_BLEIO