From 2ddfab315ca8709a5a18aa8411abdc899b71b44f Mon Sep 17 00:00:00 2001 From: DavePutz Date: Mon, 11 May 2020 11:31:18 -0500 Subject: [PATCH 1/2] Added call to rtc_reset() in rtc_init() Fix for issue #2872. The rtc_time_source had not been initialized; causing a time.time() call to fail. --- ports/atmel-samd/supervisor/port.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index b3903bb862..f232572e47 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -174,6 +174,7 @@ static void rtc_init(void) { #endif NVIC_ClearPendingIRQ(RTC_IRQn); NVIC_EnableIRQ(RTC_IRQn); + rtc_reset(); } safe_mode_t port_init(void) { From 407938bf3a7d194a3ac4e0888037ca7025185c2f Mon Sep 17 00:00:00 2001 From: DavePutz Date: Mon, 11 May 2020 12:03:44 -0500 Subject: [PATCH 2/2] Added a check for platforms supporting RTC before calling rtc_reset() Added an #if CIRCUITPY_RTC check for platforms supporting RTC --- ports/atmel-samd/supervisor/port.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index f232572e47..04e2c9191a 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -174,7 +174,10 @@ static void rtc_init(void) { #endif NVIC_ClearPendingIRQ(RTC_IRQn); NVIC_EnableIRQ(RTC_IRQn); +#if CIRCUITPY_RTC rtc_reset(); +#endif + } safe_mode_t port_init(void) {