1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-27 15:31:17 +01:00

cpu/stm32/rtc: add unlock/lock to rtc_clear_alarm

This commit is contained in:
Francisco Molina 2021-01-19 13:33:17 +01:00
parent 886d179c27
commit 7c12ea7416
No known key found for this signature in database
GPG Key ID: 3E94EAC3DBDEEDA8

View File

@ -304,11 +304,11 @@ int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg)
/* normalize input */
rtc_tm_normalize(time);
rtc_unlock();
/* disable existing alarm (if enabled) */
rtc_clear_alarm();
rtc_unlock();
/* save callback and argument */
isr_ctx.cb = cb;
isr_ctx.arg = arg;
@ -345,11 +345,15 @@ int rtc_get_alarm(struct tm *time)
void rtc_clear_alarm(void)
{
rtc_unlock();
RTC->CR &= ~(RTC_CR_ALRAE | RTC_CR_ALRAIE);
while (!(RTC_REG_ISR & RTC_ISR_ALRAWF)) {}
isr_ctx.cb = NULL;
isr_ctx.arg = NULL;
rtc_lock();
}
void rtc_poweron(void)