stm32f1xx_hal_rtc.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_hal_rtc.h
  4. * @author MCD Application Team
  5. * @brief Header file of RTC HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32F1xx_HAL_RTC_H
  37. #define __STM32F1xx_HAL_RTC_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32f1xx_hal_def.h"
  43. /** @addtogroup STM32F1xx_HAL_Driver
  44. * @{
  45. */
  46. /** @addtogroup RTC
  47. * @{
  48. */
  49. /** @addtogroup RTC_Private_Macros
  50. * @{
  51. */
  52. #define IS_RTC_ASYNCH_PREDIV(PREDIV) (((PREDIV) <= 0xFFFFFU) || ((PREDIV) == RTC_AUTO_1_SECOND))
  53. #define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23U)
  54. #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59U)
  55. #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59U)
  56. #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD))
  57. #define IS_RTC_YEAR(YEAR) ((YEAR) <= 99U)
  58. #define IS_RTC_MONTH(MONTH) (((MONTH) >= 1U) && ((MONTH) <= 12U))
  59. #define IS_RTC_DATE(DATE) (((DATE) >= 1U) && ((DATE) <= 31U))
  60. #define IS_RTC_ALARM(ALARM) ((ALARM) == RTC_ALARM_A)
  61. #define IS_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == RTC_OUTPUTSOURCE_NONE) || \
  62. ((__OUTPUT__) == RTC_OUTPUTSOURCE_CALIBCLOCK) || \
  63. ((__OUTPUT__) == RTC_OUTPUTSOURCE_ALARM) || \
  64. ((__OUTPUT__) == RTC_OUTPUTSOURCE_SECOND))
  65. /**
  66. * @}
  67. */
  68. /** @addtogroup RTC_Private_Constants
  69. * @{
  70. */
  71. /** @defgroup RTC_Timeout_Value Default Timeout Value
  72. * @{
  73. */
  74. #define RTC_TIMEOUT_VALUE 1000U
  75. /**
  76. * @}
  77. */
  78. /** @defgroup RTC_EXTI_Line_Event RTC EXTI Line event
  79. * @{
  80. */
  81. #define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)EXTI_IMR_MR17) /*!< External interrupt line 17 Connected to the RTC Alarm event */
  82. /**
  83. * @}
  84. */
  85. /**
  86. * @}
  87. */
  88. /* Exported types ------------------------------------------------------------*/
  89. /** @defgroup RTC_Exported_Types RTC Exported Types
  90. * @{
  91. */
  92. /**
  93. * @brief RTC Time structure definition
  94. */
  95. typedef struct
  96. {
  97. uint8_t Hours; /*!< Specifies the RTC Time Hour.
  98. This parameter must be a number between Min_Data = 0 and Max_Data = 23 */
  99. uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
  100. This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
  101. uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
  102. This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
  103. }RTC_TimeTypeDef;
  104. /**
  105. * @brief RTC Alarm structure definition
  106. */
  107. typedef struct
  108. {
  109. RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */
  110. uint32_t Alarm; /*!< Specifies the alarm ID (only 1 alarm ID for STM32F1).
  111. This parameter can be a value of @ref RTC_Alarms_Definitions */
  112. }RTC_AlarmTypeDef;
  113. /**
  114. * @brief HAL State structures definition
  115. */
  116. typedef enum
  117. {
  118. HAL_RTC_STATE_RESET = 0x00U, /*!< RTC not yet initialized or disabled */
  119. HAL_RTC_STATE_READY = 0x01U, /*!< RTC initialized and ready for use */
  120. HAL_RTC_STATE_BUSY = 0x02U, /*!< RTC process is ongoing */
  121. HAL_RTC_STATE_TIMEOUT = 0x03U, /*!< RTC timeout state */
  122. HAL_RTC_STATE_ERROR = 0x04U /*!< RTC error state */
  123. }HAL_RTCStateTypeDef;
  124. /**
  125. * @brief RTC Configuration Structure definition
  126. */
  127. typedef struct
  128. {
  129. uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value.
  130. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFFF or RTC_AUTO_1_SECOND
  131. If RTC_AUTO_1_SECOND is selected, AsynchPrediv will be set automatically to get 1sec timebase */
  132. uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC Tamper pin.
  133. This parameter can be a value of @ref RTC_output_source_to_output_on_the_Tamper_pin */
  134. }RTC_InitTypeDef;
  135. /**
  136. * @brief RTC Date structure definition
  137. */
  138. typedef struct
  139. {
  140. uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay (not necessary for HAL_RTC_SetDate).
  141. This parameter can be a value of @ref RTC_WeekDay_Definitions */
  142. uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format).
  143. This parameter can be a value of @ref RTC_Month_Date_Definitions */
  144. uint8_t Date; /*!< Specifies the RTC Date.
  145. This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
  146. uint8_t Year; /*!< Specifies the RTC Date Year.
  147. This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
  148. }RTC_DateTypeDef;
  149. /**
  150. * @brief Time Handle Structure definition
  151. */
  152. typedef struct
  153. {
  154. RTC_TypeDef *Instance; /*!< Register base address */
  155. RTC_InitTypeDef Init; /*!< RTC required parameters */
  156. RTC_DateTypeDef DateToUpdate; /*!< Current date set by user and updated automatically */
  157. HAL_LockTypeDef Lock; /*!< RTC locking object */
  158. __IO HAL_RTCStateTypeDef State; /*!< Time communication state */
  159. }RTC_HandleTypeDef;
  160. /**
  161. * @}
  162. */
  163. /* Exported constants --------------------------------------------------------*/
  164. /** @defgroup RTC_Exported_Constants RTC Exported Constants
  165. * @{
  166. */
  167. /** @defgroup RTC_Automatic_Prediv_1_Second Automatic calculation of prediv for 1sec timebase
  168. * @{
  169. */
  170. #define RTC_AUTO_1_SECOND 0xFFFFFFFFU
  171. /**
  172. * @}
  173. */
  174. /** @defgroup RTC_Input_parameter_format_definitions Input Parameter Format
  175. * @{
  176. */
  177. #define RTC_FORMAT_BIN 0x000000000U
  178. #define RTC_FORMAT_BCD 0x000000001U
  179. /**
  180. * @}
  181. */
  182. /** @defgroup RTC_Month_Date_Definitions Month Definitions
  183. * @{
  184. */
  185. /* Coded in BCD format */
  186. #define RTC_MONTH_JANUARY ((uint8_t)0x01)
  187. #define RTC_MONTH_FEBRUARY ((uint8_t)0x02)
  188. #define RTC_MONTH_MARCH ((uint8_t)0x03)
  189. #define RTC_MONTH_APRIL ((uint8_t)0x04)
  190. #define RTC_MONTH_MAY ((uint8_t)0x05)
  191. #define RTC_MONTH_JUNE ((uint8_t)0x06)
  192. #define RTC_MONTH_JULY ((uint8_t)0x07)
  193. #define RTC_MONTH_AUGUST ((uint8_t)0x08)
  194. #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09)
  195. #define RTC_MONTH_OCTOBER ((uint8_t)0x10)
  196. #define RTC_MONTH_NOVEMBER ((uint8_t)0x11)
  197. #define RTC_MONTH_DECEMBER ((uint8_t)0x12)
  198. /**
  199. * @}
  200. */
  201. /** @defgroup RTC_WeekDay_Definitions WeekDay Definitions
  202. * @{
  203. */
  204. #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01)
  205. #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02)
  206. #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03)
  207. #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04)
  208. #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05)
  209. #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06)
  210. #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x00)
  211. /**
  212. * @}
  213. */
  214. /** @defgroup RTC_Alarms_Definitions Alarms Definitions
  215. * @{
  216. */
  217. #define RTC_ALARM_A 0U /*!< Specify alarm ID (mainly for legacy purposes) */
  218. /**
  219. * @}
  220. */
  221. /** @defgroup RTC_output_source_to_output_on_the_Tamper_pin Output source to output on the Tamper pin
  222. * @{
  223. */
  224. #define RTC_OUTPUTSOURCE_NONE 0x00000000U /*!< No output on the TAMPER pin */
  225. #define RTC_OUTPUTSOURCE_CALIBCLOCK BKP_RTCCR_CCO /*!< RTC clock with a frequency divided by 64 on the TAMPER pin */
  226. #define RTC_OUTPUTSOURCE_ALARM BKP_RTCCR_ASOE /*!< Alarm pulse signal on the TAMPER pin */
  227. #define RTC_OUTPUTSOURCE_SECOND (BKP_RTCCR_ASOS | BKP_RTCCR_ASOE) /*!< Second pulse signal on the TAMPER pin */
  228. /**
  229. * @}
  230. */
  231. /** @defgroup RTC_Interrupts_Definitions Interrupts Definitions
  232. * @{
  233. */
  234. #define RTC_IT_OW RTC_CRH_OWIE /*!< Overflow interrupt */
  235. #define RTC_IT_ALRA RTC_CRH_ALRIE /*!< Alarm interrupt */
  236. #define RTC_IT_SEC RTC_CRH_SECIE /*!< Second interrupt */
  237. #define RTC_IT_TAMP1 BKP_CSR_TPIE /*!< TAMPER Pin interrupt enable */
  238. /**
  239. * @}
  240. */
  241. /** @defgroup RTC_Flags_Definitions Flags Definitions
  242. * @{
  243. */
  244. #define RTC_FLAG_RTOFF RTC_CRL_RTOFF /*!< RTC Operation OFF flag */
  245. #define RTC_FLAG_RSF RTC_CRL_RSF /*!< Registers Synchronized flag */
  246. #define RTC_FLAG_OW RTC_CRL_OWF /*!< Overflow flag */
  247. #define RTC_FLAG_ALRAF RTC_CRL_ALRF /*!< Alarm flag */
  248. #define RTC_FLAG_SEC RTC_CRL_SECF /*!< Second flag */
  249. #define RTC_FLAG_TAMP1F BKP_CSR_TEF /*!< Tamper Interrupt Flag */
  250. /**
  251. * @}
  252. */
  253. /**
  254. * @}
  255. */
  256. /* Exported macro ------------------------------------------------------------*/
  257. /** @defgroup RTC_Exported_macros RTC Exported Macros
  258. * @{
  259. */
  260. /** @brief Reset RTC handle state
  261. * @param __HANDLE__: RTC handle.
  262. * @retval None
  263. */
  264. #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
  265. /**
  266. * @brief Disable the write protection for RTC registers.
  267. * @param __HANDLE__: specifies the RTC handle.
  268. * @retval None
  269. */
  270. #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF)
  271. /**
  272. * @brief Enable the write protection for RTC registers.
  273. * @param __HANDLE__: specifies the RTC handle.
  274. * @retval None
  275. */
  276. #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF)
  277. /**
  278. * @brief Enable the RTC Alarm interrupt.
  279. * @param __HANDLE__: specifies the RTC handle.
  280. * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
  281. * This parameter can be any combination of the following values:
  282. * @arg RTC_IT_ALRA: Alarm A interrupt
  283. * @retval None
  284. */
  285. #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
  286. /**
  287. * @brief Disable the RTC Alarm interrupt.
  288. * @param __HANDLE__: specifies the RTC handle.
  289. * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
  290. * This parameter can be any combination of the following values:
  291. * @arg RTC_IT_ALRA: Alarm A interrupt
  292. * @retval None
  293. */
  294. #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
  295. /**
  296. * @brief Check whether the specified RTC Alarm interrupt has been enabled or not.
  297. * @param __HANDLE__: specifies the RTC handle.
  298. * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be checked
  299. * This parameter can be:
  300. * @arg RTC_IT_ALRA: Alarm A interrupt
  301. * @retval None
  302. */
  303. #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((__HANDLE__)->Instance->CRH)& ((__INTERRUPT__)))) != RESET)? SET : RESET)
  304. /**
  305. * @brief Get the selected RTC Alarm's flag status.
  306. * @param __HANDLE__: specifies the RTC handle.
  307. * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
  308. * This parameter can be:
  309. * @arg RTC_FLAG_ALRAF
  310. * @retval None
  311. */
  312. #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->CRL) & (__FLAG__)) != RESET)? SET : RESET)
  313. /**
  314. * @brief Check whether the specified RTC Alarm interrupt has occurred or not.
  315. * @param __HANDLE__: specifies the RTC handle.
  316. * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check.
  317. * This parameter can be:
  318. * @arg RTC_IT_ALRA: Alarm A interrupt
  319. * @retval None
  320. */
  321. #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CRL) & (__INTERRUPT__)) != RESET)? SET : RESET)
  322. /**
  323. * @brief Clear the RTC Alarm's pending flags.
  324. * @param __HANDLE__: specifies the RTC handle.
  325. * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
  326. * This parameter can be:
  327. * @arg RTC_FLAG_ALRAF
  328. * @retval None
  329. */
  330. #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CRL) = ~(__FLAG__)
  331. /**
  332. * @brief Enable interrupt on ALARM Exti Line 17.
  333. * @retval None.
  334. */
  335. #define __HAL_RTC_ALARM_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT)
  336. /**
  337. * @brief Disable interrupt on ALARM Exti Line 17.
  338. * @retval None.
  339. */
  340. #define __HAL_RTC_ALARM_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT)
  341. /**
  342. * @brief Enable event on ALARM Exti Line 17.
  343. * @retval None.
  344. */
  345. #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT)
  346. /**
  347. * @brief Disable event on ALARM Exti Line 17.
  348. * @retval None.
  349. */
  350. #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT)
  351. /**
  352. * @brief ALARM EXTI line configuration: set falling edge trigger.
  353. * @retval None.
  354. */
  355. #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT)
  356. /**
  357. * @brief Disable the ALARM Extended Interrupt Falling Trigger.
  358. * @retval None.
  359. */
  360. #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT)
  361. /**
  362. * @brief ALARM EXTI line configuration: set rising edge trigger.
  363. * @retval None.
  364. */
  365. #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT)
  366. /**
  367. * @brief Disable the ALARM Extended Interrupt Rising Trigger.
  368. * This parameter can be:
  369. * @retval None.
  370. */
  371. #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT)
  372. /**
  373. * @brief ALARM EXTI line configuration: set rising & falling edge trigger.
  374. * @retval None.
  375. */
  376. #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() \
  377. do{ \
  378. __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE(); \
  379. __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE(); \
  380. } while(0U)
  381. /**
  382. * @brief Disable the ALARM Extended Interrupt Rising & Falling Trigger.
  383. * This parameter can be:
  384. * @retval None.
  385. */
  386. #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() \
  387. do{ \
  388. __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE(); \
  389. __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE(); \
  390. } while(0U)
  391. /**
  392. * @brief Check whether the specified ALARM EXTI interrupt flag is set or not.
  393. * @retval EXTI ALARM Line Status.
  394. */
  395. #define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR & (RTC_EXTI_LINE_ALARM_EVENT))
  396. /**
  397. * @brief Clear the ALARM EXTI flag.
  398. * @retval None.
  399. */
  400. #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR = (RTC_EXTI_LINE_ALARM_EVENT))
  401. /**
  402. * @brief Generate a Software interrupt on selected EXTI line.
  403. * @retval None.
  404. */
  405. #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER, RTC_EXTI_LINE_ALARM_EVENT)
  406. /**
  407. * @}
  408. */
  409. /* Include RTC HAL Extension module */
  410. #include "stm32f1xx_hal_rtc_ex.h"
  411. /* Exported functions --------------------------------------------------------*/
  412. /** @addtogroup RTC_Exported_Functions
  413. * @{
  414. */
  415. /* Initialization and de-initialization functions ****************************/
  416. /** @addtogroup RTC_Exported_Functions_Group1
  417. * @{
  418. */
  419. HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
  420. HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
  421. void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
  422. void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
  423. /**
  424. * @}
  425. */
  426. /* RTC Time and Date functions ************************************************/
  427. /** @addtogroup RTC_Exported_Functions_Group2
  428. * @{
  429. */
  430. HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
  431. HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
  432. HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
  433. HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
  434. /**
  435. * @}
  436. */
  437. /* RTC Alarm functions ********************************************************/
  438. /** @addtogroup RTC_Exported_Functions_Group3
  439. * @{
  440. */
  441. HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
  442. HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
  443. HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
  444. HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
  445. void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
  446. HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  447. void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
  448. /**
  449. * @}
  450. */
  451. /* Peripheral State functions *************************************************/
  452. /** @addtogroup RTC_Exported_Functions_Group4
  453. * @{
  454. */
  455. HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
  456. /**
  457. * @}
  458. */
  459. /* Peripheral Control functions ***********************************************/
  460. /** @addtogroup RTC_Exported_Functions_Group5
  461. * @{
  462. */
  463. HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc);
  464. /**
  465. * @}
  466. */
  467. /**
  468. * @}
  469. */
  470. /**
  471. * @}
  472. */
  473. /**
  474. * @}
  475. */
  476. #ifdef __cplusplus
  477. }
  478. #endif
  479. #endif /* __STM32F1xx_HAL_RTC_H */
  480. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/