aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports/STM32/LLD')
-rw-r--r--os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c3
-rw-r--r--os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h1
2 files changed, 3 insertions, 1 deletions
diff --git a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c
index 6d44570f1..a6c776d3a 100644
--- a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c
+++ b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c
@@ -512,7 +512,8 @@ void rtcSTM32SetPeriodicWakeup(RTCDriver *rtcp, const RTCWakeup *wakeupspec) {
while (!(rtcp->rtc->ISR & RTC_ISR_WUTWF))
;
rtcp->rtc->WUTR = wakeupspec->wutr & 0xFFFF;
- rtcp->rtc->CR = (wakeupspec->wutr >> 16) & 0x7;
+ rtcp->rtc->CR &= ~RTC_CR_WUCKSEL;
+ rtcp->rtc->CR |= (wakeupspec->wutr >> 16) & RTC_CR_WUCKSEL;
rtcp->rtc->CR |= RTC_CR_WUTIE;
rtcp->rtc->CR |= RTC_CR_WUTE;
}
diff --git a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h
index e42b400e8..ad2807a0e 100644
--- a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h
+++ b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h
@@ -160,6 +160,7 @@ typedef struct {
/**
* @brief Wakeup as encoded in RTC WUTR register.
* @note ((WUTR == 0) || (WUCKSEL == 3)) are a forbidden combination.
+ * @note Bits 16..18 are copied in the CR bits 0..2 (WUCKSEL).
*/
uint32_t wutr;
} RTCWakeup;