stm32f1xx_ll_rtc.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_ll_rtc.c
  4. * @author MCD Application Team
  5. * @brief RTC LL module driver.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. #if defined(USE_FULL_LL_DRIVER)
  20. /* Includes ------------------------------------------------------------------*/
  21. #include "stm32f1xx_ll_rtc.h"
  22. #include "stm32f1xx_ll_cortex.h"
  23. #ifdef USE_FULL_ASSERT
  24. #include "stm32_assert.h"
  25. #else
  26. #define assert_param(expr) ((void)0U)
  27. #endif
  28. /** @addtogroup STM32F1xx_LL_Driver
  29. * @{
  30. */
  31. #if defined(RTC)
  32. /** @addtogroup RTC_LL
  33. * @{
  34. */
  35. /* Private types -------------------------------------------------------------*/
  36. /* Private variables ---------------------------------------------------------*/
  37. /* Private constants ---------------------------------------------------------*/
  38. /** @addtogroup RTC_LL_Private_Constants
  39. * @{
  40. */
  41. /* Default values used for prescaler */
  42. #define RTC_ASYNCH_PRESC_DEFAULT 0x00007FFFU
  43. /* Values used for timeout */
  44. #define RTC_INITMODE_TIMEOUT 1000U /* 1s when tick set to 1ms */
  45. #define RTC_SYNCHRO_TIMEOUT 1000U /* 1s when tick set to 1ms */
  46. /**
  47. * @}
  48. */
  49. /* Private macros ------------------------------------------------------------*/
  50. /** @addtogroup RTC_LL_Private_Macros
  51. * @{
  52. */
  53. #define IS_LL_RTC_ASYNCH_PREDIV(__VALUE__) ((__VALUE__) <= 0xFFFFFU)
  54. #define IS_LL_RTC_FORMAT(__VALUE__) (((__VALUE__) == LL_RTC_FORMAT_BIN) \
  55. || ((__VALUE__) == LL_RTC_FORMAT_BCD))
  56. #define IS_LL_RTC_HOUR24(__HOUR__) ((__HOUR__) <= 23U)
  57. #define IS_LL_RTC_MINUTES(__MINUTES__) ((__MINUTES__) <= 59U)
  58. #define IS_LL_RTC_SECONDS(__SECONDS__) ((__SECONDS__) <= 59U)
  59. #define IS_LL_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == LL_RTC_CALIB_OUTPUT_NONE) || \
  60. ((__OUTPUT__) == LL_RTC_CALIB_OUTPUT_RTCCLOCK) || \
  61. ((__OUTPUT__) == LL_RTC_CALIB_OUTPUT_ALARM) || \
  62. ((__OUTPUT__) == LL_RTC_CALIB_OUTPUT_SECOND))
  63. /**
  64. * @}
  65. */
  66. /* Private function prototypes -----------------------------------------------*/
  67. /* Exported functions --------------------------------------------------------*/
  68. /** @addtogroup RTC_LL_Exported_Functions
  69. * @{
  70. */
  71. /** @addtogroup RTC_LL_EF_Init
  72. * @{
  73. */
  74. /**
  75. * @brief De-Initializes the RTC registers to their default reset values.
  76. * @note This function doesn't reset the RTC Clock source and RTC Backup Data
  77. * registers.
  78. * @param RTCx RTC Instance
  79. * @retval An ErrorStatus enumeration value:
  80. * - SUCCESS: RTC registers are de-initialized
  81. * - ERROR: RTC registers are not de-initialized
  82. */
  83. ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx)
  84. {
  85. ErrorStatus status = ERROR;
  86. /* Check the parameter */
  87. assert_param(IS_RTC_ALL_INSTANCE(RTCx));
  88. /* Disable the write protection for RTC registers */
  89. LL_RTC_DisableWriteProtection(RTCx);
  90. /* Set Initialization mode */
  91. if (LL_RTC_EnterInitMode(RTCx) != ERROR)
  92. {
  93. LL_RTC_WriteReg(RTCx, CNTL, 0x0000);
  94. LL_RTC_WriteReg(RTCx, CNTH, 0x0000);
  95. LL_RTC_WriteReg(RTCx, PRLH, 0x0000);
  96. LL_RTC_WriteReg(RTCx, PRLL, 0x8000);
  97. LL_RTC_WriteReg(RTCx, CRH, 0x0000);
  98. LL_RTC_WriteReg(RTCx, CRL, 0x0020);
  99. /* Reset Tamper and alternate functions configuration register */
  100. LL_RTC_WriteReg(BKP, RTCCR, 0x00000000U);
  101. LL_RTC_WriteReg(BKP, CR, 0x00000000U);
  102. LL_RTC_WriteReg(BKP, CSR, 0x00000000U);
  103. /* Exit Initialization Mode */
  104. if (LL_RTC_ExitInitMode(RTCx) != ERROR)
  105. {
  106. /* Wait till the RTC RSF flag is set */
  107. status = LL_RTC_WaitForSynchro(RTCx);
  108. /* Clear RSF Flag */
  109. LL_RTC_ClearFlag_RS(RTCx);
  110. /* Enable the write protection for RTC registers */
  111. LL_RTC_EnableWriteProtection(RTCx);
  112. }
  113. }
  114. else
  115. {
  116. /* Enable the write protection for RTC registers */
  117. LL_RTC_EnableWriteProtection(RTCx);
  118. }
  119. return status;
  120. }
  121. /**
  122. * @brief Initializes the RTC registers according to the specified parameters
  123. * in RTC_InitStruct.
  124. * @param RTCx RTC Instance
  125. * @param RTC_InitStruct pointer to a @ref LL_RTC_InitTypeDef structure that contains
  126. * the configuration information for the RTC peripheral.
  127. * @note The RTC Prescaler register is write protected and can be written in
  128. * initialization mode only.
  129. * @note the user should call LL_RTC_StructInit() or the structure of Prescaler
  130. * need to be initialized before RTC init()
  131. * @retval An ErrorStatus enumeration value:
  132. * - SUCCESS: RTC registers are initialized
  133. * - ERROR: RTC registers are not initialized
  134. */
  135. ErrorStatus LL_RTC_Init(RTC_TypeDef *RTCx, LL_RTC_InitTypeDef *RTC_InitStruct)
  136. {
  137. ErrorStatus status = ERROR;
  138. /* Check the parameters */
  139. assert_param(IS_RTC_ALL_INSTANCE(RTCx));
  140. assert_param(IS_LL_RTC_ASYNCH_PREDIV(RTC_InitStruct->AsynchPrescaler));
  141. assert_param(IS_LL_RTC_CALIB_OUTPUT(RTC_InitStruct->OutPutSource));
  142. /* Waiting for synchro */
  143. if (LL_RTC_WaitForSynchro(RTCx) != ERROR)
  144. {
  145. /* Set Initialization mode */
  146. if (LL_RTC_EnterInitMode(RTCx) != ERROR)
  147. {
  148. /* Clear Flag Bits */
  149. LL_RTC_ClearFlag_ALR(RTCx);
  150. LL_RTC_ClearFlag_OW(RTCx);
  151. LL_RTC_ClearFlag_SEC(RTCx);
  152. if (RTC_InitStruct->OutPutSource != LL_RTC_CALIB_OUTPUT_NONE)
  153. {
  154. /* Disable the selected Tamper Pin */
  155. LL_RTC_TAMPER_Disable(BKP);
  156. }
  157. /* Set the signal which will be routed to RTC Tamper Pin */
  158. LL_RTC_SetOutputSource(BKP, RTC_InitStruct->OutPutSource);
  159. /* Configure Synchronous and Asynchronous prescaler factor */
  160. LL_RTC_SetAsynchPrescaler(RTCx, RTC_InitStruct->AsynchPrescaler);
  161. /* Exit Initialization Mode */
  162. LL_RTC_ExitInitMode(RTCx);
  163. status = SUCCESS;
  164. }
  165. }
  166. return status;
  167. }
  168. /**
  169. * @brief Set each @ref LL_RTC_InitTypeDef field to default value.
  170. * @param RTC_InitStruct pointer to a @ref LL_RTC_InitTypeDef structure which will be initialized.
  171. * @retval None
  172. */
  173. void LL_RTC_StructInit(LL_RTC_InitTypeDef *RTC_InitStruct)
  174. {
  175. /* Set RTC_InitStruct fields to default values */
  176. RTC_InitStruct->AsynchPrescaler = RTC_ASYNCH_PRESC_DEFAULT;
  177. RTC_InitStruct->OutPutSource = LL_RTC_CALIB_OUTPUT_NONE;
  178. }
  179. /**
  180. * @brief Set the RTC current time.
  181. * @param RTCx RTC Instance
  182. * @param RTC_Format This parameter can be one of the following values:
  183. * @arg @ref LL_RTC_FORMAT_BIN
  184. * @arg @ref LL_RTC_FORMAT_BCD
  185. * @param RTC_TimeStruct pointer to a RTC_TimeTypeDef structure that contains
  186. * the time configuration information for the RTC.
  187. * @note The user should call LL_RTC_TIME_StructInit() or the structure
  188. * of time need to be initialized before time init()
  189. * @retval An ErrorStatus enumeration value:
  190. * - SUCCESS: RTC Time register is configured
  191. * - ERROR: RTC Time register is not configured
  192. */
  193. ErrorStatus LL_RTC_TIME_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_TimeTypeDef *RTC_TimeStruct)
  194. {
  195. ErrorStatus status = ERROR;
  196. uint32_t counter_time = 0U;
  197. /* Check the parameters */
  198. assert_param(IS_RTC_ALL_INSTANCE(RTCx));
  199. assert_param(IS_LL_RTC_FORMAT(RTC_Format));
  200. if (RTC_Format == LL_RTC_FORMAT_BIN)
  201. {
  202. assert_param(IS_LL_RTC_HOUR24(RTC_TimeStruct->Hours));
  203. assert_param(IS_LL_RTC_MINUTES(RTC_TimeStruct->Minutes));
  204. assert_param(IS_LL_RTC_SECONDS(RTC_TimeStruct->Seconds));
  205. }
  206. else
  207. {
  208. assert_param(IS_LL_RTC_HOUR24(__LL_RTC_CONVERT_BCD2BIN(RTC_TimeStruct->Hours)));
  209. assert_param(IS_LL_RTC_MINUTES(__LL_RTC_CONVERT_BCD2BIN(RTC_TimeStruct->Minutes)));
  210. assert_param(IS_LL_RTC_SECONDS(__LL_RTC_CONVERT_BCD2BIN(RTC_TimeStruct->Seconds)));
  211. }
  212. /* Enter Initialization mode */
  213. if (LL_RTC_EnterInitMode(RTCx) != ERROR)
  214. {
  215. /* Check the input parameters format */
  216. if (RTC_Format != LL_RTC_FORMAT_BIN)
  217. {
  218. counter_time = (uint32_t)(((uint32_t)RTC_TimeStruct->Hours * 3600U) + \
  219. ((uint32_t)RTC_TimeStruct->Minutes * 60U) + \
  220. ((uint32_t)RTC_TimeStruct->Seconds));
  221. LL_RTC_TIME_Set(RTCx, counter_time);
  222. }
  223. else
  224. {
  225. counter_time = (((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_TimeStruct->Hours)) * 3600U) + \
  226. ((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_TimeStruct->Minutes)) * 60U) + \
  227. ((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_TimeStruct->Seconds))));
  228. LL_RTC_TIME_Set(RTCx, counter_time);
  229. }
  230. status = SUCCESS;
  231. }
  232. /* Exit Initialization mode */
  233. LL_RTC_ExitInitMode(RTCx);
  234. return status;
  235. }
  236. /**
  237. * @brief Set each @ref LL_RTC_TimeTypeDef field to default value (Time = 00h:00min:00sec).
  238. * @param RTC_TimeStruct pointer to a @ref LL_RTC_TimeTypeDef structure which will be initialized.
  239. * @retval None
  240. */
  241. void LL_RTC_TIME_StructInit(LL_RTC_TimeTypeDef *RTC_TimeStruct)
  242. {
  243. /* Time = 00h:00min:00sec */
  244. RTC_TimeStruct->Hours = 0U;
  245. RTC_TimeStruct->Minutes = 0U;
  246. RTC_TimeStruct->Seconds = 0U;
  247. }
  248. /**
  249. * @brief Set the RTC Alarm.
  250. * @param RTCx RTC Instance
  251. * @param RTC_Format This parameter can be one of the following values:
  252. * @arg @ref LL_RTC_FORMAT_BIN
  253. * @arg @ref LL_RTC_FORMAT_BCD
  254. * @param RTC_AlarmStruct pointer to a @ref LL_RTC_AlarmTypeDef structure that
  255. * contains the alarm configuration parameters.
  256. * @note the user should call LL_RTC_ALARM_StructInit() or the structure
  257. * of Alarm need to be initialized before Alarm init()
  258. * @retval An ErrorStatus enumeration value:
  259. * - SUCCESS: ALARM registers are configured
  260. * - ERROR: ALARM registers are not configured
  261. */
  262. ErrorStatus LL_RTC_ALARM_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct)
  263. {
  264. ErrorStatus status = ERROR;
  265. uint32_t counter_alarm = 0U;
  266. /* Check the parameters */
  267. assert_param(IS_RTC_ALL_INSTANCE(RTCx));
  268. assert_param(IS_LL_RTC_FORMAT(RTC_Format));
  269. if (RTC_Format == LL_RTC_FORMAT_BIN)
  270. {
  271. assert_param(IS_LL_RTC_HOUR24(RTC_AlarmStruct->AlarmTime.Hours));
  272. assert_param(IS_LL_RTC_MINUTES(RTC_AlarmStruct->AlarmTime.Minutes));
  273. assert_param(IS_LL_RTC_SECONDS(RTC_AlarmStruct->AlarmTime.Seconds));
  274. }
  275. else
  276. {
  277. assert_param(IS_LL_RTC_HOUR24(__LL_RTC_CONVERT_BCD2BIN(RTC_AlarmStruct->AlarmTime.Hours)));
  278. assert_param(IS_LL_RTC_MINUTES(__LL_RTC_CONVERT_BCD2BIN(RTC_AlarmStruct->AlarmTime.Minutes)));
  279. assert_param(IS_LL_RTC_SECONDS(__LL_RTC_CONVERT_BCD2BIN(RTC_AlarmStruct->AlarmTime.Seconds)));
  280. }
  281. /* Enter Initialization mode */
  282. if (LL_RTC_EnterInitMode(RTCx) != ERROR)
  283. {
  284. /* Check the input parameters format */
  285. if (RTC_Format != LL_RTC_FORMAT_BIN)
  286. {
  287. counter_alarm = (uint32_t)(((uint32_t)RTC_AlarmStruct->AlarmTime.Hours * 3600U) + \
  288. ((uint32_t)RTC_AlarmStruct->AlarmTime.Minutes * 60U) + \
  289. ((uint32_t)RTC_AlarmStruct->AlarmTime.Seconds));
  290. LL_RTC_ALARM_Set(RTCx, counter_alarm);
  291. }
  292. else
  293. {
  294. counter_alarm = (((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_AlarmStruct->AlarmTime.Hours)) * 3600U) + \
  295. ((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_AlarmStruct->AlarmTime.Minutes)) * 60U) + \
  296. ((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_AlarmStruct->AlarmTime.Seconds))));
  297. LL_RTC_ALARM_Set(RTCx, counter_alarm);
  298. }
  299. status = SUCCESS;
  300. }
  301. /* Exit Initialization mode */
  302. LL_RTC_ExitInitMode(RTCx);
  303. return status;
  304. }
  305. /**
  306. * @brief Set each @ref LL_RTC_AlarmTypeDef of ALARM field to default value (Time = 00h:00mn:00sec /
  307. * Day = 1st day of the month/Mask = all fields are masked).
  308. * @param RTC_AlarmStruct pointer to a @ref LL_RTC_AlarmTypeDef structure which will be initialized.
  309. * @retval None
  310. */
  311. void LL_RTC_ALARM_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct)
  312. {
  313. /* Alarm Time Settings : Time = 00h:00mn:00sec */
  314. RTC_AlarmStruct->AlarmTime.Hours = 0U;
  315. RTC_AlarmStruct->AlarmTime.Minutes = 0U;
  316. RTC_AlarmStruct->AlarmTime.Seconds = 0U;
  317. }
  318. /**
  319. * @brief Enters the RTC Initialization mode.
  320. * @param RTCx RTC Instance
  321. * @retval An ErrorStatus enumeration value:
  322. * - SUCCESS: RTC is in Init mode
  323. * - ERROR: RTC is not in Init mode
  324. */
  325. ErrorStatus LL_RTC_EnterInitMode(RTC_TypeDef *RTCx)
  326. {
  327. __IO uint32_t timeout = RTC_INITMODE_TIMEOUT;
  328. ErrorStatus status = SUCCESS;
  329. uint32_t tmp = 0U;
  330. /* Check the parameter */
  331. assert_param(IS_RTC_ALL_INSTANCE(RTCx));
  332. /* Wait till RTC is in INIT state and if Time out is reached exit */
  333. tmp = LL_RTC_IsActiveFlag_RTOF(RTCx);
  334. while ((timeout != 0U) && (tmp != 1U))
  335. {
  336. if (LL_SYSTICK_IsActiveCounterFlag() == 1U)
  337. {
  338. timeout --;
  339. }
  340. tmp = LL_RTC_IsActiveFlag_RTOF(RTCx);
  341. if (timeout == 0U)
  342. {
  343. status = ERROR;
  344. }
  345. }
  346. /* Disable the write protection for RTC registers */
  347. LL_RTC_DisableWriteProtection(RTCx);
  348. return status;
  349. }
  350. /**
  351. * @brief Exit the RTC Initialization mode.
  352. * @note When the initialization sequence is complete, the calendar restarts
  353. * counting after 4 RTCCLK cycles.
  354. * @param RTCx RTC Instance
  355. * @retval An ErrorStatus enumeration value:
  356. * - SUCCESS: RTC exited from in Init mode
  357. * - ERROR: Not applicable
  358. */
  359. ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx)
  360. {
  361. __IO uint32_t timeout = RTC_INITMODE_TIMEOUT;
  362. ErrorStatus status = SUCCESS;
  363. uint32_t tmp = 0U;
  364. /* Check the parameter */
  365. assert_param(IS_RTC_ALL_INSTANCE(RTCx));
  366. /* Disable initialization mode */
  367. LL_RTC_EnableWriteProtection(RTCx);
  368. /* Wait till RTC is in INIT state and if Time out is reached exit */
  369. tmp = LL_RTC_IsActiveFlag_RTOF(RTCx);
  370. while ((timeout != 0U) && (tmp != 1U))
  371. {
  372. if (LL_SYSTICK_IsActiveCounterFlag() == 1U)
  373. {
  374. timeout --;
  375. }
  376. tmp = LL_RTC_IsActiveFlag_RTOF(RTCx);
  377. if (timeout == 0U)
  378. {
  379. status = ERROR;
  380. }
  381. }
  382. return status;
  383. }
  384. /**
  385. * @brief Set the Time Counter
  386. * @param RTCx RTC Instance
  387. * @param TimeCounter this value can be from 0 to 0xFFFFFFFF
  388. * @retval An ErrorStatus enumeration value:
  389. * - SUCCESS: RTC Counter register configured
  390. * - ERROR: Not applicable
  391. */
  392. ErrorStatus LL_RTC_TIME_SetCounter(RTC_TypeDef *RTCx, uint32_t TimeCounter)
  393. {
  394. ErrorStatus status = ERROR;
  395. /* Check the parameter */
  396. assert_param(IS_RTC_ALL_INSTANCE(RTCx));
  397. /* Enter Initialization mode */
  398. if (LL_RTC_EnterInitMode(RTCx) != ERROR)
  399. {
  400. LL_RTC_TIME_Set(RTCx, TimeCounter);
  401. status = SUCCESS;
  402. }
  403. /* Exit Initialization mode */
  404. LL_RTC_ExitInitMode(RTCx);
  405. return status;
  406. }
  407. /**
  408. * @brief Set Alarm Counter.
  409. * @param RTCx RTC Instance
  410. * @param AlarmCounter this value can be from 0 to 0xFFFFFFFF
  411. * @retval An ErrorStatus enumeration value:
  412. * - SUCCESS: RTC exited from in Init mode
  413. * - ERROR: Not applicable
  414. */
  415. ErrorStatus LL_RTC_ALARM_SetCounter(RTC_TypeDef *RTCx, uint32_t AlarmCounter)
  416. {
  417. ErrorStatus status = ERROR;
  418. /* Check the parameter */
  419. assert_param(IS_RTC_ALL_INSTANCE(RTCx));
  420. /* Enter Initialization mode */
  421. if (LL_RTC_EnterInitMode(RTCx) != ERROR)
  422. {
  423. LL_RTC_ALARM_Set(RTCx, AlarmCounter);
  424. status = SUCCESS;
  425. }
  426. /* Exit Initialization mode */
  427. LL_RTC_ExitInitMode(RTCx);
  428. return status;
  429. }
  430. /**
  431. * @brief Waits until the RTC registers are synchronized with RTC APB clock.
  432. * @note The RTC Resynchronization mode is write protected, use the
  433. * @ref LL_RTC_DisableWriteProtection before calling this function.
  434. * @param RTCx RTC Instance
  435. * @retval An ErrorStatus enumeration value:
  436. * - SUCCESS: RTC registers are synchronised
  437. * - ERROR: RTC registers are not synchronised
  438. */
  439. ErrorStatus LL_RTC_WaitForSynchro(RTC_TypeDef *RTCx)
  440. {
  441. __IO uint32_t timeout = RTC_SYNCHRO_TIMEOUT;
  442. ErrorStatus status = SUCCESS;
  443. uint32_t tmp = 0U;
  444. /* Check the parameter */
  445. assert_param(IS_RTC_ALL_INSTANCE(RTCx));
  446. /* Clear RSF flag */
  447. LL_RTC_ClearFlag_RS(RTCx);
  448. /* Wait the registers to be synchronised */
  449. tmp = LL_RTC_IsActiveFlag_RS(RTCx);
  450. while ((timeout != 0U) && (tmp != 0U))
  451. {
  452. if (LL_SYSTICK_IsActiveCounterFlag() == 1U)
  453. {
  454. timeout--;
  455. }
  456. tmp = LL_RTC_IsActiveFlag_RS(RTCx);
  457. if (timeout == 0U)
  458. {
  459. status = ERROR;
  460. }
  461. }
  462. return (status);
  463. }
  464. /**
  465. * @}
  466. */
  467. /**
  468. * @}
  469. */
  470. /**
  471. * @}
  472. */
  473. #endif /* defined(RTC) */
  474. /**
  475. * @}
  476. */
  477. #endif /* USE_FULL_LL_DRIVER */
  478. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/