Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | /** |
2 | ****************************************************************************** |
||
3 | * @file stm32f1xx_hal_rtc.h |
||
4 | * @author MCD Application Team |
||
5 | * @brief Header file of RTC HAL 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 __STM32F1xx_HAL_RTC_H |
||
22 | #define __STM32F1xx_HAL_RTC_H |
||
23 | |||
24 | #ifdef __cplusplus |
||
25 | extern "C" { |
||
26 | #endif |
||
27 | |||
28 | /* Includes ------------------------------------------------------------------*/ |
||
29 | #include "stm32f1xx_hal_def.h" |
||
30 | |||
31 | /** @addtogroup STM32F1xx_HAL_Driver |
||
32 | * @{ |
||
33 | */ |
||
34 | |||
35 | /** @addtogroup RTC |
||
36 | * @{ |
||
37 | */ |
||
38 | |||
39 | /** @addtogroup RTC_Private_Macros |
||
40 | * @{ |
||
41 | */ |
||
42 | |||
43 | #define IS_RTC_ASYNCH_PREDIV(PREDIV) (((PREDIV) <= 0xFFFFFU) || ((PREDIV) == RTC_AUTO_1_SECOND)) |
||
44 | #define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23U) |
||
45 | #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59U) |
||
46 | #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59U) |
||
47 | #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD)) |
||
48 | #define IS_RTC_YEAR(YEAR) ((YEAR) <= 99U) |
||
49 | #define IS_RTC_MONTH(MONTH) (((MONTH) >= 1U) && ((MONTH) <= 12U)) |
||
50 | #define IS_RTC_DATE(DATE) (((DATE) >= 1U) && ((DATE) <= 31U)) |
||
51 | #define IS_RTC_ALARM(ALARM) ((ALARM) == RTC_ALARM_A) |
||
52 | #define IS_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == RTC_OUTPUTSOURCE_NONE) || \ |
||
53 | ((__OUTPUT__) == RTC_OUTPUTSOURCE_CALIBCLOCK) || \ |
||
54 | ((__OUTPUT__) == RTC_OUTPUTSOURCE_ALARM) || \ |
||
55 | ((__OUTPUT__) == RTC_OUTPUTSOURCE_SECOND)) |
||
56 | |||
57 | |||
58 | /** |
||
59 | * @} |
||
60 | */ |
||
61 | |||
62 | /** @addtogroup RTC_Private_Constants |
||
63 | * @{ |
||
64 | */ |
||
65 | /** @defgroup RTC_Timeout_Value Default Timeout Value |
||
66 | * @{ |
||
67 | */ |
||
68 | #define RTC_TIMEOUT_VALUE 1000U |
||
69 | /** |
||
70 | * @} |
||
71 | */ |
||
72 | |||
73 | /** @defgroup RTC_EXTI_Line_Event RTC EXTI Line event |
||
74 | * @{ |
||
75 | */ |
||
76 | #define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)EXTI_IMR_MR17) /*!< External interrupt line 17 Connected to the RTC Alarm event */ |
||
77 | /** |
||
78 | * @} |
||
79 | */ |
||
80 | |||
81 | |||
82 | /** |
||
83 | * @} |
||
84 | */ |
||
85 | |||
86 | /* Exported types ------------------------------------------------------------*/ |
||
87 | /** @defgroup RTC_Exported_Types RTC Exported Types |
||
88 | * @{ |
||
89 | */ |
||
90 | /** |
||
91 | * @brief RTC Time structure definition |
||
92 | */ |
||
93 | typedef struct |
||
94 | { |
||
95 | uint8_t Hours; /*!< Specifies the RTC Time Hour. |
||
96 | This parameter must be a number between Min_Data = 0 and Max_Data = 23 */ |
||
97 | |||
98 | uint8_t Minutes; /*!< Specifies the RTC Time Minutes. |
||
99 | This parameter must be a number between Min_Data = 0 and Max_Data = 59 */ |
||
100 | |||
101 | uint8_t Seconds; /*!< Specifies the RTC Time Seconds. |
||
102 | This parameter must be a number between Min_Data = 0 and Max_Data = 59 */ |
||
103 | |||
104 | } RTC_TimeTypeDef; |
||
105 | |||
106 | /** |
||
107 | * @brief RTC Alarm structure definition |
||
108 | */ |
||
109 | typedef struct |
||
110 | { |
||
111 | RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */ |
||
112 | |||
113 | uint32_t Alarm; /*!< Specifies the alarm ID (only 1 alarm ID for STM32F1). |
||
114 | This parameter can be a value of @ref RTC_Alarms_Definitions */ |
||
115 | } RTC_AlarmTypeDef; |
||
116 | |||
117 | /** |
||
118 | * @brief HAL State structures definition |
||
119 | */ |
||
120 | typedef enum |
||
121 | { |
||
122 | HAL_RTC_STATE_RESET = 0x00U, /*!< RTC not yet initialized or disabled */ |
||
123 | HAL_RTC_STATE_READY = 0x01U, /*!< RTC initialized and ready for use */ |
||
124 | HAL_RTC_STATE_BUSY = 0x02U, /*!< RTC process is ongoing */ |
||
125 | HAL_RTC_STATE_TIMEOUT = 0x03U, /*!< RTC timeout state */ |
||
126 | HAL_RTC_STATE_ERROR = 0x04U /*!< RTC error state */ |
||
127 | |||
128 | } HAL_RTCStateTypeDef; |
||
129 | |||
130 | /** |
||
131 | * @brief RTC Configuration Structure definition |
||
132 | */ |
||
133 | typedef struct |
||
134 | { |
||
135 | uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value. |
||
136 | This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFFF or RTC_AUTO_1_SECOND |
||
137 | If RTC_AUTO_1_SECOND is selected, AsynchPrediv will be set automatically to get 1sec timebase */ |
||
138 | |||
139 | uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC Tamper pin. |
||
140 | This parameter can be a value of @ref RTC_output_source_to_output_on_the_Tamper_pin */ |
||
141 | |||
142 | } RTC_InitTypeDef; |
||
143 | |||
144 | /** |
||
145 | * @brief RTC Date structure definition |
||
146 | */ |
||
147 | typedef struct |
||
148 | { |
||
149 | uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay (not necessary for HAL_RTC_SetDate). |
||
150 | This parameter can be a value of @ref RTC_WeekDay_Definitions */ |
||
151 | |||
152 | uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format). |
||
153 | This parameter can be a value of @ref RTC_Month_Date_Definitions */ |
||
154 | |||
155 | uint8_t Date; /*!< Specifies the RTC Date. |
||
156 | This parameter must be a number between Min_Data = 1 and Max_Data = 31 */ |
||
157 | |||
158 | uint8_t Year; /*!< Specifies the RTC Date Year. |
||
159 | This parameter must be a number between Min_Data = 0 and Max_Data = 99 */ |
||
160 | |||
161 | } RTC_DateTypeDef; |
||
162 | |||
163 | /** |
||
164 | * @brief Time Handle Structure definition |
||
165 | */ |
||
166 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) |
||
167 | typedef struct __RTC_HandleTypeDef |
||
168 | #else |
||
169 | typedef struct |
||
170 | #endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */ |
||
171 | { |
||
172 | RTC_TypeDef *Instance; /*!< Register base address */ |
||
173 | |||
174 | RTC_InitTypeDef Init; /*!< RTC required parameters */ |
||
175 | |||
176 | RTC_DateTypeDef DateToUpdate; /*!< Current date set by user and updated automatically */ |
||
177 | |||
178 | HAL_LockTypeDef Lock; /*!< RTC locking object */ |
||
179 | |||
180 | __IO HAL_RTCStateTypeDef State; /*!< Time communication state */ |
||
181 | |||
182 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) |
||
183 | void (* AlarmAEventCallback)(struct __RTC_HandleTypeDef *hrtc); /*!< RTC Alarm A Event callback */ |
||
184 | |||
185 | void (* Tamper1EventCallback)(struct __RTC_HandleTypeDef *hrtc); /*!< RTC Tamper 1 Event callback */ |
||
186 | |||
187 | void (* MspInitCallback)(struct __RTC_HandleTypeDef *hrtc); /*!< RTC Msp Init callback */ |
||
188 | |||
189 | void (* MspDeInitCallback)(struct __RTC_HandleTypeDef *hrtc); /*!< RTC Msp DeInit callback */ |
||
190 | |||
191 | #endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */ |
||
192 | |||
193 | } RTC_HandleTypeDef; |
||
194 | |||
195 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) |
||
196 | /** |
||
197 | * @brief HAL RTC Callback ID enumeration definition |
||
198 | */ |
||
199 | typedef enum |
||
200 | { |
||
201 | HAL_RTC_ALARM_A_EVENT_CB_ID = 0x00u, /*!< RTC Alarm A Event Callback ID */ |
||
202 | HAL_RTC_TAMPER1_EVENT_CB_ID = 0x04u, /*!< RTC Tamper 1 Callback ID */ |
||
203 | HAL_RTC_MSPINIT_CB_ID = 0x0Eu, /*!< RTC Msp Init callback ID */ |
||
204 | HAL_RTC_MSPDEINIT_CB_ID = 0x0Fu /*!< RTC Msp DeInit callback ID */ |
||
205 | } HAL_RTC_CallbackIDTypeDef; |
||
206 | |||
207 | /** |
||
208 | * @brief HAL RTC Callback pointer definition |
||
209 | */ |
||
210 | typedef void (*pRTC_CallbackTypeDef)(RTC_HandleTypeDef *hrtc); /*!< pointer to an RTC callback function */ |
||
211 | #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */ |
||
212 | |||
213 | /** |
||
214 | * @} |
||
215 | */ |
||
216 | |||
217 | /* Exported constants --------------------------------------------------------*/ |
||
218 | /** @defgroup RTC_Exported_Constants RTC Exported Constants |
||
219 | * @{ |
||
220 | */ |
||
221 | |||
222 | /** @defgroup RTC_Automatic_Prediv_1_Second Automatic calculation of prediv for 1sec timebase |
||
223 | * @{ |
||
224 | */ |
||
225 | #define RTC_AUTO_1_SECOND 0xFFFFFFFFU |
||
226 | |||
227 | /** |
||
228 | * @} |
||
229 | */ |
||
230 | |||
231 | /** @defgroup RTC_Input_parameter_format_definitions Input Parameter Format |
||
232 | * @{ |
||
233 | */ |
||
234 | #define RTC_FORMAT_BIN 0x000000000U |
||
235 | #define RTC_FORMAT_BCD 0x000000001U |
||
236 | |||
237 | /** |
||
238 | * @} |
||
239 | */ |
||
240 | |||
241 | /** @defgroup RTC_Month_Date_Definitions Month Definitions |
||
242 | * @{ |
||
243 | */ |
||
244 | |||
245 | /* Coded in BCD format */ |
||
246 | #define RTC_MONTH_JANUARY ((uint8_t)0x01) |
||
247 | #define RTC_MONTH_FEBRUARY ((uint8_t)0x02) |
||
248 | #define RTC_MONTH_MARCH ((uint8_t)0x03) |
||
249 | #define RTC_MONTH_APRIL ((uint8_t)0x04) |
||
250 | #define RTC_MONTH_MAY ((uint8_t)0x05) |
||
251 | #define RTC_MONTH_JUNE ((uint8_t)0x06) |
||
252 | #define RTC_MONTH_JULY ((uint8_t)0x07) |
||
253 | #define RTC_MONTH_AUGUST ((uint8_t)0x08) |
||
254 | #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09) |
||
255 | #define RTC_MONTH_OCTOBER ((uint8_t)0x10) |
||
256 | #define RTC_MONTH_NOVEMBER ((uint8_t)0x11) |
||
257 | #define RTC_MONTH_DECEMBER ((uint8_t)0x12) |
||
258 | |||
259 | /** |
||
260 | * @} |
||
261 | */ |
||
262 | |||
263 | /** @defgroup RTC_WeekDay_Definitions WeekDay Definitions |
||
264 | * @{ |
||
265 | */ |
||
266 | #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01) |
||
267 | #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02) |
||
268 | #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03) |
||
269 | #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04) |
||
270 | #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05) |
||
271 | #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06) |
||
272 | #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x00) |
||
273 | |||
274 | /** |
||
275 | * @} |
||
276 | */ |
||
277 | |||
278 | /** @defgroup RTC_Alarms_Definitions Alarms Definitions |
||
279 | * @{ |
||
280 | */ |
||
281 | #define RTC_ALARM_A 0U /*!< Specify alarm ID (mainly for legacy purposes) */ |
||
282 | |||
283 | /** |
||
284 | * @} |
||
285 | */ |
||
286 | |||
287 | |||
288 | /** @defgroup RTC_output_source_to_output_on_the_Tamper_pin Output source to output on the Tamper pin |
||
289 | * @{ |
||
290 | */ |
||
291 | |||
292 | #define RTC_OUTPUTSOURCE_NONE 0x00000000U /*!< No output on the TAMPER pin */ |
||
293 | #define RTC_OUTPUTSOURCE_CALIBCLOCK BKP_RTCCR_CCO /*!< RTC clock with a frequency divided by 64 on the TAMPER pin */ |
||
294 | #define RTC_OUTPUTSOURCE_ALARM BKP_RTCCR_ASOE /*!< Alarm pulse signal on the TAMPER pin */ |
||
295 | #define RTC_OUTPUTSOURCE_SECOND (BKP_RTCCR_ASOS | BKP_RTCCR_ASOE) /*!< Second pulse signal on the TAMPER pin */ |
||
296 | |||
297 | /** |
||
298 | * @} |
||
299 | */ |
||
300 | |||
301 | /** @defgroup RTC_Interrupts_Definitions Interrupts Definitions |
||
302 | * @{ |
||
303 | */ |
||
304 | #define RTC_IT_OW RTC_CRH_OWIE /*!< Overflow interrupt */ |
||
305 | #define RTC_IT_ALRA RTC_CRH_ALRIE /*!< Alarm interrupt */ |
||
306 | #define RTC_IT_SEC RTC_CRH_SECIE /*!< Second interrupt */ |
||
307 | #define RTC_IT_TAMP1 BKP_CSR_TPIE /*!< TAMPER Pin interrupt enable */ |
||
308 | /** |
||
309 | * @} |
||
310 | */ |
||
311 | |||
312 | /** @defgroup RTC_Flags_Definitions Flags Definitions |
||
313 | * @{ |
||
314 | */ |
||
315 | #define RTC_FLAG_RTOFF RTC_CRL_RTOFF /*!< RTC Operation OFF flag */ |
||
316 | #define RTC_FLAG_RSF RTC_CRL_RSF /*!< Registers Synchronized flag */ |
||
317 | #define RTC_FLAG_OW RTC_CRL_OWF /*!< Overflow flag */ |
||
318 | #define RTC_FLAG_ALRAF RTC_CRL_ALRF /*!< Alarm flag */ |
||
319 | #define RTC_FLAG_SEC RTC_CRL_SECF /*!< Second flag */ |
||
320 | #define RTC_FLAG_TAMP1F BKP_CSR_TEF /*!< Tamper Interrupt Flag */ |
||
321 | |||
322 | /** |
||
323 | * @} |
||
324 | */ |
||
325 | |||
326 | /** |
||
327 | * @} |
||
328 | */ |
||
329 | |||
330 | /* Exported macro ------------------------------------------------------------*/ |
||
331 | /** @defgroup RTC_Exported_macros RTC Exported Macros |
||
332 | * @{ |
||
333 | */ |
||
334 | |||
335 | /** @brief Reset RTC handle state |
||
336 | * @param __HANDLE__: RTC handle. |
||
337 | * @retval None |
||
338 | */ |
||
339 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) |
||
340 | #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) do{\ |
||
341 | (__HANDLE__)->State = HAL_RTC_STATE_RESET;\ |
||
342 | (__HANDLE__)->MspInitCallback = NULL;\ |
||
343 | (__HANDLE__)->MspDeInitCallback = NULL;\ |
||
344 | }while(0u) |
||
345 | #else |
||
346 | #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET) |
||
347 | #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */ |
||
348 | |||
349 | /** |
||
350 | * @brief Disable the write protection for RTC registers. |
||
351 | * @param __HANDLE__: specifies the RTC handle. |
||
352 | * @retval None |
||
353 | */ |
||
354 | #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF) |
||
355 | |||
356 | /** |
||
357 | * @brief Enable the write protection for RTC registers. |
||
358 | * @param __HANDLE__: specifies the RTC handle. |
||
359 | * @retval None |
||
360 | */ |
||
361 | #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF) |
||
362 | |||
363 | /** |
||
364 | * @brief Enable the RTC Alarm interrupt. |
||
365 | * @param __HANDLE__: specifies the RTC handle. |
||
366 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled. |
||
367 | * This parameter can be any combination of the following values: |
||
368 | * @arg RTC_IT_ALRA: Alarm A interrupt |
||
369 | * @retval None |
||
370 | */ |
||
371 | #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__)) |
||
372 | |||
373 | /** |
||
374 | * @brief Disable the RTC Alarm interrupt. |
||
375 | * @param __HANDLE__: specifies the RTC handle. |
||
376 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled. |
||
377 | * This parameter can be any combination of the following values: |
||
378 | * @arg RTC_IT_ALRA: Alarm A interrupt |
||
379 | * @retval None |
||
380 | */ |
||
381 | #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__)) |
||
382 | |||
383 | /** |
||
384 | * @brief Check whether the specified RTC Alarm interrupt has been enabled or not. |
||
385 | * @param __HANDLE__: specifies the RTC handle. |
||
386 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be checked |
||
387 | * This parameter can be: |
||
388 | * @arg RTC_IT_ALRA: Alarm A interrupt |
||
389 | * @retval None |
||
390 | */ |
||
391 | #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((__HANDLE__)->Instance->CRH)& ((__INTERRUPT__)))) != RESET)? SET : RESET) |
||
392 | |||
393 | /** |
||
394 | * @brief Get the selected RTC Alarm's flag status. |
||
395 | * @param __HANDLE__: specifies the RTC handle. |
||
396 | * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled. |
||
397 | * This parameter can be: |
||
398 | * @arg RTC_FLAG_ALRAF |
||
399 | * @retval None |
||
400 | */ |
||
401 | #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->CRL) & (__FLAG__)) != RESET)? SET : RESET) |
||
402 | |||
403 | /** |
||
404 | * @brief Check whether the specified RTC Alarm interrupt has occurred or not. |
||
405 | * @param __HANDLE__: specifies the RTC handle. |
||
406 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check. |
||
407 | * This parameter can be: |
||
408 | * @arg RTC_IT_ALRA: Alarm A interrupt |
||
409 | * @retval None |
||
410 | */ |
||
411 | #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CRL) & (__INTERRUPT__)) != RESET)? SET : RESET) |
||
412 | |||
413 | /** |
||
414 | * @brief Clear the RTC Alarm's pending flags. |
||
415 | * @param __HANDLE__: specifies the RTC handle. |
||
416 | * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled. |
||
417 | * This parameter can be: |
||
418 | * @arg RTC_FLAG_ALRAF |
||
419 | * @retval None |
||
420 | */ |
||
421 | #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CRL) = ~(__FLAG__) |
||
422 | |||
423 | /** |
||
424 | * @brief Enable interrupt on ALARM Exti Line 17. |
||
425 | * @retval None. |
||
426 | */ |
||
427 | #define __HAL_RTC_ALARM_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT) |
||
428 | |||
429 | /** |
||
430 | * @brief Disable interrupt on ALARM Exti Line 17. |
||
431 | * @retval None. |
||
432 | */ |
||
433 | #define __HAL_RTC_ALARM_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT) |
||
434 | |||
435 | /** |
||
436 | * @brief Enable event on ALARM Exti Line 17. |
||
437 | * @retval None. |
||
438 | */ |
||
439 | #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT) |
||
440 | |||
441 | /** |
||
442 | * @brief Disable event on ALARM Exti Line 17. |
||
443 | * @retval None. |
||
444 | */ |
||
445 | #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT) |
||
446 | |||
447 | |||
448 | /** |
||
449 | * @brief ALARM EXTI line configuration: set falling edge trigger. |
||
450 | * @retval None. |
||
451 | */ |
||
452 | #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT) |
||
453 | |||
454 | |||
455 | /** |
||
456 | * @brief Disable the ALARM Extended Interrupt Falling Trigger. |
||
457 | * @retval None. |
||
458 | */ |
||
459 | #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT) |
||
460 | |||
461 | |||
462 | /** |
||
463 | * @brief ALARM EXTI line configuration: set rising edge trigger. |
||
464 | * @retval None. |
||
465 | */ |
||
466 | #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT) |
||
467 | |||
468 | /** |
||
469 | * @brief Disable the ALARM Extended Interrupt Rising Trigger. |
||
470 | * This parameter can be: |
||
471 | * @retval None. |
||
472 | */ |
||
473 | #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT) |
||
474 | |||
475 | /** |
||
476 | * @brief ALARM EXTI line configuration: set rising & falling edge trigger. |
||
477 | * @retval None. |
||
478 | */ |
||
479 | #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() \ |
||
480 | do{ \ |
||
481 | __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE(); \ |
||
482 | __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE(); \ |
||
483 | } while(0U) |
||
484 | |||
485 | /** |
||
486 | * @brief Disable the ALARM Extended Interrupt Rising & Falling Trigger. |
||
487 | * This parameter can be: |
||
488 | * @retval None. |
||
489 | */ |
||
490 | #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() \ |
||
491 | do{ \ |
||
492 | __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE(); \ |
||
493 | __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE(); \ |
||
494 | } while(0U) |
||
495 | |||
496 | /** |
||
497 | * @brief Check whether the specified ALARM EXTI interrupt flag is set or not. |
||
498 | * @retval EXTI ALARM Line Status. |
||
499 | */ |
||
500 | #define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR & (RTC_EXTI_LINE_ALARM_EVENT)) |
||
501 | |||
502 | /** |
||
503 | * @brief Clear the ALARM EXTI flag. |
||
504 | * @retval None. |
||
505 | */ |
||
506 | #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR = (RTC_EXTI_LINE_ALARM_EVENT)) |
||
507 | |||
508 | /** |
||
509 | * @brief Generate a Software interrupt on selected EXTI line. |
||
510 | * @retval None. |
||
511 | */ |
||
512 | #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER, RTC_EXTI_LINE_ALARM_EVENT) |
||
513 | /** |
||
514 | * @} |
||
515 | */ |
||
516 | |||
517 | /* Include RTC HAL Extension module */ |
||
518 | #include "stm32f1xx_hal_rtc_ex.h" |
||
519 | |||
520 | /* Exported functions --------------------------------------------------------*/ |
||
521 | /** @addtogroup RTC_Exported_Functions |
||
522 | * @{ |
||
523 | */ |
||
524 | |||
525 | |||
526 | /* Initialization and de-initialization functions ****************************/ |
||
527 | /** @addtogroup RTC_Exported_Functions_Group1 |
||
528 | * @{ |
||
529 | */ |
||
530 | HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc); |
||
531 | HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc); |
||
532 | void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc); |
||
533 | void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc); |
||
534 | |||
535 | /* Callbacks Register/UnRegister functions ***********************************/ |
||
536 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) |
||
537 | HAL_StatusTypeDef HAL_RTC_RegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID, pRTC_CallbackTypeDef pCallback); |
||
538 | HAL_StatusTypeDef HAL_RTC_UnRegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID); |
||
539 | #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */ |
||
540 | /** |
||
541 | * @} |
||
542 | */ |
||
543 | |||
544 | /* RTC Time and Date functions ************************************************/ |
||
545 | /** @addtogroup RTC_Exported_Functions_Group2 |
||
546 | * @{ |
||
547 | */ |
||
548 | HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format); |
||
549 | HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format); |
||
550 | HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format); |
||
551 | HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format); |
||
552 | /** |
||
553 | * @} |
||
554 | */ |
||
555 | |||
556 | /* RTC Alarm functions ********************************************************/ |
||
557 | /** @addtogroup RTC_Exported_Functions_Group3 |
||
558 | * @{ |
||
559 | */ |
||
560 | HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format); |
||
561 | HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format); |
||
562 | HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm); |
||
563 | HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format); |
||
564 | void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc); |
||
565 | HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); |
||
566 | void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc); |
||
567 | /** |
||
568 | * @} |
||
569 | */ |
||
570 | |||
571 | /* Peripheral State functions *************************************************/ |
||
572 | /** @addtogroup RTC_Exported_Functions_Group4 |
||
573 | * @{ |
||
574 | */ |
||
575 | HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc); |
||
576 | /** |
||
577 | * @} |
||
578 | */ |
||
579 | |||
580 | /* Peripheral Control functions ***********************************************/ |
||
581 | /** @addtogroup RTC_Exported_Functions_Group5 |
||
582 | * @{ |
||
583 | */ |
||
584 | HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef *hrtc); |
||
585 | /** |
||
586 | * @} |
||
587 | */ |
||
588 | |||
589 | /** |
||
590 | * @} |
||
591 | */ |
||
592 | |||
593 | /** |
||
594 | * @} |
||
595 | */ |
||
596 | |||
597 | /** |
||
598 | * @} |
||
599 | */ |
||
600 | |||
601 | #ifdef __cplusplus |
||
602 | } |
||
603 | #endif |
||
604 | |||
605 | #endif /* __STM32F1xx_HAL_RTC_H */ |
||
606 | |||
607 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |