mirror of
https://github.com/firewalkwithm3/Sensor-Watch.git
synced 2024-11-22 11:10:29 +08:00
wait for RTC SYNCBUSY in watch_register_extwake_callback
This commit is contained in:
parent
20b4a32835
commit
cae5d8a33f
|
@ -77,6 +77,7 @@ void watch_register_extwake_callback(uint8_t pin, ext_irq_cb_t callback, bool le
|
||||||
RTC->MODE2.TAMPCTRL.reg = config;
|
RTC->MODE2.TAMPCTRL.reg = config;
|
||||||
// re-enable the RTC
|
// re-enable the RTC
|
||||||
RTC->MODE2.CTRLA.bit.ENABLE = 1;
|
RTC->MODE2.CTRLA.bit.ENABLE = 1;
|
||||||
|
while (RTC->MODE2.SYNCBUSY.bit.ENABLE); // wait for RTC to be enabled
|
||||||
|
|
||||||
NVIC_ClearPendingIRQ(RTC_IRQn);
|
NVIC_ClearPendingIRQ(RTC_IRQn);
|
||||||
NVIC_EnableIRQ(RTC_IRQn);
|
NVIC_EnableIRQ(RTC_IRQn);
|
||||||
|
|
Loading…
Reference in a new issue