stm32f7xx_hal_rtc.h 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx_hal_rtc.h
  4. * @author MCD Application Team
  5. * @brief Header file of RTC HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef STM32F7xx_HAL_RTC_H
  20. #define STM32F7xx_HAL_RTC_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32f7xx_hal_def.h"
  26. /** @addtogroup STM32F7xx_HAL_Driver
  27. * @{
  28. */
  29. /** @addtogroup RTC
  30. * @{
  31. */
  32. /* Exported types ------------------------------------------------------------*/
  33. /** @defgroup RTC_Exported_Types RTC Exported Types
  34. * @{
  35. */
  36. /**
  37. * @brief HAL State structures definition
  38. */
  39. typedef enum
  40. {
  41. HAL_RTC_STATE_RESET = 0x00U, /*!< RTC not yet initialized or disabled */
  42. HAL_RTC_STATE_READY = 0x01U, /*!< RTC initialized and ready for use */
  43. HAL_RTC_STATE_BUSY = 0x02U, /*!< RTC process is ongoing */
  44. HAL_RTC_STATE_TIMEOUT = 0x03U, /*!< RTC timeout state */
  45. HAL_RTC_STATE_ERROR = 0x04U /*!< RTC error state */
  46. } HAL_RTCStateTypeDef;
  47. /**
  48. * @brief RTC Configuration Structure definition
  49. */
  50. typedef struct
  51. {
  52. uint32_t HourFormat; /*!< Specifies the RTC Hour Format.
  53. This parameter can be a value of @ref RTC_Hour_Formats */
  54. uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value.
  55. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F */
  56. uint32_t SynchPrediv; /*!< Specifies the RTC Synchronous Predivider value.
  57. This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x7FFF */
  58. uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC output.
  59. This parameter can be a value of @ref RTC_Output_selection_Definitions */
  60. uint32_t OutPutPolarity; /*!< Specifies the polarity of the output signal.
  61. This parameter can be a value of @ref RTC_Output_Polarity_Definitions */
  62. uint32_t OutPutType; /*!< Specifies the RTC Output Pin mode.
  63. This parameter can be a value of @ref RTC_Output_Type_ALARM_OUT */
  64. } RTC_InitTypeDef;
  65. /**
  66. * @brief RTC Time structure definition
  67. */
  68. typedef struct
  69. {
  70. uint8_t Hours; /*!< Specifies the RTC Time Hour.
  71. This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the RTC_HourFormat_12 is selected
  72. This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the RTC_HourFormat_24 is selected */
  73. uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
  74. This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
  75. uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
  76. This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
  77. uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
  78. This parameter can be a value of @ref RTC_AM_PM_Definitions */
  79. uint32_t SubSeconds; /*!< Specifies the RTC_SSR RTC Sub Second register content.
  80. This parameter corresponds to a time unit range between [0-1] Second
  81. with [1 Sec / SecondFraction +1] granularity */
  82. uint32_t SecondFraction; /*!< Specifies the range or granularity of Sub Second register content
  83. corresponding to Synchronous prescaler factor value (PREDIV_S)
  84. This parameter corresponds to a time unit range between [0-1] Second
  85. with [1 Sec / SecondFraction +1] granularity.
  86. This field will be used only by HAL_RTC_GetTime function */
  87. uint32_t DayLightSaving; /*!< This interface is deprecated. To manage Daylight
  88. Saving Time, please use HAL_RTC_DST_xxx functions */
  89. uint32_t StoreOperation; /*!< This interface is deprecated. To manage Daylight
  90. Saving Time, please use HAL_RTC_DST_xxx functions */
  91. } RTC_TimeTypeDef;
  92. /**
  93. * @brief RTC Date structure definition
  94. */
  95. typedef struct
  96. {
  97. uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
  98. This parameter can be a value of @ref RTC_WeekDay_Definitions */
  99. uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format).
  100. This parameter can be a value of @ref RTC_Month_Date_Definitions */
  101. uint8_t Date; /*!< Specifies the RTC Date.
  102. This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
  103. uint8_t Year; /*!< Specifies the RTC Date Year.
  104. This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
  105. } RTC_DateTypeDef;
  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 AlarmMask; /*!< Specifies the RTC Alarm Masks.
  113. This parameter can be a value of @ref RTC_AlarmMask_Definitions */
  114. uint32_t AlarmSubSecondMask; /*!< Specifies the RTC Alarm SubSeconds Masks.
  115. This parameter can be a value of @ref RTC_Alarm_Sub_Seconds_Masks_Definitions */
  116. uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay.
  117. This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */
  118. uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay.
  119. If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range.
  120. If the Alarm WeekDay is selected, this parameter can be a value of @ref RTC_WeekDay_Definitions */
  121. uint32_t Alarm; /*!< Specifies the alarm .
  122. This parameter can be a value of @ref RTC_Alarms_Definitions */
  123. } RTC_AlarmTypeDef;
  124. /**
  125. * @brief RTC Handle Structure definition
  126. */
  127. #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
  128. typedef struct __RTC_HandleTypeDef
  129. #else
  130. typedef struct
  131. #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
  132. {
  133. RTC_TypeDef *Instance; /*!< Register base address */
  134. RTC_InitTypeDef Init; /*!< RTC required parameters */
  135. HAL_LockTypeDef Lock; /*!< RTC locking object */
  136. __IO HAL_RTCStateTypeDef State; /*!< Time communication state */
  137. #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
  138. void (* AlarmAEventCallback) (struct __RTC_HandleTypeDef *hrtc); /*!< RTC Alarm A Event callback */
  139. void (* AlarmBEventCallback) (struct __RTC_HandleTypeDef *hrtc); /*!< RTC Alarm B Event callback */
  140. void (* TimeStampEventCallback) (struct __RTC_HandleTypeDef *hrtc); /*!< RTC Timestamp Event callback */
  141. void (* WakeUpTimerEventCallback) (struct __RTC_HandleTypeDef *hrtc); /*!< RTC WakeUpTimer Event callback */
  142. void (* Tamper1EventCallback) (struct __RTC_HandleTypeDef *hrtc); /*!< RTC Tamper 1 Event callback */
  143. void (* Tamper2EventCallback) (struct __RTC_HandleTypeDef *hrtc); /*!< RTC Tamper 2 Event callback */
  144. void (* Tamper3EventCallback) (struct __RTC_HandleTypeDef *hrtc); /*!< RTC Tamper 3 Event callback */
  145. void (* MspInitCallback) (struct __RTC_HandleTypeDef *hrtc); /*!< RTC Msp Init callback */
  146. void (* MspDeInitCallback) (struct __RTC_HandleTypeDef *hrtc); /*!< RTC Msp DeInit callback */
  147. #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
  148. } RTC_HandleTypeDef;
  149. #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
  150. /**
  151. * @brief HAL RTC Callback ID enumeration definition
  152. */
  153. typedef enum
  154. {
  155. HAL_RTC_ALARM_A_EVENT_CB_ID = 0x00U, /*!< RTC Alarm A Event Callback ID */
  156. HAL_RTC_ALARM_B_EVENT_CB_ID = 0x01U, /*!< RTC Alarm B Event Callback ID */
  157. HAL_RTC_TIMESTAMP_EVENT_CB_ID = 0x02U, /*!< RTC Timestamp Event Callback ID */
  158. HAL_RTC_WAKEUPTIMER_EVENT_CB_ID = 0x03U, /*!< RTC Wakeup Timer Event Callback ID */
  159. HAL_RTC_TAMPER1_EVENT_CB_ID = 0x04U, /*!< RTC Tamper 1 Callback ID */
  160. HAL_RTC_TAMPER2_EVENT_CB_ID = 0x05U, /*!< RTC Tamper 2 Callback ID */
  161. HAL_RTC_TAMPER3_EVENT_CB_ID = 0x06U, /*!< RTC Tamper 3 Callback ID */
  162. HAL_RTC_MSPINIT_CB_ID = 0x0EU, /*!< RTC Msp Init callback ID */
  163. HAL_RTC_MSPDEINIT_CB_ID = 0x0FU /*!< RTC Msp DeInit callback ID */
  164. } HAL_RTC_CallbackIDTypeDef;
  165. /**
  166. * @brief HAL RTC Callback pointer definition
  167. */
  168. typedef void (*pRTC_CallbackTypeDef)(RTC_HandleTypeDef *hrtc); /*!< pointer to an RTC callback function */
  169. #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
  170. /**
  171. * @}
  172. */
  173. /* Exported constants --------------------------------------------------------*/
  174. /** @defgroup RTC_Exported_Constants RTC Exported Constants
  175. * @{
  176. */
  177. /** @defgroup RTC_Hour_Formats RTC Hour Formats
  178. * @{
  179. */
  180. #define RTC_HOURFORMAT_24 0x00000000U
  181. #define RTC_HOURFORMAT_12 RTC_CR_FMT
  182. /**
  183. * @}
  184. */
  185. /** @defgroup RTC_Output_selection_Definitions RTC Output Selection Definitions
  186. * @{
  187. */
  188. #define RTC_OUTPUT_DISABLE 0x00000000U
  189. #define RTC_OUTPUT_ALARMA RTC_CR_OSEL_0
  190. #define RTC_OUTPUT_ALARMB RTC_CR_OSEL_1
  191. #define RTC_OUTPUT_WAKEUP RTC_CR_OSEL
  192. /**
  193. * @}
  194. */
  195. /** @defgroup RTC_Output_Polarity_Definitions RTC Output Polarity Definitions
  196. * @{
  197. */
  198. #define RTC_OUTPUT_POLARITY_HIGH 0x00000000U
  199. #define RTC_OUTPUT_POLARITY_LOW RTC_CR_POL
  200. /**
  201. * @}
  202. */
  203. /** @defgroup RTC_Output_Type_ALARM_OUT RTC Output Type ALARM OUT
  204. * @{
  205. */
  206. #define RTC_OUTPUT_TYPE_OPENDRAIN 0x00000000U
  207. #define RTC_OUTPUT_TYPE_PUSHPULL RTC_OR_ALARMTYPE
  208. /**
  209. * @}
  210. */
  211. /** @defgroup RTC_AM_PM_Definitions RTC AM PM Definitions
  212. * @{
  213. */
  214. #define RTC_HOURFORMAT12_AM ((uint8_t)0x00)
  215. #define RTC_HOURFORMAT12_PM ((uint8_t)0x01)
  216. /**
  217. * @}
  218. */
  219. /** @defgroup RTC_DayLightSaving_Definitions RTC DayLight Saving Definitions
  220. * @{
  221. */
  222. #define RTC_DAYLIGHTSAVING_SUB1H RTC_CR_SUB1H
  223. #define RTC_DAYLIGHTSAVING_ADD1H RTC_CR_ADD1H
  224. #define RTC_DAYLIGHTSAVING_NONE 0x00000000U
  225. /**
  226. * @}
  227. */
  228. /** @defgroup RTC_StoreOperation_Definitions RTC Store Operation Definitions
  229. * @{
  230. */
  231. #define RTC_STOREOPERATION_RESET 0x00000000U
  232. #define RTC_STOREOPERATION_SET RTC_CR_BKP
  233. /**
  234. * @}
  235. */
  236. /** @defgroup RTC_Input_parameter_format_definitions RTC Input Parameter Format Definitions
  237. * @{
  238. */
  239. #define RTC_FORMAT_BIN 0x00000000U
  240. #define RTC_FORMAT_BCD 0x00000001U
  241. /**
  242. * @}
  243. */
  244. /** @defgroup RTC_Month_Date_Definitions RTC Month Date Definitions (in BCD format)
  245. * @{
  246. */
  247. #define RTC_MONTH_JANUARY ((uint8_t)0x01)
  248. #define RTC_MONTH_FEBRUARY ((uint8_t)0x02)
  249. #define RTC_MONTH_MARCH ((uint8_t)0x03)
  250. #define RTC_MONTH_APRIL ((uint8_t)0x04)
  251. #define RTC_MONTH_MAY ((uint8_t)0x05)
  252. #define RTC_MONTH_JUNE ((uint8_t)0x06)
  253. #define RTC_MONTH_JULY ((uint8_t)0x07)
  254. #define RTC_MONTH_AUGUST ((uint8_t)0x08)
  255. #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09)
  256. #define RTC_MONTH_OCTOBER ((uint8_t)0x10)
  257. #define RTC_MONTH_NOVEMBER ((uint8_t)0x11)
  258. #define RTC_MONTH_DECEMBER ((uint8_t)0x12)
  259. /**
  260. * @}
  261. */
  262. /** @defgroup RTC_WeekDay_Definitions RTC WeekDay Definitions
  263. * @{
  264. */
  265. #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01)
  266. #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02)
  267. #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03)
  268. #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04)
  269. #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05)
  270. #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06)
  271. #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07)
  272. /**
  273. * @}
  274. */
  275. /** @defgroup RTC_AlarmDateWeekDay_Definitions RTC Alarm Date WeekDay Definitions
  276. * @{
  277. */
  278. #define RTC_ALARMDATEWEEKDAYSEL_DATE 0x00000000U
  279. #define RTC_ALARMDATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL
  280. /**
  281. * @}
  282. */
  283. /** @defgroup RTC_AlarmMask_Definitions RTC Alarm Mask Definitions
  284. * @{
  285. */
  286. #define RTC_ALARMMASK_NONE 0x00000000U
  287. #define RTC_ALARMMASK_DATEWEEKDAY RTC_ALRMAR_MSK4
  288. #define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3
  289. #define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2
  290. #define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1
  291. #define RTC_ALARMMASK_ALL (RTC_ALARMMASK_DATEWEEKDAY | \
  292. RTC_ALARMMASK_HOURS | \
  293. RTC_ALARMMASK_MINUTES | \
  294. RTC_ALARMMASK_SECONDS)
  295. /**
  296. * @}
  297. */
  298. /** @defgroup RTC_Alarms_Definitions RTC Alarms Definitions
  299. * @{
  300. */
  301. #define RTC_ALARM_A RTC_CR_ALRAE
  302. #define RTC_ALARM_B RTC_CR_ALRBE
  303. /**
  304. * @}
  305. */
  306. /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions RTC Alarm Sub Seconds Masks Definitions
  307. * @{
  308. */
  309. /*!< All Alarm SS fields are masked. There is no comparison on sub seconds for Alarm */
  310. #define RTC_ALARMSUBSECONDMASK_ALL 0x00000000U
  311. /*!< SS[14:1] are don't care in Alarm comparison. Only SS[0] is compared. */
  312. #define RTC_ALARMSUBSECONDMASK_SS14_1 RTC_ALRMASSR_MASKSS_0
  313. /*!< SS[14:2] are don't care in Alarm comparison. Only SS[1:0] are compared. */
  314. #define RTC_ALARMSUBSECONDMASK_SS14_2 RTC_ALRMASSR_MASKSS_1
  315. /*!< SS[14:3] are don't care in Alarm comparison. Only SS[2:0] are compared. */
  316. #define RTC_ALARMSUBSECONDMASK_SS14_3 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_1)
  317. /*!< SS[14:4] are don't care in Alarm comparison. Only SS[3:0] are compared. */
  318. #define RTC_ALARMSUBSECONDMASK_SS14_4 RTC_ALRMASSR_MASKSS_2
  319. /*!< SS[14:5] are don't care in Alarm comparison. Only SS[4:0] are compared. */
  320. #define RTC_ALARMSUBSECONDMASK_SS14_5 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_2)
  321. /*!< SS[14:6] are don't care in Alarm comparison. Only SS[5:0] are compared. */
  322. #define RTC_ALARMSUBSECONDMASK_SS14_6 (RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_2)
  323. /*!< SS[14:7] are don't care in Alarm comparison. Only SS[6:0] are compared. */
  324. #define RTC_ALARMSUBSECONDMASK_SS14_7 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_2)
  325. /*!< SS[14:8] are don't care in Alarm comparison. Only SS[7:0] are compared. */
  326. #define RTC_ALARMSUBSECONDMASK_SS14_8 RTC_ALRMASSR_MASKSS_3
  327. /*!< SS[14:9] are don't care in Alarm comparison. Only SS[8:0] are compared. */
  328. #define RTC_ALARMSUBSECONDMASK_SS14_9 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_3)
  329. /*!< SS[14:10] are don't care in Alarm comparison. Only SS[9:0] are compared. */
  330. #define RTC_ALARMSUBSECONDMASK_SS14_10 (RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_3)
  331. /*!< SS[14:11] are don't care in Alarm comparison. Only SS[10:0] are compared. */
  332. #define RTC_ALARMSUBSECONDMASK_SS14_11 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_3)
  333. /*!< SS[14:12] are don't care in Alarm comparison. Only SS[11:0] are compared. */
  334. #define RTC_ALARMSUBSECONDMASK_SS14_12 (RTC_ALRMASSR_MASKSS_2 | RTC_ALRMASSR_MASKSS_3)
  335. /*!< SS[14:13] are don't care in Alarm comparison. Only SS[12:0] are compared. */
  336. #define RTC_ALARMSUBSECONDMASK_SS14_13 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_2 | RTC_ALRMASSR_MASKSS_3)
  337. /*!< SS[14] is don't care in Alarm comparison. Only SS[13:0] are compared. */
  338. #define RTC_ALARMSUBSECONDMASK_SS14 (RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_2 | RTC_ALRMASSR_MASKSS_3)
  339. /*!< SS[14:0] are compared and must match to activate alarm. */
  340. #define RTC_ALARMSUBSECONDMASK_NONE RTC_ALRMASSR_MASKSS
  341. /**
  342. * @}
  343. */
  344. /** @defgroup RTC_Interrupts_Definitions RTC Interrupts Definitions
  345. * @{
  346. */
  347. #define RTC_IT_TS RTC_CR_TSIE /*!< Enable Timestamp Interrupt */
  348. #define RTC_IT_WUT RTC_CR_WUTIE /*!< Enable Wakeup timer Interrupt */
  349. #define RTC_IT_ALRB RTC_CR_ALRBIE /*!< Enable Alarm B Interrupt */
  350. #define RTC_IT_ALRA RTC_CR_ALRAIE /*!< Enable Alarm A Interrupt */
  351. /**
  352. * @}
  353. */
  354. /** @defgroup RTC_Flags_Definitions RTC Flags Definitions
  355. * @{
  356. */
  357. #define RTC_FLAG_RECALPF RTC_ISR_RECALPF /*!< Recalibration pending flag */
  358. #define RTC_FLAG_TAMP3F RTC_ISR_TAMP3F /*!< Tamper 3 event flag */
  359. #define RTC_FLAG_TAMP2F RTC_ISR_TAMP2F /*!< Tamper 2 event flag */
  360. #define RTC_FLAG_TAMP1F RTC_ISR_TAMP1F /*!< Tamper 1 event flag */
  361. #define RTC_FLAG_TSOVF RTC_ISR_TSOVF /*!< Timestamp overflow flag */
  362. #define RTC_FLAG_TSF RTC_ISR_TSF /*!< Timestamp event flag */
  363. #define RTC_FLAG_ITSF RTC_ISR_ITSF /*!< Internal Timestamp event flag */
  364. #define RTC_FLAG_WUTF RTC_ISR_WUTF /*!< Wakeup timer event flag */
  365. #define RTC_FLAG_ALRBF RTC_ISR_ALRBF /*!< Alarm B event flag */
  366. #define RTC_FLAG_ALRAF RTC_ISR_ALRAF /*!< Alarm A event flag */
  367. #define RTC_FLAG_INITF RTC_ISR_INITF /*!< RTC in initialization mode flag */
  368. #define RTC_FLAG_RSF RTC_ISR_RSF /*!< Register synchronization flag */
  369. #define RTC_FLAG_INITS RTC_ISR_INITS /*!< RTC initialization status flag */
  370. #define RTC_FLAG_SHPF RTC_ISR_SHPF /*!< Shift operation pending flag */
  371. #define RTC_FLAG_WUTWF RTC_ISR_WUTWF /*!< WUTR register write allowance flag */
  372. #define RTC_FLAG_ALRBWF RTC_ISR_ALRBWF /*!< ALRMBR register write allowance flag */
  373. #define RTC_FLAG_ALRAWF RTC_ISR_ALRAWF /*!< ALRMAR register write allowance flag */
  374. /**
  375. * @}
  376. */
  377. /**
  378. * @}
  379. */
  380. /* Exported macros -----------------------------------------------------------*/
  381. /** @defgroup RTC_Exported_Macros RTC Exported Macros
  382. * @{
  383. */
  384. /** @brief Reset RTC handle state
  385. * @param __HANDLE__ specifies the RTC handle.
  386. * @retval None
  387. */
  388. #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
  389. #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) do { \
  390. (__HANDLE__)->State = HAL_RTC_STATE_RESET; \
  391. (__HANDLE__)->MspInitCallback = NULL; \
  392. (__HANDLE__)->MspDeInitCallback = NULL; \
  393. } while(0U)
  394. #else
  395. #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
  396. #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
  397. /**
  398. * @brief Disable the write protection for RTC registers.
  399. * @param __HANDLE__ specifies the RTC handle.
  400. * @retval None
  401. */
  402. #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) do { \
  403. (__HANDLE__)->Instance->WPR = 0xCAU; \
  404. (__HANDLE__)->Instance->WPR = 0x53U; \
  405. } while(0U)
  406. /**
  407. * @brief Enable the write protection for RTC registers.
  408. * @param __HANDLE__ specifies the RTC handle.
  409. * @retval None
  410. */
  411. #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) do { \
  412. (__HANDLE__)->Instance->WPR = 0xFFU; \
  413. } while(0U)
  414. /**
  415. * @brief Check whether the RTC Calendar is initialized.
  416. * @param __HANDLE__ specifies the RTC handle.
  417. * @retval None
  418. */
  419. #define __HAL_RTC_IS_CALENDAR_INITIALIZED(__HANDLE__) (((((__HANDLE__)->Instance->ISR) & (RTC_FLAG_INITS)) == RTC_FLAG_INITS) ? 1U : 0U)
  420. /**
  421. * @brief Enable the RTC ALARMA peripheral.
  422. * @param __HANDLE__ specifies the RTC handle.
  423. * @retval None
  424. */
  425. #define __HAL_RTC_ALARMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRAE))
  426. /**
  427. * @brief Disable the RTC ALARMA peripheral.
  428. * @param __HANDLE__ specifies the RTC handle.
  429. * @retval None
  430. */
  431. #define __HAL_RTC_ALARMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRAE))
  432. /**
  433. * @brief Enable the RTC ALARMB peripheral.
  434. * @param __HANDLE__ specifies the RTC handle.
  435. * @retval None
  436. */
  437. #define __HAL_RTC_ALARMB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRBE))
  438. /**
  439. * @brief Disable the RTC ALARMB peripheral.
  440. * @param __HANDLE__ specifies the RTC handle.
  441. * @retval None
  442. */
  443. #define __HAL_RTC_ALARMB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRBE))
  444. /**
  445. * @brief Enable the RTC Alarm interrupt.
  446. * @param __HANDLE__ specifies the RTC handle.
  447. * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to be enabled or disabled.
  448. * This parameter can be any combination of the following values:
  449. * @arg RTC_IT_ALRA: Alarm A interrupt
  450. * @arg RTC_IT_ALRB: Alarm B interrupt
  451. * @retval None
  452. */
  453. #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
  454. /**
  455. * @brief Disable the RTC Alarm interrupt.
  456. * @param __HANDLE__ specifies the RTC handle.
  457. * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to be enabled or disabled.
  458. * This parameter can be any combination of the following values:
  459. * @arg RTC_IT_ALRA: Alarm A interrupt
  460. * @arg RTC_IT_ALRB: Alarm B interrupt
  461. * @retval None
  462. */
  463. #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
  464. /**
  465. * @brief Check whether the specified RTC Alarm interrupt has occurred or not.
  466. * @param __HANDLE__ specifies the RTC handle.
  467. * @param __INTERRUPT__ specifies the RTC Alarm interrupt to check.
  468. * This parameter can be:
  469. * @arg RTC_IT_ALRA: Alarm A interrupt
  470. * @arg RTC_IT_ALRB: Alarm B interrupt
  471. * @retval None
  472. */
  473. #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__) >> 4U)) != 0U) ? 1U : 0U)
  474. /**
  475. * @brief Get the selected RTC Alarm's flag status.
  476. * @param __HANDLE__ specifies the RTC handle.
  477. * @param __FLAG__ specifies the RTC Alarm Flag to check.
  478. * This parameter can be:
  479. * @arg RTC_FLAG_ALRAF: Alarm A interrupt flag
  480. * @arg RTC_FLAG_ALRAWF: Alarm A 'write allowed' flag
  481. * @arg RTC_FLAG_ALRBF: Alarm B interrupt flag
  482. * @arg RTC_FLAG_ALRBWF: Alarm B 'write allowed' flag
  483. * @retval None
  484. */
  485. #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U)
  486. /**
  487. * @brief Clear the RTC Alarm's pending flags.
  488. * @param __HANDLE__ specifies the RTC handle.
  489. * @param __FLAG__ specifies the RTC Alarm flag to be cleared.
  490. * This parameter can be:
  491. * @arg RTC_FLAG_ALRAF
  492. * @arg RTC_FLAG_ALRBF
  493. * @retval None
  494. */
  495. #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
  496. /**
  497. * @brief Check whether the specified RTC Alarm interrupt has been enabled or not.
  498. * @param __HANDLE__ specifies the RTC handle.
  499. * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to check.
  500. * This parameter can be:
  501. * @arg RTC_IT_ALRA: Alarm A interrupt
  502. * @arg RTC_IT_ALRB: Alarm B interrupt
  503. * @retval None
  504. */
  505. #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != 0U) ? 1U : 0U)
  506. /**
  507. * @brief Enable interrupt on the RTC Alarm associated EXTI line.
  508. * @retval None
  509. */
  510. #define __HAL_RTC_ALARM_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_ALARM_EVENT)
  511. /**
  512. * @brief Disable interrupt on the RTC Alarm associated EXTI line.
  513. * @retval None
  514. */
  515. #define __HAL_RTC_ALARM_EXTI_DISABLE_IT() (EXTI->IMR &= ~RTC_EXTI_LINE_ALARM_EVENT)
  516. /**
  517. * @brief Enable event on the RTC Alarm associated EXTI line.
  518. * @retval None.
  519. */
  520. #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_ALARM_EVENT)
  521. /**
  522. * @brief Disable event on the RTC Alarm associated EXTI line.
  523. * @retval None.
  524. */
  525. #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~RTC_EXTI_LINE_ALARM_EVENT)
  526. /**
  527. * @brief Enable falling edge trigger on the RTC Alarm associated EXTI line.
  528. * @retval None.
  529. */
  530. #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_ALARM_EVENT)
  531. /**
  532. * @brief Disable falling edge trigger on the RTC Alarm associated EXTI line.
  533. * @retval None.
  534. */
  535. #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~RTC_EXTI_LINE_ALARM_EVENT)
  536. /**
  537. * @brief Enable rising edge trigger on the RTC Alarm associated EXTI line.
  538. * @retval None.
  539. */
  540. #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_ALARM_EVENT)
  541. /**
  542. * @brief Disable rising edge trigger on the RTC Alarm associated EXTI line.
  543. * @retval None.
  544. */
  545. #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~RTC_EXTI_LINE_ALARM_EVENT)
  546. /**
  547. * @brief Enable rising & falling edge trigger on the RTC Alarm associated EXTI line.
  548. * @retval None.
  549. */
  550. #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
  551. __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE(); \
  552. __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE(); \
  553. } while(0U)
  554. /**
  555. * @brief Disable rising & falling edge trigger on the RTC Alarm associated EXTI line.
  556. * @retval None.
  557. */
  558. #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
  559. __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE(); \
  560. __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE(); \
  561. } while(0U)
  562. /**
  563. * @brief Check whether the RTC Alarm associated EXTI line interrupt flag is set or not.
  564. * @retval Line Status.
  565. */
  566. #define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_ALARM_EVENT)
  567. /**
  568. * @brief Clear the RTC Alarm associated EXTI line flag.
  569. * @retval None.
  570. */
  571. #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_ALARM_EVENT)
  572. /**
  573. * @brief Generate a Software interrupt on RTC Alarm associated EXTI line.
  574. * @retval None.
  575. */
  576. #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_ALARM_EVENT)
  577. /**
  578. * @}
  579. */
  580. /* Include RTC HAL Extended module */
  581. #include "stm32f7xx_hal_rtc_ex.h"
  582. /* Exported functions --------------------------------------------------------*/
  583. /** @addtogroup RTC_Exported_Functions
  584. * @{
  585. */
  586. /** @addtogroup RTC_Exported_Functions_Group1
  587. * @{
  588. */
  589. /* Initialization and de-initialization functions ****************************/
  590. HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
  591. HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
  592. void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
  593. void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
  594. /* Callbacks Register/UnRegister functions ***********************************/
  595. #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
  596. HAL_StatusTypeDef HAL_RTC_RegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID, pRTC_CallbackTypeDef pCallback);
  597. HAL_StatusTypeDef HAL_RTC_UnRegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID);
  598. #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
  599. /**
  600. * @}
  601. */
  602. /** @addtogroup RTC_Exported_Functions_Group2
  603. * @{
  604. */
  605. /* RTC Time and Date functions ************************************************/
  606. HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
  607. HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
  608. HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
  609. HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
  610. /**
  611. * @}
  612. */
  613. /** @addtogroup RTC_Exported_Functions_Group3
  614. * @{
  615. */
  616. /* RTC Alarm functions ********************************************************/
  617. HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
  618. HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
  619. HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
  620. HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
  621. void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
  622. HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  623. void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
  624. /**
  625. * @}
  626. */
  627. /** @addtogroup RTC_Exported_Functions_Group4
  628. * @{
  629. */
  630. /* Peripheral Control functions ***********************************************/
  631. HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef *hrtc);
  632. /* RTC Daylight Saving Time functions *****************************************/
  633. void HAL_RTC_DST_Add1Hour(RTC_HandleTypeDef *hrtc);
  634. void HAL_RTC_DST_Sub1Hour(RTC_HandleTypeDef *hrtc);
  635. void HAL_RTC_DST_SetStoreOperation(RTC_HandleTypeDef *hrtc);
  636. void HAL_RTC_DST_ClearStoreOperation(RTC_HandleTypeDef *hrtc);
  637. uint32_t HAL_RTC_DST_ReadStoreOperation(RTC_HandleTypeDef *hrtc);
  638. /**
  639. * @}
  640. */
  641. /** @addtogroup RTC_Exported_Functions_Group5
  642. * @{
  643. */
  644. /* Peripheral State functions *************************************************/
  645. HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
  646. /**
  647. * @}
  648. */
  649. /**
  650. * @}
  651. */
  652. /* Private types -------------------------------------------------------------*/
  653. /* Private variables ---------------------------------------------------------*/
  654. /* Private constants ---------------------------------------------------------*/
  655. /** @defgroup RTC_Private_Constants RTC Private Constants
  656. * @{
  657. */
  658. /* Masks Definition */
  659. #define RTC_TR_RESERVED_MASK ((uint32_t)(RTC_TR_HT | RTC_TR_HU | \
  660. RTC_TR_MNT | RTC_TR_MNU | \
  661. RTC_TR_ST | RTC_TR_SU | \
  662. RTC_TR_PM))
  663. #define RTC_DR_RESERVED_MASK ((uint32_t)(RTC_DR_YT | RTC_DR_YU | \
  664. RTC_DR_MT | RTC_DR_MU | \
  665. RTC_DR_DT | RTC_DR_DU | \
  666. RTC_DR_WDU))
  667. #define RTC_INIT_MASK 0xFFFFFFFFU
  668. #define RTC_RSF_MASK ((uint32_t)~(RTC_ISR_INIT | RTC_ISR_RSF))
  669. #define RTC_FLAGS_MASK ((uint32_t)(RTC_FLAG_INITF | RTC_FLAG_INITS | \
  670. RTC_FLAG_ALRAF | RTC_FLAG_ALRAWF | \
  671. RTC_FLAG_ALRBF | RTC_FLAG_ALRBWF | \
  672. RTC_FLAG_WUTF | RTC_FLAG_WUTWF | \
  673. RTC_FLAG_RECALPF | RTC_FLAG_SHPF | \
  674. RTC_FLAG_TSF | RTC_FLAG_TSOVF | \
  675. RTC_FLAG_RSF | RTC_TAMPER_FLAGS_MASK))
  676. #define RTC_TIMEOUT_VALUE 1000U
  677. #define RTC_EXTI_LINE_ALARM_EVENT EXTI_IMR_IM17 /*!< External interrupt line 17 Connected to the RTC Alarm event */
  678. /**
  679. * @}
  680. */
  681. /* Private macros ------------------------------------------------------------*/
  682. /** @defgroup RTC_Private_Macros RTC Private Macros
  683. * @{
  684. */
  685. /** @defgroup RTC_IS_RTC_Definitions RTC Private macros to check input parameters
  686. * @{
  687. */
  688. #define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HOURFORMAT_12) || \
  689. ((FORMAT) == RTC_HOURFORMAT_24))
  690. #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_OUTPUT_DISABLE) || \
  691. ((OUTPUT) == RTC_OUTPUT_ALARMA) || \
  692. ((OUTPUT) == RTC_OUTPUT_ALARMB) || \
  693. ((OUTPUT) == RTC_OUTPUT_WAKEUP))
  694. #define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OUTPUT_POLARITY_HIGH) || \
  695. ((POL) == RTC_OUTPUT_POLARITY_LOW))
  696. #define IS_RTC_OUTPUT_TYPE(TYPE) (((TYPE) == RTC_OUTPUT_TYPE_OPENDRAIN) || \
  697. ((TYPE) == RTC_OUTPUT_TYPE_PUSHPULL))
  698. #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7FU)
  699. #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7FFFU)
  700. #define IS_RTC_HOUR12(HOUR) (((HOUR) > 0U) && ((HOUR) <= 12U))
  701. #define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23U)
  702. #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59U)
  703. #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59U)
  704. #define IS_RTC_HOURFORMAT12(PM) (((PM) == RTC_HOURFORMAT12_AM) || \
  705. ((PM) == RTC_HOURFORMAT12_PM))
  706. #define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DAYLIGHTSAVING_SUB1H) || \
  707. ((SAVE) == RTC_DAYLIGHTSAVING_ADD1H) || \
  708. ((SAVE) == RTC_DAYLIGHTSAVING_NONE))
  709. #define IS_RTC_STORE_OPERATION(OPERATION) (((OPERATION) == RTC_STOREOPERATION_RESET) || \
  710. ((OPERATION) == RTC_STOREOPERATION_SET))
  711. #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD))
  712. #define IS_RTC_YEAR(YEAR) ((YEAR) <= 99U)
  713. #define IS_RTC_MONTH(MONTH) (((MONTH) >= 1U) && ((MONTH) <= 12U))
  714. #define IS_RTC_DATE(DATE) (((DATE) >= 1U) && ((DATE) <= 31U))
  715. #define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
  716. ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
  717. ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
  718. ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
  719. ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
  720. ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
  721. ((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
  722. #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) > 0U) && ((DATE) <= 31U))
  723. #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
  724. ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
  725. ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
  726. ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
  727. ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
  728. ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
  729. ((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
  730. #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_ALARMDATEWEEKDAYSEL_DATE) || \
  731. ((SEL) == RTC_ALARMDATEWEEKDAYSEL_WEEKDAY))
  732. #define IS_RTC_ALARM_MASK(MASK) (((MASK) & ((uint32_t)~RTC_ALARMMASK_ALL)) == 0U)
  733. #define IS_RTC_ALARM(ALARM) (((ALARM) == RTC_ALARM_A) || ((ALARM) == RTC_ALARM_B))
  734. #define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= RTC_ALRMASSR_SS)
  735. #define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_ALARMSUBSECONDMASK_ALL) || \
  736. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_1) || \
  737. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_2) || \
  738. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_3) || \
  739. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_4) || \
  740. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_5) || \
  741. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_6) || \
  742. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_7) || \
  743. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_8) || \
  744. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_9) || \
  745. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_10) || \
  746. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_11) || \
  747. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_12) || \
  748. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_13) || \
  749. ((MASK) == RTC_ALARMSUBSECONDMASK_SS14) || \
  750. ((MASK) == RTC_ALARMSUBSECONDMASK_NONE))
  751. /**
  752. * @}
  753. */
  754. /**
  755. * @}
  756. */
  757. /* Private functions ---------------------------------------------------------*/
  758. /** @defgroup RTC_Private_Functions RTC Private Functions
  759. * @{
  760. */
  761. HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef *hrtc);
  762. HAL_StatusTypeDef RTC_ExitInitMode(RTC_HandleTypeDef *hrtc);
  763. uint8_t RTC_ByteToBcd2(uint8_t number);
  764. uint8_t RTC_Bcd2ToByte(uint8_t number);
  765. /**
  766. * @}
  767. */
  768. /**
  769. * @}
  770. */
  771. /**
  772. * @}
  773. */
  774. #ifdef __cplusplus
  775. }
  776. #endif
  777. #endif /* STM32F7xx_HAL_RTC_H */