]> git.earman.xyz Git - sensor-watch.git/commitdiff
wait for RTC SYNCBUSY in watch_register_extwake_callback
authorJoseph Bryant <jb@dreamcountry.org>
Fri, 30 Aug 2024 06:23:28 +0000 (07:23 +0100)
committerMatheus Afonso Martins Moreira <matheus@matheusmoreira.com>
Fri, 30 Aug 2024 19:20:32 +0000 (16:20 -0300)
watch-library/hardware/watch/watch_deepsleep.c

index efdad6dda4b4b69360f90aa64114d246faff9fdb..a25b667b066a5bd84f48ff7140e6a40ce98644a8 100644 (file)
@@ -77,6 +77,7 @@ void watch_register_extwake_callback(uint8_t pin, ext_irq_cb_t callback, bool le
     RTC->MODE2.TAMPCTRL.reg = config;
     // re-enable the RTC
     RTC->MODE2.CTRLA.bit.ENABLE = 1;
+    while (RTC->MODE2.SYNCBUSY.bit.ENABLE); // wait for RTC to be enabled
 
     NVIC_ClearPendingIRQ(RTC_IRQn);
     NVIC_EnableIRQ(RTC_IRQn);