1 | /**
|
---|
2 | ******************************************************************************
|
---|
3 | * @file stm32f4xx_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) 2017 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 __STM32F4xx_HAL_RTC_H
|
---|
22 | #define __STM32F4xx_HAL_RTC_H
|
---|
23 |
|
---|
24 | #ifdef __cplusplus
|
---|
25 | extern "C" {
|
---|
26 | #endif
|
---|
27 |
|
---|
28 | /* Includes ------------------------------------------------------------------*/
|
---|
29 | #include "stm32f4xx_hal_def.h"
|
---|
30 |
|
---|
31 | /** @addtogroup STM32F4xx_HAL_Driver
|
---|
32 | * @{
|
---|
33 | */
|
---|
34 |
|
---|
35 | /** @addtogroup RTC
|
---|
36 | * @{
|
---|
37 | */
|
---|
38 |
|
---|
39 | /* Exported types ------------------------------------------------------------*/
|
---|
40 | /** @defgroup RTC_Exported_Types RTC Exported Types
|
---|
41 | * @{
|
---|
42 | */
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * @brief HAL State structures definition
|
---|
46 | */
|
---|
47 | typedef enum
|
---|
48 | {
|
---|
49 | HAL_RTC_STATE_RESET = 0x00U, /*!< RTC not yet initialized or disabled */
|
---|
50 | HAL_RTC_STATE_READY = 0x01U, /*!< RTC initialized and ready for use */
|
---|
51 | HAL_RTC_STATE_BUSY = 0x02U, /*!< RTC process is ongoing */
|
---|
52 | HAL_RTC_STATE_TIMEOUT = 0x03U, /*!< RTC timeout state */
|
---|
53 | HAL_RTC_STATE_ERROR = 0x04U /*!< RTC error state */
|
---|
54 | }HAL_RTCStateTypeDef;
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * @brief RTC Configuration Structure definition
|
---|
58 | */
|
---|
59 | typedef struct
|
---|
60 | {
|
---|
61 | uint32_t HourFormat; /*!< Specifies the RTC Hour Format.
|
---|
62 | This parameter can be a value of @ref RTC_Hour_Formats */
|
---|
63 |
|
---|
64 | uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value.
|
---|
65 | This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F */
|
---|
66 |
|
---|
67 | uint32_t SynchPrediv; /*!< Specifies the RTC Synchronous Predivider value.
|
---|
68 | This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFFU */
|
---|
69 |
|
---|
70 | uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC output.
|
---|
71 | This parameter can be a value of @ref RTC_Output_selection_Definitions */
|
---|
72 |
|
---|
73 | uint32_t OutPutPolarity; /*!< Specifies the polarity of the output signal.
|
---|
74 | This parameter can be a value of @ref RTC_Output_Polarity_Definitions */
|
---|
75 |
|
---|
76 | uint32_t OutPutType; /*!< Specifies the RTC Output Pin mode.
|
---|
77 | This parameter can be a value of @ref RTC_Output_Type_ALARM_OUT */
|
---|
78 | }RTC_InitTypeDef;
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * @brief RTC Time structure definition
|
---|
82 | */
|
---|
83 | typedef struct
|
---|
84 | {
|
---|
85 | uint8_t Hours; /*!< Specifies the RTC Time Hour.
|
---|
86 | This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the RTC_HourFormat_12 is selected.
|
---|
87 | This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the RTC_HourFormat_24 is selected */
|
---|
88 |
|
---|
89 | uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
|
---|
90 | This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
|
---|
91 |
|
---|
92 | uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
|
---|
93 | This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
|
---|
94 |
|
---|
95 | uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
|
---|
96 | This parameter can be a value of @ref RTC_AM_PM_Definitions */
|
---|
97 |
|
---|
98 | uint32_t SubSeconds; /*!< Specifies the RTC_SSR RTC Sub Second register content.
|
---|
99 | This parameter corresponds to a time unit range between [0-1] Second
|
---|
100 | with [1 Sec / SecondFraction +1] granularity */
|
---|
101 |
|
---|
102 | uint32_t SecondFraction; /*!< Specifies the range or granularity of Sub Second register content
|
---|
103 | corresponding to Synchronous pre-scaler factor value (PREDIV_S)
|
---|
104 | This parameter corresponds to a time unit range between [0-1] Second
|
---|
105 | with [1 Sec / SecondFraction +1] granularity.
|
---|
106 | This field will be used only by HAL_RTC_GetTime function */
|
---|
107 |
|
---|
108 | uint32_t DayLightSaving; /*!< This interface is deprecated. To manage Daylight Saving Time,
|
---|
109 | please use HAL_RTC_DST_xxx functions */
|
---|
110 |
|
---|
111 | uint32_t StoreOperation; /*!< This interface is deprecated. To manage Daylight Saving Time,
|
---|
112 | please use HAL_RTC_DST_xxx functions */
|
---|
113 | }RTC_TimeTypeDef;
|
---|
114 |
|
---|
115 | /**
|
---|
116 | * @brief RTC Date structure definition
|
---|
117 | */
|
---|
118 | typedef struct
|
---|
119 | {
|
---|
120 | uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
|
---|
121 | This parameter can be a value of @ref RTC_WeekDay_Definitions */
|
---|
122 |
|
---|
123 | uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format).
|
---|
124 | This parameter can be a value of @ref RTC_Month_Date_Definitions */
|
---|
125 |
|
---|
126 | uint8_t Date; /*!< Specifies the RTC Date.
|
---|
127 | This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
|
---|
128 |
|
---|
129 | uint8_t Year; /*!< Specifies the RTC Date Year.
|
---|
130 | This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
|
---|
131 |
|
---|
132 | }RTC_DateTypeDef;
|
---|
133 |
|
---|
134 | /**
|
---|
135 | * @brief RTC Alarm structure definition
|
---|
136 | */
|
---|
137 | typedef struct
|
---|
138 | {
|
---|
139 | RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */
|
---|
140 |
|
---|
141 | uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks.
|
---|
142 | This parameter can be a value of @ref RTC_AlarmMask_Definitions */
|
---|
143 |
|
---|
144 | uint32_t AlarmSubSecondMask; /*!< Specifies the RTC Alarm SubSeconds Masks.
|
---|
145 | This parameter can be a value of @ref RTC_Alarm_Sub_Seconds_Masks_Definitions */
|
---|
146 |
|
---|
147 | uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay.
|
---|
148 | This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */
|
---|
149 |
|
---|
150 | uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay.
|
---|
151 | If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range.
|
---|
152 | If the Alarm WeekDay is selected, this parameter can be a value of @ref RTC_WeekDay_Definitions */
|
---|
153 |
|
---|
154 | uint32_t Alarm; /*!< Specifies the alarm .
|
---|
155 | This parameter can be a value of @ref RTC_Alarms_Definitions */
|
---|
156 | }RTC_AlarmTypeDef;
|
---|
157 |
|
---|
158 | /**
|
---|
159 | * @brief RTC Handle Structure definition
|
---|
160 | */
|
---|
161 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
|
---|
162 | typedef struct __RTC_HandleTypeDef
|
---|
163 | #else
|
---|
164 | typedef struct
|
---|
165 | #endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */
|
---|
166 | {
|
---|
167 | RTC_TypeDef *Instance; /*!< Register base address */
|
---|
168 |
|
---|
169 | RTC_InitTypeDef Init; /*!< RTC required parameters */
|
---|
170 |
|
---|
171 | HAL_LockTypeDef Lock; /*!< RTC locking object */
|
---|
172 |
|
---|
173 | __IO HAL_RTCStateTypeDef State; /*!< Time communication state */
|
---|
174 |
|
---|
175 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
|
---|
176 | void (* AlarmAEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Alarm A Event callback */
|
---|
177 |
|
---|
178 | void (* AlarmBEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Alarm B Event callback */
|
---|
179 |
|
---|
180 | void (* TimeStampEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC TimeStamp Event callback */
|
---|
181 |
|
---|
182 | void (* WakeUpTimerEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC WakeUpTimer Event callback */
|
---|
183 |
|
---|
184 | void (* Tamper1EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Tamper 1 Event callback */
|
---|
185 |
|
---|
186 | void (* Tamper2EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Tamper 2 Event callback */
|
---|
187 |
|
---|
188 | void (* MspInitCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Msp Init callback */
|
---|
189 |
|
---|
190 | void (* MspDeInitCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Msp DeInit callback */
|
---|
191 |
|
---|
192 | #endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */
|
---|
193 |
|
---|
194 | }RTC_HandleTypeDef;
|
---|
195 |
|
---|
196 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
|
---|
197 | /**
|
---|
198 | * @brief HAL RTC Callback ID enumeration definition
|
---|
199 | */
|
---|
200 | typedef enum
|
---|
201 | {
|
---|
202 | HAL_RTC_ALARM_A_EVENT_CB_ID = 0x00u, /*!< RTC Alarm A Event Callback ID */
|
---|
203 | HAL_RTC_ALARM_B_EVENT_CB_ID = 0x01u, /*!< RTC Alarm B Event Callback ID */
|
---|
204 | HAL_RTC_TIMESTAMP_EVENT_CB_ID = 0x02u, /*!< RTC TimeStamp Event Callback ID */
|
---|
205 | HAL_RTC_WAKEUPTIMER_EVENT_CB_ID = 0x03u, /*!< RTC Wake-Up Timer Event Callback ID */
|
---|
206 | HAL_RTC_TAMPER1_EVENT_CB_ID = 0x04u, /*!< RTC Tamper 1 Callback ID */
|
---|
207 | HAL_RTC_TAMPER2_EVENT_CB_ID = 0x05u, /*!< RTC Tamper 2 Callback ID */
|
---|
208 | HAL_RTC_MSPINIT_CB_ID = 0x0Eu, /*!< RTC Msp Init callback ID */
|
---|
209 | HAL_RTC_MSPDEINIT_CB_ID = 0x0Fu /*!< RTC Msp DeInit callback ID */
|
---|
210 | }HAL_RTC_CallbackIDTypeDef;
|
---|
211 |
|
---|
212 | /**
|
---|
213 | * @brief HAL RTC Callback pointer definition
|
---|
214 | */
|
---|
215 | typedef void (*pRTC_CallbackTypeDef)(RTC_HandleTypeDef * hrtc); /*!< pointer to an RTC callback function */
|
---|
216 | #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
|
---|
217 |
|
---|
218 | /**
|
---|
219 | * @}
|
---|
220 | */
|
---|
221 |
|
---|
222 | /* Exported constants --------------------------------------------------------*/
|
---|
223 | /** @defgroup RTC_Exported_Constants RTC Exported Constants
|
---|
224 | * @{
|
---|
225 | */
|
---|
226 |
|
---|
227 | /** @defgroup RTC_Hour_Formats RTC Hour Formats
|
---|
228 | * @{
|
---|
229 | */
|
---|
230 | #define RTC_HOURFORMAT_24 0x00000000U
|
---|
231 | #define RTC_HOURFORMAT_12 0x00000040U
|
---|
232 | /**
|
---|
233 | * @}
|
---|
234 | */
|
---|
235 |
|
---|
236 | /** @defgroup RTC_Output_selection_Definitions RTC Output Selection Definitions
|
---|
237 | * @{
|
---|
238 | */
|
---|
239 | #define RTC_OUTPUT_DISABLE 0x00000000U
|
---|
240 | #define RTC_OUTPUT_ALARMA 0x00200000U
|
---|
241 | #define RTC_OUTPUT_ALARMB 0x00400000U
|
---|
242 | #define RTC_OUTPUT_WAKEUP 0x00600000U
|
---|
243 | /**
|
---|
244 | * @}
|
---|
245 | */
|
---|
246 |
|
---|
247 | /** @defgroup RTC_Output_Polarity_Definitions RTC Output Polarity Definitions
|
---|
248 | * @{
|
---|
249 | */
|
---|
250 | #define RTC_OUTPUT_POLARITY_HIGH 0x00000000U
|
---|
251 | #define RTC_OUTPUT_POLARITY_LOW 0x00100000U
|
---|
252 | /**
|
---|
253 | * @}
|
---|
254 | */
|
---|
255 |
|
---|
256 | /** @defgroup RTC_Output_Type_ALARM_OUT RTC Output Type ALARM OUT
|
---|
257 | * @{
|
---|
258 | */
|
---|
259 | #define RTC_OUTPUT_TYPE_OPENDRAIN 0x00000000U
|
---|
260 | #define RTC_OUTPUT_TYPE_PUSHPULL 0x00040000U
|
---|
261 | /**
|
---|
262 | * @}
|
---|
263 | */
|
---|
264 |
|
---|
265 | /** @defgroup RTC_AM_PM_Definitions RTC AM PM Definitions
|
---|
266 | * @{
|
---|
267 | */
|
---|
268 | #define RTC_HOURFORMAT12_AM ((uint8_t)0x00)
|
---|
269 | #define RTC_HOURFORMAT12_PM ((uint8_t)0x40)
|
---|
270 | /**
|
---|
271 | * @}
|
---|
272 | */
|
---|
273 |
|
---|
274 | /** @defgroup RTC_DayLightSaving_Definitions RTC DayLight Saving Definitions
|
---|
275 | * @{
|
---|
276 | */
|
---|
277 | #define RTC_DAYLIGHTSAVING_SUB1H 0x00020000U
|
---|
278 | #define RTC_DAYLIGHTSAVING_ADD1H 0x00010000U
|
---|
279 | #define RTC_DAYLIGHTSAVING_NONE 0x00000000U
|
---|
280 | /**
|
---|
281 | * @}
|
---|
282 | */
|
---|
283 |
|
---|
284 | /** @defgroup RTC_StoreOperation_Definitions RTC Store Operation Definitions
|
---|
285 | * @{
|
---|
286 | */
|
---|
287 | #define RTC_STOREOPERATION_RESET 0x00000000U
|
---|
288 | #define RTC_STOREOPERATION_SET 0x00040000U
|
---|
289 | /**
|
---|
290 | * @}
|
---|
291 | */
|
---|
292 |
|
---|
293 | /** @defgroup RTC_Input_parameter_format_definitions RTC Input Parameter Format Definitions
|
---|
294 | * @{
|
---|
295 | */
|
---|
296 | #define RTC_FORMAT_BIN 0x00000000U
|
---|
297 | #define RTC_FORMAT_BCD 0x00000001U
|
---|
298 | /**
|
---|
299 | * @}
|
---|
300 | */
|
---|
301 |
|
---|
302 | /** @defgroup RTC_Month_Date_Definitions RTC Month Date Definitions
|
---|
303 | * @{
|
---|
304 | */
|
---|
305 | /* Coded in BCD format */
|
---|
306 | #define RTC_MONTH_JANUARY ((uint8_t)0x01)
|
---|
307 | #define RTC_MONTH_FEBRUARY ((uint8_t)0x02)
|
---|
308 | #define RTC_MONTH_MARCH ((uint8_t)0x03)
|
---|
309 | #define RTC_MONTH_APRIL ((uint8_t)0x04)
|
---|
310 | #define RTC_MONTH_MAY ((uint8_t)0x05)
|
---|
311 | #define RTC_MONTH_JUNE ((uint8_t)0x06)
|
---|
312 | #define RTC_MONTH_JULY ((uint8_t)0x07)
|
---|
313 | #define RTC_MONTH_AUGUST ((uint8_t)0x08)
|
---|
314 | #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09)
|
---|
315 | #define RTC_MONTH_OCTOBER ((uint8_t)0x10)
|
---|
316 | #define RTC_MONTH_NOVEMBER ((uint8_t)0x11)
|
---|
317 | #define RTC_MONTH_DECEMBER ((uint8_t)0x12)
|
---|
318 | /**
|
---|
319 | * @}
|
---|
320 | */
|
---|
321 |
|
---|
322 | /** @defgroup RTC_WeekDay_Definitions RTC WeekDay Definitions
|
---|
323 | * @{
|
---|
324 | */
|
---|
325 | #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01)
|
---|
326 | #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02)
|
---|
327 | #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03)
|
---|
328 | #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04)
|
---|
329 | #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05)
|
---|
330 | #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06)
|
---|
331 | #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07)
|
---|
332 | /**
|
---|
333 | * @}
|
---|
334 | */
|
---|
335 |
|
---|
336 | /** @defgroup RTC_AlarmDateWeekDay_Definitions RTC Alarm Date WeekDay Definitions
|
---|
337 | * @{
|
---|
338 | */
|
---|
339 | #define RTC_ALARMDATEWEEKDAYSEL_DATE 0x00000000U
|
---|
340 | #define RTC_ALARMDATEWEEKDAYSEL_WEEKDAY 0x40000000U
|
---|
341 | /**
|
---|
342 | * @}
|
---|
343 | */
|
---|
344 |
|
---|
345 | /** @defgroup RTC_AlarmMask_Definitions RTC Alarm Mask Definitions
|
---|
346 | * @{
|
---|
347 | */
|
---|
348 | #define RTC_ALARMMASK_NONE 0x00000000U
|
---|
349 | #define RTC_ALARMMASK_DATEWEEKDAY RTC_ALRMAR_MSK4
|
---|
350 | #define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3
|
---|
351 | #define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2
|
---|
352 | #define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1
|
---|
353 | #define RTC_ALARMMASK_ALL 0x80808080U
|
---|
354 | /**
|
---|
355 | * @}
|
---|
356 | */
|
---|
357 |
|
---|
358 | /** @defgroup RTC_Alarms_Definitions RTC Alarms Definitions
|
---|
359 | * @{
|
---|
360 | */
|
---|
361 | #define RTC_ALARM_A RTC_CR_ALRAE
|
---|
362 | #define RTC_ALARM_B RTC_CR_ALRBE
|
---|
363 | /**
|
---|
364 | * @}
|
---|
365 | */
|
---|
366 |
|
---|
367 | /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions RTC Alarm Sub Seconds Masks Definitions
|
---|
368 | * @{
|
---|
369 | */
|
---|
370 | #define RTC_ALARMSUBSECONDMASK_ALL 0x00000000U /*!< All Alarm SS fields are masked.
|
---|
371 | There is no comparison on sub seconds
|
---|
372 | for Alarm */
|
---|
373 | #define RTC_ALARMSUBSECONDMASK_SS14_1 0x01000000U /*!< SS[14:1] are don't care in Alarm
|
---|
374 | comparison. Only SS[0] is compared. */
|
---|
375 | #define RTC_ALARMSUBSECONDMASK_SS14_2 0x02000000U /*!< SS[14:2] are don't care in Alarm
|
---|
376 | comparison. Only SS[1:0] are compared */
|
---|
377 | #define RTC_ALARMSUBSECONDMASK_SS14_3 0x03000000U /*!< SS[14:3] are don't care in Alarm
|
---|
378 | comparison. Only SS[2:0] are compared */
|
---|
379 | #define RTC_ALARMSUBSECONDMASK_SS14_4 0x04000000U /*!< SS[14:4] are don't care in Alarm
|
---|
380 | comparison. Only SS[3:0] are compared */
|
---|
381 | #define RTC_ALARMSUBSECONDMASK_SS14_5 0x05000000U /*!< SS[14:5] are don't care in Alarm
|
---|
382 | comparison. Only SS[4:0] are compared */
|
---|
383 | #define RTC_ALARMSUBSECONDMASK_SS14_6 0x06000000U /*!< SS[14:6] are don't care in Alarm
|
---|
384 | comparison. Only SS[5:0] are compared */
|
---|
385 | #define RTC_ALARMSUBSECONDMASK_SS14_7 0x07000000U /*!< SS[14:7] are don't care in Alarm
|
---|
386 | comparison. Only SS[6:0] are compared */
|
---|
387 | #define RTC_ALARMSUBSECONDMASK_SS14_8 0x08000000U /*!< SS[14:8] are don't care in Alarm
|
---|
388 | comparison. Only SS[7:0] are compared */
|
---|
389 | #define RTC_ALARMSUBSECONDMASK_SS14_9 0x09000000U /*!< SS[14:9] are don't care in Alarm
|
---|
390 | comparison. Only SS[8:0] are compared */
|
---|
391 | #define RTC_ALARMSUBSECONDMASK_SS14_10 0x0A000000U /*!< SS[14:10] are don't care in Alarm
|
---|
392 | comparison. Only SS[9:0] are compared */
|
---|
393 | #define RTC_ALARMSUBSECONDMASK_SS14_11 0x0B000000U /*!< SS[14:11] are don't care in Alarm
|
---|
394 | comparison. Only SS[10:0] are compared */
|
---|
395 | #define RTC_ALARMSUBSECONDMASK_SS14_12 0x0C000000U /*!< SS[14:12] are don't care in Alarm
|
---|
396 | comparison.Only SS[11:0] are compared */
|
---|
397 | #define RTC_ALARMSUBSECONDMASK_SS14_13 0x0D000000U /*!< SS[14:13] are don't care in Alarm
|
---|
398 | comparison. Only SS[12:0] are compared */
|
---|
399 | #define RTC_ALARMSUBSECONDMASK_SS14 0x0E000000U /*!< SS[14] is don't care in Alarm
|
---|
400 | comparison.Only SS[13:0] are compared */
|
---|
401 | #define RTC_ALARMSUBSECONDMASK_NONE 0x0F000000U /*!< SS[14:0] are compared and must match
|
---|
402 | to activate alarm. */
|
---|
403 | /**
|
---|
404 | * @}
|
---|
405 | */
|
---|
406 |
|
---|
407 | /** @defgroup RTC_Interrupts_Definitions RTC Interrupts Definitions
|
---|
408 | * @{
|
---|
409 | */
|
---|
410 | #define RTC_IT_TS 0x00008000U
|
---|
411 | #define RTC_IT_WUT 0x00004000U
|
---|
412 | #define RTC_IT_ALRB 0x00002000U
|
---|
413 | #define RTC_IT_ALRA 0x00001000U
|
---|
414 | #define RTC_IT_TAMP 0x00000004U /* Used only to Enable the Tamper Interrupt */
|
---|
415 | #define RTC_IT_TAMP1 0x00020000U
|
---|
416 | #define RTC_IT_TAMP2 0x00040000U
|
---|
417 | /**
|
---|
418 | * @}
|
---|
419 | */
|
---|
420 |
|
---|
421 | /** @defgroup RTC_Flags_Definitions RTC Flags Definitions
|
---|
422 | * @{
|
---|
423 | */
|
---|
424 | #define RTC_FLAG_RECALPF 0x00010000U
|
---|
425 | #define RTC_FLAG_TAMP2F 0x00004000U
|
---|
426 | #define RTC_FLAG_TAMP1F 0x00002000U
|
---|
427 | #define RTC_FLAG_TSOVF 0x00001000U
|
---|
428 | #define RTC_FLAG_TSF 0x00000800U
|
---|
429 | #define RTC_FLAG_WUTF 0x00000400U
|
---|
430 | #define RTC_FLAG_ALRBF 0x00000200U
|
---|
431 | #define RTC_FLAG_ALRAF 0x00000100U
|
---|
432 | #define RTC_FLAG_INITF 0x00000040U
|
---|
433 | #define RTC_FLAG_RSF 0x00000020U
|
---|
434 | #define RTC_FLAG_INITS 0x00000010U
|
---|
435 | #define RTC_FLAG_SHPF 0x00000008U
|
---|
436 | #define RTC_FLAG_WUTWF 0x00000004U
|
---|
437 | #define RTC_FLAG_ALRBWF 0x00000002U
|
---|
438 | #define RTC_FLAG_ALRAWF 0x00000001U
|
---|
439 | /**
|
---|
440 | * @}
|
---|
441 | */
|
---|
442 |
|
---|
443 | /**
|
---|
444 | * @}
|
---|
445 | */
|
---|
446 |
|
---|
447 | /* Exported macro ------------------------------------------------------------*/
|
---|
448 | /** @defgroup RTC_Exported_Macros RTC Exported Macros
|
---|
449 | * @{
|
---|
450 | */
|
---|
451 |
|
---|
452 | /** @brief Reset RTC handle state
|
---|
453 | * @param __HANDLE__ specifies the RTC handle.
|
---|
454 | * @retval None
|
---|
455 | */
|
---|
456 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
|
---|
457 | #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) do{\
|
---|
458 | (__HANDLE__)->State = HAL_RTC_STATE_RESET;\
|
---|
459 | (__HANDLE__)->MspInitCallback = NULL;\
|
---|
460 | (__HANDLE__)->MspDeInitCallback = NULL;\
|
---|
461 | }while(0u)
|
---|
462 | #else
|
---|
463 | #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
|
---|
464 | #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
|
---|
465 |
|
---|
466 | /**
|
---|
467 | * @brief Disable the write protection for RTC registers.
|
---|
468 | * @param __HANDLE__ specifies the RTC handle.
|
---|
469 | * @retval None
|
---|
470 | */
|
---|
471 | #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) \
|
---|
472 | do{ \
|
---|
473 | (__HANDLE__)->Instance->WPR = 0xCAU; \
|
---|
474 | (__HANDLE__)->Instance->WPR = 0x53U; \
|
---|
475 | } while(0U)
|
---|
476 |
|
---|
477 | /**
|
---|
478 | * @brief Enable the write protection for RTC registers.
|
---|
479 | * @param __HANDLE__ specifies the RTC handle.
|
---|
480 | * @retval None
|
---|
481 | */
|
---|
482 | #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) \
|
---|
483 | do{ \
|
---|
484 | (__HANDLE__)->Instance->WPR = 0xFFU; \
|
---|
485 | } while(0U)
|
---|
486 |
|
---|
487 | /**
|
---|
488 | * @brief Enable the RTC ALARMA peripheral.
|
---|
489 | * @param __HANDLE__ specifies the RTC handle.
|
---|
490 | * @retval None
|
---|
491 | */
|
---|
492 | #define __HAL_RTC_ALARMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRAE))
|
---|
493 |
|
---|
494 | /**
|
---|
495 | * @brief Disable the RTC ALARMA peripheral.
|
---|
496 | * @param __HANDLE__ specifies the RTC handle.
|
---|
497 | * @retval None
|
---|
498 | */
|
---|
499 | #define __HAL_RTC_ALARMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRAE))
|
---|
500 |
|
---|
501 | /**
|
---|
502 | * @brief Enable the RTC ALARMB peripheral.
|
---|
503 | * @param __HANDLE__ specifies the RTC handle.
|
---|
504 | * @retval None
|
---|
505 | */
|
---|
506 | #define __HAL_RTC_ALARMB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRBE))
|
---|
507 |
|
---|
508 | /**
|
---|
509 | * @brief Disable the RTC ALARMB peripheral.
|
---|
510 | * @param __HANDLE__ specifies the RTC handle.
|
---|
511 | * @retval None
|
---|
512 | */
|
---|
513 | #define __HAL_RTC_ALARMB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRBE))
|
---|
514 |
|
---|
515 | /**
|
---|
516 | * @brief Enable the RTC Alarm interrupt.
|
---|
517 | * @param __HANDLE__ specifies the RTC handle.
|
---|
518 | * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to be enabled or disabled.
|
---|
519 | * This parameter can be any combination of the following values:
|
---|
520 | * @arg RTC_IT_ALRA: Alarm A interrupt
|
---|
521 | * @arg RTC_IT_ALRB: Alarm B interrupt
|
---|
522 | * @retval None
|
---|
523 | */
|
---|
524 | #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
|
---|
525 |
|
---|
526 | /**
|
---|
527 | * @brief Disable the RTC Alarm interrupt.
|
---|
528 | * @param __HANDLE__ specifies the RTC handle.
|
---|
529 | * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to be enabled or disabled.
|
---|
530 | * This parameter can be any combination of the following values:
|
---|
531 | * @arg RTC_IT_ALRA: Alarm A interrupt
|
---|
532 | * @arg RTC_IT_ALRB: Alarm B interrupt
|
---|
533 | * @retval None
|
---|
534 | */
|
---|
535 | #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
|
---|
536 |
|
---|
537 | /**
|
---|
538 | * @brief Check whether the specified RTC Alarm interrupt has occurred or not.
|
---|
539 | * @param __HANDLE__ specifies the RTC handle.
|
---|
540 | * @param __INTERRUPT__ specifies the RTC Alarm interrupt to check.
|
---|
541 | * This parameter can be:
|
---|
542 | * @arg RTC_IT_ALRA: Alarm A interrupt
|
---|
543 | * @arg RTC_IT_ALRB: Alarm B interrupt
|
---|
544 | * @retval None
|
---|
545 | */
|
---|
546 | #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR)& ((__INTERRUPT__)>> 4U)) != RESET)? SET : RESET)
|
---|
547 |
|
---|
548 | /**
|
---|
549 | * @brief Get the selected RTC Alarm's flag status.
|
---|
550 | * @param __HANDLE__ specifies the RTC handle.
|
---|
551 | * @param __FLAG__ specifies the RTC Alarm Flag to check.
|
---|
552 | * This parameter can be:
|
---|
553 | * @arg RTC_FLAG_ALRAF
|
---|
554 | * @arg RTC_FLAG_ALRBF
|
---|
555 | * @arg RTC_FLAG_ALRAWF
|
---|
556 | * @arg RTC_FLAG_ALRBWF
|
---|
557 | * @retval None
|
---|
558 | */
|
---|
559 | #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
|
---|
560 |
|
---|
561 | /**
|
---|
562 | * @brief Clear the RTC Alarm's pending flags.
|
---|
563 | * @param __HANDLE__ specifies the RTC handle.
|
---|
564 | * @param __FLAG__ specifies the RTC Alarm Flag sources to be enabled or disabled.
|
---|
565 | * This parameter can be:
|
---|
566 | * @arg RTC_FLAG_ALRAF
|
---|
567 | * @arg RTC_FLAG_ALRBF
|
---|
568 | * @retval None
|
---|
569 | */
|
---|
570 | #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
|
---|
571 |
|
---|
572 |
|
---|
573 | /**
|
---|
574 | * @brief Check whether the specified RTC Alarm interrupt has been enabled or not.
|
---|
575 | * @param __HANDLE__ specifies the RTC handle.
|
---|
576 | * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to check.
|
---|
577 | * This parameter can be:
|
---|
578 | * @arg RTC_IT_ALRA: Alarm A interrupt
|
---|
579 | * @arg RTC_IT_ALRB: Alarm B interrupt
|
---|
580 | * @retval None
|
---|
581 | */
|
---|
582 | #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
|
---|
583 |
|
---|
584 | /**
|
---|
585 | * @brief Enable interrupt on the RTC Alarm associated Exti line.
|
---|
586 | * @retval None
|
---|
587 | */
|
---|
588 | #define __HAL_RTC_ALARM_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_ALARM_EVENT)
|
---|
589 |
|
---|
590 | /**
|
---|
591 | * @brief Disable interrupt on the RTC Alarm associated Exti line.
|
---|
592 | * @retval None
|
---|
593 | */
|
---|
594 | #define __HAL_RTC_ALARM_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
|
---|
595 |
|
---|
596 | /**
|
---|
597 | * @brief Enable event on the RTC Alarm associated Exti line.
|
---|
598 | * @retval None.
|
---|
599 | */
|
---|
600 | #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_ALARM_EVENT)
|
---|
601 |
|
---|
602 | /**
|
---|
603 | * @brief Disable event on the RTC Alarm associated Exti line.
|
---|
604 | * @retval None.
|
---|
605 | */
|
---|
606 | #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
|
---|
607 |
|
---|
608 | /**
|
---|
609 | * @brief Enable falling edge trigger on the RTC Alarm associated Exti line.
|
---|
610 | * @retval None.
|
---|
611 | */
|
---|
612 | #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_ALARM_EVENT)
|
---|
613 |
|
---|
614 | /**
|
---|
615 | * @brief Disable falling edge trigger on the RTC Alarm associated Exti line.
|
---|
616 | * @retval None.
|
---|
617 | */
|
---|
618 | #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
|
---|
619 |
|
---|
620 | /**
|
---|
621 | * @brief Enable rising edge trigger on the RTC Alarm associated Exti line.
|
---|
622 | * @retval None.
|
---|
623 | */
|
---|
624 | #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_ALARM_EVENT)
|
---|
625 |
|
---|
626 | /**
|
---|
627 | * @brief Disable rising edge trigger on the RTC Alarm associated Exti line.
|
---|
628 | * @retval None.
|
---|
629 | */
|
---|
630 | #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
|
---|
631 |
|
---|
632 | /**
|
---|
633 | * @brief Enable rising & falling edge trigger on the RTC Alarm associated Exti line.
|
---|
634 | * @retval None.
|
---|
635 | */
|
---|
636 | #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() do { __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE(); \
|
---|
637 | __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE();\
|
---|
638 | } while(0U)
|
---|
639 |
|
---|
640 | /**
|
---|
641 | * @brief Disable rising & falling edge trigger on the RTC Alarm associated Exti line.
|
---|
642 | * @retval None.
|
---|
643 | */
|
---|
644 | #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() do { __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE();\
|
---|
645 | __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE();\
|
---|
646 | } while(0U)
|
---|
647 |
|
---|
648 | /**
|
---|
649 | * @brief Check whether the RTC Alarm associated Exti line interrupt flag is set or not.
|
---|
650 | * @retval Line Status.
|
---|
651 | */
|
---|
652 | #define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_ALARM_EVENT)
|
---|
653 |
|
---|
654 | /**
|
---|
655 | * @brief Clear the RTC Alarm associated Exti line flag.
|
---|
656 | * @retval None.
|
---|
657 | */
|
---|
658 | #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_ALARM_EVENT)
|
---|
659 |
|
---|
660 | /**
|
---|
661 | * @brief Generate a Software interrupt on RTC Alarm associated Exti line.
|
---|
662 | * @retval None.
|
---|
663 | */
|
---|
664 | #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_ALARM_EVENT)
|
---|
665 | /**
|
---|
666 | * @}
|
---|
667 | */
|
---|
668 |
|
---|
669 | /* Include RTC HAL Extension module */
|
---|
670 | #include "stm32f4xx_hal_rtc_ex.h"
|
---|
671 |
|
---|
672 | /* Exported functions --------------------------------------------------------*/
|
---|
673 | /** @addtogroup RTC_Exported_Functions
|
---|
674 | * @{
|
---|
675 | */
|
---|
676 |
|
---|
677 | /** @addtogroup RTC_Exported_Functions_Group1
|
---|
678 | * @{
|
---|
679 | */
|
---|
680 | /* Initialization and de-initialization functions ****************************/
|
---|
681 | HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
|
---|
682 | HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
|
---|
683 | void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
|
---|
684 | void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
|
---|
685 |
|
---|
686 | /* Callbacks Register/UnRegister functions ***********************************/
|
---|
687 | #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
|
---|
688 | HAL_StatusTypeDef HAL_RTC_RegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID, pRTC_CallbackTypeDef pCallback);
|
---|
689 | HAL_StatusTypeDef HAL_RTC_UnRegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID);
|
---|
690 | #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
|
---|
691 | /**
|
---|
692 | * @}
|
---|
693 | */
|
---|
694 |
|
---|
695 | /** @addtogroup RTC_Exported_Functions_Group2
|
---|
696 | * @{
|
---|
697 | */
|
---|
698 | /* RTC Time and Date functions ************************************************/
|
---|
699 | HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
|
---|
700 | HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
|
---|
701 | HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
|
---|
702 | HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
|
---|
703 | void HAL_RTC_DST_Add1Hour(RTC_HandleTypeDef *hrtc);
|
---|
704 | void HAL_RTC_DST_Sub1Hour(RTC_HandleTypeDef *hrtc);
|
---|
705 | void HAL_RTC_DST_SetStoreOperation(RTC_HandleTypeDef *hrtc);
|
---|
706 | void HAL_RTC_DST_ClearStoreOperation(RTC_HandleTypeDef *hrtc);
|
---|
707 | uint32_t HAL_RTC_DST_ReadStoreOperation(RTC_HandleTypeDef *hrtc);
|
---|
708 | /**
|
---|
709 | * @}
|
---|
710 | */
|
---|
711 |
|
---|
712 | /** @addtogroup RTC_Exported_Functions_Group3
|
---|
713 | * @{
|
---|
714 | */
|
---|
715 | /* RTC Alarm functions ********************************************************/
|
---|
716 | HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
|
---|
717 | HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
|
---|
718 | HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
|
---|
719 | HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
|
---|
720 | void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
|
---|
721 | HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
|
---|
722 | void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
|
---|
723 | /**
|
---|
724 | * @}
|
---|
725 | */
|
---|
726 |
|
---|
727 | /** @addtogroup RTC_Exported_Functions_Group4
|
---|
728 | * @{
|
---|
729 | */
|
---|
730 | /* Peripheral Control functions ***********************************************/
|
---|
731 | HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc);
|
---|
732 | /**
|
---|
733 | * @}
|
---|
734 | */
|
---|
735 |
|
---|
736 | /** @addtogroup RTC_Exported_Functions_Group5
|
---|
737 | * @{
|
---|
738 | */
|
---|
739 | /* Peripheral State functions *************************************************/
|
---|
740 | HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
|
---|
741 | /**
|
---|
742 | * @}
|
---|
743 | */
|
---|
744 |
|
---|
745 | /**
|
---|
746 | * @}
|
---|
747 | */
|
---|
748 |
|
---|
749 | /* Private types -------------------------------------------------------------*/
|
---|
750 | /* Private variables ---------------------------------------------------------*/
|
---|
751 | /* Private constants ---------------------------------------------------------*/
|
---|
752 | /** @defgroup RTC_Private_Constants RTC Private Constants
|
---|
753 | * @{
|
---|
754 | */
|
---|
755 | /* Masks Definition */
|
---|
756 | #define RTC_TR_RESERVED_MASK 0x007F7F7FU
|
---|
757 | #define RTC_DR_RESERVED_MASK 0x00FFFF3FU
|
---|
758 | #define RTC_INIT_MASK 0xFFFFFFFFU
|
---|
759 | #define RTC_RSF_MASK 0xFFFFFF5FU
|
---|
760 | #define RTC_FLAGS_MASK ((uint32_t)(RTC_FLAG_TSOVF | RTC_FLAG_TSF | RTC_FLAG_WUTF | \
|
---|
761 | RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | RTC_FLAG_INITF | \
|
---|
762 | RTC_FLAG_RSF | RTC_FLAG_INITS | RTC_FLAG_WUTWF | \
|
---|
763 | RTC_FLAG_ALRBWF | RTC_FLAG_ALRAWF | RTC_FLAG_TAMP1F | \
|
---|
764 | RTC_FLAG_RECALPF | RTC_FLAG_SHPF))
|
---|
765 |
|
---|
766 | #define RTC_TIMEOUT_VALUE 1000
|
---|
767 |
|
---|
768 | #define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)EXTI_IMR_MR17) /*!< External interrupt line 17 Connected to the RTC Alarm event */
|
---|
769 | /**
|
---|
770 | * @}
|
---|
771 | */
|
---|
772 |
|
---|
773 | /* Private macros ------------------------------------------------------------*/
|
---|
774 | /** @defgroup RTC_Private_Macros RTC Private Macros
|
---|
775 | * @{
|
---|
776 | */
|
---|
777 |
|
---|
778 | /** @defgroup RTC_IS_RTC_Definitions RTC Private macros to check input parameters
|
---|
779 | * @{
|
---|
780 | */
|
---|
781 | #define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HOURFORMAT_12) || \
|
---|
782 | ((FORMAT) == RTC_HOURFORMAT_24))
|
---|
783 | #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_OUTPUT_DISABLE) || \
|
---|
784 | ((OUTPUT) == RTC_OUTPUT_ALARMA) || \
|
---|
785 | ((OUTPUT) == RTC_OUTPUT_ALARMB) || \
|
---|
786 | ((OUTPUT) == RTC_OUTPUT_WAKEUP))
|
---|
787 | #define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OUTPUT_POLARITY_HIGH) || \
|
---|
788 | ((POL) == RTC_OUTPUT_POLARITY_LOW))
|
---|
789 | #define IS_RTC_OUTPUT_TYPE(TYPE) (((TYPE) == RTC_OUTPUT_TYPE_OPENDRAIN) || \
|
---|
790 | ((TYPE) == RTC_OUTPUT_TYPE_PUSHPULL))
|
---|
791 | #define IS_RTC_HOUR12(HOUR) (((HOUR) > 0U) && ((HOUR) <= 12U))
|
---|
792 | #define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23U)
|
---|
793 | #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7FU)
|
---|
794 | #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7FFFU)
|
---|
795 | #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59U)
|
---|
796 | #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59U)
|
---|
797 |
|
---|
798 | #define IS_RTC_HOURFORMAT12(PM) (((PM) == RTC_HOURFORMAT12_AM) || ((PM) == RTC_HOURFORMAT12_PM))
|
---|
799 | #define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DAYLIGHTSAVING_SUB1H) || \
|
---|
800 | ((SAVE) == RTC_DAYLIGHTSAVING_ADD1H) || \
|
---|
801 | ((SAVE) == RTC_DAYLIGHTSAVING_NONE))
|
---|
802 | #define IS_RTC_STORE_OPERATION(OPERATION) (((OPERATION) == RTC_STOREOPERATION_RESET) || \
|
---|
803 | ((OPERATION) == RTC_STOREOPERATION_SET))
|
---|
804 | #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD))
|
---|
805 | #define IS_RTC_YEAR(YEAR) ((YEAR) <= 99U)
|
---|
806 | #define IS_RTC_MONTH(MONTH) (((MONTH) >= 1U) && ((MONTH) <= 12U))
|
---|
807 | #define IS_RTC_DATE(DATE) (((DATE) >= 1U) && ((DATE) <= 31U))
|
---|
808 | #define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
|
---|
809 | ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
|
---|
810 | ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
|
---|
811 | ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
|
---|
812 | ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
|
---|
813 | ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
|
---|
814 | ((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
|
---|
815 | #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) > 0U) && ((DATE) <= 31U))
|
---|
816 | #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
|
---|
817 | ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
|
---|
818 | ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
|
---|
819 | ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
|
---|
820 | ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
|
---|
821 | ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
|
---|
822 | ((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
|
---|
823 | #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_ALARMDATEWEEKDAYSEL_DATE) || \
|
---|
824 | ((SEL) == RTC_ALARMDATEWEEKDAYSEL_WEEKDAY))
|
---|
825 | #define IS_RTC_ALARM_MASK(MASK) (((MASK) & 0x7F7F7F7FU) == (uint32_t)RESET)
|
---|
826 | #define IS_RTC_ALARM(ALARM) (((ALARM) == RTC_ALARM_A) || ((ALARM) == RTC_ALARM_B))
|
---|
827 | #define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= 0x00007FFFU)
|
---|
828 |
|
---|
829 | #define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_ALARMSUBSECONDMASK_ALL) || \
|
---|
830 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_1) || \
|
---|
831 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_2) || \
|
---|
832 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_3) || \
|
---|
833 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_4) || \
|
---|
834 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_5) || \
|
---|
835 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_6) || \
|
---|
836 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_7) || \
|
---|
837 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_8) || \
|
---|
838 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_9) || \
|
---|
839 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_10) || \
|
---|
840 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_11) || \
|
---|
841 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_12) || \
|
---|
842 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_13) || \
|
---|
843 | ((MASK) == RTC_ALARMSUBSECONDMASK_SS14) || \
|
---|
844 | ((MASK) == RTC_ALARMSUBSECONDMASK_NONE))
|
---|
845 | /**
|
---|
846 | * @}
|
---|
847 | */
|
---|
848 |
|
---|
849 | /**
|
---|
850 | * @}
|
---|
851 | */
|
---|
852 |
|
---|
853 | /* Private functions ---------------------------------------------------------*/
|
---|
854 | /** @defgroup RTC_Private_Functions RTC Private Functions
|
---|
855 | * @{
|
---|
856 | */
|
---|
857 | HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef* hrtc);
|
---|
858 | uint8_t RTC_ByteToBcd2(uint8_t Value);
|
---|
859 | uint8_t RTC_Bcd2ToByte(uint8_t Value);
|
---|
860 | /**
|
---|
861 | * @}
|
---|
862 | */
|
---|
863 |
|
---|
864 | /**
|
---|
865 | * @}
|
---|
866 | */
|
---|
867 |
|
---|
868 | /**
|
---|
869 | * @}
|
---|
870 | */
|
---|
871 |
|
---|
872 | #ifdef __cplusplus
|
---|
873 | }
|
---|
874 | #endif
|
---|
875 |
|
---|
876 | #endif /* __STM32F4xx_HAL_RTC_H */
|
---|
877 |
|
---|
878 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
---|