You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

943 lines
40 KiB

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