Skip to content

Commit fdebabc

Browse files
committed
fix(F1): properly update date
Fixes #87 Signed-off-by: Frederic Pillon <[email protected]>
1 parent 36c7af7 commit fdebabc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/rtc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,8 @@ bool RTC_init(hourFormat_t format, sourceClock_t source, bool reset)
485485
RTC_initClock(source);
486486
#if defined(STM32F1xx)
487487
memcpy(&RtcHandle.DateToUpdate, &BackupDate, 4);
488+
/* Update date automatically by calling HAL_RTC_GetDate */
489+
RTC_GetDate(&years, &month, &days, &weekDay);
488490
/* and fill the new RTC Date value */
489491
RTC_SetDate(RtcHandle.DateToUpdate.Year, RtcHandle.DateToUpdate.Month,
490492
RtcHandle.DateToUpdate.Date, RtcHandle.DateToUpdate.WeekDay);

0 commit comments

Comments
 (0)