diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c | 7 |
1 files changed, 4 insertions, 3 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 09844f680..5c42dbc3b 100644 --- a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c +++ b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c @@ -345,9 +345,10 @@ void rtc_lld_set_time(RTCDriver *rtcp, const RTCDateTime *timespec) { /* Writing the registers.*/
rtc_enter_init();
- rtcp->rtc->TR = tr;
- rtcp->rtc->DR = dr;
- rtcp->rtc->CR |= timespec->dstflag << RTC_CR_BKP_OFFSET;
+ rtcp->rtc->TR = tr;
+ rtcp->rtc->DR = dr;
+ rtcp->rtc->CR = (rtcp->rtc->CR & ~(1U << RTC_CR_BKP_OFFSET)) |
+ (timespec->dstflag << RTC_CR_BKP_OFFSET);
rtc_exit_init();
/* Leaving a reentrant critical zone.*/
|