source: asp3_wo_tecs/trunk/arch/arm_m_gcc/stm32f4xx_stm32cube/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rtc_ex.h@ 303

Last change on this file since 303 was 303, checked in by ertl-honda, 7 years ago

nucleo_f401re依存部の追加

File size: 43.1 KB
Line 
1/**
2 ******************************************************************************
3 * @file stm32f4xx_hal_rtc_ex.h
4 * @author MCD Application Team
5 * @version V1.4.1
6 * @date 09-October-2015
7 * @brief Header file of RTC HAL Extension module.
8 ******************************************************************************
9 * @attention
10 *
11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
12 *
13 * Redistribution and use in source and binary forms, with or without modification,
14 * are permitted provided that the following conditions are met:
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 ******************************************************************************
36 */
37
38/* Define to prevent recursive inclusion -------------------------------------*/
39#ifndef __STM32F4xx_HAL_RTC_EX_H
40#define __STM32F4xx_HAL_RTC_EX_H
41
42#ifdef __cplusplus
43 extern "C" {
44#endif
45
46/* Includes ------------------------------------------------------------------*/
47#include "stm32f4xx_hal_def.h"
48
49/** @addtogroup STM32F4xx_HAL_Driver
50 * @{
51 */
52
53/** @addtogroup RTCEx
54 * @{
55 */
56
57/* Exported types ------------------------------------------------------------*/
58/** @defgroup RTCEx_Exported_Types RTCEx Exported Types
59 * @{
60 */
61
62/**
63 * @brief RTC Tamper structure definition
64 */
65typedef struct
66{
67 uint32_t Tamper; /*!< Specifies the Tamper Pin.
68 This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */
69
70 uint32_t PinSelection; /*!< Specifies the Tamper Pin.
71 This parameter can be a value of @ref RTCEx_Tamper_Pins_Selection */
72
73 uint32_t Trigger; /*!< Specifies the Tamper Trigger.
74 This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */
75
76 uint32_t Filter; /*!< Specifies the RTC Filter Tamper.
77 This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */
78
79 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency.
80 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */
81
82 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration .
83 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */
84
85 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp .
86 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */
87
88 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection.
89 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */
90}RTC_TamperTypeDef;
91/**
92 * @}
93 */
94
95/* Exported constants --------------------------------------------------------*/
96/** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants
97 * @{
98 */
99
100/** @defgroup RTCEx_Backup_Registers_Definitions RTC Backup Registers Definitions
101 * @{
102 */
103#define RTC_BKP_DR0 ((uint32_t)0x00000000)
104#define RTC_BKP_DR1 ((uint32_t)0x00000001)
105#define RTC_BKP_DR2 ((uint32_t)0x00000002)
106#define RTC_BKP_DR3 ((uint32_t)0x00000003)
107#define RTC_BKP_DR4 ((uint32_t)0x00000004)
108#define RTC_BKP_DR5 ((uint32_t)0x00000005)
109#define RTC_BKP_DR6 ((uint32_t)0x00000006)
110#define RTC_BKP_DR7 ((uint32_t)0x00000007)
111#define RTC_BKP_DR8 ((uint32_t)0x00000008)
112#define RTC_BKP_DR9 ((uint32_t)0x00000009)
113#define RTC_BKP_DR10 ((uint32_t)0x0000000A)
114#define RTC_BKP_DR11 ((uint32_t)0x0000000B)
115#define RTC_BKP_DR12 ((uint32_t)0x0000000C)
116#define RTC_BKP_DR13 ((uint32_t)0x0000000D)
117#define RTC_BKP_DR14 ((uint32_t)0x0000000E)
118#define RTC_BKP_DR15 ((uint32_t)0x0000000F)
119#define RTC_BKP_DR16 ((uint32_t)0x00000010)
120#define RTC_BKP_DR17 ((uint32_t)0x00000011)
121#define RTC_BKP_DR18 ((uint32_t)0x00000012)
122#define RTC_BKP_DR19 ((uint32_t)0x00000013)
123/**
124 * @}
125 */
126
127/** @defgroup RTCEx_Time_Stamp_Edges_definitions RTC TimeStamp Edges Definitions
128 * @{
129 */
130#define RTC_TIMESTAMPEDGE_RISING ((uint32_t)0x00000000)
131#define RTC_TIMESTAMPEDGE_FALLING ((uint32_t)0x00000008)
132/**
133 * @}
134 */
135
136/** @defgroup RTCEx_Tamper_Pins_Definitions RTC Tamper Pins Definitions
137 * @{
138 */
139#define RTC_TAMPER_1 RTC_TAFCR_TAMP1E
140#define RTC_TAMPER_2 RTC_TAFCR_TAMP2E
141/**
142 * @}
143 */
144
145/** @defgroup RTCEx_Tamper_Pins_Selection RTC tamper Pins Selection
146 * @{
147 */
148#define RTC_TAMPERPIN_DEFAULT ((uint32_t)0x00000000)
149#define RTC_TAMPERPIN_POS1 ((uint32_t)0x00010000)
150/**
151 * @}
152 */
153
154/** @defgroup RTCEx_TimeStamp_Pin_Selection RTC TimeStamp Pins Selection
155 * @{
156 */
157#define RTC_TIMESTAMPPIN_DEFAULT ((uint32_t)0x00000000)
158#define RTC_TIMESTAMPPIN_POS1 ((uint32_t)0x00020000)
159/**
160 * @}
161 */
162
163/** @defgroup RTCEx_Tamper_Trigger_Definitions RTC Tamper Triggers Definitions
164 * @{
165 */
166#define RTC_TAMPERTRIGGER_RISINGEDGE ((uint32_t)0x00000000)
167#define RTC_TAMPERTRIGGER_FALLINGEDGE ((uint32_t)0x00000002)
168#define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE
169#define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE
170/**
171 * @}
172 */
173
174/** @defgroup RTCEx_Tamper_Filter_Definitions RTC Tamper Filter Definitions
175 * @{
176 */
177#define RTC_TAMPERFILTER_DISABLE ((uint32_t)0x00000000) /*!< Tamper filter is disabled */
178
179#define RTC_TAMPERFILTER_2SAMPLE ((uint32_t)0x00000800) /*!< Tamper is activated after 2
180 consecutive samples at the active level */
181#define RTC_TAMPERFILTER_4SAMPLE ((uint32_t)0x00001000) /*!< Tamper is activated after 4
182 consecutive samples at the active level */
183#define RTC_TAMPERFILTER_8SAMPLE ((uint32_t)0x00001800) /*!< Tamper is activated after 8
184 consecutive samples at the active level. */
185/**
186 * @}
187 */
188
189/** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTC Tamper Sampling Frequencies Definitions
190 * @{
191 */
192#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 ((uint32_t)0x00000000) /*!< Each of the tamper inputs are sampled
193 with a frequency = RTCCLK / 32768 */
194#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 ((uint32_t)0x00000100) /*!< Each of the tamper inputs are sampled
195 with a frequency = RTCCLK / 16384 */
196#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 ((uint32_t)0x00000200) /*!< Each of the tamper inputs are sampled
197 with a frequency = RTCCLK / 8192 */
198#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 ((uint32_t)0x00000300) /*!< Each of the tamper inputs are sampled
199 with a frequency = RTCCLK / 4096 */
200#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 ((uint32_t)0x00000400) /*!< Each of the tamper inputs are sampled
201 with a frequency = RTCCLK / 2048 */
202#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 ((uint32_t)0x00000500) /*!< Each of the tamper inputs are sampled
203 with a frequency = RTCCLK / 1024 */
204#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 ((uint32_t)0x00000600) /*!< Each of the tamper inputs are sampled
205 with a frequency = RTCCLK / 512 */
206#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 ((uint32_t)0x00000700) /*!< Each of the tamper inputs are sampled
207 with a frequency = RTCCLK / 256 */
208/**
209 * @}
210 */
211
212/** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTC Tamper Pin Precharge Duration Definitions
213 * @{
214 */
215#define RTC_TAMPERPRECHARGEDURATION_1RTCCLK ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before
216 sampling during 1 RTCCLK cycle */
217#define RTC_TAMPERPRECHARGEDURATION_2RTCCLK ((uint32_t)0x00002000) /*!< Tamper pins are pre-charged before
218 sampling during 2 RTCCLK cycles */
219#define RTC_TAMPERPRECHARGEDURATION_4RTCCLK ((uint32_t)0x00004000) /*!< Tamper pins are pre-charged before
220 sampling during 4 RTCCLK cycles */
221#define RTC_TAMPERPRECHARGEDURATION_8RTCCLK ((uint32_t)0x00006000) /*!< Tamper pins are pre-charged before
222 sampling during 8 RTCCLK cycles */
223/**
224 * @}
225 */
226
227/** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTC Tamper TimeStamp On Tamper Detection Definitions
228 * @{
229 */
230#define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE ((uint32_t)RTC_TAFCR_TAMPTS) /*!< TimeStamp on Tamper Detection event saved */
231#define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event is not saved */
232/**
233 * @}
234 */
235
236/** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTC Tamper Pull Up Definitions
237 * @{
238 */
239#define RTC_TAMPER_PULLUP_ENABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event saved */
240#define RTC_TAMPER_PULLUP_DISABLE ((uint32_t)RTC_TAFCR_TAMPPUDIS) /*!< TimeStamp on Tamper Detection event is not saved */
241/**
242 * @}
243 */
244
245/** @defgroup RTCEx_Wakeup_Timer_Definitions RTC Wake-up Timer Definitions
246 * @{
247 */
248#define RTC_WAKEUPCLOCK_RTCCLK_DIV16 ((uint32_t)0x00000000)
249#define RTC_WAKEUPCLOCK_RTCCLK_DIV8 ((uint32_t)0x00000001)
250#define RTC_WAKEUPCLOCK_RTCCLK_DIV4 ((uint32_t)0x00000002)
251#define RTC_WAKEUPCLOCK_RTCCLK_DIV2 ((uint32_t)0x00000003)
252#define RTC_WAKEUPCLOCK_CK_SPRE_16BITS ((uint32_t)0x00000004)
253#define RTC_WAKEUPCLOCK_CK_SPRE_17BITS ((uint32_t)0x00000006)
254/**
255 * @}
256 */
257
258/** @defgroup RTCEx_Digital_Calibration_Definitions RTC Digital Calib Definitions
259 * @{
260 */
261#define RTC_CALIBSIGN_POSITIVE ((uint32_t)0x00000000)
262#define RTC_CALIBSIGN_NEGATIVE ((uint32_t)0x00000080)
263/**
264 * @}
265 */
266
267/** @defgroup RTCEx_Smooth_calib_period_Definitions RTC Smooth Calib Period Definitions
268 * @{
269 */
270#define RTC_SMOOTHCALIB_PERIOD_32SEC ((uint32_t)0x00000000) /*!< If RTCCLK = 32768 Hz, Smooth calibration
271 period is 32s, else 2exp20 RTCCLK seconds */
272#define RTC_SMOOTHCALIB_PERIOD_16SEC ((uint32_t)0x00002000) /*!< If RTCCLK = 32768 Hz, Smooth calibration
273 period is 16s, else 2exp19 RTCCLK seconds */
274#define RTC_SMOOTHCALIB_PERIOD_8SEC ((uint32_t)0x00004000) /*!< If RTCCLK = 32768 Hz, Smooth calibration
275 period is 8s, else 2exp18 RTCCLK seconds */
276/**
277 * @}
278 */
279
280/** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTC Smooth Calib Plus Pulses Definitions
281 * @{
282 */
283#define RTC_SMOOTHCALIB_PLUSPULSES_SET ((uint32_t)0x00008000) /*!< The number of RTCCLK pulses added
284 during a X -second window = Y - CALM[8:0]
285 with Y = 512, 256, 128 when X = 32, 16, 8 */
286#define RTC_SMOOTHCALIB_PLUSPULSES_RESET ((uint32_t)0x00000000) /*!< The number of RTCCLK pulses subbstited
287 during a 32-second window = CALM[8:0] */
288/**
289 * @}
290 */
291
292/** @defgroup RTCEx_Add_1_Second_Parameter_Definitions RTC Add 1 Second Parameter Definitions
293 * @{
294 */
295#define RTC_SHIFTADD1S_RESET ((uint32_t)0x00000000)
296#define RTC_SHIFTADD1S_SET ((uint32_t)0x80000000)
297/**
298 * @}
299 */
300
301
302 /** @defgroup RTCEx_Calib_Output_selection_Definitions RTC Calib Output Selection Definitions
303 * @{
304 */
305#define RTC_CALIBOUTPUT_512HZ ((uint32_t)0x00000000)
306#define RTC_CALIBOUTPUT_1HZ ((uint32_t)0x00080000)
307/**
308 * @}
309 */
310
311/**
312 * @}
313 */
314
315/* Exported macro ------------------------------------------------------------*/
316/** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros
317 * @{
318 */
319
320/* ---------------------------------WAKEUPTIMER---------------------------------*/
321/** @defgroup RTCEx_WakeUp_Timer RTC WakeUp Timer
322 * @{
323 */
324
325/**
326 * @brief Enable the RTC WakeUp Timer peripheral.
327 * @param __HANDLE__: specifies the RTC handle.
328 * @retval None
329 */
330#define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE))
331
332/**
333 * @brief Disable the RTC Wake-up Timer peripheral.
334 * @param __HANDLE__: specifies the RTC handle.
335 * @retval None
336 */
337#define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE))
338
339/**
340 * @brief Enable the RTC WakeUpTimer interrupt.
341 * @param __HANDLE__: specifies the RTC handle.
342 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
343 * This parameter can be:
344 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
345 * @retval None
346 */
347#define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
348
349/**
350 * @brief Disable the RTC WakeUpTimer interrupt.
351 * @param __HANDLE__: specifies the RTC handle.
352 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
353 * This parameter can be:
354 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
355 * @retval None
356 */
357#define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
358
359/**
360 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
361 * @param __HANDLE__: specifies the RTC handle.
362 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt to check.
363 * This parameter can be:
364 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
365 * @retval None
366 */
367#define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4)) != RESET)? SET : RESET)
368
369/**
370 * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not.
371 * @param __HANDLE__: specifies the RTC handle.
372 * @param __INTERRUPT__: specifies the RTC Wake Up timer interrupt sources to check.
373 * This parameter can be:
374 * @arg RTC_IT_WUT: WakeUpTimer interrupt
375 * @retval None
376 */
377#define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
378
379/**
380 * @brief Get the selected RTC WakeUpTimer's flag status.
381 * @param __HANDLE__: specifies the RTC handle.
382 * @param __FLAG__: specifies the RTC WakeUpTimer Flag to check.
383 * This parameter can be:
384 * @arg RTC_FLAG_WUTF
385 * @arg RTC_FLAG_WUTWF
386 * @retval None
387 */
388#define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
389
390/**
391 * @brief Clear the RTC Wake Up timer's pending flags.
392 * @param __HANDLE__: specifies the RTC handle.
393 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
394 * This parameter can be:
395 * @arg RTC_FLAG_WUTF
396 * @retval None
397 */
398#define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
399
400/**
401 * @brief Enable interrupt on the RTC Wake-up Timer associated Exti line.
402 * @retval None
403 */
404#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
405
406/**
407 * @brief Disable interrupt on the RTC Wake-up Timer associated Exti line.
408 * @retval None
409 */
410#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
411
412/**
413 * @brief Enable event on the RTC Wake-up Timer associated Exti line.
414 * @retval None.
415 */
416#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
417
418/**
419 * @brief Disable event on the RTC Wake-up Timer associated Exti line.
420 * @retval None.
421 */
422#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
423
424/**
425 * @brief Enable falling edge trigger on the RTC Wake-up Timer associated Exti line.
426 * @retval None.
427 */
428#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
429
430/**
431 * @brief Disable falling edge trigger on the RTC Wake-up Timer associated Exti line.
432 * @retval None.
433 */
434#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
435
436/**
437 * @brief Enable rising edge trigger on the RTC Wake-up Timer associated Exti line.
438 * @retval None.
439 */
440#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
441
442/**
443 * @brief Disable rising edge trigger on the RTC Wake-up Timer associated Exti line.
444 * @retval None.
445 */
446#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
447
448/**
449 * @brief Enable rising & falling edge trigger on the RTC Wake-up Timer associated Exti line.
450 * @retval None.
451 */
452#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE();
453
454/**
455 * @brief Disable rising & falling edge trigger on the RTC Wake-up Timer associated Exti line.
456 * This parameter can be:
457 * @retval None.
458 */
459#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE();
460
461/**
462 * @brief Check whether the RTC Wake-up Timer associated Exti line interrupt flag is set or not.
463 * @retval Line Status.
464 */
465#define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
466
467/**
468 * @brief Clear the RTC Wake-up Timer associated Exti line flag.
469 * @retval None.
470 */
471#define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
472
473/**
474 * @brief Generate a Software interrupt on the RTC Wake-up Timer associated Exti line.
475 * @retval None.
476 */
477#define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
478
479/**
480 * @}
481 */
482
483/* ---------------------------------TIMESTAMP---------------------------------*/
484/** @defgroup RTCEx_Timestamp RTC Timestamp
485 * @{
486 */
487
488/**
489 * @brief Enable the RTC TimeStamp peripheral.
490 * @param __HANDLE__: specifies the RTC handle.
491 * @retval None
492 */
493#define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE))
494
495/**
496 * @brief Disable the RTC TimeStamp peripheral.
497 * @param __HANDLE__: specifies the RTC handle.
498 * @retval None
499 */
500#define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE))
501
502/**
503 * @brief Enable the RTC TimeStamp interrupt.
504 * @param __HANDLE__: specifies the RTC handle.
505 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
506 * This parameter can be:
507 * @arg RTC_IT_TS: TimeStamp interrupt
508 * @retval None
509 */
510#define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
511
512/**
513 * @brief Disable the RTC TimeStamp interrupt.
514 * @param __HANDLE__: specifies the RTC handle.
515 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
516 * This parameter can be:
517 * @arg RTC_IT_TS: TimeStamp interrupt
518 * @retval None
519 */
520#define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
521
522/**
523 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not.
524 * @param __HANDLE__: specifies the RTC handle.
525 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt to check.
526 * This parameter can be:
527 * @arg RTC_IT_TS: TimeStamp interrupt
528 * @retval None
529 */
530#define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4)) != RESET)? SET : RESET)
531
532/**
533 * @brief Check whether the specified RTC Time Stamp interrupt has been enabled or not.
534 * @param __HANDLE__: specifies the RTC handle.
535 * @param __INTERRUPT__: specifies the RTC Time Stamp interrupt source to check.
536 * This parameter can be:
537 * @arg RTC_IT_TS: TimeStamp interrupt
538 * @retval None
539 */
540#define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
541
542/**
543 * @brief Get the selected RTC TimeStamp's flag status.
544 * @param __HANDLE__: specifies the RTC handle.
545 * @param __FLAG__: specifies the RTC TimeStamp flag to check.
546 * This parameter can be:
547 * @arg RTC_FLAG_TSF
548 * @arg RTC_FLAG_TSOVF
549 * @retval None
550 */
551#define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
552
553/**
554 * @brief Clear the RTC Time Stamp's pending flags.
555 * @param __HANDLE__: specifies the RTC handle.
556 * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
557 * This parameter can be:
558 * @arg RTC_FLAG_TSF
559 * @retval None
560 */
561#define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
562
563/**
564 * @}
565 */
566
567/* ---------------------------------TAMPER------------------------------------*/
568/** @defgroup RTCEx_Tamper RTC Tamper
569 * @{
570 */
571
572/**
573 * @brief Enable the RTC Tamper1 input detection.
574 * @param __HANDLE__: specifies the RTC handle.
575 * @retval None
576 */
577#define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR |= (RTC_TAFCR_TAMP1E))
578
579/**
580 * @brief Disable the RTC Tamper1 input detection.
581 * @param __HANDLE__: specifies the RTC handle.
582 * @retval None
583 */
584#define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR &= ~(RTC_TAFCR_TAMP1E))
585
586/**
587 * @brief Enable the RTC Tamper2 input detection.
588 * @param __HANDLE__: specifies the RTC handle.
589 * @retval None
590 */
591#define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR |= (RTC_TAFCR_TAMP2E))
592
593/**
594 * @brief Disable the RTC Tamper2 input detection.
595 * @param __HANDLE__: specifies the RTC handle.
596 * @retval None
597 */
598#define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR &= ~(RTC_TAFCR_TAMP2E))
599
600/**
601 * @brief Check whether the specified RTC Tamper interrupt has occurred or not.
602 * @param __HANDLE__: specifies the RTC handle.
603 * @param __INTERRUPT__: specifies the RTC Tamper interrupt to check.
604 * This parameter can be:
605 * @arg RTC_IT_TAMP1
606 * @arg RTC_IT_TAMP2
607 * @retval None
608 */
609#define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4)) != RESET)? SET : RESET)
610
611/**
612 * @brief Check whether the specified RTC Tamper interrupt has been enabled or not.
613 * @param __HANDLE__: specifies the RTC handle.
614 * @param __INTERRUPT__: specifies the RTC Tamper interrupt source to check.
615 * This parameter can be:
616 * @arg RTC_IT_TAMP: Tamper interrupt
617 * @retval None
618 */
619#define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->TAFCR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
620
621/**
622 * @brief Get the selected RTC Tamper's flag status.
623 * @param __HANDLE__: specifies the RTC handle.
624 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
625 * This parameter can be:
626 * @arg RTC_FLAG_TAMP1F
627 * @arg RTC_FLAG_TAMP2F
628 * @retval None
629 */
630#define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
631
632/**
633 * @brief Clear the RTC Tamper's pending flags.
634 * @param __HANDLE__: specifies the RTC handle.
635 * @param __FLAG__: specifies the RTC Tamper Flag to clear.
636 * This parameter can be:
637 * @arg RTC_FLAG_TAMP1F
638 * @arg RTC_FLAG_TAMP2F
639 * @retval None
640 */
641#define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
642/**
643 * @}
644 */
645
646/* --------------------------TAMPER/TIMESTAMP---------------------------------*/
647/** @defgroup RTCEx_Tamper_Timestamp EXTI RTC Tamper Timestamp EXTI
648 * @{
649 */
650
651/**
652 * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line.
653 * @retval None
654 */
655#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
656
657/**
658 * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line.
659 * @retval None
660 */
661#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
662
663/**
664 * @brief Enable event on the RTC Tamper and Timestamp associated Exti line.
665 * @retval None.
666 */
667#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
668
669/**
670 * @brief Disable event on the RTC Tamper and Timestamp associated Exti line.
671 * @retval None.
672 */
673#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
674
675/**
676 * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
677 * @retval None.
678 */
679#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
680
681/**
682 * @brief Disable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
683 * @retval None.
684 */
685#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
686
687/**
688 * @brief Enable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
689 * @retval None.
690 */
691#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
692
693/**
694 * @brief Disable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
695 * @retval None.
696 */
697#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
698
699/**
700 * @brief Enable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
701 * @retval None.
702 */
703#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE();
704
705/**
706 * @brief Disable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
707 * This parameter can be:
708 * @retval None.
709 */
710#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE();
711
712/**
713 * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not.
714 * @retval Line Status.
715 */
716#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
717
718/**
719 * @brief Clear the RTC Tamper and Timestamp associated Exti line flag.
720 * @retval None.
721 */
722#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
723
724/**
725 * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line
726 * @retval None.
727 */
728#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
729/**
730 * @}
731 */
732
733/* ------------------------------Calibration----------------------------------*/
734/** @defgroup RTCEx_Calibration RTC Calibration
735 * @{
736 */
737
738/**
739 * @brief Enable the Coarse calibration process.
740 * @param __HANDLE__: specifies the RTC handle.
741 * @retval None
742 */
743#define __HAL_RTC_COARSE_CALIB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_DCE))
744
745/**
746 * @brief Disable the Coarse calibration process.
747 * @param __HANDLE__: specifies the RTC handle.
748 * @retval None
749 */
750#define __HAL_RTC_COARSE_CALIB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_DCE))
751
752/**
753 * @brief Enable the RTC calibration output.
754 * @param __HANDLE__: specifies the RTC handle.
755 * @retval None
756 */
757#define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE))
758
759/**
760 * @brief Disable the calibration output.
761 * @param __HANDLE__: specifies the RTC handle.
762 * @retval None
763 */
764#define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE))
765
766/**
767 * @brief Enable the clock reference detection.
768 * @param __HANDLE__: specifies the RTC handle.
769 * @retval None
770 */
771#define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON))
772
773/**
774 * @brief Disable the clock reference detection.
775 * @param __HANDLE__: specifies the RTC handle.
776 * @retval None
777 */
778#define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON))
779
780/**
781 * @brief Get the selected RTC shift operation's flag status.
782 * @param __HANDLE__: specifies the RTC handle.
783 * @param __FLAG__: specifies the RTC shift operation Flag is pending or not.
784 * This parameter can be:
785 * @arg RTC_FLAG_SHPF
786 * @retval None
787 */
788#define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
789/**
790 * @}
791 */
792
793/**
794 * @}
795 */
796
797/* Exported functions --------------------------------------------------------*/
798/** @defgroup RTCEx_Exported_Functions RTCEx Exported Functions
799 * @{
800 */
801
802/** @addtogroup RTCEx_Exported_Functions_Group1
803 * @{
804 */
805/* RTC TimeStamp and Tamper functions *****************************************/
806HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
807HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
808HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc);
809HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format);
810
811HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
812HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
813HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper);
814void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc);
815
816void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc);
817void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc);
818void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc);
819HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
820HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
821HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
822/**
823 * @}
824 */
825
826/** @addtogroup RTCEx_Exported_Functions_Group2
827 * @{
828 */
829/* RTC Wake-up functions ******************************************************/
830HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
831HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
832uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc);
833uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc);
834void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc);
835void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc);
836HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
837/**
838 * @}
839 */
840
841/** @addtogroup RTCEx_Exported_Functions_Group3
842 * @{
843 */
844/* Extension Control functions ************************************************/
845void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
846uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
847
848HAL_StatusTypeDef HAL_RTCEx_SetCoarseCalib(RTC_HandleTypeDef *hrtc, uint32_t CalibSign, uint32_t Value);
849HAL_StatusTypeDef HAL_RTCEx_DeactivateCoarseCalib(RTC_HandleTypeDef *hrtc);
850HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue);
851HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
852HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput);
853HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc);
854HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc);
855HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc);
856HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc);
857HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc);
858/**
859 * @}
860 */
861
862/** @addtogroup RTCEx_Exported_Functions_Group4
863 * @{
864 */
865/* Extension RTC features functions *******************************************/
866void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc);
867HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
868/**
869 * @}
870 */
871
872/**
873 * @}
874 */
875
876/* Private types -------------------------------------------------------------*/
877/* Private variables ---------------------------------------------------------*/
878/* Private constants ---------------------------------------------------------*/
879/** @defgroup RTCEx_Private_Constants RTCEx Private Constants
880 * @{
881 */
882#define RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT ((uint32_t)EXTI_IMR_MR21) /*!< External interrupt line 21 Connected to the RTC Tamper and Time Stamp events */
883#define RTC_EXTI_LINE_WAKEUPTIMER_EVENT ((uint32_t)EXTI_IMR_MR22) /*!< External interrupt line 22 Connected to the RTC Wake-up event */
884/**
885 * @}
886 */
887
888/* Private macros ------------------------------------------------------------*/
889/** @defgroup RTCEx_Private_Macros RTCEx Private Macros
890 * @{
891 */
892
893/** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters
894 * @{
895 */
896#define IS_RTC_BKP(BKP) (((BKP) == RTC_BKP_DR0) || \
897 ((BKP) == RTC_BKP_DR1) || \
898 ((BKP) == RTC_BKP_DR2) || \
899 ((BKP) == RTC_BKP_DR3) || \
900 ((BKP) == RTC_BKP_DR4) || \
901 ((BKP) == RTC_BKP_DR5) || \
902 ((BKP) == RTC_BKP_DR6) || \
903 ((BKP) == RTC_BKP_DR7) || \
904 ((BKP) == RTC_BKP_DR8) || \
905 ((BKP) == RTC_BKP_DR9) || \
906 ((BKP) == RTC_BKP_DR10) || \
907 ((BKP) == RTC_BKP_DR11) || \
908 ((BKP) == RTC_BKP_DR12) || \
909 ((BKP) == RTC_BKP_DR13) || \
910 ((BKP) == RTC_BKP_DR14) || \
911 ((BKP) == RTC_BKP_DR15) || \
912 ((BKP) == RTC_BKP_DR16) || \
913 ((BKP) == RTC_BKP_DR17) || \
914 ((BKP) == RTC_BKP_DR18) || \
915 ((BKP) == RTC_BKP_DR19))
916#define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \
917 ((EDGE) == RTC_TIMESTAMPEDGE_FALLING))
918#define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & ((uint32_t)!(RTC_TAFCR_TAMP1E | RTC_TAFCR_TAMP2E))) == 0x00) && ((TAMPER) != (uint32_t)RESET))
919
920#define IS_RTC_TAMPER_PIN(PIN) (((PIN) == RTC_TAMPERPIN_DEFAULT) || \
921 ((PIN) == RTC_TAMPERPIN_POS1))
922
923#define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_DEFAULT) || \
924 ((PIN) == RTC_TIMESTAMPPIN_POS1))
925
926#define IS_RTC_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) || \
927 ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \
928 ((TRIGGER) == RTC_TAMPERTRIGGER_LOWLEVEL) || \
929 ((TRIGGER) == RTC_TAMPERTRIGGER_HIGHLEVEL))
930#define IS_RTC_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TAMPERFILTER_DISABLE) || \
931 ((FILTER) == RTC_TAMPERFILTER_2SAMPLE) || \
932 ((FILTER) == RTC_TAMPERFILTER_4SAMPLE) || \
933 ((FILTER) == RTC_TAMPERFILTER_8SAMPLE))
934#define IS_RTC_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \
935 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \
936 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \
937 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \
938 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \
939 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \
940 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \
941 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256))
942#define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \
943 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \
944 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \
945 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK))
946#define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \
947 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE))
948#define IS_RTC_TAMPER_PULLUP_STATE(STATE) (((STATE) == RTC_TAMPER_PULLUP_ENABLE) || \
949 ((STATE) == RTC_TAMPER_PULLUP_DISABLE))
950#define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \
951 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \
952 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \
953 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \
954 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \
955 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS))
956
957#define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFF)
958#define IS_RTC_CALIB_SIGN(SIGN) (((SIGN) == RTC_CALIBSIGN_POSITIVE) || \
959 ((SIGN) == RTC_CALIBSIGN_NEGATIVE))
960
961#define IS_RTC_CALIB_VALUE(VALUE) ((VALUE) < 0x20)
962
963#define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \
964 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \
965 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC))
966#define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \
967 ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET))
968
969
970#define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FF)
971#define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \
972 ((SEL) == RTC_SHIFTADD1S_SET))
973#define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFF)
974#define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \
975 ((OUTPUT) == RTC_CALIBOUTPUT_1HZ))
976/**
977 * @}
978 */
979
980/**
981 * @}
982 */
983
984/**
985 * @}
986 */
987
988/**
989 * @}
990 */
991
992#ifdef __cplusplus
993}
994#endif
995
996#endif /* __STM32F4xx_HAL_RTC_EX_H */
997
998/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Note: See TracBrowser for help on using the repository browser.