STM32 RTC : skip rtc_write if possible

pull/9208/head
jeromecoutant 2018-11-16 14:32:32 +01:00 committed by Cruz Monrreal II
parent 35b7a06bda
commit f5577c005e
1 changed files with 5 additions and 0 deletions

View File

@ -217,6 +217,11 @@ void rtc_write(time_t t)
RTC_DateTypeDef dateStruct = {0};
RTC_TimeTypeDef timeStruct = {0};
/* if the requested time is the current time, no need to continue */
if (t == rtc_read()) {
return;
}
core_util_critical_section_enter();
RtcHandle.Instance = RTC;