stm32: rtc: clear wakeup clock selection

Clear wakeup clock selection before setting the desired bits, so no
old bits can stay set

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
This commit is contained in:
Bruno Randolf 2018-09-05 15:09:38 +01:00 committed by Karl Palsson
parent b8424263e8
commit 833ddd9b0a

View File

@ -107,6 +107,7 @@ void rtc_set_wakeup_time(uint16_t wkup_time, uint8_t rtc_cr_wucksel)
* down-counting. * down-counting.
*/ */
RTC_WUTR = wkup_time; RTC_WUTR = wkup_time;
RTC_CR &= ~(RTC_CR_WUCLKSEL_MASK << RTC_CR_WUCLKSEL_SHIFT);
RTC_CR |= (rtc_cr_wucksel << RTC_CR_WUCLKSEL_SHIFT); RTC_CR |= (rtc_cr_wucksel << RTC_CR_WUCLKSEL_SHIFT);
RTC_CR |= RTC_CR_WUTE; RTC_CR |= RTC_CR_WUTE;
} }