2 ******************************************************************************
3 * @file stm32l0xx_hal_rtc_ex.h
4 * @author MCD Application Team
6 * @date 06-February-2015
7 * @brief Header file of RTC HAL Extended module.
8 ******************************************************************************
11 * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
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.
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.
35 ******************************************************************************
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32L0xx_HAL_RTC_EX_H
40 #define __STM32L0xx_HAL_RTC_EX_H
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32l0xx_hal_def.h"
49 /** @addtogroup STM32L0xx_HAL_Driver
53 /** @defgroup RTCEx RTCEx
57 /* Exported types ------------------------------------------------------------*/
59 /** @defgroup RTCEx_Exported_Types RTC Extended Exported Types
64 * @brief RTC Tamper structure definition
68 uint32_t Tamper; /*!< Specifies the Tamper Pin.
69 This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */
71 uint32_t Interrupt; /*!< Specifies the Tamper Interrupt.
72 This parameter can be a value of @ref RTCEx_Tamper_Interrupt_Definitions */
74 uint32_t Trigger; /*!< Specifies the Tamper Trigger.
75 This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */
77 uint32_t NoErase; /*!< Specifies the Tamper no erase mode.
78 This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp_Definitions */
80 uint32_t MaskFlag; /*!< Specifies the Tamper Flag masking.
81 This parameter can be a value of @ref RTCEx_Tamper_MaskFlag_Definitions */
83 uint32_t Filter; /*!< Specifies the RTC Filter Tamper.
84 This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */
86 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency.
87 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */
89 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration .
90 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */
92 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp .
93 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */
95 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection.
96 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */
102 /* Exported constants --------------------------------------------------------*/
103 /** @defgroup RTCEx_Exported_Constants RTC Extended Exported Constants
108 /** @defgroup RTCEx_Interrupts_Definitions RTC Extended Interrupts Definitions
111 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
112 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
114 #define RTC_IT_TAMP3 RTC_TAMPCR_TAMP3IE
116 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
117 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
124 /** @defgroup RTCEx_Flags_Definitions RTC Extended Flags Definitions
127 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
128 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
130 #define RTC_FLAG_TAMP3F RTC_ISR_TAMP3F
132 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
133 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
140 /** @defgroup RTCEx_Backup_Registers_Definitions RTC Extended Backup Registers Definition
143 #define RTC_BKP_DR0 ((uint32_t)0x00000000)
144 #define RTC_BKP_DR1 ((uint32_t)0x00000001)
145 #define RTC_BKP_DR2 ((uint32_t)0x00000002)
146 #define RTC_BKP_DR3 ((uint32_t)0x00000003)
147 #define RTC_BKP_DR4 ((uint32_t)0x00000004)
149 #define IS_RTC_BKP(__BKP__) (((__BKP__) == RTC_BKP_DR0) || \
150 ((__BKP__) == RTC_BKP_DR1) || \
151 ((__BKP__) == RTC_BKP_DR2) || \
152 ((__BKP__) == RTC_BKP_DR3) || \
153 ((__BKP__) == RTC_BKP_DR4))
158 /** @defgroup RTC_Mask_Definition RTC Mask Definition
162 /* Masks Definition */
164 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
165 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
167 #define RTC_FLAGS_MASK ((uint32_t) (RTC_FLAG_RECALPF | RTC_FLAG_TAMP3F | RTC_FLAG_TAMP2F | \
168 RTC_FLAG_TAMP1F| RTC_FLAG_TSOVF | RTC_FLAG_TSF | \
169 RTC_FLAG_WUTF | RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | \
170 RTC_FLAG_INIT | RTC_FLAG_INITF | RTC_FLAG_RSF | \
171 RTC_FLAG_INITS | RTC_FLAG_SHPF | RTC_FLAG_WUTWF | \
172 RTC_FLAG_ALRBWF | RTC_FLAG_ALRAWF))
174 #define RTC_TAMPCR_TAMPXE ((uint32_t) (RTC_TAMPCR_TAMP3E | RTC_TAMPCR_TAMP2E | RTC_TAMPCR_TAMP1E))
178 #define RTC_FLAGS_MASK ((uint32_t) (RTC_FLAG_RECALPF | RTC_FLAG_TAMP2F | RTC_FLAG_TAMP1F| \
179 RTC_FLAG_TSOVF | RTC_FLAG_TSF | RTC_FLAG_WUTF | \
180 RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | RTC_FLAG_INIT | \
181 RTC_FLAG_INITF | RTC_FLAG_RSF | RTC_FLAG_INITS | \
182 RTC_FLAG_SHPF | RTC_FLAG_WUTWF |RTC_FLAG_ALRBWF | \
185 #define RTC_TAMPCR_TAMPXE ((uint32_t) (RTC_TAMPCR_TAMP2E | RTC_TAMPCR_TAMP1E))
187 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
188 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
194 /** @defgroup RTCEx_Time_Stamp_Edges_definitions RTC Extended Time Stamp Edges definition
197 #define RTC_TIMESTAMPEDGE_RISING ((uint32_t)0x00000000)
198 #define RTC_TIMESTAMPEDGE_FALLING RTC_CR_TSEDGE
200 #define IS_TIMESTAMP_EDGE(__EDGE__) (((__EDGE__) == RTC_TIMESTAMPEDGE_RISING) || \
201 ((__EDGE__) == RTC_TIMESTAMPEDGE_FALLING))
206 /** @defgroup RTCEx_Tamper_Pins_Definitions RTC Extended Tamper Pins Definition
210 #define RTC_TAMPER_1 RTC_TAMPCR_TAMP1E
211 #define RTC_TAMPER_2 RTC_TAMPCR_TAMP2E
213 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
214 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
216 #define RTC_TAMPER_3 RTC_TAMPCR_TAMP3E
218 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
219 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
222 #define IS_RTC_TAMPER(__TAMPER__) ((((__TAMPER__) & ((uint32_t)(0xFFFFFFFF ^ RTC_TAMPCR_TAMPXE))) == 0x00) && ((__TAMPER__) != (uint32_t)RESET))
229 /** @defgroup RTCEx_Tamper_Interrupt_Definitions RTC Extended Tamper Interrupt Definitions
233 #define RTC_TAMPER1_INTERRUPT RTC_TAMPCR_TAMP1IE
234 #define RTC_TAMPER2_INTERRUPT RTC_TAMPCR_TAMP2IE
235 #define RTC_ALL_TAMPER_INTERRUPT RTC_TAMPCR_TAMPIE
237 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
238 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
240 #define RTC_TAMPER3_INTERRUPT RTC_TAMPCR_TAMP3IE
241 #define IS_RTC_TAMPER_INTERRUPT(__INTERRUPT__) (((__INTERRUPT__) == RTC_TAMPER1_INTERRUPT) || \
242 ((__INTERRUPT__) == RTC_TAMPER2_INTERRUPT) || \
243 ((__INTERRUPT__) == RTC_TAMPER3_INTERRUPT) || \
244 ((__INTERRUPT__) == RTC_ALL_TAMPER_INTERRUPT ))
248 #define IS_RTC_TAMPER_INTERRUPT(__INTERRUPT__) (((__INTERRUPT__) == RTC_TAMPER1_INTERRUPT) || \
249 ((__INTERRUPT__) == RTC_TAMPER2_INTERRUPT) || \
250 ((__INTERRUPT__) == RTC_ALL_TAMPER_INTERRUPT ))
252 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
253 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
260 /** @defgroup RTCEx_TimeStamp_Pin_Selections RTC Extended TimeStamp Pin Selection
263 #define RTC_TIMESTAMPPIN_PC13 ((uint32_t)0x00000000)
265 #define IS_RTC_TIMESTAMP_PIN(__PIN__) (((__PIN__) == RTC_TIMESTAMPPIN_PC13))
270 /** @defgroup RTCEx_Tamper_Trigger_Definitions RTC Extended Tamper Trigger Definition
273 #define RTC_TAMPERTRIGGER_RISINGEDGE ((uint32_t)0x00000000)
274 #define RTC_TAMPERTRIGGER_FALLINGEDGE RTC_TAMPCR_TAMP1TRG
275 #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE
276 #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE
278 #define IS_RTC_TAMPER_TRIGGER(__TRIGGER__) (((__TRIGGER__) == RTC_TAMPERTRIGGER_RISINGEDGE) || \
279 ((__TRIGGER__) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \
280 ((__TRIGGER__) == RTC_TAMPERTRIGGER_LOWLEVEL) || \
281 ((__TRIGGER__) == RTC_TAMPERTRIGGER_HIGHLEVEL))
287 /** @defgroup RTCEx_Tamper_EraseBackUp_Definitions RTC Extended Tamper EraseBackUp Definitions
290 #define RTC_TAMPER_ERASE_BACKUP_ENABLE ((uint32_t)0x00000000)
291 #define RTC_TAMPER_ERASE_BACKUP_DISABLE RTC_TAMPCR_TAMP1NOERASE
293 #define IS_RTC_TAMPER_ERASE_MODE(__MODE__) (((__MODE__) == RTC_TAMPER_ERASE_BACKUP_ENABLE) || \
294 ((__MODE__) == RTC_TAMPER_ERASE_BACKUP_DISABLE))
299 /** @defgroup RTCEx_Tamper_MaskFlag_Definitions RTC Extended Tamper MaskFlag Definitions
302 #define RTC_TAMPERMASK_FLAG_DISABLE ((uint32_t)0x00000000)
303 #define RTC_TAMPERMASK_FLAG_ENABLE RTC_TAMPCR_TAMP1MF
305 #define IS_RTC_TAMPER_MASKFLAG_STATE(__STATE__) (((__STATE__) == RTC_TAMPERMASK_FLAG_ENABLE ) || \
306 ((__STATE__) == RTC_TAMPERMASK_FLAG_DISABLE))
311 /** @defgroup RTCEx_Tamper_Filter_Definitions RTC Extended Tamper Filter Definitions
314 #define RTC_TAMPERFILTER_DISABLE ((uint32_t)0x00000000) /*!< Tamper filter is disabled */
316 #define RTC_TAMPERFILTER_2SAMPLE RTC_TAMPCR_TAMPFLT_0 /*!< Tamper is activated after 2
317 consecutive samples at the active level */
318 #define RTC_TAMPERFILTER_4SAMPLE RTC_TAMPCR_TAMPFLT_1 /*!< Tamper is activated after 4
319 consecutive samples at the active level */
320 #define RTC_TAMPERFILTER_8SAMPLE RTC_TAMPCR_TAMPFLT /*!< Tamper is activated after 8
321 consecutive samples at the active leve. */
323 #define IS_RTC_TAMPER_FILTER(__FILTER__) (((__FILTER__) == RTC_TAMPERFILTER_DISABLE) || \
324 ((__FILTER__) == RTC_TAMPERFILTER_2SAMPLE) || \
325 ((__FILTER__) == RTC_TAMPERFILTER_4SAMPLE) || \
326 ((__FILTER__) == RTC_TAMPERFILTER_8SAMPLE))
331 /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTC Extended Tamper Sampling Frequencies Definitions
334 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 ((uint32_t)0x00000000) /*!< Each of the tamper inputs are sampled
335 with a frequency = RTCCLK / 32768 */
336 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 RTC_TAMPCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled
337 with a frequency = RTCCLK / 16384 */
338 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 RTC_TAMPCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled
339 with a frequency = RTCCLK / 8192 */
340 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 ((uint32_t) (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_1)) /*!< Each of the tamper inputs are sampled
341 with a frequency = RTCCLK / 4096 */
342 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 RTC_TAMPCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled
343 with a frequency = RTCCLK / 2048 */
344 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 ((uint32_t) (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_2)) /*!< Each of the tamper inputs are sampled
345 with a frequency = RTCCLK / 1024 */
346 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 ((uint32_t) (RTC_TAMPCR_TAMPFREQ_1 | RTC_TAMPCR_TAMPFREQ_2)) /*!< Each of the tamper inputs are sampled
347 with a frequency = RTCCLK / 512 */
348 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 ((uint32_t) (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_1 | \
349 RTC_TAMPCR_TAMPFREQ_2)) /*!< Each of the tamper inputs are sampled
350 with a frequency = RTCCLK / 256 */
352 #define IS_RTC_TAMPER_SAMPLING_FREQ(__FREQ__) (((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \
353 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \
354 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \
355 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \
356 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \
357 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \
358 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \
359 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256))
364 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTC Extended Tamper Pin Precharge Duration Definitions
367 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before
368 sampling during 1 RTCCLK cycle */
369 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK RTC_TAMPCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before
370 sampling during 2 RTCCLK cycles */
371 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK RTC_TAMPCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before
372 sampling during 4 RTCCLK cycles */
373 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK ((uint32_t)(RTC_TAMPCR_TAMPPRCH_0 | RTC_TAMPCR_TAMPPRCH_1)) /*!< Tamper pins are pre-charged before
374 sampling during 8 RTCCLK cycles */
376 #define IS_RTC_TAMPER_PRECHARGE_DURATION(__DURATION_) (((__DURATION_) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \
377 ((__DURATION_) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \
378 ((__DURATION_) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \
379 ((__DURATION_) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK))
384 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTC Extended Tamper TimeStampOnTamperDetection Definitions
387 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE RTC_TAMPCR_TAMPTS /*!< TimeStamp on Tamper Detection event saved */
388 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event is not saved */
390 #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(__DETECTION__) (((__DETECTION__) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \
391 ((__DETECTION__) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE))
396 /** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTC Extended Tamper Pull UP Definitions
399 #define RTC_TAMPER_PULLUP_ENABLE ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before sampling */
400 #define RTC_TAMPER_PULLUP_DISABLE RTC_TAMPCR_TAMPPUDIS /*!< Tamper pins pre-charge is disabled */
402 #define IS_RTC_TAMPER_PULLUP_STATE(__STATE__) (((__STATE__) == RTC_TAMPER_PULLUP_ENABLE) || \
403 ((__STATE__) == RTC_TAMPER_PULLUP_DISABLE))
408 /** @defgroup RTCEx_Wakeup_Timer_Definitions RTC Extended Wakeup Timer Definitions
411 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 ((uint32_t)0x00000000)
412 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 RTC_CR_WUCKSEL_0
413 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 RTC_CR_WUCKSEL_1
414 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 ((uint32_t) (RTC_CR_WUCKSEL_0 | RTC_CR_WUCKSEL_1))
415 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS RTC_CR_WUCKSEL_2
416 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS ((uint32_t) (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_2))
418 #define IS_RTC_WAKEUP_CLOCK(__CLOCK__) (((__CLOCK__) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \
419 ((__CLOCK__) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \
420 ((__CLOCK__) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \
421 ((__CLOCK__) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \
422 ((__CLOCK__) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \
423 ((__CLOCK__) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS))
425 #define IS_RTC_WAKEUP_COUNTER(__COUNTER__) ((__COUNTER__) <= RTC_WUTR_WUT)
430 /** @defgroup RTCEx_Smooth_calib_period_Definitions RTC Extended Smooth calib period Definitions
433 #define RTC_SMOOTHCALIB_PERIOD_32SEC ((uint32_t)0x00000000) /*!< If RTCCLK = 32768 Hz, Smooth calibation
434 period is 32s, else 2exp20 RTCCLK pulses */
435 #define RTC_SMOOTHCALIB_PERIOD_16SEC RTC_CAL_CALW16 /*!< If RTCCLK = 32768 Hz, Smooth calibation
436 period is 16s, else 2exp19 RTCCLK pulses */
437 #define RTC_SMOOTHCALIB_PERIOD_8SEC RTC_CAL_CALW8 /*!< If RTCCLK = 32768 Hz, Smooth calibation
438 period is 8s, else 2exp18 RTCCLK pulses */
440 #define IS_RTC_SMOOTH_CALIB_PERIOD(__PERIOD__) (((__PERIOD__) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \
441 ((__PERIOD__) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \
442 ((__PERIOD__) == RTC_SMOOTHCALIB_PERIOD_8SEC))
447 /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTC Extended Smooth calib Plus pulses Definitions
450 #define RTC_SMOOTHCALIB_PLUSPULSES_SET RTC_CAL_CALP /*!< The number of RTCCLK pulses added
451 during a X -second window = Y - CALM[8:0]
452 with Y = 512, 256, 128 when X = 32, 16, 8 */
453 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET ((uint32_t)0x00000000) /*!< The number of RTCCLK pulses subbstited
454 during a 32-second window = CALM[8:0] */
456 #define IS_RTC_SMOOTH_CALIB_PLUS(__PLUS__) (((__PLUS__) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \
457 ((__PLUS__) == RTC_SMOOTHCALIB_PLUSPULSES_RESET))
462 /** @defgroup RTCEx_Smooth_calib_Minus_pulses_Definitions RTC Extended Smooth calib Minus pulses Definitions
465 #define IS_RTC_SMOOTH_CALIB_MINUS(__VALUE__) ((__VALUE__) <= RTC_CAL_CALM)
470 /** @defgroup RTCEx_Add_1_Second_Parameter_Definition RTC Extended Add 1 Second Parameter Definitions
473 #define RTC_SHIFTADD1S_RESET ((uint32_t)0x00000000)
474 #define RTC_SHIFTADD1S_SET RTC_SHIFTR_ADD1S
476 #define IS_RTC_SHIFT_ADD1S(__SEL__) (((__SEL__) == RTC_SHIFTADD1S_RESET) || \
477 ((__SEL__) == RTC_SHIFTADD1S_SET))
482 /** @defgroup RTCEx_Substract_Fraction_Of_Second_Value RTC Extended Substract Fraction Of Second Value
485 #define IS_RTC_SHIFT_SUBFS(__FS__) ((__FS__) <= RTC_SHIFTR_SUBFS)
490 /** @defgroup RTCEx_Calib_Output_selection_Definitions RTC Extended Calib Output selection Definitions
493 #define RTC_CALIBOUTPUT_512HZ ((uint32_t)0x00000000)
494 #define RTC_CALIBOUTPUT_1HZ RTC_CR_COSEL
496 #define IS_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == RTC_CALIBOUTPUT_512HZ) || \
497 ((__OUTPUT__) == RTC_CALIBOUTPUT_1HZ))
506 /* Exported macro ------------------------------------------------------------*/
507 /** @defgroup RTCEx_Exported_Macros RTC Extended Exported Macros
512 * @brief Enable the RTC WakeUp Timer peripheral.
513 * @param __HANDLE__: specifies the RTC handle.
516 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE))
519 * @brief Enable the RTC TimeStamp peripheral.
520 * @param __HANDLE__: specifies the RTC handle.
523 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE))
526 * @brief Disable the RTC WakeUp Timer peripheral.
527 * @param __HANDLE__: specifies the RTC handle.
530 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE))
533 * @brief Disable the RTC TimeStamp peripheral.
534 * @param __HANDLE__: specifies the RTC handle.
537 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE))
540 * @brief Enable the RTC calibration output.
541 * @param __HANDLE__: specifies the RTC handle.
544 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE))
547 * @brief Disable the calibration output.
548 * @param __HANDLE__: specifies the RTC handle.
551 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE))
554 * @brief Enable the clock reference detection.
555 * @param __HANDLE__: specifies the RTC handle.
558 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON))
561 * @brief Disable the clock reference detection.
562 * @param __HANDLE__: specifies the RTC handle.
565 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON))
568 * @brief Enable the RTC TimeStamp interrupt.
569 * @param __HANDLE__: specifies the RTC handle.
570 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
571 * This parameter can be:
572 * @arg RTC_IT_TS: TimeStamp interrupt
575 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
578 * @brief Enable the RTC WakeUpTimer interrupt.
579 * @param __HANDLE__: specifies the RTC handle.
580 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
581 * This parameter can be:
582 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
585 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
588 * @brief Disable the RTC TimeStamp interrupt.
589 * @param __HANDLE__: specifies the RTC handle.
590 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
591 * This parameter can be:
592 * @arg RTC_IT_TS: TimeStamp interrupt
595 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
598 * @brief Disable the RTC WakeUpTimer interrupt.
599 * @param __HANDLE__: specifies the RTC handle.
600 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
601 * This parameter can be:
602 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
605 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
608 * @brief Check whether the specified RTC Tamper interrupt has occurred or not.
609 * @param __HANDLE__: specifies the RTC handle.
610 * @param __FLAG__: specifies the RTC Tamper interrupt sources to be enabled or disabled.
611 * This parameter can be:
615 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
618 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
619 * @param __HANDLE__: specifies the RTC handle.
620 * @param __FLAG__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
621 * This parameter can be:
622 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
625 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
628 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not.
629 * @param __HANDLE__: specifies the RTC handle.
630 * @param __FLAG__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
631 * This parameter can be:
632 * @arg RTC_IT_TS: TimeStamp interrupt
635 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
638 * @brief Get the selected RTC TimeStamp's flag status.
639 * @param __HANDLE__: specifies the RTC handle.
640 * @param __FLAG__: specifies the RTC TimeStamp Flag sources to be enabled or disabled.
641 * This parameter can be:
643 * @arg RTC_FLAG_TSOVF
646 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
649 * @brief Get the selected RTC WakeUpTimer's flag status.
650 * @param __HANDLE__: specifies the RTC handle.
651 * @param __FLAG__: specifies the RTC WakeUpTimer Flag sources to be enabled or disabled.
652 * This parameter can be:
654 * @arg RTC_FLAG_WUTWF
657 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
660 * @brief Get the selected RTC Tamper's flag status.
661 * @param __HANDLE__: specifies the RTC handle.
662 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
663 * This parameter can be:
664 * @arg RTC_FLAG_TAMP1F
667 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
670 * @brief Get the selected RTC shift operation's flag status.
671 * @param __HANDLE__: specifies the RTC handle.
672 * @param __FLAG__: specifies the RTC shift operation Flag is pending or not.
673 * This parameter can be:
677 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
680 * @brief Clear the RTC Time Stamp's pending flags.
681 * @param __HANDLE__: specifies the RTC handle.
682 * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
683 * This parameter can be:
687 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& RTC_FLAGS_MASK)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
690 * @brief Clear the RTC Tamper's pending flags.
691 * @param __HANDLE__: specifies the RTC handle.
692 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
693 * This parameter can be:
694 * @arg RTC_FLAG_TAMP1F
697 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& RTC_FLAGS_MASK)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
700 * @brief Clear the RTC Wake Up timer's pending flags.
701 * @param __HANDLE__: specifies the RTC handle.
702 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
703 * This parameter can be:
707 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& RTC_FLAGS_MASK)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
709 /* WAKE-UP TIMER EXTI */
710 /* ------------------ */
712 * @brief Enable interrupt on the RTC WakeUp Timer associated Exti line.
715 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
718 * @brief Disable interrupt on the RTC WakeUp Timer associated Exti line.
721 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
724 * @brief Enable event on the RTC WakeUp Timer associated Exti line.
727 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
730 * @brief Disable event on the RTC WakeUp Timer associated Exti line.
733 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
736 * @brief Enable falling edge trigger on the RTC WakeUp Timer associated Exti line.
739 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
742 * @brief Disable falling edge trigger on the RTC WakeUp Timer associated Exti line.
745 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
748 * @brief Enable rising edge trigger on the RTC WakeUp Timer associated Exti line.
751 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
754 * @brief Disable rising edge trigger on the RTC WakeUp Timer associated Exti line.
757 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
760 * @brief Enable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line.
763 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE();
766 * @brief Disable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line.
767 * This parameter can be:
770 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE();
773 * @brief Check whether the RTC WakeUp Timer associated Exti line interrupt flag is set or not.
774 * @retval Line Status.
776 #define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
779 * @brief Clear the RTC WakeUp Timer associated Exti line flag.
782 #define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
785 * @brief Generate a Software interrupt on the RTC WakeUp Timer associated Exti line.
788 #define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
791 /* TAMPER TIMESTAMP EXTI */
792 /* --------------------- */
794 * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line.
797 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
800 * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line.
803 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
806 * @brief Enable event on the RTC Tamper and Timestamp associated Exti line.
809 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
812 * @brief Disable event on the RTC Tamper and Timestamp associated Exti line.
815 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
818 * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
821 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
824 * @brief Disable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
827 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
830 * @brief Enable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
833 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
836 * @brief Disable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
839 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
842 * @brief Enable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
845 #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();
848 * @brief Disable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
849 * This parameter can be:
852 #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();
855 * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not.
856 * @retval Line Status.
858 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
861 * @brief Clear the RTC Tamper and Timestamp associated Exti line flag.
864 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
867 * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line
870 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
877 /* Exported functions --------------------------------------------------------*/
878 /** @defgroup RTCEx_Exported_Functions RTC Extended Exported Functions
882 /** @defgroup RTCEx_Exported_Functions_Group1 Extended RTC TimeStamp and Tamper functions
886 /* RTC TimeStamp and Tamper functions *****************************************/
887 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
888 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
889 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc);
890 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format);
892 HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
893 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
894 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper);
895 void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc);
897 void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc);
898 void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc);
900 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
901 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
903 void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc);
905 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
906 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
909 void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc);
910 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
911 HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
912 HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
914 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
915 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
917 HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
919 #endif /* (STM32L083xx) || (STM32L082xx) || (STM32L081xx) ||
920 * (STM32L073xx) || (STM32L072xx) || (STM32L071xx)
927 /** @defgroup RTCEx_Exported_Functions_Group2 Extended RTC Wake-up functions
931 /* RTC Wake-up functions ******************************************************/
932 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
933 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
934 uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc);
935 uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc);
936 void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc);
937 void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc);
938 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
943 /** @defgroup RTCEx_Exported_Functions_Group3 Extended Peripheral Control functions
947 /* Extended Control functions ************************************************/
948 void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
949 uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
951 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue);
952 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
953 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput);
954 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc);
955 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc);
956 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc);
957 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc);
958 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc);
963 /* Extended RTC features functions *******************************************/
964 /** @defgroup RTCEx_Exported_Functions_Group4 Extended features functions
967 void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc);
968 HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
990 #endif /* __STM32L0xx_HAL_RTC_EX_H */
992 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/