Skip to content

Commit

Permalink
fix(F1): properly update date
Browse files Browse the repository at this point in the history
Fixes #87

Signed-off-by: Frederic Pillon <[email protected]>
  • Loading branch information
fpistm committed Jan 25, 2023
1 parent 36c7af7 commit fdebabc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ bool RTC_init(hourFormat_t format, sourceClock_t source, bool reset)
RTC_initClock(source);
#if defined(STM32F1xx)
memcpy(&RtcHandle.DateToUpdate, &BackupDate, 4);
/* Update date automatically by calling HAL_RTC_GetDate */
RTC_GetDate(&years, &month, &days, &weekDay);
/* and fill the new RTC Date value */
RTC_SetDate(RtcHandle.DateToUpdate.Year, RtcHandle.DateToUpdate.Month,
RtcHandle.DateToUpdate.Date, RtcHandle.DateToUpdate.WeekDay);
Expand Down

0 comments on commit fdebabc

Please sign in to comment.