77 #define RTC_TIMEOUT_MS ((uint32_t)1000)
80 #define RTC_ASYNCH_PREDIV ((uint32_t)0x7FFF)
100 LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
101 LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_BKP);
102 LL_PWR_EnableBkUpAccess();
105 if (LL_RCC_LSE_IsReady() != 1)
107 LL_RCC_ForceBackupDomainReset();
108 LL_RCC_ReleaseBackupDomainReset();
113 while (LL_RCC_LSE_IsReady() != 1)
122 if (LL_RCC_GetRTCClockSource() != LL_RCC_RTC_CLKSOURCE_LSE)
124 LL_RCC_SetRTCClockSource(LL_RCC_RTC_CLKSOURCE_LSE);
132 LL_RTC_DisableWriteProtection(
RTC);
135 if (LL_RTC_EnterInitMode(
RTC) != 0)
144 LL_EXTI_EnableIT_0_31(LL_EXTI_LINE_17);
145 LL_EXTI_EnableRisingTrig_0_31(LL_EXTI_LINE_17);
152 LL_RTC_EnableIT_SEC(
RTC);
155 LL_RTC_ExitInitMode(
RTC);
158 LL_RTC_EnableWriteProtection(
RTC);
180 unsigned long t1, a, b, c, d, e, m;
191 jd = ((counter+43200)/(86400>>1)) + (2440587<<1) + 1;
210 c = a - (146097*b)/4;
214 mday = e - (153*m+2)/5 + 1;
215 mon = m + 3 - 12*(m/10);
216 year = 100*b + d - 4800 + (m/10);
322 LL_RTC_DisableWriteProtection(
RTC);
325 if (LL_RTC_EnterInitMode(
RTC) != 0)
334 LL_RTC_ClearFlag_RS(
RTC);
339 while(LL_RTC_IsActiveFlag_RS(
RTC) != 1)
347 if (LL_RTC_ExitInitMode(
RTC) != 0)
353 LL_RTC_EnableWriteProtection(
RTC);