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.
 
 
 

1336 lines
54 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32wbxx_hal_rtc_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of RTC HAL Extended module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2019 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 STM32WBxx_HAL_RTC_EX_H
  21. #define STM32WBxx_HAL_RTC_EX_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32wbxx_hal_def.h"
  27. /** @addtogroup STM32WBxx_HAL_Driver
  28. * @{
  29. */
  30. /** @defgroup RTCEx RTCEx
  31. * @{
  32. */
  33. /* Exported types ------------------------------------------------------------*/
  34. /** @defgroup RTCEx_Exported_Types RTCEx Exported Types
  35. * @{
  36. */
  37. /**
  38. * @brief RTC Tamper structure definition
  39. */
  40. typedef struct
  41. {
  42. uint32_t Tamper; /*!< Specifies the Tamper Pin.
  43. This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */
  44. uint32_t Interrupt; /*!< Specifies the Tamper Interrupt.
  45. This parameter can be a value of @ref RTCEx_Tamper_Interrupt_Definitions */
  46. uint32_t Trigger; /*!< Specifies the Tamper Trigger.
  47. This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */
  48. uint32_t NoErase; /*!< Specifies the Tamper no erase mode.
  49. This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp_Definitions */
  50. uint32_t MaskFlag; /*!< Specifies the Tamper Flag masking.
  51. This parameter can be a value of @ref RTCEx_Tamper_MaskFlag_Definitions */
  52. uint32_t Filter; /*!< Specifies the RTC Filter Tamper.
  53. This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */
  54. uint32_t SamplingFrequency; /*!< Specifies the sampling frequency.
  55. This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */
  56. uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration .
  57. This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */
  58. uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp .
  59. This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */
  60. uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection.
  61. This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */
  62. }RTC_TamperTypeDef;
  63. /**
  64. * @}
  65. */
  66. /* Exported constants --------------------------------------------------------*/
  67. /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants
  68. * @{
  69. */
  70. /** @defgroup RTCEx_Output_selection_Definitions RTCEx Output Selection Definition
  71. * @{
  72. */
  73. #define RTC_OUTPUT_DISABLE ((uint32_t)0x00000000U)
  74. #define RTC_OUTPUT_ALARMA ((uint32_t)RTC_CR_OSEL_0)
  75. #define RTC_OUTPUT_ALARMB ((uint32_t)RTC_CR_OSEL_1)
  76. #define RTC_OUTPUT_WAKEUP ((uint32_t)RTC_CR_OSEL)
  77. /**
  78. * @}
  79. */
  80. /** @defgroup RTCEx_Backup_Registers_Definitions RTCEx Backup Registers Definition
  81. * @{
  82. */
  83. #define RTC_BKP_DR0 ((uint32_t)0x00000000U)
  84. #define RTC_BKP_DR1 ((uint32_t)0x00000001U)
  85. #define RTC_BKP_DR2 ((uint32_t)0x00000002U)
  86. #define RTC_BKP_DR3 ((uint32_t)0x00000003U)
  87. #define RTC_BKP_DR4 ((uint32_t)0x00000004U)
  88. #define RTC_BKP_DR5 ((uint32_t)0x00000005U)
  89. #define RTC_BKP_DR6 ((uint32_t)0x00000006U)
  90. #define RTC_BKP_DR7 ((uint32_t)0x00000007U)
  91. #define RTC_BKP_DR8 ((uint32_t)0x00000008U)
  92. #define RTC_BKP_DR9 ((uint32_t)0x00000009U)
  93. #define RTC_BKP_DR10 ((uint32_t)0x0000000AU)
  94. #define RTC_BKP_DR11 ((uint32_t)0x0000000BU)
  95. #define RTC_BKP_DR12 ((uint32_t)0x0000000CU)
  96. #define RTC_BKP_DR13 ((uint32_t)0x0000000DU)
  97. #define RTC_BKP_DR14 ((uint32_t)0x0000000EU)
  98. #define RTC_BKP_DR15 ((uint32_t)0x0000000FU)
  99. #define RTC_BKP_DR16 ((uint32_t)0x00000010U)
  100. #define RTC_BKP_DR17 ((uint32_t)0x00000011U)
  101. #define RTC_BKP_DR18 ((uint32_t)0x00000012U)
  102. #define RTC_BKP_DR19 ((uint32_t)0x00000013U)
  103. /**
  104. * @}
  105. */
  106. /** @defgroup RTCEx_Time_Stamp_Edges_definitions RTCEx Time Stamp Edges definition
  107. * @{
  108. */
  109. #define RTC_TIMESTAMPEDGE_RISING ((uint32_t)0x00000000U)
  110. #define RTC_TIMESTAMPEDGE_FALLING RTC_CR_TSEDGE
  111. /**
  112. * @}
  113. */
  114. /** @defgroup RTCEx_TimeStamp_Pin_Selections RTCEx TimeStamp Pin Selection
  115. * @{
  116. */
  117. #define RTC_TIMESTAMPPIN_DEFAULT ((uint32_t)0x00000000U)
  118. /**
  119. * @}
  120. */
  121. /** @defgroup RTCEx_Tamper_Pins_Definitions RTCEx Tamper Pins Definition
  122. * @{
  123. */
  124. #if defined(RTC_TAMPER1_SUPPORT)
  125. #define RTC_TAMPER_1 RTC_TAMPCR_TAMP1E
  126. #endif /* RTC_TAMPER1_SUPPORT */
  127. #define RTC_TAMPER_2 RTC_TAMPCR_TAMP2E
  128. #if defined(RTC_TAMPER3_SUPPORT)
  129. #define RTC_TAMPER_3 RTC_TAMPCR_TAMP3E
  130. #endif /* RTC_TAMPER3_SUPPORT */
  131. /**
  132. * @}
  133. */
  134. /** @defgroup RTCEx_Tamper_Interrupt_Definitions RTCEx Tamper Interrupt Definitions
  135. * @{
  136. */
  137. #if defined(RTC_TAMPER1_SUPPORT)
  138. #define RTC_TAMPER1_INTERRUPT RTC_TAMPCR_TAMP1IE
  139. #endif /* RTC_TAMPER1_SUPPORT */
  140. #define RTC_TAMPER2_INTERRUPT RTC_TAMPCR_TAMP2IE
  141. #if defined(RTC_TAMPER3_SUPPORT)
  142. #define RTC_TAMPER3_INTERRUPT RTC_TAMPCR_TAMP3IE
  143. #endif /* RTC_TAMPER3_SUPPORT */
  144. #define RTC_ALL_TAMPER_INTERRUPT RTC_TAMPCR_TAMPIE
  145. /**
  146. * @}
  147. */
  148. /** @defgroup RTCEx_Tamper_Trigger_Definitions RTCEx Tamper Trigger Definitions
  149. * @{
  150. */
  151. #define RTC_TAMPERTRIGGER_RISINGEDGE ((uint32_t)0x00000000U)
  152. #define RTC_TAMPERTRIGGER_FALLINGEDGE ((uint32_t)0x00000002U)
  153. #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE
  154. #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE
  155. /**
  156. * @}
  157. */
  158. /** @defgroup RTCEx_Tamper_EraseBackUp_Definitions RTCEx Tamper EraseBackUp Definitions
  159. * @{
  160. */
  161. #define RTC_TAMPER_ERASE_BACKUP_ENABLE ((uint32_t)0x00000000U)
  162. #define RTC_TAMPER_ERASE_BACKUP_DISABLE ((uint32_t)0x00020000U)
  163. /**
  164. * @}
  165. */
  166. /** @defgroup RTCEx_Tamper_MaskFlag_Definitions RTCEx Tamper MaskFlag Definitions
  167. * @{
  168. */
  169. #define RTC_TAMPERMASK_FLAG_DISABLE ((uint32_t)0x00000000U)
  170. #define RTC_TAMPERMASK_FLAG_ENABLE ((uint32_t)0x00040000U)
  171. /**
  172. * @}
  173. */
  174. /** @defgroup RTCEx_Tamper_Filter_Definitions RTCEx Tamper Filter Definitions
  175. * @{
  176. */
  177. #define RTC_TAMPERFILTER_DISABLE ((uint32_t)0x00000000U) /*!< Tamper filter is disabled */
  178. #define RTC_TAMPERFILTER_2SAMPLE RTC_TAMPCR_TAMPFLT_0 /*!< Tamper is activated after 2
  179. consecutive samples at the active level */
  180. #define RTC_TAMPERFILTER_4SAMPLE RTC_TAMPCR_TAMPFLT_1 /*!< Tamper is activated after 4
  181. consecutive samples at the active level */
  182. #define RTC_TAMPERFILTER_8SAMPLE RTC_TAMPCR_TAMPFLT /*!< Tamper is activated after 8
  183. consecutive samples at the active leve. */
  184. /**
  185. * @}
  186. */
  187. /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTCEx Tamper Sampling Frequencies Definitions
  188. * @{
  189. */
  190. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 ((uint32_t)0x00000000U) /*!< Each of the tamper inputs are sampled
  191. with a frequency = RTCCLK / 32768 */
  192. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 RTC_TAMPCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled
  193. with a frequency = RTCCLK / 16384 */
  194. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 RTC_TAMPCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled
  195. with a frequency = RTCCLK / 8192 */
  196. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 ((uint32_t) (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_1)) /*!< Each of the tamper inputs are sampled
  197. with a frequency = RTCCLK / 4096 */
  198. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 RTC_TAMPCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled
  199. with a frequency = RTCCLK / 2048 */
  200. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 ((uint32_t) (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_2)) /*!< Each of the tamper inputs are sampled
  201. with a frequency = RTCCLK / 1024 */
  202. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 ((uint32_t) (RTC_TAMPCR_TAMPFREQ_1 | RTC_TAMPCR_TAMPFREQ_2)) /*!< Each of the tamper inputs are sampled
  203. with a frequency = RTCCLK / 512 */
  204. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 ((uint32_t) (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_1 | \
  205. RTC_TAMPCR_TAMPFREQ_2)) /*!< Each of the tamper inputs are sampled
  206. with a frequency = RTCCLK / 256 */
  207. /**
  208. * @}
  209. */
  210. /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTCEx Tamper Pin Precharge Duration Definitions
  211. * @{
  212. */
  213. #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK ((uint32_t)0x00000000U) /*!< Tamper pins are pre-charged before
  214. sampling during 1 RTCCLK cycle */
  215. #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK RTC_TAMPCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before
  216. sampling during 2 RTCCLK cycles */
  217. #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK RTC_TAMPCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before
  218. sampling during 4 RTCCLK cycles */
  219. #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK ((uint32_t)(RTC_TAMPCR_TAMPPRCH_0 | RTC_TAMPCR_TAMPPRCH_1)) /*!< Tamper pins are pre-charged before
  220. sampling during 8 RTCCLK cycles */
  221. /**
  222. * @}
  223. */
  224. /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTCEx Tamper TimeStampOnTamperDetection Definitions
  225. * @{
  226. */
  227. #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE RTC_TAMPCR_TAMPTS /*!< TimeStamp on Tamper Detection event saved */
  228. #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE ((uint32_t)0x00000000U) /*!< TimeStamp on Tamper Detection event is not saved */
  229. /**
  230. * @}
  231. */
  232. /** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTCEx Tamper Pull UP Definitions
  233. * @{
  234. */
  235. #define RTC_TAMPER_PULLUP_ENABLE ((uint32_t)0x00000000U) /*!< Tamper pins are pre-charged before sampling */
  236. #define RTC_TAMPER_PULLUP_DISABLE RTC_TAMPCR_TAMPPUDIS /*!< Tamper pins pre-charge is disabled */
  237. /**
  238. * @}
  239. */
  240. /** @defgroup RTCEx_Wakeup_Timer_Definitions RTCEx Wakeup Timer Definitions
  241. * @{
  242. */
  243. #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 ((uint32_t)0x00000000U)
  244. #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 RTC_CR_WUCKSEL_0
  245. #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 RTC_CR_WUCKSEL_1
  246. #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 ((uint32_t) (RTC_CR_WUCKSEL_0 | RTC_CR_WUCKSEL_1))
  247. #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS RTC_CR_WUCKSEL_2
  248. #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS ((uint32_t) (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_2))
  249. /**
  250. * @}
  251. */
  252. /** @defgroup RTCEx_Smooth_calib_period_Definitions RTCEx Smooth calib period Definitions
  253. * @{
  254. */
  255. #define RTC_SMOOTHCALIB_PERIOD_32SEC ((uint32_t)0x00000000U) /*!< If RTCCLK = 32768 Hz, Smooth calibation
  256. period is 32s, else 2exp20 RTCCLK pulses */
  257. #define RTC_SMOOTHCALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< If RTCCLK = 32768 Hz, Smooth calibation
  258. period is 16s, else 2exp19 RTCCLK pulses */
  259. #define RTC_SMOOTHCALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< If RTCCLK = 32768 Hz, Smooth calibation
  260. period is 8s, else 2exp18 RTCCLK pulses */
  261. /**
  262. * @}
  263. */
  264. /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTCEx Smooth calib Plus pulses Definitions
  265. * @{
  266. */
  267. #define RTC_SMOOTHCALIB_PLUSPULSES_SET RTC_CALR_CALP /*!< The number of RTCCLK pulses added
  268. during a X -second window = Y - CALM[8:0]
  269. with Y = 512, 256, 128 when X = 32, 16, 8 */
  270. #define RTC_SMOOTHCALIB_PLUSPULSES_RESET ((uint32_t)0x00000000U) /*!< The number of RTCCLK pulses subbstited
  271. during a 32-second window = CALM[8:0] */
  272. /**
  273. * @}
  274. */
  275. /** @defgroup RTCEx_Calib_Output_selection_Definitions RTCEx Calib Output selection Definitions
  276. * @{
  277. */
  278. #define RTC_CALIBOUTPUT_512HZ ((uint32_t)0x00000000U)
  279. #define RTC_CALIBOUTPUT_1HZ RTC_CR_COSEL
  280. /**
  281. * @}
  282. */
  283. /** @defgroup RTCEx_Add_1_Second_Parameter_Definition RTCEx Add 1 Second Parameter Definitions
  284. * @{
  285. */
  286. #define RTC_SHIFTADD1S_RESET ((uint32_t)0x00000000U)
  287. #define RTC_SHIFTADD1S_SET RTC_SHIFTR_ADD1S
  288. /**
  289. * @}
  290. */
  291. /** @defgroup RTCEx_Interrupts_Definitions RTCEx Interrupts Definitions
  292. * @{
  293. */
  294. #if defined(RTC_TAMPER3_SUPPORT)
  295. #define RTC_IT_TAMP3 ((uint32_t)RTC_TAMPCR_TAMP3IE) /*!< Enable Tamper 3 Interrupt */
  296. #endif
  297. /**
  298. * @}
  299. */
  300. /** @defgroup RTCEx_Flags_Definitions RTCEx Flags Definitions
  301. * @{
  302. */
  303. #if defined(RTC_TAMPER3_SUPPORT)
  304. #define RTC_FLAG_TAMP3F ((uint32_t)RTC_ISR_TAMP3F)
  305. #endif
  306. /**
  307. * @}
  308. */
  309. /**
  310. * @}
  311. */
  312. /* Exported macros -----------------------------------------------------------*/
  313. /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros
  314. * @{
  315. */
  316. /* ---------------------------------WAKEUPTIMER---------------------------------*/
  317. /** @defgroup RTCEx_WakeUp_Timer RTC WakeUp Timer
  318. * @{
  319. */
  320. /**
  321. * @brief Enable the RTC WakeUp Timer peripheral.
  322. * @param __HANDLE__ specifies the RTC handle.
  323. * @retval None
  324. */
  325. #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE))
  326. /**
  327. * @brief Disable the RTC WakeUp Timer peripheral.
  328. * @param __HANDLE__ specifies the RTC handle.
  329. * @retval None
  330. */
  331. #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE))
  332. /**
  333. * @brief Enable the RTC WakeUpTimer interrupt.
  334. * @param __HANDLE__ specifies the RTC handle.
  335. * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled.
  336. * This parameter can be:
  337. * @arg RTC_IT_WUT: WakeUpTimer interrupt
  338. * @retval None
  339. */
  340. #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
  341. /**
  342. * @brief Disable the RTC WakeUpTimer interrupt.
  343. * @param __HANDLE__ specifies the RTC handle.
  344. * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be disabled.
  345. * This parameter can be:
  346. * @arg RTC_IT_WUT: WakeUpTimer interrupt
  347. * @retval None
  348. */
  349. #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
  350. /**
  351. * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
  352. * @param __HANDLE__ specifies the RTC handle.
  353. * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt to check.
  354. * This parameter can be:
  355. * @arg RTC_IT_WUT: WakeUpTimer interrupt
  356. * @retval None
  357. */
  358. #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4U)) != 0U) ? 1U : 0U)
  359. /**
  360. * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not.
  361. * @param __HANDLE__ specifies the RTC handle.
  362. * @param __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check.
  363. * This parameter can be:
  364. * @arg RTC_IT_WUT: WakeUpTimer interrupt
  365. * @retval None
  366. */
  367. #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != 0U) ? 1U : 0U)
  368. /**
  369. * @brief Get the selected RTC WakeUpTimer's flag status.
  370. * @param __HANDLE__ specifies the RTC handle.
  371. * @param __FLAG__ specifies the RTC WakeUpTimer Flag is pending or not.
  372. * This parameter can be:
  373. * @arg RTC_FLAG_WUTF
  374. * @arg RTC_FLAG_WUTWF
  375. * @retval None
  376. */
  377. #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U)
  378. /**
  379. * @brief Clear the RTC Wake Up timer's pending flags.
  380. * @param __HANDLE__ specifies the RTC handle.
  381. * @param __FLAG__ specifies the RTC WakeUpTimer Flag to clear.
  382. * This parameter can be:
  383. * @arg RTC_FLAG_WUTF
  384. * @retval None
  385. */
  386. #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
  387. /**
  388. * @brief Enable interrupt on the RTC WakeUp Timer associated Exti line of core 1.
  389. * @retval None
  390. */
  391. #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  392. /**
  393. * @brief Disable interrupt on the RTC WakeUp Timer associated Exti line of core 1.
  394. * @retval None
  395. */
  396. #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
  397. /**
  398. * @brief Enable interrupt on the RTC WakeUp Timer associated Exti line of core 2.
  399. * @retval None
  400. */
  401. #define __HAL_RTC_WAKEUPTIMER_EXTIC2_ENABLE_IT() (EXTI->C2IMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  402. /**
  403. * @brief Disable interrupt on the RTC WakeUp Timer associated Exti line of core 2.
  404. * @retval None
  405. */
  406. #define __HAL_RTC_WAKEUPTIMER_EXTIC2_DISABLE_IT() (EXTI->C2IMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
  407. /**
  408. * @brief Enable event on the RTC WakeUp Timer associated Exti line of core 1.
  409. * @retval None.
  410. */
  411. #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  412. /**
  413. * @brief Enable event on the RTC WakeUp Timer associated Exti line of core 2.
  414. * @retval None.
  415. */
  416. #define __HAL_RTC_WAKEUPTIMER_EXTIC2_ENABLE_EVENT() (EXTI->C2EMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  417. /**
  418. * @brief Disable event on the RTC WakeUp Timer associated Exti line of core 1.
  419. * @retval None.
  420. */
  421. #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
  422. /**
  423. * @brief Disable event on the RTC WakeUp Timer associated Exti line of core 2.
  424. * @retval None.
  425. */
  426. #define __HAL_RTC_WAKEUPTIMER_EXTIC2_DISABLE_EVENT() (EXTI->C2EMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
  427. /*---------------*/
  428. /**
  429. * @brief Enable falling edge trigger on the RTC WakeUp Timer associated Exti line.
  430. * @retval None.
  431. */
  432. #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  433. /**
  434. * @brief Disable falling edge trigger on the RTC WakeUp Timer associated Exti line.
  435. * @retval None.
  436. */
  437. #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
  438. /**
  439. * @brief Enable rising edge trigger on the RTC WakeUp Timer associated Exti line.
  440. * @retval None.
  441. */
  442. #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  443. /**
  444. * @brief Disable rising edge trigger on the RTC WakeUp Timer associated Exti line.
  445. * @retval None.
  446. */
  447. #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
  448. /**
  449. * @brief Enable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line.
  450. * @retval None
  451. */
  452. #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
  453. __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE(); \
  454. __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE(); \
  455. } while(0U)
  456. /**
  457. * @brief Disable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line.
  458. * This parameter can be:
  459. * @retval None
  460. */
  461. #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
  462. __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE(); \
  463. __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE(); \
  464. } while(0U)
  465. /**
  466. * @brief Check whether the RTC WakeUp Timer associated Exti line interrupt flag is set or not of core 1.
  467. * @retval Line Status.
  468. */
  469. #define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR1 & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  470. /**
  471. * @brief Check whether the RTC WakeUp Timer associated Exti line interrupt flag is set or not of core 2.
  472. * @retval Line Status.
  473. */
  474. #define __HAL_RTC_WAKEUPTIMER_EXTIC2_GET_FLAG() (EXTI->PR1 & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  475. /**
  476. * @brief Clear the RTC WakeUp Timer associated Exti line flag of core 1.
  477. * @retval None.
  478. */
  479. #define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  480. /**
  481. * @brief Clear the RTC WakeUp Timer associated Exti line flag of core 2.
  482. * @retval None.
  483. */
  484. #define __HAL_RTC_WAKEUPTIMER_EXTIC2_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  485. /*---------------*/
  486. /**
  487. * @brief Generate a Software interrupt on the RTC WakeUp Timer associated Exti line.
  488. * @retval None.
  489. */
  490. #define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  491. /*---------------*/
  492. /**
  493. * @}
  494. */
  495. /* ---------------------------------TIMESTAMP---------------------------------*/
  496. /** @defgroup RTCEx_Timestamp RTC Timestamp
  497. * @{
  498. */
  499. /**
  500. * @brief Enable the RTC TimeStamp peripheral.
  501. * @param __HANDLE__ specifies the RTC handle.
  502. * @retval None
  503. */
  504. #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE))
  505. /**
  506. * @brief Disable the RTC TimeStamp peripheral.
  507. * @param __HANDLE__ specifies the RTC handle.
  508. * @retval None
  509. */
  510. #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE))
  511. /**
  512. * @brief Enable the RTC TimeStamp interrupt.
  513. * @param __HANDLE__ specifies the RTC handle.
  514. * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be enabled.
  515. * This parameter can be:
  516. * @arg RTC_IT_TS: TimeStamp interrupt
  517. * @retval None
  518. */
  519. #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
  520. /**
  521. * @brief Disable the RTC TimeStamp interrupt.
  522. * @param __HANDLE__ specifies the RTC handle.
  523. * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be disabled.
  524. * This parameter can be:
  525. * @arg RTC_IT_TS: TimeStamp interrupt
  526. * @retval None
  527. */
  528. #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
  529. /**
  530. * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not.
  531. * @param __HANDLE__ specifies the RTC handle.
  532. * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt to check.
  533. * This parameter can be:
  534. * @arg RTC_IT_TS: TimeStamp interrupt
  535. * @retval None
  536. */
  537. #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4U)) != 0U) ? 1U : 0U)
  538. /**
  539. * @brief Check whether the specified RTC Time Stamp interrupt has been enabled or not.
  540. * @param __HANDLE__ specifies the RTC handle.
  541. * @param __INTERRUPT__ specifies the RTC Time Stamp interrupt source to check.
  542. * This parameter can be:
  543. * @arg RTC_IT_TS: TimeStamp interrupt
  544. * @retval None
  545. */
  546. #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != 0U) ? 1U : 0U)
  547. /**
  548. * @brief Get the selected RTC TimeStamp's flag status.
  549. * @param __HANDLE__ specifies the RTC handle.
  550. * @param __FLAG__ specifies the RTC TimeStamp Flag is pending or not.
  551. * This parameter can be:
  552. * @arg RTC_FLAG_TSF
  553. * @arg RTC_FLAG_TSOVF
  554. * @retval None
  555. */
  556. #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U)
  557. /**
  558. * @brief Clear the RTC Time Stamp's pending flags.
  559. * @param __HANDLE__ specifies the RTC handle.
  560. * @param __FLAG__ specifies the RTC TimeStamp Flag to clear.
  561. * This parameter can be:
  562. * @arg RTC_FLAG_TSF
  563. * @arg RTC_FLAG_TSOVF
  564. * @retval None
  565. */
  566. #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
  567. /**
  568. * @}
  569. */
  570. /* ---------------------------------TAMPER------------------------------------*/
  571. /** @defgroup RTCEx_Tamper RTC Tamper
  572. * @{
  573. */
  574. #if defined(RTC_TAMPER1_SUPPORT)
  575. /**
  576. * @brief Enable the RTC Tamper1 input detection.
  577. * @param __HANDLE__ specifies the RTC handle.
  578. * @retval None
  579. */
  580. #define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP1E))
  581. /**
  582. * @brief Disable the RTC Tamper1 input detection.
  583. * @param __HANDLE__ specifies the RTC handle.
  584. * @retval None
  585. */
  586. #define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP1E))
  587. #endif /* RTC_TAMPER1_SUPPORT */
  588. /**
  589. * @brief Enable the RTC Tamper2 input detection.
  590. * @param __HANDLE__ specifies the RTC handle.
  591. * @retval None
  592. */
  593. #define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP2E))
  594. /**
  595. * @brief Disable the RTC Tamper2 input detection.
  596. * @param __HANDLE__ specifies the RTC handle.
  597. * @retval None
  598. */
  599. #define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP2E))
  600. #if defined(RTC_TAMPER3_SUPPORT)
  601. /**
  602. * @brief Enable the RTC Tamper3 input detection.
  603. * @param __HANDLE__ specifies the RTC handle.
  604. * @retval None
  605. */
  606. #define __HAL_RTC_TAMPER3_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP3E))
  607. /**
  608. * @brief Disable the RTC Tamper3 input detection.
  609. * @param __HANDLE__ specifies the RTC handle.
  610. * @retval None
  611. */
  612. #define __HAL_RTC_TAMPER3_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP3E))
  613. #endif /* RTC_TAMPER3_SUPPORT */
  614. /**************************************************************************************************/
  615. /**
  616. * @brief Enable the RTC Tamper interrupt.
  617. * @param __HANDLE__ specifies the RTC handle.
  618. * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be enabled.
  619. * This parameter can be any combination of the following values:
  620. * @arg RTC_IT_TAMP: All tampers interrupts
  621. * @arg RTC_IT_TAMP1: Tamper1 interrupt (*)
  622. * @arg RTC_IT_TAMP2: Tamper2 interrupt
  623. * @arg RTC_IT_TAMP3: Tamper3 interrupt (*)
  624. *
  625. * (*) Value not defined in all devices. \n
  626. *
  627. * @retval None
  628. */
  629. #define __HAL_RTC_TAMPER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->TAMPCR |= (__INTERRUPT__))
  630. /**
  631. * @brief Disable the RTC Tamper interrupt.
  632. * @param __HANDLE__ specifies the RTC handle.
  633. * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be disabled.
  634. * This parameter can be any combination of the following values:
  635. * @arg RTC_IT_TAMP: All tampers interrupts
  636. * @arg RTC_IT_TAMP1: Tamper1 interrupt (*)
  637. * @arg RTC_IT_TAMP2: Tamper2 interrupt
  638. * @arg RTC_IT_TAMP3: Tamper3 interrupt (*)
  639. *
  640. * (*) Value not defined in all devices. \n
  641. *
  642. * @retval None
  643. */
  644. #define __HAL_RTC_TAMPER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->TAMPCR &= ~(__INTERRUPT__))
  645. /**************************************************************************************************/
  646. /**
  647. * @brief Check whether the specified RTC Tamper interrupt has occurred or not.
  648. * @param __HANDLE__ specifies the RTC handle.
  649. * @param __INTERRUPT__ specifies the RTC Tamper interrupt to check.
  650. * This parameter can be:
  651. * @arg RTC_IT_TAMP1: Tamper1 interrupt (*)
  652. * @arg RTC_IT_TAMP2: Tamper2 interrupt
  653. * @arg RTC_IT_TAMP3: Tamper3 interrupt (*)
  654. *
  655. * (*) Value not defined in all devices. \n
  656. *
  657. * @retval None
  658. */
  659. #if defined(RTC_TAMPER1_SUPPORT) && defined(RTC_TAMPER3_SUPPORT)
  660. #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) == RTC_IT_TAMP1) ? (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 3U)) != 0U) ? 1U : 0U) : \
  661. ((__INTERRUPT__) == RTC_IT_TAMP2) ? (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 5U)) != 0U) ? 1U : 0U) : \
  662. ((__INTERRUPT__) == RTC_IT_TAMP3) ? (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 7U)) != 0U) ? 1U : 0U))
  663. #else
  664. #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) == RTC_IT_TAMP1) ? (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 3U)) != 0U) ? 1U : 0U))
  665. #endif
  666. /**************************************************************************************************/
  667. /**
  668. * @brief Check whether the specified RTC Tamper interrupt has been enabled or not.
  669. * @param __HANDLE__ specifies the RTC handle.
  670. * @param __INTERRUPT__ specifies the RTC Tamper interrupt source to check.
  671. * This parameter can be:
  672. * @arg RTC_IT_TAMP: All tampers interrupts
  673. * @arg RTC_IT_TAMP1: Tamper1 interrupt (*)
  674. * @arg RTC_IT_TAMP2: Tamper2 interrupt
  675. * @arg RTC_IT_TAMP3: Tamper3 interrupt (*)
  676. *
  677. * (*) Value not defined in all devices. \n
  678. *
  679. * @retval None
  680. */
  681. #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->TAMPCR) & (__INTERRUPT__)) != 0U) ? 1U : 0U)
  682. /**
  683. * @brief Get the selected RTC Tamper's flag status.
  684. * @param __HANDLE__ specifies the RTC handle.
  685. * @param __FLAG__ specifies the RTC Tamper Flag is pending or not.
  686. * This parameter can be:
  687. * @arg RTC_FLAG_TAMP1F: Tamper1 flag (*)
  688. * @arg RTC_FLAG_TAMP2F: Tamper2 flag
  689. * @arg RTC_FLAG_TAMP3F: Tamper3 flag (*)
  690. *
  691. * (*) Value not defined in all devices. \n
  692. *
  693. * @retval None
  694. */
  695. #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U)
  696. /**
  697. * @brief Clear the RTC Tamper's pending flags.
  698. * @param __HANDLE__ specifies the RTC handle.
  699. * @param __FLAG__ specifies the RTC Tamper Flag to clear.
  700. * This parameter can be:
  701. * @arg RTC_FLAG_TAMP1F: Tamper1 flag (*)
  702. * @arg RTC_FLAG_TAMP2F: Tamper2 flag
  703. * @arg RTC_FLAG_TAMP3F: Tamper3 flag (*)
  704. *
  705. * (*) Value not defined in all devices. \n
  706. *
  707. * @retval None
  708. */
  709. #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
  710. /**************************************************************************************************/
  711. #if defined(RTC_INTERNALTS_SUPPORT)
  712. /**
  713. * @brief Enable the RTC internal TimeStamp peripheral.
  714. * @param __HANDLE__ specifies the RTC handle.
  715. * @retval None
  716. */
  717. #define __HAL_RTC_INTERNAL_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ITSE))
  718. /**
  719. * @brief Disable the RTC internal TimeStamp peripheral.
  720. * @param __HANDLE__ specifies the RTC handle.
  721. * @retval None
  722. */
  723. #define __HAL_RTC_INTERNAL_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ITSE))
  724. /**
  725. * @brief Get the selected RTC Internal Time Stamp's flag status.
  726. * @param __HANDLE__ specifies the RTC handle.
  727. * @param __FLAG__ specifies the RTC Internal Time Stamp Flag is pending or not.
  728. * This parameter can be:
  729. * @arg RTC_FLAG_ITSF
  730. * @retval None
  731. */
  732. #define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U)
  733. /**
  734. * @brief Clear the RTC Internal Time Stamp's pending flags.
  735. * @param __HANDLE__ specifies the RTC handle.
  736. * @param __FLAG__ specifies the RTC Internal Time Stamp Flag source to clear.
  737. * This parameter can be:
  738. * @arg RTC_FLAG_ITSF
  739. * @retval None
  740. */
  741. #define __HAL_RTC_INTERNAL_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
  742. #endif
  743. /**************************************************************************************************/
  744. /**
  745. * @}
  746. */
  747. /* --------------------------TAMPER/TIMESTAMP---------------------------------*/
  748. /** @defgroup RTCEx_Tamper_Timestamp EXTI RTC Tamper Timestamp EXTI
  749. * @{
  750. */
  751. /* TAMPER TIMESTAMP EXTI */
  752. /* --------------------- */
  753. /**
  754. * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line of core 1.
  755. * @retval None
  756. */
  757. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  758. /**
  759. * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line of core 2.
  760. * @retval None
  761. */
  762. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTIC2_ENABLE_IT() (EXTI->C2IMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  763. /**
  764. * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line of core 1.
  765. * @retval None
  766. */
  767. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
  768. /**
  769. * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line of core 2.
  770. * @retval None
  771. */
  772. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTIC2_DISABLE_IT() (EXTI->C2IMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
  773. /**
  774. * @brief Enable event on the RTC Tamper and Timestamp associated Exti line of core 1.
  775. * @retval None.
  776. */
  777. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  778. /**
  779. * @brief Enable event on the RTC Tamper and Timestamp associated Exti line of core 2.
  780. * @retval None.
  781. */
  782. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTIC2_ENABLE_EVENT() (EXTI->C2EMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  783. /**
  784. * @brief Disable event on the RTC Tamper and Timestamp associated Exti line of core 1.
  785. * @retval None.
  786. */
  787. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
  788. /**
  789. * @brief Disable event on the RTC Tamper and Timestamp associated Exti line of core 2.
  790. * @retval None.
  791. */
  792. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTIC2_DISABLE_EVENT() (EXTI->C2EMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
  793. /*-----------------*/
  794. /**
  795. * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
  796. * @retval None.
  797. */
  798. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  799. /**
  800. * @brief Disable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
  801. * @retval None.
  802. */
  803. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
  804. /**
  805. * @brief Enable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
  806. * @retval None.
  807. */
  808. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  809. /**
  810. * @brief Disable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
  811. * @retval None.
  812. */
  813. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
  814. /**
  815. * @brief Enable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
  816. * @retval None.
  817. */
  818. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
  819. __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE(); \
  820. __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE(); \
  821. } while(0U)
  822. /**
  823. * @brief Disable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
  824. * This parameter can be:
  825. * @retval None.
  826. */
  827. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
  828. __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE(); \
  829. __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE(); \
  830. } while(0U)
  831. /**
  832. * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not of core 1.
  833. * @retval Line Status.
  834. */
  835. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI->PR1 & RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  836. /**
  837. * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not of core 2.
  838. * @retval Line Status.
  839. */
  840. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTIC2_GET_FLAG() (EXTI->PR2 & RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  841. /**
  842. * @brief Clear the RTC Tamper and Timestamp associated Exti line flag of core 1.
  843. * @retval None.
  844. */
  845. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  846. /**
  847. * @brief Clear the RTC Tamper and Timestamp associated Exti line flag of core 2.
  848. * @retval None.
  849. */
  850. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTIC2_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  851. /**
  852. * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line
  853. * @retval None.
  854. */
  855. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT() (EXTI->SWIER1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  856. /**
  857. * @}
  858. */
  859. /* ------------------------------Calibration----------------------------------*/
  860. /** @defgroup RTCEx_Calibration RTC Calibration
  861. * @{
  862. */
  863. /**
  864. * @brief Enable the RTC calibration output.
  865. * @param __HANDLE__ specifies the RTC handle.
  866. * @retval None
  867. */
  868. #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE))
  869. /**
  870. * @brief Disable the calibration output.
  871. * @param __HANDLE__ specifies the RTC handle.
  872. * @retval None
  873. */
  874. #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE))
  875. /**
  876. * @brief Enable the clock reference detection.
  877. * @param __HANDLE__ specifies the RTC handle.
  878. * @retval None
  879. */
  880. #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON))
  881. /**
  882. * @brief Disable the clock reference detection.
  883. * @param __HANDLE__ specifies the RTC handle.
  884. * @retval None
  885. */
  886. #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON))
  887. /**
  888. * @brief Get the selected RTC shift operation's flag status.
  889. * @param __HANDLE__ specifies the RTC handle.
  890. * @param __FLAG__ specifies the RTC shift operation Flag is pending or not.
  891. * This parameter can be:
  892. * @arg RTC_FLAG_SHPF
  893. * @retval None
  894. */
  895. #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U)? 1U : 0U)
  896. /**
  897. * @}
  898. */
  899. /**
  900. * @}
  901. */
  902. /* Exported functions --------------------------------------------------------*/
  903. /** @defgroup RTCEx_Exported_Functions RTCEx Exported Functions
  904. * @{
  905. */
  906. /* RTC TimeStamp and Tamper functions *****************************************/
  907. /** @defgroup RTCEx_Exported_Functions_Group1 Extended RTC TimeStamp and Tamper functions
  908. * @{
  909. */
  910. HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
  911. HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
  912. HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc);
  913. #if defined(RTC_INTERNALTS_SUPPORT)
  914. HAL_StatusTypeDef HAL_RTCEx_SetInternalTimeStamp(RTC_HandleTypeDef *hrtc);
  915. HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTimeStamp(RTC_HandleTypeDef *hrtc);
  916. #endif
  917. HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format);
  918. HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
  919. HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
  920. HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper);
  921. void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc);
  922. #if defined(RTC_TAMPER1_SUPPORT)
  923. void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc);
  924. #endif /* RTC_TAMPER1_SUPPORT */
  925. void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc);
  926. #if defined(RTC_TAMPER3_SUPPORT)
  927. void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc);
  928. #endif /* RTC_TAMPER3_SUPPORT */
  929. void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc);
  930. HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  931. #if defined(RTC_TAMPER1_SUPPORT)
  932. HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  933. #endif /* RTC_TAMPER1_SUPPORT */
  934. HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  935. #if defined(RTC_TAMPER3_SUPPORT)
  936. HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  937. #endif /* RTC_TAMPER3_SUPPORT */
  938. /**
  939. * @}
  940. */
  941. /* RTC Wake-up functions ******************************************************/
  942. /** @defgroup RTCEx_Exported_Functions_Group2 Extended RTC Wake-up functions
  943. * @{
  944. */
  945. HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
  946. HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
  947. HAL_StatusTypeDef HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc);
  948. uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc);
  949. void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc);
  950. void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc);
  951. HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  952. /**
  953. * @}
  954. */
  955. /* Extended Control functions ************************************************/
  956. /** @defgroup RTCEx_Exported_Functions_Group3 Extended Peripheral Control functions
  957. * @{
  958. */
  959. void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
  960. uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
  961. HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue);
  962. HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
  963. HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput);
  964. HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc);
  965. HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc);
  966. HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc);
  967. HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc);
  968. HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc);
  969. /**
  970. * @}
  971. */
  972. /* Extended RTC features functions *******************************************/
  973. /** @defgroup RTCEx_Exported_Functions_Group4 Extended features functions
  974. * @{
  975. */
  976. void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc);
  977. HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  978. /**
  979. * @}
  980. */
  981. /**
  982. * @}
  983. */
  984. /* Private types -------------------------------------------------------------*/
  985. /* Private variables ---------------------------------------------------------*/
  986. /* Private constants ---------------------------------------------------------*/
  987. /** @defgroup RTCEx_Private_Constants RTCEx Private Constants
  988. * @{
  989. */
  990. /* Masks Definition */
  991. #if defined(RTC_TAMPER1_SUPPORT) && defined(RTC_TAMPER3_SUPPORT)
  992. #define RTC_FLAGS_MASK ((uint32_t) (RTC_FLAG_RECALPF | RTC_FLAG_TAMP3F | RTC_FLAG_TAMP2F | \
  993. RTC_FLAG_TAMP1F| RTC_FLAG_TSOVF | RTC_FLAG_TSF | \
  994. RTC_FLAG_WUTF | RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | \
  995. RTC_FLAG_INITF | RTC_FLAG_RSF | \
  996. RTC_FLAG_INITS | RTC_FLAG_SHPF | RTC_FLAG_WUTWF | \
  997. RTC_FLAG_ALRBWF | RTC_FLAG_ALRAWF))
  998. #define RTC_TAMPCR_TAMPXE ((uint32_t) (RTC_TAMPCR_TAMP3E | RTC_TAMPCR_TAMP2E | RTC_TAMPCR_TAMP1E))
  999. #define RTC_TAMPCR_TAMPXIE ((uint32_t) (RTC_TAMPER1_INTERRUPT | RTC_TAMPER2_INTERRUPT | \
  1000. RTC_TAMPER3_INTERRUPT | RTC_ALL_TAMPER_INTERRUPT))
  1001. #else
  1002. #define RTC_FLAGS_MASK ((uint32_t) (RTC_FLAG_RECALPF | RTC_FLAG_TAMP2F | \
  1003. RTC_FLAG_TSOVF | RTC_FLAG_TSF | RTC_FLAG_WUTF | \
  1004. RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | \
  1005. RTC_FLAG_INITF | RTC_FLAG_RSF | RTC_FLAG_INITS | \
  1006. RTC_FLAG_SHPF | RTC_FLAG_WUTWF |RTC_FLAG_ALRBWF | \
  1007. RTC_FLAG_ALRAWF))
  1008. #define RTC_TAMPCR_TAMPXE ((uint32_t) (RTC_TAMPCR_TAMP2E))
  1009. #define RTC_TAMPCR_TAMPXIE ((uint32_t) (RTC_TAMPER2_INTERRUPT | RTC_ALL_TAMPER_INTERRUPT))
  1010. #endif
  1011. #define RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT (EXTI_IMR1_IM18) /*!< External interrupt line 18 Connected to the RTC Tamper and Time Stamp events */
  1012. #define RTC_EXTI_LINE_WAKEUPTIMER_EVENT (EXTI_IMR1_IM19) /*!< External interrupt line 19 Connected to the RTC Wakeup event */
  1013. /**
  1014. * @}
  1015. */
  1016. /* Private macros ------------------------------------------------------------*/
  1017. /** @defgroup RTCEx_Private_Macros RTCEx Private Macros
  1018. * @{
  1019. */
  1020. /** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters
  1021. * @{
  1022. */
  1023. #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_OUTPUT_DISABLE) || \
  1024. ((OUTPUT) == RTC_OUTPUT_ALARMA) || \
  1025. ((OUTPUT) == RTC_OUTPUT_ALARMB) || \
  1026. ((OUTPUT) == RTC_OUTPUT_WAKEUP))
  1027. #define IS_RTC_BKP(BKP) ((BKP) < (uint32_t) RTC_BKP_NUMBER)
  1028. #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \
  1029. ((EDGE) == RTC_TIMESTAMPEDGE_FALLING))
  1030. #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & ((uint32_t)(0xFFFFFFFFU ^ RTC_TAMPCR_TAMPXE))) == 0x00U) && ((TAMPER) != 0U))
  1031. #define IS_RTC_TAMPER_INTERRUPT(INTERRUPT) ((((INTERRUPT) & (uint32_t)(0xFFFFFFFFU ^ RTC_TAMPCR_TAMPXIE)) == 0x00U) && ((INTERRUPT) != 0U))
  1032. #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_DEFAULT))
  1033. #define IS_RTC_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) || \
  1034. ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \
  1035. ((TRIGGER) == RTC_TAMPERTRIGGER_LOWLEVEL) || \
  1036. ((TRIGGER) == RTC_TAMPERTRIGGER_HIGHLEVEL))
  1037. #define IS_RTC_TAMPER_ERASE_MODE(MODE) (((MODE) == RTC_TAMPER_ERASE_BACKUP_ENABLE) || \
  1038. ((MODE) == RTC_TAMPER_ERASE_BACKUP_DISABLE))
  1039. #define IS_RTC_TAMPER_MASKFLAG_STATE(STATE) (((STATE) == RTC_TAMPERMASK_FLAG_ENABLE) || \
  1040. ((STATE) == RTC_TAMPERMASK_FLAG_DISABLE))
  1041. #define IS_RTC_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TAMPERFILTER_DISABLE) || \
  1042. ((FILTER) == RTC_TAMPERFILTER_2SAMPLE) || \
  1043. ((FILTER) == RTC_TAMPERFILTER_4SAMPLE) || \
  1044. ((FILTER) == RTC_TAMPERFILTER_8SAMPLE))
  1045. #define IS_RTC_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \
  1046. ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \
  1047. ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \
  1048. ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \
  1049. ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \
  1050. ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \
  1051. ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \
  1052. ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256))
  1053. #define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \
  1054. ((DURATION) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \
  1055. ((DURATION) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \
  1056. ((DURATION) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK))
  1057. #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \
  1058. ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE))
  1059. #define IS_RTC_TAMPER_PULLUP_STATE(STATE) (((STATE) == RTC_TAMPER_PULLUP_ENABLE) || \
  1060. ((STATE) == RTC_TAMPER_PULLUP_DISABLE))
  1061. #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \
  1062. ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \
  1063. ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \
  1064. ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \
  1065. ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \
  1066. ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS))
  1067. #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= RTC_WUTR_WUT)
  1068. #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \
  1069. ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \
  1070. ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC))
  1071. #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \
  1072. ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET))
  1073. /** @defgroup RTCEx_Smooth_calib_Minus_pulses_Definitions RTCEx Smooth calib Minus pulses Definitions
  1074. * @{
  1075. */
  1076. #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= RTC_CALR_CALM)
  1077. /**
  1078. * @}
  1079. */
  1080. #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \
  1081. ((SEL) == RTC_SHIFTADD1S_SET))
  1082. /** @defgroup RTCEx_Substract_Fraction_Of_Second_Value RTCEx Substract Fraction Of Second Value
  1083. * @{
  1084. */
  1085. #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= RTC_SHIFTR_SUBFS)
  1086. /**
  1087. * @}
  1088. */
  1089. #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \
  1090. ((OUTPUT) == RTC_CALIBOUTPUT_1HZ))
  1091. /**
  1092. * @}
  1093. */
  1094. /**
  1095. * @}
  1096. */
  1097. /**
  1098. * @}
  1099. */
  1100. /**
  1101. * @}
  1102. */
  1103. #ifdef __cplusplus
  1104. }
  1105. #endif
  1106. #endif /* STM32WBxx_HAL_RTC_EX_H */
  1107. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/