From cae5d8a33f5e7aa248b07e7a1b59fbc60b8c5a3b Mon Sep 17 00:00:00 2001 From: Joseph Bryant Date: Fri, 30 Aug 2024 07:23:28 +0100 Subject: [PATCH] wait for RTC SYNCBUSY in watch_register_extwake_callback --- watch-library/hardware/watch/watch_deepsleep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/watch-library/hardware/watch/watch_deepsleep.c b/watch-library/hardware/watch/watch_deepsleep.c index efdad6d..a25b667 100644 --- a/watch-library/hardware/watch/watch_deepsleep.c +++ b/watch-library/hardware/watch/watch_deepsleep.c @@ -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);