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