STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
stm32h7xx_hal_rtc_ex.h
Go to the documentation of this file.
1/**
2 ******************************************************************************
3 * @file stm32h7xx_hal_rtc_ex.h
4 * @author MCD Application Team
5 * @brief Header file of RTC HAL Extension module.
6 ******************************************************************************
7 * @attention
8 *
9 * Copyright (c) 2017 STMicroelectronics.
10 * All rights reserved.
11 *
12 * This software is licensed under terms that can be found in the LICENSE file
13 * in the root directory of this software component.
14 * If no LICENSE file comes with this software, it is provided AS-IS.
15 *
16 ******************************************************************************
17 */
18
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_RTC_EX_H
21#define STM32H7xx_HAL_RTC_EX_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif /* __cplusplus */
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
30/** @addtogroup STM32H7xx_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/** @defgroup RTCEx_Tamper_structure_definition RTC Tamper structure definition
45 * @{
46 */
47typedef 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 This parameter is not applicable to the STM32H723/33, STM32H725/35 and STM32H730
61 devices, and has been kept for backward compatibility */
62
63 uint32_t MaskFlag; /*!< Specifies the Tamper Flag masking.
64 This parameter can be a value of @ref RTCEx_Tamper_MaskFlag_Definitions
65 This parameter is not applicable to the STM32H723/33, STM32H725/35 and STM32H730
66 devices, and has been kept for backward compatibility */
67
68 uint32_t Filter; /*!< Specifies the TAMP Filter Tamper.
69 This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */
70
71 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency.
72 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */
73
74 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration .
75 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */
76
77 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp .
78 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */
79
80 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection.
81 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */
83/**
84 * @}
85 */
86
87#if defined(TAMP)
88/** @defgroup RTCEx_Internal_Tamper_structure_definition RTCEx Internal Tamper structure definition
89 * @{
90 */
91typedef struct
92{
93 uint32_t IntTamper; /*!< Specifies the Internal Tamper Pin.
94 This parameter can be a value of @ref RTCEx_Internal_Tamper_Pins_Definitions */
95
96 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection.
97 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */
98} RTC_InternalTamperTypeDef;
99/**
100 * @}
101 */
102
103/** @defgroup RTCEx_Active_Seed_Size Seed size Definitions
104 * @{
105 */
106#define RTC_ATAMP_SEED_NB_UINT32 4U
107/**
108 * @}
109 */
110
111/** @defgroup RTCEx_Active_Tampers_Number Active Tampers number Definitions
112 * @{
113 */
114#define RTC_TAMP_NB 3u
115/**
116 * @}
117 */
118
119/** @defgroup RTCEx_ActiveTamper_structures_definition RTC Active Tamper structures definitions
120 * @{
121 */
122typedef struct
123{
124 uint32_t Enable; /*!< Specifies the Tamper input is active.
125 This parameter can be a value of @ref RTCEx_ActiveTamper_Enable */
126
127 uint32_t Interrupt; /*!< Specifies the interrupt mode
128 This parameter can be a value of @ref RTCEx_ActiveTamper_Interrupt */
129
130 uint32_t Output; /*!< Specifies the TAMP output to be compared with.
131 The same output can be used for several tamper inputs.
132 This parameter can be a value of @ref RTCEx_ActiveTamper_Sel */
133
134 uint32_t NoErase; /*!< Specifies the Tamper no erase mode.
135 This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp_Definitions */
136
137 uint32_t MaskFlag; /*!< Specifies the Tamper Flag masking.
138 This parameter can be a value of @ref RTCEx_Tamper_MaskFlag_Definitions */
139
140} RTC_ATampInputTypeDef;
141
142
143typedef struct
144{
145 uint32_t ActiveFilter; /*!< Specifies the Active tamper filter enable.
146 This parameter can be a value of @ref RTCEx_ActiveTamper_Filter */
147
148 uint32_t ActiveAsyncPrescaler; /*!< Specifies the Active Tamper asynchronous Prescaler clock.
149 This parameter can be a value of @ref RTCEx_ActiveTamper_Async_prescaler */
150
151 uint32_t TimeStampOnTamperDetection; /*!< Specifies the timeStamp on tamper detection.
152 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */
153
154 uint32_t ActiveOutputChangePeriod; /*!< Specifies the Active Tamper output change period .
155 This parameter can be a value from 0 to 7. */
156
157 uint32_t Seed[RTC_ATAMP_SEED_NB_UINT32];
158 /*!< Specifies the Active Tamper RNG Seed value .
159 This parameter can be a value from 0 to (2^32-1) */
160
161 RTC_ATampInputTypeDef TampInput[RTC_TAMP_NB];
162 /*!< Specifies configuration of all active tampers.
163 The index of TampInput[RTC_TAMP_NB] can be a value of RTCEx_ActiveTamper_Sel */
164} RTC_ActiveTampersTypeDef;
165
166/**
167 * @}
168 */
169#endif /* TAMP */
170
171/**
172 * @}
173 */
174
175/* Exported constants --------------------------------------------------------*/
176
177/** @defgroup RTCEx_Exported_Constants RTC Exported Constants
178 * @{
179 */
180
181/* ========================================================================== */
182/* ##### Extended RTC Backup registers exported constants ##### */
183/* ========================================================================== */
184
185/** @defgroup RTCEx_Backup_Registers_Number_Definitions RTC Backup Registers Number Definitions
186 * @{
187 */
188#if defined(TAMP)
189#define BKP_REG_NUMBER TAMP_BKP_NUMBER
190#else
191#define BKP_REG_NUMBER RTC_BKP_NUMBER
192#endif /* TAMP */
193/**
194 * @}
195 */
196
197/** @defgroup RTCEx_Backup_Registers_Definitions RTC Backup Registers Definitions
198 * @{
199 */
200#define RTC_BKP_DR0 0x00u
201#define RTC_BKP_DR1 0x01u
202#define RTC_BKP_DR2 0x02u
203#define RTC_BKP_DR3 0x03u
204#define RTC_BKP_DR4 0x04u
205#define RTC_BKP_DR5 0x05u
206#define RTC_BKP_DR6 0x06u
207#define RTC_BKP_DR7 0x07u
208#define RTC_BKP_DR8 0x08u
209#define RTC_BKP_DR9 0x09u
210#define RTC_BKP_DR10 0x0Au
211#define RTC_BKP_DR11 0x0Bu
212#define RTC_BKP_DR12 0x0Cu
213#define RTC_BKP_DR13 0x0Du
214#define RTC_BKP_DR14 0x0Eu
215#define RTC_BKP_DR15 0x0Fu
216#define RTC_BKP_DR16 0x10u
217#define RTC_BKP_DR17 0x11u
218#define RTC_BKP_DR18 0x12u
219#define RTC_BKP_DR19 0x13u
220#define RTC_BKP_DR20 0x14u
221#define RTC_BKP_DR21 0x15u
222#define RTC_BKP_DR22 0x16u
223#define RTC_BKP_DR23 0x17u
224#define RTC_BKP_DR24 0x18u
225#define RTC_BKP_DR25 0x19u
226#define RTC_BKP_DR26 0x1Au
227#define RTC_BKP_DR27 0x1Bu
228#define RTC_BKP_DR28 0x1Cu
229#define RTC_BKP_DR29 0x1Du
230#define RTC_BKP_DR30 0x1Eu
231#define RTC_BKP_DR31 0x1Fu
232/**
233 * @}
234 */
235
236/* ========================================================================== */
237/* ##### RTC TimeStamp exported constants ##### */
238/* ========================================================================== */
239
240/** @defgroup RTCEx_TimeStamp_Edges_definitions RTC TimeStamp Edges Definitions
241 *
242 * @{
243 */
244#define RTC_TIMESTAMPEDGE_RISING 0x00000000u
245#define RTC_TIMESTAMPEDGE_FALLING RTC_CR_TSEDGE
246/**
247 * @}
248 */
249
250/** @defgroup RTCEx_TimeStamp_Pin_Selection RTC TimeStamp Pin Selection
251 * @{
252 */
253#define RTC_TIMESTAMPPIN_DEFAULT 0x00000000u
254/**
255 * @}
256 */
257
258
259/* ========================================================================== */
260/* ##### RTC Tamper exported constants ##### */
261/* ========================================================================== */
262
263/** @defgroup RTCEx_Tamper_Pins_Definitions RTC Tamper Pins Definitions
264 * @{
265 */
266#if defined(TAMP)
267#define RTC_TAMPER_1 TAMP_CR1_TAMP1E
268#define RTC_TAMPER_2 TAMP_CR1_TAMP2E
269#define RTC_TAMPER_3 TAMP_CR1_TAMP3E
270#else
271#define RTC_TAMPER_1 RTC_TAMPCR_TAMP1E
272#if defined(RTC_TAMPER2_SUPPORT)
273#define RTC_TAMPER_2 RTC_TAMPCR_TAMP2E
274#endif /* RTC_TAMPER2_SUPPORT */
275#define RTC_TAMPER_3 RTC_TAMPCR_TAMP3E
276#endif /* TAMP */
277
278#if defined(RTC_TAMPER2_SUPPORT)
279#define RTC_TAMPER_ALL (RTC_TAMPER_1 | RTC_TAMPER_2 | RTC_TAMPER_3)
280#else
281#define RTC_TAMPER_ALL (RTC_TAMPER_1 | RTC_TAMPER_3)
282#endif /* RTC_TAMPER2_SUPPORT */
283/**
284 * @}
285 */
286
287/** @defgroup RTCEx_Tamper_Interrupt_Definitions RTC Tamper Interrupts Definitions
288 * @{
289 */
290#if defined(TAMP)
291#define RTC_IT_TAMP1 TAMP_IER_TAMP1IE /*!< Enable Tamper 1 Interrupt */
292#define RTC_IT_TAMP2 TAMP_IER_TAMP2IE /*!< Enable Tamper 2 Interrupt */
293#define RTC_IT_TAMP3 TAMP_IER_TAMP3IE /*!< Enable Tamper 3 Interrupt */
294#else
295#if defined(RTC_TAMPxIE_SUPPORT)
296#define RTC_IT_TAMP1 RTC_TAMPCR_TAMP1IE /*!< Enable Tamper 1 Interrupt */
297#define RTC_IT_TAMP2 RTC_TAMPCR_TAMP2IE /*!< Enable Tamper 2 Interrupt */
298#define RTC_IT_TAMP3 RTC_TAMPCR_TAMP3IE /*!< Enable Tamper 3 Interrupt */
299#else
300#define RTC_IT_TAMP1 RTC_TAFCR_TAMPIE /*!< Enable Tamper Interrupt */
301#endif /* RTC_TAMPxIE_SUPPORT */
302#endif /* TAMP */
303
304#if defined(TAMP)
305#define RTC_IT_TAMP 0x00000000u /*!< No such feature in RTC3 */
306#define RTC_IT_TAMPALL (RTC_IT_TAMP1 | RTC_IT_TAMP2 | RTC_IT_TAMP3)
307#else
308#define RTC_IT_TAMP RTC_TAMPCR_TAMPIE /*!< Enable all Tamper Interrupts */
309#define RTC_IT_TAMPALL RTC_IT_TAMP
310#endif /* TAMP */
311/**
312 * @}
313 */
314
315/** @defgroup RTCEx_Internal_Tamper_Pins_Definitions RTCEx Internal Tamper Pins Definition
316 * @{
317 */
318#if defined(TAMP)
319#define RTC_INT_TAMPER_1 TAMP_CR1_ITAMP1E
320#define RTC_INT_TAMPER_2 TAMP_CR1_ITAMP2E
321#define RTC_INT_TAMPER_3 TAMP_CR1_ITAMP3E
322#define RTC_INT_TAMPER_4 TAMP_CR1_ITAMP4E
323#define RTC_INT_TAMPER_5 TAMP_CR1_ITAMP5E
324#define RTC_INT_TAMPER_6 TAMP_CR1_ITAMP6E
325#define RTC_INT_TAMPER_8 TAMP_CR1_ITAMP8E
326
327#define RTC_INT_TAMPER_ALL (RTC_INT_TAMPER_1 | RTC_INT_TAMPER_2 |\
328 RTC_INT_TAMPER_3 | RTC_INT_TAMPER_4 |\
329 RTC_INT_TAMPER_5 | RTC_INT_TAMPER_6 |\
330 RTC_INT_TAMPER_8)
331#endif /* TAMP */
332/**
333 * @}
334 */
335
336/** @defgroup RTCEx_Internal_Tamper_Interrupt_Definitions RTC Internal Tamper Interrupt
337 * @{
338 */
339#if defined(TAMP)
340#define RTC_INTERNAL_TAMPER1_INTERRUPT TAMP_IER_ITAMP1IE /*!< Enable Internal Tamper 1 Interrupt */
341#define RTC_INTERNAL_TAMPER2_INTERRUPT TAMP_IER_ITAMP2IE /*!< Enable Internal Tamper 2 Interrupt */
342#define RTC_INTERNAL_TAMPER3_INTERRUPT TAMP_IER_ITAMP3IE /*!< Enable Internal Tamper 3 Interrupt */
343#define RTC_INTERNAL_TAMPER4_INTERRUPT TAMP_IER_ITAMP4IE /*!< Enable Internal Tamper 4 Interrupt */
344#define RTC_INTERNAL_TAMPER5_INTERRUPT TAMP_IER_ITAMP5IE /*!< Enable Internal Tamper 5 Interrupt */
345#define RTC_INTERNAL_TAMPER6_INTERRUPT TAMP_IER_ITAMP6IE /*!< Enable Internal Tamper 6 Interrupt */
346#define RTC_INTERNAL_TAMPER8_INTERRUPT TAMP_IER_ITAMP8IE /*!< Enable Internal Tamper 8 Interrupt */
347#endif /* TAMP */
348/**
349 * @}
350 */
351
352/** @defgroup RTCEx_Tamper_Trigger_Definitions RTC Tamper Triggers Definitions
353 * @{
354 */
355#define RTC_TAMPERTRIGGER_RISINGEDGE 0x01u /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */
356#define RTC_TAMPERTRIGGER_FALLINGEDGE 0x02u /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */
357#define RTC_TAMPERTRIGGER_LOWLEVEL 0x04u /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */
358#define RTC_TAMPERTRIGGER_HIGHLEVEL 0x08u /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */
359
360#if defined(TAMP)
361#define RTC_TAMPER_1_TRIGGER TAMP_CR2_TAMP1TRG
362#define RTC_TAMPER_2_TRIGGER TAMP_CR2_TAMP2TRG
363#define RTC_TAMPER_3_TRIGGER TAMP_CR2_TAMP3TRG
364#else
365#define RTC_TAMPER_1_TRIGGER RTC_TAMPCR_TAMP1TRG
366#if defined(RTC_TAMPER2_SUPPORT)
367#define RTC_TAMPER_2_TRIGGER RTC_TAMPCR_TAMP2TRG
368#endif /* RTC_TAMPER2_SUPPORT */
369#define RTC_TAMPER_3_TRIGGER RTC_TAMPCR_TAMP3TRG
370#endif /* TAMP */
371
372#if defined(RTC_TAMPER2_SUPPORT)
373#define RTC_TAMPER_X_TRIGGER (RTC_TAMPER_1_TRIGGER |\
374 RTC_TAMPER_2_TRIGGER |\
375 RTC_TAMPER_3_TRIGGER)
376#else
377#define RTC_TAMPER_X_TRIGGER (RTC_TAMPER_1_TRIGGER |\
378 RTC_TAMPER_3_TRIGGER)
379#endif /* RTC_TAMPER2_SUPPORT */
380/**
381 * @}
382 */
383
384/** @defgroup RTCEx_Tamper_EraseBackUp_Definitions RTC Tamper EraseBackUp Definitions
385* @{
386*/
387#if defined(TAMP)
388#define RTC_TAMPER_ERASE_BACKUP_ENABLE 0x00u
389#define RTC_TAMPER_ERASE_BACKUP_DISABLE 0x01u
390#else
391#if defined(RTC_TAMPNOERASE_SUPPORT)
392#define RTC_TAMPER_ERASE_BACKUP_ENABLE 0x00u
393#define RTC_TAMPER_ERASE_BACKUP_DISABLE RTC_TAMPCR_TAMP1NOERASE
394#else
395/*!< These values are not applicable to the STM32H723/33, STM32H725/35 and STM32H730
396 devices, and have been kept for backward compatibility */
397#define RTC_TAMPER_ERASE_BACKUP_ENABLE 0x00u
398#define RTC_TAMPER_ERASE_BACKUP_DISABLE 0x01u
399#endif /* RTC_TAMPNOERASE_SUPPORT */
400#endif /* TAMP */
401
402#if defined(TAMP)
403#define RTC_DISABLE_BKP_ERASE_ON_TAMPER_1 TAMP_CR2_TAMP1NOERASE
404#define RTC_DISABLE_BKP_ERASE_ON_TAMPER_2 TAMP_CR2_TAMP2NOERASE
405#define RTC_DISABLE_BKP_ERASE_ON_TAMPER_3 TAMP_CR2_TAMP3NOERASE
406#else
407#if defined(RTC_TAMPNOERASE_SUPPORT)
408#define RTC_DISABLE_BKP_ERASE_ON_TAMPER_1 RTC_TAMPCR_TAMP1NOERASE
409#define RTC_DISABLE_BKP_ERASE_ON_TAMPER_2 RTC_TAMPCR_TAMP2NOERASE
410#define RTC_DISABLE_BKP_ERASE_ON_TAMPER_3 RTC_TAMPCR_TAMP3NOERASE
411#endif /* RTC_TAMPNOERASE_SUPPORT */
412#endif /* TAMP */
413
414#if defined(RTC_TAMPNOERASE_SUPPORT)
415#define RTC_DISABLE_BKP_ERASE_ON_TAMPER_MASK (RTC_DISABLE_BKP_ERASE_ON_TAMPER_1 |\
416 RTC_DISABLE_BKP_ERASE_ON_TAMPER_2 |\
417 RTC_DISABLE_BKP_ERASE_ON_TAMPER_3)
418#endif /* RTC_TAMPNOERASE_SUPPORT */
419/**
420 * @}
421 */
422
423/** @defgroup RTCEx_Tamper_MaskFlag_Definitions RTC Tamper Mask Flag Definitions
424* @{
425*/
426#if defined(TAMP)
427#define RTC_TAMPERMASK_FLAG_DISABLE 0x00u
428#define RTC_TAMPERMASK_FLAG_ENABLE 0x01u
429#else
430#if defined(RTC_TAMPMASKFLAG_SUPPORT)
431#define RTC_TAMPERMASK_FLAG_DISABLE 0x00u
432#define RTC_TAMPERMASK_FLAG_ENABLE RTC_TAMPCR_TAMP1MF
433#else
434/*!< These values are not applicable to the STM32H723/33, STM32H725/35 and STM32H730
435 devices, and have been kept for backward compatibility */
436#define RTC_TAMPERMASK_FLAG_DISABLE 0x00u
437#define RTC_TAMPERMASK_FLAG_ENABLE 0x01u
438#endif /* RTC_TAMPMASKFLAG_SUPPORT */
439#endif /* TAMP */
440
441#if defined(TAMP)
442#define RTC_TAMPER_1_MASK_FLAG TAMP_CR2_TAMP1MSK
443#define RTC_TAMPER_2_MASK_FLAG TAMP_CR2_TAMP2MSK
444#define RTC_TAMPER_3_MASK_FLAG TAMP_CR2_TAMP3MSK
445#else
446#if defined(RTC_TAMPMASKFLAG_SUPPORT)
447#define RTC_TAMPER_1_MASK_FLAG RTC_TAMPCR_TAMP1MF
448#define RTC_TAMPER_2_MASK_FLAG RTC_TAMPCR_TAMP2MF
449#define RTC_TAMPER_3_MASK_FLAG RTC_TAMPCR_TAMP3MF
450#endif /* RTC_TAMPMASKFLAG_SUPPORT */
451#endif /* TAMP */
452
453#if defined(RTC_TAMPMASKFLAG_SUPPORT)
454#define RTC_TAMPER_X_MASK_FLAG (RTC_TAMPER_1_MASK_FLAG |\
455 RTC_TAMPER_2_MASK_FLAG |\
456 RTC_TAMPER_3_MASK_FLAG)
457#endif /* RTC_TAMPMASKFLAG_SUPPORT */
458/**
459 * @}
460 */
461
462/** @defgroup RTCEx_Tamper_Filter_Definitions RTC Tamper Filter Definitions
463 * @{
464 */
465#if defined(TAMP)
466#define RTC_TAMPERFILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */
467
468#define RTC_TAMPERFILTER_2SAMPLE TAMP_FLTCR_TAMPFLT_0 /*!< Tamper is activated after 2
469 consecutive samples at the active level */
470#define RTC_TAMPERFILTER_4SAMPLE TAMP_FLTCR_TAMPFLT_1 /*!< Tamper is activated after 4
471 consecutive samples at the active level */
472#define RTC_TAMPERFILTER_8SAMPLE TAMP_FLTCR_TAMPFLT /*!< Tamper is activated after 8
473 consecutive samples at the active level */
474#define RTC_TAMPERFILTER_MASK TAMP_FLTCR_TAMPFLT /*!< Masking all bits except those of
475 field TAMPFLT[1:0]. */
476#else
477#define RTC_TAMPERFILTER_DISABLE 0x00000000u /*!< Tamper filter is disabled */
478
479#define RTC_TAMPERFILTER_2SAMPLE RTC_TAMPCR_TAMPFLT_0 /*!< Tamper is activated after 2
480 consecutive samples at the active level */
481#define RTC_TAMPERFILTER_4SAMPLE RTC_TAMPCR_TAMPFLT_1 /*!< Tamper is activated after 4
482 consecutive samples at the active level */
483#define RTC_TAMPERFILTER_8SAMPLE RTC_TAMPCR_TAMPFLT /*!< Tamper is activated after 8
484 consecutive samples at the active level. */
485#define RTC_TAMPERFILTER_MASK RTC_TAMPCR_TAMPFLT /*!< Masking all bits except those of
486 field TAMPFLT[1:0]. */
487#endif /* TAMP */
488/**
489 * @}
490 */
491
492/** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTC Tamper Sampling Frequencies Definitions
493 * @{
494 */
495#if defined(TAMP)
496#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 0x00000000U /*!< Each of the tamper inputs are sampled
497 with a frequency = RTCCLK / 32768 */
498#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 TAMP_FLTCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled
499 with a frequency = RTCCLK / 16384 */
500#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 TAMP_FLTCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled
501 with a frequency = RTCCLK / 8192 */
502#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled
503 with a frequency = RTCCLK / 4096 */
504#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 TAMP_FLTCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled
505 with a frequency = RTCCLK / 2048 */
506#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled
507 with a frequency = RTCCLK / 1024 */
508#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 (TAMP_FLTCR_TAMPFREQ_1 | TAMP_FLTCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled
509 with a frequency = RTCCLK / 512 */
510#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 TAMP_FLTCR_TAMPFREQ /*!< Each of the tamper inputs are sampled
511 with a frequency = RTCCLK / 256 */
512#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_MASK TAMP_FLTCR_TAMPFREQ /*!< Masking all bits except those of
513 field TAMPFREQ[2:0]*/
514#else
515#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 0x00000000u /*!< Each of the tamper inputs are sampled
516 with a frequency = RTCCLK / 32768 */
517#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 RTC_TAMPCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled
518 with a frequency = RTCCLK / 16384 */
519#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 RTC_TAMPCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled
520 with a frequency = RTCCLK / 8192 */
521#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled
522 with a frequency = RTCCLK / 4096 */
523#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 RTC_TAMPCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled
524 with a frequency = RTCCLK / 2048 */
525#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled
526 with a frequency = RTCCLK / 1024 */
527#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 (RTC_TAMPCR_TAMPFREQ_1 | RTC_TAMPCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled
528 with a frequency = RTCCLK / 512 */
529#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 RTC_TAMPCR_TAMPFREQ /*!< Each of the tamper inputs are sampled
530 with a frequency = RTCCLK / 256 */
531#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_MASK RTC_TAMPCR_TAMPFREQ /*!< Masking all bits except those of
532 field TAMPFREQ[2:0]*/
533#endif /* TAMP */
534/**
535 * @}
536 */
537
538/** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTC Tamper Pin Precharge Duration Definitions
539 * @{
540 */
541#if defined(TAMP)
542#define RTC_TAMPERPRECHARGEDURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before
543 sampling during 1 RTCCLK cycle */
544#define RTC_TAMPERPRECHARGEDURATION_2RTCCLK TAMP_FLTCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before
545 sampling during 2 RTCCLK cycles */
546#define RTC_TAMPERPRECHARGEDURATION_4RTCCLK TAMP_FLTCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before
547 sampling during 4 RTCCLK cycles */
548#define RTC_TAMPERPRECHARGEDURATION_8RTCCLK TAMP_FLTCR_TAMPPRCH /*!< Tamper pins are pre-charged before
549 sampling during 8 RTCCLK cycles */
550#define RTC_TAMPERPRECHARGEDURATION_MASK TAMP_FLTCR_TAMPPRCH /*!< Masking all bits except those of
551 field TAMPPRCH[1:0] */
552#else
553#define RTC_TAMPERPRECHARGEDURATION_1RTCCLK 0x00000000u /*!< Tamper pins are pre-charged before
554 sampling during 1 RTCCLK cycle */
555#define RTC_TAMPERPRECHARGEDURATION_2RTCCLK RTC_TAMPCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before
556 sampling during 2 RTCCLK cycles */
557#define RTC_TAMPERPRECHARGEDURATION_4RTCCLK RTC_TAMPCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before
558 sampling during 4 RTCCLK cycles */
559#define RTC_TAMPERPRECHARGEDURATION_8RTCCLK RTC_TAMPCR_TAMPPRCH /*!< Tamper pins are pre-charged before
560 sampling during 8 RTCCLK cycles */
561#define RTC_TAMPERPRECHARGEDURATION_MASK RTC_TAMPCR_TAMPPRCH /*!< Masking all bits except those of
562 field TAMPPRCH[1:0] */
563#endif /* TAMP */
564/**
565 * @}
566 */
567
568/** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTC Tamper TimeStamp On Tamper Detection Definitions
569 * @{
570 */
571#if defined(TAMP)
572#define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE 0x00000000u /*!< TimeStamp on Tamper Detection event is not saved */
573#define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE RTC_CR_TAMPTS /*!< TimeStamp on Tamper Detection event saved */
574#define RTC_TIMESTAMPONTAMPERDETECTION_MASK RTC_CR_TAMPTS /*!< Masking all bits except bit TAMPTS */
575#else
576#define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE 0x00000000u /*!< TimeStamp on Tamper Detection event is not saved */
577#define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE RTC_TAMPCR_TAMPTS /*!< TimeStamp on Tamper Detection event saved */
578#define RTC_TIMESTAMPONTAMPERDETECTION_MASK RTC_TAMPCR_TAMPTS /*!< Masking all bits except bit TAMPTS */
579#endif /* TAMP */
580/**
581 * @}
582 */
583
584/** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTC Tamper Pull Up Definitions
585 * @{
586 */
587#if defined(TAMP)
588#define RTC_TAMPER_PULLUP_ENABLE 0x00000000u /*!< Tamper pins are pre-charged before sampling */
589#define RTC_TAMPER_PULLUP_DISABLE TAMP_FLTCR_TAMPPUDIS /*!< Tamper pins pre-charge is disabled */
590#define RTC_TAMPER_PULLUP_MASK TAMP_FLTCR_TAMPPUDIS /*!< Maskin all bits except bit TAMPPUDIS */
591#else
592#define RTC_TAMPER_PULLUP_ENABLE 0x00000000u /*!< TimeStamp on Tamper Detection event saved */
593#define RTC_TAMPER_PULLUP_DISABLE RTC_TAMPCR_TAMPPUDIS /*!< TimeStamp on Tamper Detection event is not saved */
594#define RTC_TAMPER_PULLUP_MASK RTC_TAMPCR_TAMPPUDIS /*!< Maskin all bits except bit TAMPPUDIS */
595#endif /* TAMP */
596/**
597 * @}
598 */
599
600/** @defgroup RTCEx_Tamper_DetectionOutput_Definitions RTC Tamper Detection Output Definitions
601 * @{
602 */
603#if defined(TAMP)
604#define RTC_TAMPERDETECTIONOUTPUT_DISABLE 0x00000000u /*!< The tamper flag is not routed on TAMPALRM */
605#define RTC_TAMPERDETECTIONOUTPUT_ENABLE RTC_CR_TAMPOE /*!< The tamper flag is routed on TAMPALRM combined with the signal
606 provided by OSEL and with the polarity provided by POL */
607#endif /* TAMP */
608/**
609 * @}
610 */
611
612/** @defgroup RTC_Tamper_Flags_Definitions RTC Tamper Flags Definitions
613 * @{
614 */
615#if defined(TAMP)
616#define RTC_FLAG_TAMP1F TAMP_SR_TAMP1F
617#define RTC_FLAG_TAMP2F TAMP_SR_TAMP2F
618#define RTC_FLAG_TAMP3F TAMP_SR_TAMP3F
619#else
620#define RTC_FLAG_TAMP1F RTC_ISR_TAMP1F
621#if defined(RTC_TAMPER2_SUPPORT)
622#define RTC_FLAG_TAMP2F RTC_ISR_TAMP2F
623#endif /* RTC_TAMPER2_SUPPORT */
624#define RTC_FLAG_TAMP3F RTC_ISR_TAMP3F
625#endif /* TAMP */
626/**
627 * @}
628 */
629
630/** @defgroup RTCEx_ActiveTamper_Enable RTCEx_ActiveTamper_Enable Definitions
631 * @{
632 */
633#define RTC_ATAMP_ENABLE 1u
634#define RTC_ATAMP_DISABLE 0u
635/**
636 * @}
637 */
638
639/** @defgroup RTCEx_ActiveTamper_Interrupt RTCEx_ActiveTamper_Interrupt Definitions
640 * @{
641 */
642#define RTC_ATAMP_INTERRUPT_ENABLE 1u
643#define RTC_ATAMP_INTERRUPT_DISABLE 0u
644/**
645 * @}
646 */
647
648/** @defgroup RTCEx_ActiveTamper_Filter RTCEx_ActiveTamper_Filter Definitions
649 * @{
650 */
651#define RTC_ATAMP_FILTER_ENABLE TAMP_ATCR1_FLTEN
652#define RTC_ATAMP_FILTER_DISABLE 0u
653/**
654 * @}
655 */
656
657/** @defgroup RTCEx_ActiveTamper_Async_prescaler RTC Active_Tamper_Asynchronous_Prescaler clock Definitions
658 * @{
659 */
660#define RTC_ATAMP_ASYNCPRES_RTCCLK 0u /*!< RTCCLK */
661#define RTC_ATAMP_ASYNCPRES_RTCCLK_2 TAMP_ATCR1_ATCKSEL_0 /*!< RTCCLK/2 */
662#define RTC_ATAMP_ASYNCPRES_RTCCLK_4 TAMP_ATCR1_ATCKSEL_1 /*!< RTCCLK/4 */
663#define RTC_ATAMP_ASYNCPRES_RTCCLK_8 (TAMP_ATCR1_ATCKSEL_1 | TAMP_ATCR1_ATCKSEL_0) /*!< RTCCLK/8 */
664#define RTC_ATAMP_ASYNCPRES_RTCCLK_16 TAMP_ATCR1_ATCKSEL_2 /*!< RTCCLK/16 */
665#define RTC_ATAMP_ASYNCPRES_RTCCLK_32 (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_0) /*!< RTCCLK/32 */
666#define RTC_ATAMP_ASYNCPRES_RTCCLK_64 (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_1) /*!< RTCCLK/64 */
667#define RTC_ATAMP_ASYNCPRES_RTCCLK_128 (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_1 | TAMP_ATCR1_ATCKSEL_0) /*!< RTCCLK/128 */
668/**
669 * @}
670 */
671
672/** @defgroup RTCEx_ActiveTamper_Sel RTC Active Tamper selection Definition
673 * @{
674 */
675#define RTC_ATAMP_1 0u /*!< Tamper 1 */
676#define RTC_ATAMP_2 1u /*!< Tamper 2 */
677#define RTC_ATAMP_3 2u /*!< Tamper 3 */
678#define RTC_ATAMP_4 3u /*!< Tamper 4 */
679#define RTC_ATAMP_5 4u /*!< Tamper 5 */
680#define RTC_ATAMP_6 5u /*!< Tamper 6 */
681#define RTC_ATAMP_7 6u /*!< Tamper 7 */
682#define RTC_ATAMP_8 7u /*!< Tamper 8 */
683/**
684 * @}
685 */
686
687/** @defgroup RTCEx_MonotonicCounter_Instance RTCEx Monotonic Counter Instance Definition
688 * @{
689 */
690#define RTC_MONOTONIC_COUNTER_1 0u /*!< Monotonic counter 1 */
691/**
692 * @}
693 */
694
695/** @defgroup RTCEx_Tamper_Registers_Offset RTC Tamper Registers Offset
696 * @{
697 */
698#if defined(TAMP)
699/* Add this offset to RTC registers base address to reach TAMP registers base address. */
700#define TAMP_OFFSET (TAMP_BASE - RTC_BASE)
701#endif /* TAMP */
702/**
703 * @}
704 */
705
706/* ========================================================================== */
707/* ##### RTC Wake-up exported constants ##### */
708/* ========================================================================== */
709
710/** @defgroup RTCEx_Wakeup_Timer_Definitions RTC Wakeup Timer Definitions
711 * @{
712 */
713#define RTC_WAKEUPCLOCK_RTCCLK_DIV16 0x00000000u
714#define RTC_WAKEUPCLOCK_RTCCLK_DIV8 RTC_CR_WUCKSEL_0
715#define RTC_WAKEUPCLOCK_RTCCLK_DIV4 RTC_CR_WUCKSEL_1
716#define RTC_WAKEUPCLOCK_RTCCLK_DIV2 (RTC_CR_WUCKSEL_0 | RTC_CR_WUCKSEL_1)
717#define RTC_WAKEUPCLOCK_CK_SPRE_16BITS RTC_CR_WUCKSEL_2
718#define RTC_WAKEUPCLOCK_CK_SPRE_17BITS (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_2)
719/**
720 * @}
721 */
722
723/* ========================================================================== */
724/* ##### Extended RTC Peripheral Control exported constants ##### */
725/* ========================================================================== */
726
727/** @defgroup RTCEx_Smooth_calib_period_Definitions RTC Smooth Calib Period Definitions
728 * @{
729 */
730#define RTC_SMOOTHCALIB_PERIOD_32SEC 0x00000000u /*!< If RTCCLK = 32768 Hz, Smooth calibration
731 period is 32s, else 2exp20 RTCCLK pulses */
732#define RTC_SMOOTHCALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< If RTCCLK = 32768 Hz, Smooth calibration
733 period is 16s, else 2exp19 RTCCLK pulses */
734#define RTC_SMOOTHCALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< If RTCCLK = 32768 Hz, Smooth calibration
735 period is 8s, else 2exp18 RTCCLK pulses */
736/**
737 * @}
738 */
739
740/** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTC Smooth Calib Plus pulses Definitions
741 * @{
742 */
743#define RTC_SMOOTHCALIB_PLUSPULSES_SET RTC_CALR_CALP /*!< The number of RTCCLK pulses added
744 during a X -second window = Y - CALM[8:0]
745 with Y = 512, 256, 128 when X = 32, 16, 8 */
746#define RTC_SMOOTHCALIB_PLUSPULSES_RESET 0x00000000u /*!< The number of RTCCLK pulses subbstited
747 during a 32-second window = CALM[8:0] */
748/**
749 * @}
750 */
751
752/** @defgroup RTCEx_Calib_Output_selection_Definitions RTC Calib Output Selection Definitions
753 * @{
754 */
755#define RTC_CALIBOUTPUT_512HZ 0x00000000u
756#define RTC_CALIBOUTPUT_1HZ RTC_CR_COSEL
757/**
758 * @}
759 */
760
761/** @defgroup RTCEx_Add_1_Second_Parameter_Definitions RTC Add 1 Second Parameter Definitions
762 * @{
763 */
764#define RTC_SHIFTADD1S_RESET 0x00000000u
765#define RTC_SHIFTADD1S_SET RTC_SHIFTR_ADD1S
766/**
767 * @}
768 */
769
770/**
771 * @}
772 */
773
774/* Exported macros -----------------------------------------------------------*/
775
776/** @defgroup RTCEx_Exported_Macros RTC Exported Macros
777 * @{
778 */
779
780/* ========================================================================== */
781/* ##### RTC Wake-up exported macros ##### */
782/* ========================================================================== */
783
784/**
785 * @brief Enable the RTC WakeUp Timer peripheral.
786 * @param __HANDLE__ specifies the RTC handle.
787 * @retval None
788 */
789#define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE))
790
791/**
792 * @brief Disable the RTC WakeUp Timer peripheral.
793 * @param __HANDLE__ specifies the RTC handle.
794 * @retval None
795 */
796#define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE))
797
798/**
799 * @brief Enable the RTC WakeUpTimer interrupt.
800 * @param __HANDLE__ specifies the RTC handle.
801 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled.
802 * This parameter can be:
803 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt
804 * @retval None
805 */
806#define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
807
808/**
809 * @brief Disable the RTC WakeUpTimer interrupt.
810 * @param __HANDLE__ specifies the RTC handle.
811 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be disabled.
812 * This parameter can be:
813 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt
814 * @retval None
815 */
816#define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
817
818/**
819 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
820 * @param __HANDLE__ specifies the RTC handle.
821 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to check.
822 * This parameter can be:
823 * @arg RTC_FLAG_WUTF WakeUpTimer interrupt flag
824 * @retval None
825 */
826#if defined(TAMP)
827#define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->SR) & (__INTERRUPT__)) != 0U) ? 1U : 0U)
828#else
829#define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & (__INTERRUPT__)) != 0U) ? 1U : 0U)
830#endif /* TAMP */
831
832/**
833 * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not.
834 * @param __HANDLE__ specifies the RTC handle.
835 * @param __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check.
836 * This parameter can be:
837 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt
838 * @retval None
839 */
840#define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != 0U) ? 1U : 0U)
841
842#if defined(TAMP)
843/**
844 * @brief Get the selected RTC WakeUpTimer's flag status.
845 * @param __HANDLE__ specifies the RTC handle.
846 * @param __FLAG__ specifies the RTC WakeUpTimer Flag sources to check.
847 * This parameter can be:
848 * @arg @ref RTC_FLAG_WUTF
849 * @retval Flag status
850 */
851#define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->SR) & (__FLAG__)) != 0U) ? 1U : 0U)
852#else
853/**
854 * @brief Get the selected RTC WakeUpTimer's flag status.
855 * @param __HANDLE__ specifies the RTC handle.
856 * @param __FLAG__ specifies the RTC WakeUpTimer Flag sources to check.
857 * This parameter can be:
858 * @arg @ref RTC_FLAG_WUTF
859 * @arg @ref RTC_FLAG_WUTWF
860 * @retval Flag status
861 */
862#define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U)
863#endif /* TAMP */
864
865/**
866 * @brief Clear the RTC Wake Up timer's pending flags.
867 * @param __HANDLE__ specifies the RTC handle.
868 * @param __FLAG__ specifies the RTC WakeUpTimer Flag to clear.
869 * This parameter can be:
870 * @arg @ref RTC_FLAG_WUTF
871 * @retval None
872 */
873#if defined(TAMP)
874#define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SCR |= __FLAG__)
875#else
876#define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
877#endif /* TAMP */
878
879/* ========================================================================== */
880/* ##### RTC Tamper exported macros ##### */
881/* ========================================================================== */
882
883/**
884 * @brief Enable the RTC Tamper1 input detection.
885 * @param __HANDLE__ specifies the RTC handle.
886 * @retval None
887 */
888#if defined(TAMP)
889#define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->CR1 |= (TAMP_CR1_TAMP1E))
890#else
891#define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP1E))
892#endif /* TAMP */
893
894/**
895 * @brief Disable the RTC Tamper1 input detection.
896 * @param __HANDLE__ specifies the RTC handle.
897 * @retval None
898 */
899#if defined(TAMP)
900#define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->CR1 &= ~(RTC_TAMPCR_TAMP1E))
901#else
902#define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP1E))
903#endif /* TAMP */
904
905/**
906 * @brief Enable the RTC Tamper2 input detection.
907 * @param __HANDLE__ specifies the RTC handle.
908 * @retval None
909 */
910#if defined(TAMP)
911#define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->CR1 |= (TAMP_CR1_TAMP2E))
912#else
913#if defined(RTC_TAMPER2_SUPPORT)
914#define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP2E))
915#endif /* RTC_TAMPER2_SUPPORT */
916#endif /* TAMP */
917
918/**
919 * @brief Disable the RTC Tamper2 input detection.
920 * @param __HANDLE__ specifies the RTC handle.
921 * @retval None
922 */
923#if defined(TAMP)
924#define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (TAMP_OFFSET))->CR1 &= ~(RTC_TAMPCR_TAMP2E))
925#else
926#if defined(RTC_TAMPER2_SUPPORT)
927#define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP2E))
928#endif /* RTC_TAMPER2_SUPPORT */
929#endif /* TAMP */
930
931/**
932 * @brief Enable the RTC Tamper3 input detection.
933 * @param __HANDLE__ specifies the RTC handle.
934 * @retval None
935 */
936#if defined(TAMP)
937#define __HAL_RTC_TAMPER3_ENABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->CR1 |= (TAMP_CR1_TAMP3E))
938#else
939#define __HAL_RTC_TAMPER3_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP3E))
940#endif /* TAMP */
941
942/**
943 * @brief Disable the RTC Tamper3 input detection.
944 * @param __HANDLE__ specifies the RTC handle.
945 * @retval None
946 */
947#if defined(TAMP)
948#define __HAL_RTC_TAMPER3_DISABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->CR1 &= ~(RTC_TAMPCR_TAMP3E))
949#else
950#define __HAL_RTC_TAMPER3_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP3E))
951#endif /* TAMP */
952
953/**
954 * @brief Enable the RTC Tamper interrupt.
955 * @param __HANDLE__ specifies the RTC handle.
956 * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be enabled.
957 * This parameter can be any combination of the following values:
958 * @arg RTC_IT_TAMPALL: All tampers interrupts
959 * @arg RTC_IT_TAMP1: Tamper1 interrupt
960 * @arg RTC_IT_TAMP2: Tamper2 interrupt (*)
961 * @arg RTC_IT_TAMP3: Tamper3 interrupt
962 * (*) Not applicable to all devices.
963 * @retval None
964 */
965#if defined(TAMP)
966#define __HAL_RTC_TAMPER_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->IER |= (__INTERRUPT__))
967#else
968#define __HAL_RTC_TAMPER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->TAMPCR |= (__INTERRUPT__))
969#endif /* TAMP */
970
971/**
972 * @brief Disable the RTC Tamper interrupt.
973 * @param __HANDLE__ specifies the RTC handle.
974 * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be disabled.
975 * This parameter can be any combination of the following values:
976 * @arg RTC_IT_TAMP: All tampers interrupts
977 * @arg RTC_IT_TAMP1: Tamper1 interrupt
978 * @arg RTC_IT_TAMP2: Tamper2 interrupt (*)
979 * @arg RTC_IT_TAMP3: Tamper3 interrupt
980 * (*) Not applicable to all devices.
981 * @retval None
982 */
983#if defined(TAMP)
984#define __HAL_RTC_TAMPER_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->IER &= ~(__INTERRUPT__))
985#else
986#define __HAL_RTC_TAMPER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->TAMPCR &= ~(__INTERRUPT__))
987#endif /* TAMP */
988
989/**
990 * @brief Check whether the specified RTC Tamper interrupt has been enabled or not.
991 * @param __HANDLE__ specifies the RTC handle.
992 * @param __INTERRUPT__ specifies the RTC Tamper interrupt source to check.
993 * This parameter can be:
994 * @arg RTC_IT_TAMPALL: All tampers interrupts
995 * @arg RTC_IT_TAMP1: Tamper1 interrupt
996 * @arg RTC_IT_TAMP2: Tamper2 interrupt (*)
997 * @arg RTC_IT_TAMP3: Tamper3 interrupt
998 * (*) Not applicable to all devices.
999 * @retval Flag status
1000 */
1001#if defined(TAMP)
1002#define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->IER) & (__INTERRUPT__)) != 0U) ? 1U : 0U)
1003#else
1004#define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->TAMPCR) & (__INTERRUPT__)) != 0U) ? 1U : 0U)
1005#endif /* TAMP */
1006
1007/**
1008 * @brief Get the selected RTC Tamper's flag status.
1009 * @param __HANDLE__ specifies the RTC handle.
1010 * @param __FLAG__ specifies the RTC Tamper Flag is pending or not.
1011 * This parameter can be:
1012 * @arg RTC_FLAG_TAMP1F: Tamper1 flag
1013 * @arg RTC_FLAG_TAMP2F: Tamper2 flag (*)
1014 * @arg RTC_FLAG_TAMP3F: Tamper3 flag
1015 * (*) Not applicable to all devices.
1016 * @retval Flag status
1017 */
1018#if defined(TAMP)
1019#define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) ((((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->SR) & (__FLAG__)) != 0U) ? 1U : 0U)
1020#else
1021#define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U)
1022#endif /* TAMP */
1023
1024/**
1025 * @brief Clear the RTC Tamper's pending flags.
1026 * @param __HANDLE__ specifies the RTC handle.
1027 * @param __FLAG__ specifies the RTC Tamper Flag to clear.
1028 * This parameter can be:
1029 * @arg RTC_FLAG_TAMP1F: Tamper1 flag
1030 * @arg RTC_FLAG_TAMP2F: Tamper2 flag (*)
1031 * @arg RTC_FLAG_TAMP3F: Tamper3 flag
1032 * (*) Not applicable to all devices.
1033 * @retval None
1034 */
1035#if defined(TAMP)
1036#define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->SCR) |= (__FLAG__))
1037#else
1038#define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
1039#endif /* TAMP */
1040
1041/**
1042 * @brief Get the frequency at which each of the Tamper inputs are sampled.
1043 * @param __HANDLE__ specifies the RTC handle.
1044 * @retval Sampling frequency
1045 * This value can be:
1046 * @arg RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768
1047 * @arg RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384
1048 * @arg RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192
1049 * @arg RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096
1050 * @arg RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048
1051 * @arg RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512
1052 * @arg RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256
1053 */
1054#if defined(TAMP)
1055#define __HAL_RTC_TAMPER_GET_SAMPLING_FREQ(__HANDLE__) ((uint32_t)((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->FLTCR) & (RTC_TAMPERSAMPLINGFREQ_RTCCLK_MASK)))
1056#else
1057#define __HAL_RTC_TAMPER_GET_SAMPLING_FREQ(__HANDLE__) ((uint32_t)(((__HANDLE__)->Instance->TAMPCR) & (RTC_TAMPERSAMPLINGFREQ_RTCCLK_MASK)))
1058#endif /* TAMP */
1059
1060/**
1061 * @brief Get the number of consecutive samples at the specified level needed
1062 * to activate a Tamper event.
1063 * @param __HANDLE__ specifies the RTC handle.
1064 * @retval Number of consecutive samples
1065 * This value can be:
1066 * @arg RTC_TAMPERFILTER_DISABLE
1067 * @arg RTC_TAMPERFILTER_2SAMPLE
1068 * @arg RTC_TAMPERFILTER_4SAMPLE
1069 * @arg RTC_TAMPERFILTER_8SAMPLE
1070 */
1071#if defined(TAMP)
1072#define __HAL_RTC_TAMPER_GET_SAMPLES_COUNT(__HANDLE__) ((uint32_t)((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->FLTCR) & (RTC_TAMPERFILTER_MASK)))
1073#else
1074#define __HAL_RTC_TAMPER_GET_SAMPLES_COUNT(__HANDLE__) ((uint32_t)(((__HANDLE__)->Instance->TAMPCR) & (RTC_TAMPERFILTER_MASK)))
1075#endif /* TAMP */
1076
1077/**
1078 * @brief Get the pull-up resistors precharge duration.
1079 * @param __HANDLE__ specifies the RTC handle.
1080 * @retval Number of consecutive samples
1081 * This value can be:
1082 * @arg RTC_TAMPERPRECHARGEDURATION_1RTCCLK
1083 * @arg RTC_TAMPERPRECHARGEDURATION_2RTCCLK
1084 * @arg RTC_TAMPERPRECHARGEDURATION_4RTCCLK
1085 * @arg RTC_TAMPERPRECHARGEDURATION_8RTCCLK
1086 */
1087#if defined(TAMP)
1088#define __HAL_RTC_TAMPER_GET_PRCHRG_DURATION(__HANDLE__) ((uint32_t)((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->FLTCR) & (RTC_TAMPERPRECHARGEDURATION_MASK)))
1089#else
1090#define __HAL_RTC_TAMPER_GET_PRCHRG_DURATION(__HANDLE__) ((uint32_t)(((__HANDLE__)->Instance->TAMPCR) & (RTC_TAMPERPRECHARGEDURATION_MASK)))
1091#endif /* TAMP */
1092
1093/**
1094 * @brief Get the pull-up resistors status.
1095 * @param __HANDLE__ specifies the RTC handle.
1096 * @retval Pull-up resistors status
1097 * This value can be:
1098 * @arg RTC_TAMPER_PULLUP_ENABLE
1099 * @arg RTC_TAMPER_PULLUP_DISABLE
1100 */
1101#if defined(TAMP)
1102#define __HAL_RTC_TAMPER_GET_PULLUP_STATUS(__HANDLE__) ((uint32_t)((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + TAMP_OFFSET))->FLTCR) & (RTC_TAMPER_PULLUP_MASK)))
1103#else
1104#define __HAL_RTC_TAMPER_GET_PULLUP_STATUS(__HANDLE__) ((uint32_t)(((__HANDLE__)->Instance->TAMPCR) & (RTC_TAMPER_PULLUP_MASK)))
1105#endif /* TAMP */
1106
1107/* ========================================================================== */
1108/* ##### RTC TimeStamp exported macros ##### */
1109/* ========================================================================== */
1110
1111/**
1112 * @brief Enable the RTC TimeStamp peripheral.
1113 * @param __HANDLE__ specifies the RTC handle.
1114 * @retval None
1115 */
1116#define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE))
1117
1118/**
1119 * @brief Disable the RTC TimeStamp peripheral.
1120 * @param __HANDLE__ specifies the RTC handle.
1121 * @retval None
1122 */
1123#define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE))
1124
1125/**
1126 * @brief Enable the RTC TimeStamp interrupt.
1127 * @param __HANDLE__ specifies the RTC handle.
1128 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be enabled.
1129 * This parameter can be:
1130 * @arg @ref RTC_IT_TS TimeStamp interrupt
1131 * @retval None
1132 */
1133#define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
1134
1135/**
1136 * @brief Disable the RTC TimeStamp interrupt.
1137 * @param __HANDLE__ specifies the RTC handle.
1138 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be disabled.
1139 * This parameter can be:
1140 * @arg @ref RTC_IT_TS TimeStamp interrupt
1141 * @retval None
1142 */
1143#define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
1144
1145/**
1146 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not.
1147 * @param __HANDLE__ specifies the RTC handle.
1148 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to check.
1149 * This parameter can be:
1150 * @arg @ref RTC_IT_TS TimeStamp interrupt
1151 * @retval None
1152 */
1153#if defined(TAMP)
1154#define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->MISR) & ((__INTERRUPT__) >> 12)) != 0U) ? 1U : 0U)
1155#else
1156#define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & (__INTERRUPT__)) != 0U) ? 1U : 0U)
1157#endif /* TAMP */
1158/**
1159 * @brief Check whether the specified RTC Time Stamp interrupt has been enabled or not.
1160 * @param __HANDLE__ specifies the RTC handle.
1161 * @param __INTERRUPT__ specifies the RTC Time Stamp interrupt source to check.
1162 * This parameter can be:
1163 * @arg @ref RTC_IT_TS TimeStamp interrupt
1164 * @retval None
1165 */
1166#define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != 0U) ? 1U : 0U)
1167
1168/**
1169 * @brief Get the selected RTC TimeStamp's flag status.
1170 * @param __HANDLE__ specifies the RTC handle.
1171 * @param __FLAG__ specifies the RTC TimeStamp Flag is pending or not.
1172 * This parameter can be:
1173 * @arg RTC_FLAG_TSF
1174 * @arg RTC_FLAG_TSOVF
1175 * @retval Flag status
1176 */
1177#if defined(TAMP)
1178#define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->SR) & (__FLAG__)) != 0U) ? 1U : 0U)
1179#else
1180#define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U)
1181#endif /* TAMP */
1182
1183/**
1184 * @brief Clear the RTC Time Stamp's pending flags.
1185 * @param __HANDLE__ specifies the RTC handle.
1186 * @param __FLAG__ specifies the RTC Alarm Flag sources to clear.
1187 * This parameter can be:
1188 * @arg RTC_FLAG_TSF
1189 * @arg RTC_FLAG_TSOVF
1190 * @retval None
1191 */
1192#if defined(TAMP)
1193#define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SCR |= __FLAG__)
1194#else
1195#define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)))
1196#endif /* TAMP */
1197
1198/**
1199 * @brief Enable the RTC internal TimeStamp peripheral.
1200 * @param __HANDLE__ specifies the RTC handle.
1201 * @retval None
1202 */
1203#define __HAL_RTC_INTERNAL_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ITSE))
1204
1205/**
1206 * @brief Disable the RTC internal TimeStamp peripheral.
1207 * @param __HANDLE__ specifies the RTC handle.
1208 * @retval None
1209 */
1210#define __HAL_RTC_INTERNAL_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ITSE))
1211
1212/**
1213 * @brief Get the selected RTC Internal Time Stamp's flag status.
1214 * @param __HANDLE__ specifies the RTC handle.
1215 * @param __FLAG__ specifies the RTC Internal Time Stamp Flag is pending or not.
1216 * This parameter can be:
1217 * @arg RTC_FLAG_ITSF
1218 * @retval Flag status
1219 */
1220#if defined(TAMP)
1221#define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->SR) & (__FLAG__)) != 0U) ? 1U : 0U)
1222#else
1223#define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U)
1224#endif /* TAMP */
1225
1226/**
1227 * @brief Clear the RTC Internal Time Stamp's pending flags.
1228 * @param __HANDLE__ specifies the RTC handle.
1229 * @param __FLAG__ specifies the RTC Internal Time Stamp Flag source to clear.
1230 * This parameter can be:
1231 * @arg RTC_FLAG_ITSF
1232 * @note This flag must be cleared together with TSF flag.
1233 * @retval None
1234 */
1235#if defined(TAMP)
1236#define __HAL_RTC_INTERNAL_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SCR |= __FLAG__)
1237#else
1238#define __HAL_RTC_INTERNAL_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)))
1239#endif /* TAMP */
1240
1241/**
1242 * @brief Enable the RTC TimeStamp on Tamper detection.
1243 * @param __HANDLE__ specifies the RTC handle.
1244 * @retval None
1245 */
1246#if defined(TAMP)
1247#define __HAL_RTC_TAMPTS_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_TIMESTAMPONTAMPERDETECTION_MASK))
1248#else
1249#define __HAL_RTC_TAMPTS_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TIMESTAMPONTAMPERDETECTION_MASK))
1250#endif /* TAMP */
1251
1252/**
1253 * @brief Disable the RTC TimeStamp on Tamper detection.
1254 * @param __HANDLE__ specifies the RTC handle.
1255 * @retval None
1256 */
1257#if defined(TAMP)
1258#define __HAL_RTC_TAMPTS_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_TIMESTAMPONTAMPERDETECTION_MASK))
1259#else
1260#define __HAL_RTC_TAMPTS_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TIMESTAMPONTAMPERDETECTION_MASK))
1261#endif /* TAMP */
1262
1263/**
1264 * @brief Get activation status of the RTC TimeStamp on Tamper detection.
1265 * @param __HANDLE__ specifies the RTC handle.
1266 * @retval Activation status of TimeStamp on Tamper detection
1267 * This value can be:
1268 * @arg RTC_TIMESTAMPONTAMPERDETECTION_ENABLE
1269 * @arg RTC_TIMESTAMPONTAMPERDETECTION_DISABLE
1270 */
1271#if defined(TAMP)
1272#define __HAL_RTC_TAMPTS_GET_STATUS(__HANDLE__) ((__HANDLE__)->Instance->CR &= RTC_TIMESTAMPONTAMPERDETECTION_MASK)
1273#else
1274#define __HAL_RTC_TAMPTS_GET_STATUS(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= RTC_TIMESTAMPONTAMPERDETECTION_MASK)
1275#endif /* TAMP */
1276
1277#if defined(TAMP)
1278/**
1279 * @brief Enable the RTC Tamper detection output.
1280 * @param __HANDLE__ specifies the RTC handle.
1281 * @retval None
1282 */
1283#define __HAL_RTC_TAMPOE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TAMPOE))
1284
1285/**
1286 * @brief Disable the RTC Tamper detection output.
1287 * @param __HANDLE__ specifies the RTC handle.
1288 * @retval None
1289 */
1290#define __HAL_RTC_TAMPOE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TAMPOE))
1291#endif /* TAMP */
1292
1293/* ========================================================================== */
1294/* ##### Extended RTC Peripheral Control exported macros ##### */
1295/* ========================================================================== */
1296
1297/**
1298 * @brief Enable the RTC calibration output.
1299 * @param __HANDLE__ specifies the RTC handle.
1300 * @retval None
1301 */
1302#define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE))
1303
1304/**
1305 * @brief Disable the calibration output.
1306 * @param __HANDLE__ specifies the RTC handle.
1307 * @retval None
1308 */
1309#define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE))
1310
1311/**
1312 * @brief Enable the clock reference detection.
1313 * @param __HANDLE__ specifies the RTC handle.
1314 * @retval None
1315 */
1316#define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON))
1317
1318/**
1319 * @brief Disable the clock reference detection.
1320 * @param __HANDLE__ specifies the RTC handle.
1321 * @retval None
1322 */
1323#define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON))
1324
1325/**
1326 * @brief Get the selected RTC shift operation's flag status.
1327 * @param __HANDLE__ specifies the RTC handle.
1328 * @param __FLAG__ specifies the RTC shift operation Flag is pending or not.
1329 * This parameter can be:
1330 * @arg RTC_FLAG_SHPF
1331 * @retval Flag status
1332 */
1333#if defined(TAMP)
1334#define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ICSR) & (__FLAG__)) != 0U) ? 1U : 0U)
1335#else
1336#define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U)
1337#endif /* TAMP */
1338
1339/* ========================================================================== */
1340/* ##### RTC Wake-up Interrupt exported macros ##### */
1341/* ========================================================================== */
1342
1343/**
1344 * @brief Enable interrupt on the RTC WakeUp Timer associated Exti line.
1345 * @retval None
1346 */
1347#if defined(EXTI_D1)
1348#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI_D1->IMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1349#else /* EXTI */
1350#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1351#endif /* EXTI_D1 */
1352/**
1353 * @brief Disable interrupt on the RTC WakeUp Timer associated Exti line.
1354 * @retval None
1355 */
1356#if defined(EXTI_D1)
1357#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI_D1->IMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
1358#else /* EXTI */
1359#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
1360#endif /* EXTI_D1 */
1361
1362/**
1363 * @brief Enable event on the RTC WakeUp Timer associated Exti line.
1364 * @retval None
1365 */
1366#if defined(EXTI_D1)
1367#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI_D1->EMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1368#else /* EXTI */
1369#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1370#endif /* EXTI_D1 */
1371
1372/**
1373 * @brief Disable event on the RTC WakeUp Timer associated Exti line.
1374 * @retval None
1375 */
1376#if defined(EXTI_D1)
1377#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI_D1->EMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
1378#else /* EXTI */
1379#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
1380#endif /* EXTI_D1 */
1381
1382/**
1383 * @brief Enable event on the RTC WakeUp Timer associated D3 Exti line.
1384 * @retval None
1385 */
1386#define __HAL_RTC_WAKEUPTIMER_EXTID3_ENABLE_EVENT() (EXTI->D3PMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1387
1388/**
1389 * @brief Disable event on the RTC WakeUp Timer associated D3 Exti line.
1390 * @retval None
1391 */
1392#define __HAL_RTC_WAKEUPTIMER_EXTID3_DISABLE_EVENT() (EXTI->D3PMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
1393
1394#if defined(DUAL_CORE)
1395/**
1396 * @brief Enable interrupt on the RTC WakeUp Timer associated D2 Exti line.
1397 * @retval None
1398 */
1399#define __HAL_RTC_WAKEUPTIMER_EXTID2_ENABLE_IT() (EXTI_D2->IMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1400
1401/**
1402 * @brief Disable interrupt on the RTC WakeUp Timer associated D2 Exti line.
1403 * @retval None
1404 */
1405#define __HAL_RTC_WAKEUPTIMER_EXTID2_DISABLE_IT() (EXTI_D2->IMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
1406
1407/**
1408 * @brief Enable event on the RTC WakeUp Timer associated D2 Exti line.
1409 * @retval None
1410 */
1411#define __HAL_RTC_WAKEUPTIMER_EXTID2_ENABLE_EVENT() (EXTI_D2->EMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1412
1413/**
1414 * @brief Disable event on the RTC WakeUp Timer associated D2 Exti line.
1415 * @retval None
1416 */
1417#define __HAL_RTC_WAKEUPTIMER_EXTID2_DISABLE_EVENT() (EXTI_D2->EMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
1418
1419#endif /* DUAL_CORE */
1420
1421/**
1422 * @brief Enable falling edge trigger on the RTC WakeUp Timer associated Exti line.
1423 * @retval None
1424 */
1425#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1426
1427/**
1428 * @brief Disable falling edge trigger on the RTC WakeUp Timer associated Exti line.
1429 * @retval None
1430 */
1431#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
1432
1433/**
1434 * @brief Enable rising edge trigger on the RTC WakeUp Timer associated Exti line.
1435 * @retval None
1436 */
1437#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1438
1439/**
1440 * @brief Disable rising edge trigger on the RTC WakeUp Timer associated Exti line.
1441 * @retval None
1442 */
1443#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
1444
1445/**
1446 * @brief Enable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line.
1447 * @retval None
1448 */
1449#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
1450 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE(); \
1451 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE(); \
1452 } while(0)
1453
1454/**
1455 * @brief Disable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line.
1456 * This parameter can be:
1457 * @retval None
1458 */
1459#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
1460 __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE(); \
1461 __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE(); \
1462 } while(0)
1463
1464/**
1465 * @brief Check whether the RTC WakeUp Timer associated Exti line interrupt flag is set or not.
1466 * @retval Line Status.
1467 */
1468#if defined(EXTI_D1)
1469#define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI_D1->PR1 & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1470#else /* EXTI */
1471#define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR1 & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1472#endif /* EXTI_D1 */
1473
1474/**
1475 * @brief Clear the RTC WakeUp Timer associated Exti line flag.
1476 * @retval None
1477 */
1478#if defined(EXTI_D1)
1479#define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI_D1->PR1 = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1480#else /* EXTI */
1481#define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1482#endif /* EXTI_D1 */
1483
1484/**
1485 * @brief Check whether the RTC WakeUp Timer associated D3 Exti line interrupt flag is set or not.
1486 * @retval Line Status
1487 */
1488#define __HAL_RTC_WAKEUPTIMER_EXTID3_GET_FLAG() (EXTI_D3->PR1 & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1489
1490/**
1491 * @brief Clear the RTC WakeUp Timer associated D3 Exti line flag.
1492 * @retval None.
1493 */
1494#define __HAL_RTC_WAKEUPTIMER_EXTID3_CLEAR_FLAG() (EXTI_D3->PR1 = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1495
1496/**
1497 * @brief Generate a Software interrupt on the RTC WakeUp Timer associated Exti line.
1498 * @retval None.
1499 */
1500#define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1501
1502#if defined(DUAL_CORE)
1503
1504/**
1505 * @brief Check whether the RTC WakeUp Timer associated D2 Exti line interrupt flag is set or not.
1506 * @retval Line Status.
1507 */
1508#define __HAL_RTC_WAKEUPTIMER_EXTID2_GET_FLAG() (EXTI_D2->PR1 & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1509
1510/**
1511 * @brief Clear the RTC WakeUp Timer associated D2 Exti line flag.
1512 * @retval None.
1513 */
1514#define __HAL_RTC_WAKEUPTIMER_EXTID2_CLEAR_FLAG() (EXTI_D2->PR1 = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1515
1516#endif /* DUAL_CORE */
1517
1518/* ========================================================================== */
1519/* ##### RTC TimeStamp and Tamper Interrupt exported macros ##### */
1520/* ========================================================================== */
1521
1522/**
1523 * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line.
1524 * @retval None
1525 */
1526#if defined(EXTI_D1)
1527#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI_D1->IMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1528#else /* EXTI */
1529#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1530#endif /* EXTI_D1 */
1531
1532/**
1533 * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line.
1534 * @retval None
1535 */
1536#if defined(EXTI_D1)
1537#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI_D1->IMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
1538#else /* EXTI */
1539#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
1540#endif /* EXTI_D1 */
1541
1542/**
1543 * @brief Enable event on the RTC Tamper and Timestamp associated Exti line.
1544 * @retval None
1545 */
1546#if defined(EXTI_D1)
1547#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI_D1->EMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1548#else /* EXTI */
1549#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1550#endif /* EXTI_D1 */
1551
1552/**
1553 * @brief Disable event on the RTC Tamper and Timestamp associated Exti line.
1554 * @retval None
1555 */
1556#if defined(EXTI_D1)
1557#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI_D1->EMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
1558#else /* EXTI */
1559#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
1560#endif /* EXTI_D1 */
1561
1562#if defined(DUAL_CORE)
1563/**
1564 * @brief Enable interrupt on the RTC Tamper and Timestamp associated D2 Exti line.
1565 * @retval None
1566 */
1567#define __HAL_RTC_TAMPER_TIMESTAMP_EXTID2_ENABLE_IT() (EXTI_D2->IMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1568
1569/**
1570 * @brief Disable interrupt on the RTC Tamper and Timestamp associated D2 Exti line.
1571 * @retval None
1572 */
1573#define __HAL_RTC_TAMPER_TIMESTAMP_EXTID2_DISABLE_IT() (EXTI_D2->IMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
1574
1575
1576/**
1577 * @brief Enable event on the RTC Tamper and Timestamp associated D2 Exti line.
1578 * @retval None
1579 */
1580#define __HAL_RTC_TAMPER_TIMESTAMP_EXTID2_ENABLE_EVENT() (EXTI_D2->EMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1581
1582
1583/**
1584 * @brief Disable event on the RTC Tamper and Timestamp associated D2 Exti line.
1585 * @retval None
1586 */
1587#define __HAL_RTC_TAMPER_TIMESTAMP_EXTID2_DISABLE_EVENT() (EXTI_D2->EMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
1588
1589#endif /* DUAL_CORE */
1590
1591/**
1592 * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
1593 * @retval None
1594 */
1595#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1596
1597/**
1598 * @brief Disable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
1599 * @retval None
1600 */
1601#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
1602
1603/**
1604 * @brief Enable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
1605 * @retval None
1606 */
1607#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1608
1609/**
1610 * @brief Disable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
1611 * @retval None
1612 */
1613#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
1614
1615/**
1616 * @brief Enable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
1617 * @retval None
1618 */
1619#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
1620 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE(); \
1621 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE(); \
1622 } while(0)
1623
1624/**
1625 * @brief Disable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
1626 * @retval None
1627 */
1628#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
1629 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE(); \
1630 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE(); \
1631 } while(0)
1632
1633/**
1634 * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not.
1635 * @retval Line Status
1636 */
1637#if defined(EXTI_D1)
1638#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI_D1->PR1 & RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1639#else /* EXTI */
1640#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI->PR1 & RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1641#endif /* EXTI_D1 */
1642
1643/**
1644 * @brief Clear the RTC Tamper and Timestamp associated Exti line flag.
1645 * @retval None
1646 */
1647#if defined(EXTI_D1)
1648#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI_D1->PR1 = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1649#else /* EXTI */
1650#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1651#endif /* EXTI_D1 */
1652
1653#if defined(DUAL_CORE)
1654/**
1655 * @brief Check whether the RTC Tamper and Timestamp associated D2 Exti line interrupt flag is set or not.
1656 * @retval Line Status
1657 */
1658#define __HAL_RTC_TAMPER_TIMESTAMP_EXTID2_GET_FLAG() (EXTI_D2->PR1 & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
1659
1660/**
1661 * @brief Clear the RTC Tamper and Timestamp associated D2 Exti line flag.
1662 * @retval None
1663 */
1664#define __HAL_RTC_TAMPER_TIMESTAMP_EXTID2_CLEAR_FLAG() (EXTI_D2->PR1 = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1665
1666#endif /* DUAL_CORE */
1667
1668/**
1669 * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line
1670 * @retval None
1671 */
1672#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT() (EXTI->SWIER1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
1673
1674/**
1675 * @}
1676 */
1677
1678/* Exported functions --------------------------------------------------------*/
1679
1680/** @defgroup RTCEx_Exported_Functions RTC Exported Functions
1681 * @{
1682 */
1683
1684/* ========================================================================== */
1685/* ##### RTC TimeStamp exported functions ##### */
1686/* ========================================================================== */
1687
1688/* RTC TimeStamp functions ****************************************************/
1689
1690/** @defgroup RTCEx_Exported_Functions_Group1 Extended RTC TimeStamp functions
1691 * @{
1692 */
1693HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
1694HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
1702/**
1703 * @}
1704 */
1705
1706/* ========================================================================== */
1707/* ##### RTC Tamper exported functions ##### */
1708/* ========================================================================== */
1709
1710/* RTC Tamper functions *******************************************************/
1711
1712/** @defgroup RTCEx_Exported_Functions_Group5 Extended RTC Tamper functions
1713 * @{
1714 */
1719#if defined(RTC_TAMPER2_SUPPORT)
1720HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
1721#endif /* RTC_TAMPER2_SUPPORT */
1724#if defined(RTC_TAMPER2_SUPPORT)
1725void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc);
1726#endif /* RTC_TAMPER2_SUPPORT */
1728#if defined(TAMP)
1729HAL_StatusTypeDef HAL_RTCEx_SetInternalTamper(RTC_HandleTypeDef *hrtc, const RTC_InternalTamperTypeDef *sIntTamper);
1730HAL_StatusTypeDef HAL_RTCEx_SetInternalTamper_IT(RTC_HandleTypeDef *hrtc, const RTC_InternalTamperTypeDef *sIntTamper);
1731HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTamper(RTC_HandleTypeDef *hrtc, uint32_t IntTamper);
1732HAL_StatusTypeDef HAL_RTCEx_PollForInternalTamperEvent(RTC_HandleTypeDef *hrtc, uint32_t IntTamper, uint32_t Timeout);
1733void HAL_RTCEx_InternalTamper1EventCallback(RTC_HandleTypeDef *hrtc);
1734void HAL_RTCEx_InternalTamper2EventCallback(RTC_HandleTypeDef *hrtc);
1735void HAL_RTCEx_InternalTamper3EventCallback(RTC_HandleTypeDef *hrtc);
1736void HAL_RTCEx_InternalTamper4EventCallback(RTC_HandleTypeDef *hrtc);
1737void HAL_RTCEx_InternalTamper5EventCallback(RTC_HandleTypeDef *hrtc);
1738void HAL_RTCEx_InternalTamper6EventCallback(RTC_HandleTypeDef *hrtc);
1739void HAL_RTCEx_InternalTamper8EventCallback(RTC_HandleTypeDef *hrtc);
1740HAL_StatusTypeDef HAL_RTCEx_SetActiveTampers(RTC_HandleTypeDef *hrtc, const RTC_ActiveTampersTypeDef *sAllTamper);
1741HAL_StatusTypeDef HAL_RTCEx_SetActiveSeed(RTC_HandleTypeDef *hrtc, const uint32_t *pSeed);
1742HAL_StatusTypeDef HAL_RTCEx_DeactivateActiveTampers(RTC_HandleTypeDef *hrtc);
1743#endif /* TAMP */
1744
1745/**
1746 * @}
1747 */
1748
1749/* ========================================================================== */
1750/* ##### RTC Wake-up exported functions ##### */
1751/* ========================================================================== */
1752
1753/* RTC Wake-up functions ******************************************************/
1754
1755/** @defgroup RTCEx_Exported_Functions_Group2 Extended RTC Wake-up functions
1756 * @{
1757 */
1758HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
1759HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
1765/**
1766 * @}
1767 */
1768
1769/* ========================================================================== */
1770/* ##### Extended RTC Backup registers exported functions ##### */
1771/* ========================================================================== */
1772
1773/* Extended RTC Backup registers functions ************************************/
1774
1775/** @defgroup RTCEx_Exported_Functions_Group6 Extended RTC Backup register functions
1776 * @{
1777 */
1778void HAL_RTCEx_BKUPWrite(const RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
1779uint32_t HAL_RTCEx_BKUPRead(const RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
1780/**
1781 * @}
1782 */
1783
1784/* ========================================================================== */
1785/* ##### Extended RTC Peripheral Control exported functions ##### */
1786/* ========================================================================== */
1787
1788/* Extended RTC Peripheral Control functions **********************************/
1789
1790/** @defgroup RTCEx_Exported_Functions_Group3 Extended Peripheral Control functions
1791 * @{
1792 */
1793HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue);
1794HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
1801#if defined(TAMP)
1802HAL_StatusTypeDef HAL_RTCEx_MonotonicCounterIncrement(RTC_HandleTypeDef *hrtc, uint32_t Instance);
1803HAL_StatusTypeDef HAL_RTCEx_MonotonicCounterGet(const RTC_HandleTypeDef *hrtc, uint32_t *Counter, uint32_t Instance);
1804#endif /* TAMP */
1805/**
1806 * @}
1807 */
1808
1809/* Extended RTC features functions *******************************************/
1810
1811/** @defgroup RTCEx_Exported_Functions_Group4 Extended features functions
1812 * @{
1813 */
1814
1817/**
1818 * @}
1819 */
1820
1821/**
1822 * @}
1823 */
1824
1825/* Private types -------------------------------------------------------------*/
1826/* Private variables ---------------------------------------------------------*/
1827/* Private constants ---------------------------------------------------------*/
1828/** @defgroup RTCEx_Private_Constants RTC Private Constants
1829 * @{
1830 */
1831#define RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT EXTI_IMR1_IM18 /*!< External interrupt line 18 Connected to the RTC Tamper and Time Stamp events */
1832#define RTC_EXTI_LINE_WAKEUPTIMER_EVENT EXTI_IMR1_IM19 /*!< External interrupt line 19 Connected to the RTC Wakeup event */
1833
1834/* Masks Definition */
1835#if defined(RTC_TAMPER2_SUPPORT)
1836#define RTC_TAMPER_X ((uint32_t) (RTC_TAMPER_1 | RTC_TAMPER_2 | RTC_TAMPER_3))
1837#else
1838#define RTC_TAMPER_X ((uint32_t) (RTC_TAMPER_1 | RTC_TAMPER_3))
1839#endif /* RTC_TAMPER2_SUPPORT */
1840
1841#if defined(RTC_TAMPxIE_SUPPORT)
1842#define RTC_TAMPER_X_INTERRUPT ((uint32_t) (RTC_IT_TAMP1 | RTC_IT_TAMP2 | RTC_IT_TAMP3))
1843#else
1844#define RTC_TAMPER_X_INTERRUPT RTC_IT_TAMPALL
1845#endif /* RTC_TAMPxIE_SUPPORT */
1846
1847/**
1848 * @}
1849 */
1850
1851/* Private macros ------------------------------------------------------------*/
1852/** @defgroup RTCEx_Private_Macros RTC Private Macros
1853 * @{
1854 */
1855
1856/** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters
1857 * @{
1858 */
1859
1860/* ========================================================================== */
1861/* ##### Extended RTC Backup registers private macros ##### */
1862/* ========================================================================== */
1863
1864#define IS_RTC_BKP(__BKP__) ((__BKP__) < BKP_REG_NUMBER)
1865
1866/* ========================================================================== */
1867/* ##### RTC TimeStamp private macros ##### */
1868/* ========================================================================== */
1869
1870#define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \
1871 ((EDGE) == RTC_TIMESTAMPEDGE_FALLING))
1872
1873#define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_DEFAULT))
1874
1875/* ========================================================================== */
1876/* ##### RTC Wake-up private macros ##### */
1877/* ========================================================================== */
1878
1879#define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \
1880 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \
1881 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \
1882 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \
1883 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \
1884 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS))
1885
1886#define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= RTC_WUTR_WUT)
1887
1888/* ========================================================================== */
1889/* ##### RTC Smooth Calibration private macros ##### */
1890/* ========================================================================== */
1891
1892#define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \
1893 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \
1894 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC))
1895
1896#define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \
1897 ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET))
1898
1899#define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= RTC_CALR_CALM)
1900
1901/* ========================================================================== */
1902/* ##### Extended RTC Peripheral Control private macros ##### */
1903/* ========================================================================== */
1904
1905#define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \
1906 ((SEL) == RTC_SHIFTADD1S_SET))
1907
1908#define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= RTC_SHIFTR_SUBFS)
1909
1910#define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \
1911 ((OUTPUT) == RTC_CALIBOUTPUT_1HZ))
1912
1913/* ========================================================================== */
1914/* ##### RTC Tamper private macros ##### */
1915/* ========================================================================== */
1916
1917#define IS_RTC_TAMPER(__TAMPER__) ((((__TAMPER__) & RTC_TAMPER_X) != 0x00U) && \
1918 (((__TAMPER__) & ~RTC_TAMPER_X) == 0x00U))
1919
1920#define IS_RTC_TAMPER_INTERRUPT(__INTERRUPT__) \
1921 ((((__INTERRUPT__) & ( RTC_TAMPER_X_INTERRUPT | RTC_IT_TAMPALL )) != 0x00U) && \
1922 (((__INTERRUPT__) & (~(RTC_TAMPER_X_INTERRUPT | RTC_IT_TAMPALL))) == 0x00U))
1923
1924#define IS_RTC_TAMPER_TRIGGER(__TRIGGER__) (((__TRIGGER__) == RTC_TAMPERTRIGGER_RISINGEDGE) || \
1925 ((__TRIGGER__) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \
1926 ((__TRIGGER__) == RTC_TAMPERTRIGGER_LOWLEVEL) || \
1927 ((__TRIGGER__) == RTC_TAMPERTRIGGER_HIGHLEVEL))
1928
1929#define IS_RTC_TAMPER_ERASE_MODE(__MODE__) (((__MODE__) == RTC_TAMPER_ERASE_BACKUP_ENABLE) || \
1930 ((__MODE__) == RTC_TAMPER_ERASE_BACKUP_DISABLE))
1931
1932#define IS_RTC_TAMPER_MASKFLAG_STATE(__STATE__) (((__STATE__) == RTC_TAMPERMASK_FLAG_ENABLE) || \
1933 ((__STATE__) == RTC_TAMPERMASK_FLAG_DISABLE))
1934
1935#define IS_RTC_TAMPER_FILTER(__FILTER__) (((__FILTER__) == RTC_TAMPERFILTER_DISABLE) || \
1936 ((__FILTER__) == RTC_TAMPERFILTER_2SAMPLE) || \
1937 ((__FILTER__) == RTC_TAMPERFILTER_4SAMPLE) || \
1938 ((__FILTER__) == RTC_TAMPERFILTER_8SAMPLE))
1939
1940#define IS_RTC_TAMPER_SAMPLING_FREQ(__FREQ__) (((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \
1941 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \
1942 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \
1943 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \
1944 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \
1945 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \
1946 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \
1947 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256))
1948
1949#define IS_RTC_TAMPER_PRECHARGE_DURATION(__DURATION__) (((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \
1950 ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \
1951 ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \
1952 ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK))
1953
1954#define IS_RTC_TAMPER_PULLUP_STATE(__STATE__) (((__STATE__) == RTC_TAMPER_PULLUP_ENABLE) || \
1955 ((__STATE__) == RTC_TAMPER_PULLUP_DISABLE))
1956
1957#define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(__DETECTION__) (((__DETECTION__) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \
1958 ((__DETECTION__) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE))
1959
1960#if defined(TAMP)
1961#define IS_RTC_TAMPER_TAMPERDETECTIONOUTPUT(__MODE__) (((__MODE__) == RTC_TAMPERDETECTIONOUTPUT_ENABLE) || \
1962 ((__MODE__) == RTC_TAMPERDETECTIONOUTPUT_DISABLE))
1963#endif /* TAMP */
1964
1965#define IS_RTC_TAMPER_FILTER_CONFIG_CORRECT(FILTER, TRIGGER) \
1966 ( ( ((FILTER) != RTC_TAMPERFILTER_DISABLE) \
1967 && ( ((TRIGGER) == RTC_TAMPERTRIGGER_LOWLEVEL) \
1968 || ((TRIGGER) == RTC_TAMPERTRIGGER_HIGHLEVEL))) \
1969 || ( ((FILTER) == RTC_TAMPERFILTER_DISABLE) \
1970 && ( ((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) \
1971 || ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE))))
1972
1973#define IS_RTC_INTERNAL_TAMPER(__INT_TAMPER__) ((((__INT_TAMPER__) & RTC_INT_TAMPER_ALL) != 0x00U) && \
1974 (((__INT_TAMPER__) & ~RTC_INT_TAMPER_ALL) == 0x00U))
1975
1976/**
1977 * @}
1978 */
1979
1980/**
1981 * @}
1982 */
1983
1984/**
1985 * @}
1986 */
1987
1988/**
1989 * @}
1990 */
1991
1992#ifdef __cplusplus
1993}
1994#endif /* __cplusplus */
1995
1996#endif /* STM32H7xx_HAL_RTC_EX_H */
1997
HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTimeStamp(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_SetInternalTimeStamp(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format)
void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin)
HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin)
void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout)
HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout)
HAL_StatusTypeDef HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc)
void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc)
uint32_t HAL_RTCEx_GetWakeUpTimer(const RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock)
HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock)
void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc)
Definition board_sleep.c:18
HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS)
HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue)
HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput)
void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout)
HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout)
HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, const RTC_TamperTypeDef *sTamper)
void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, const RTC_TamperTypeDef *sTamper)
void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout)
HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper)
void HAL_RTCEx_BKUPWrite(const RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data)
uint32_t HAL_RTCEx_BKUPRead(const RTC_HandleTypeDef *hrtc, uint32_t BackupRegister)
RTC_HandleTypeDef hrtc
Definition main.c:52
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
RTC Date structure definition.
RTC Handle Structure definition.
uint32_t Trigger
Specifies the Tamper Trigger.
uint32_t SamplingFrequency
Specifies the sampling frequency.
uint32_t Filter
Specifies the TAMP Filter Tamper.
uint32_t TamperPullUp
Specifies the Tamper PullUp .
uint32_t Tamper
Specifies the Tamper Pin.
uint32_t NoErase
Specifies the Tamper no erase mode.
uint32_t PrechargeDuration
Specifies the Precharge Duration .
uint32_t Interrupt
Specifies the Tamper Interrupt.
uint32_t TimeStampOnTamperDetection
Specifies the TimeStampOnTamperDetection.
uint32_t MaskFlag
Specifies the Tamper Flag masking.
RTC Time structure definition.