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