stm32f1xx_hal_rtc.h 20 KB

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