Skip to content

Commit 535b439

Browse files
committed
Revert "STM32 RTC : skip rtc_write if possible"
`rtc_write` must start the RTC. `time()` uses `rtc_write(0)` to start the RTC if it is not already enabled, but this check made that not work. There's no point trying to optimise this case in a HAL - if we wanted `set_time()` to protect against users making pointless adjustments, the implementation should be there. But even then, you might want different levels of hysteresis depending on application, so it's probably best left to applications. This reverts commit 9da5e48.
1 parent ac361d6 commit 535b439

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

targets/TARGET_STM/rtc_api.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,6 @@ void rtc_write(time_t t)
217217
RTC_DateTypeDef dateStruct = {0};
218218
RTC_TimeTypeDef timeStruct = {0};
219219

220-
/* if the requested time is the current time, no need to continue */
221-
if (t == rtc_read()) {
222-
return;
223-
}
224-
225220
core_util_critical_section_enter();
226221
RtcHandle.Instance = RTC;
227222

0 commit comments

Comments
 (0)