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