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