From 4cca455c9b5651d7b846b9e1a8b49ea81adc8cd7 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Wed, 20 May 2020 16:44:18 +0800 Subject: [PATCH] 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 --- ports/nrf/supervisor/port.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index 4edb78f7c0..e88b6c26fe 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