]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L1/stm32l1xx_hal_rtc.h
Merge commit 'f6d56675f9f981c5464f0ca7a1fbb0162154e8c5'
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32L1 / stm32l1xx_hal_rtc.h
1 /**
2 ******************************************************************************
3 * @file stm32l1xx_hal_rtc.h
4 * @author MCD Application Team
5 * @version V1.0.0
6 * @date 5-September-2014
7 * @brief Header file of RTC HAL module.
8 ******************************************************************************
9 * @attention
10 *
11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
12 *
13 * Redistribution and use in source and binary forms, with or without modification,
14 * are permitted provided that the following conditions are met:
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 ******************************************************************************
36 */
37
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32L1xx_HAL_RTC_H
40 #define __STM32L1xx_HAL_RTC_H
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32l1xx_hal_def.h"
48
49 /** @addtogroup STM32L1xx_HAL_Driver
50 * @{
51 */
52
53 /** @addtogroup RTC
54 * @{
55 */
56
57 /* Exported types ------------------------------------------------------------*/
58 /** @defgroup RTC_Exported_Types RTC Exported Types
59 * @{
60 */
61
62 /**
63 * @brief HAL State structures definition
64 */
65 typedef enum
66 {
67 HAL_RTC_STATE_RESET = 0x00, /*!< RTC not yet initialized or disabled */
68 HAL_RTC_STATE_READY = 0x01, /*!< RTC initialized and ready for use */
69 HAL_RTC_STATE_BUSY = 0x02, /*!< RTC process is ongoing */
70 HAL_RTC_STATE_TIMEOUT = 0x03, /*!< RTC timeout state */
71 HAL_RTC_STATE_ERROR = 0x04 /*!< RTC error state */
72
73 }HAL_RTCStateTypeDef;
74
75 /**
76 * @brief RTC Configuration Structure definition
77 */
78 typedef struct
79 {
80 uint32_t HourFormat; /*!< Specifies the RTC Hour Format.
81 This parameter can be a value of @ref RTC_Hour_Formats */
82
83 uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value.
84 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F */
85
86 uint32_t SynchPrediv; /*!< Specifies the RTC Synchronous Predivider value.
87 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF */
88
89 uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC output.
90 This parameter can be a value of @ref RTCEx_Output_selection_Definitions */
91
92 uint32_t OutPutPolarity; /*!< Specifies the polarity of the output signal.
93 This parameter can be a value of @ref RTC_Output_Polarity_Definitions */
94
95 uint32_t OutPutType; /*!< Specifies the RTC Output Pin mode.
96 This parameter can be a value of @ref RTC_Output_Type_ALARM_OUT */
97 }RTC_InitTypeDef;
98
99 /**
100 * @brief RTC Date structure definition
101 */
102 typedef struct
103 {
104 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
105 This parameter can be a value of @ref RTC_WeekDay_Definitions */
106
107 uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format).
108 This parameter can be a value of @ref RTC_Month_Date_Definitions */
109
110 uint8_t Date; /*!< Specifies the RTC Date.
111 This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
112
113 uint8_t Year; /*!< Specifies the RTC Date Year.
114 This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
115
116 }RTC_DateTypeDef;
117
118 /**
119 * @brief Time Handle Structure definition
120 */
121 typedef struct
122 {
123 RTC_TypeDef *Instance; /*!< Register base address */
124
125 RTC_InitTypeDef Init; /*!< RTC required parameters */
126
127 HAL_LockTypeDef Lock; /*!< RTC locking object */
128
129 __IO HAL_RTCStateTypeDef State; /*!< Time communication state */
130
131 }RTC_HandleTypeDef;
132
133 /**
134 * @}
135 */
136
137 /* Exported constants --------------------------------------------------------*/
138 /** @defgroup RTC_Exported_Constants RTC Exported Constants
139 * @{
140 */
141
142 /** @defgroup RTC_Timeout_Value Default Timeout Value
143 * @{
144 */
145 #define RTC_TIMEOUT_VALUE 1000
146 /**
147 * @}
148 */
149
150 /** @defgroup RTC_Hour_Formats Hour Formats
151 * @{
152 */
153 #define RTC_HOURFORMAT_24 ((uint32_t)0x00000000)
154 #define RTC_HOURFORMAT_12 ((uint32_t)0x00000040)
155
156 #define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HOURFORMAT_12) || \
157 ((FORMAT) == RTC_HOURFORMAT_24))
158 /**
159 * @}
160 */
161
162 /** @defgroup RTC_Output_Polarity_Definitions Outpout Polarity
163 * @{
164 */
165 #define RTC_OUTPUT_POLARITY_HIGH ((uint32_t)0x00000000)
166 #define RTC_OUTPUT_POLARITY_LOW ((uint32_t)0x00100000)
167
168 #define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OUTPUT_POLARITY_HIGH) || \
169 ((POL) == RTC_OUTPUT_POLARITY_LOW))
170 /**
171 * @}
172 */
173
174 /** @defgroup RTC_Output_Type_ALARM_OUT Alarm Output Type
175 * @{
176 */
177 #define RTC_OUTPUT_TYPE_OPENDRAIN ((uint32_t)0x00000000)
178 #define RTC_OUTPUT_TYPE_PUSHPULL ((uint32_t)0x00040000)
179
180 #define IS_RTC_OUTPUT_TYPE(TYPE) (((TYPE) == RTC_OUTPUT_TYPE_OPENDRAIN) || \
181 ((TYPE) == RTC_OUTPUT_TYPE_PUSHPULL))
182
183 /**
184 * @}
185 */
186
187 /** @defgroup RTC_Asynchronous_Predivider Asynchronous Predivider
188 * @{
189 */
190 #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= (uint32_t)0x7F)
191 /**
192 * @}
193 */
194
195 /** @defgroup RTC_Time_Definitions Time Definitions
196 * @{
197 */
198 #define IS_RTC_HOUR12(HOUR) (((HOUR) > (uint32_t)0) && ((HOUR) <= (uint32_t)12))
199 #define IS_RTC_HOUR24(HOUR) ((HOUR) <= (uint32_t)23)
200 #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= (uint32_t)59)
201 #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= (uint32_t)59)
202 /**
203 * @}
204 */
205
206 /** @defgroup RTC_AM_PM_Definitions AM PM Definitions
207 * @{
208 */
209 #define RTC_HOURFORMAT12_AM ((uint8_t)0x00)
210 #define RTC_HOURFORMAT12_PM ((uint8_t)0x40)
211
212 #define IS_RTC_HOURFORMAT12(PM) (((PM) == RTC_HOURFORMAT12_AM) || ((PM) == RTC_HOURFORMAT12_PM))
213 /**
214 * @}
215 */
216
217 /** @defgroup RTC_DayLightSaving_Definitions DayLightSaving
218 * @{
219 */
220 #define RTC_DAYLIGHTSAVING_SUB1H ((uint32_t)0x00020000)
221 #define RTC_DAYLIGHTSAVING_ADD1H ((uint32_t)0x00010000)
222 #define RTC_DAYLIGHTSAVING_NONE ((uint32_t)0x00000000)
223
224 #define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DAYLIGHTSAVING_SUB1H) || \
225 ((SAVE) == RTC_DAYLIGHTSAVING_ADD1H) || \
226 ((SAVE) == RTC_DAYLIGHTSAVING_NONE))
227 /**
228 * @}
229 */
230
231 /** @defgroup RTC_StoreOperation_Definitions StoreOperation
232 * @{
233 */
234 #define RTC_STOREOPERATION_RESET ((uint32_t)0x00000000)
235 #define RTC_STOREOPERATION_SET ((uint32_t)0x00040000)
236
237 #define IS_RTC_STORE_OPERATION(OPERATION) (((OPERATION) == RTC_STOREOPERATION_RESET) || \
238 ((OPERATION) == RTC_STOREOPERATION_SET))
239 /**
240 * @}
241 */
242
243 /** @defgroup RTC_Input_parameter_format_definitions Input Parameter Format
244 * @{
245 */
246 #define FORMAT_BIN ((uint32_t)0x000000000)
247 #define FORMAT_BCD ((uint32_t)0x000000001)
248
249 #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == FORMAT_BIN) || ((FORMAT) == FORMAT_BCD))
250 /**
251 * @}
252 */
253
254 /** @defgroup RTC_Year_Date_Definitions Year Definitions
255 * @{
256 */
257 #define IS_RTC_YEAR(YEAR) ((YEAR) <= (uint32_t)99)
258 /**
259 * @}
260 */
261
262 /** @defgroup RTC_Month_Date_Definitions Month Definitions
263 * @{
264 */
265
266 /* Coded in BCD format */
267 #define RTC_MONTH_JANUARY ((uint8_t)0x01)
268 #define RTC_MONTH_FEBRUARY ((uint8_t)0x02)
269 #define RTC_MONTH_MARCH ((uint8_t)0x03)
270 #define RTC_MONTH_APRIL ((uint8_t)0x04)
271 #define RTC_MONTH_MAY ((uint8_t)0x05)
272 #define RTC_MONTH_JUNE ((uint8_t)0x06)
273 #define RTC_MONTH_JULY ((uint8_t)0x07)
274 #define RTC_MONTH_AUGUST ((uint8_t)0x08)
275 #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09)
276 #define RTC_MONTH_OCTOBER ((uint8_t)0x10)
277 #define RTC_MONTH_NOVEMBER ((uint8_t)0x11)
278 #define RTC_MONTH_DECEMBER ((uint8_t)0x12)
279
280 #define IS_RTC_MONTH(MONTH) (((MONTH) >= (uint32_t)1) && ((MONTH) <= (uint32_t)12))
281 #define IS_RTC_DATE(DATE) (((DATE) >= (uint32_t)1) && ((DATE) <= (uint32_t)31))
282 /**
283 * @}
284 */
285
286 /** @defgroup RTC_WeekDay_Definitions WeekDay Definitions
287 * @{
288 */
289 #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01)
290 #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02)
291 #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03)
292 #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04)
293 #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05)
294 #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06)
295 #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07)
296
297 #define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
298 ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
299 ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
300 ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
301 ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
302 ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
303 ((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
304 /**
305 * @}
306 */
307
308 /** @defgroup RTC_Alarm_Definitions Alarm Definitions
309 * @{
310 */
311 #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) >(uint32_t) 0) && ((DATE) <= (uint32_t)31))
312 #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
313 ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
314 ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
315 ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
316 ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
317 ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
318 ((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
319 /**
320 * @}
321 */
322
323
324 /** @defgroup RTC_AlarmDateWeekDay_Definitions AlarmDateWeekDay Definitions
325 * @{
326 */
327 #define RTC_ALARMDATEWEEKDAYSEL_DATE ((uint32_t)0x00000000)
328 #define RTC_ALARMDATEWEEKDAYSEL_WEEKDAY ((uint32_t)0x40000000)
329
330 #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_ALARMDATEWEEKDAYSEL_DATE) || \
331 ((SEL) == RTC_ALARMDATEWEEKDAYSEL_WEEKDAY))
332 /**
333 * @}
334 */
335
336
337 /** @defgroup RTC_AlarmMask_Definitions Alarm Mask Definitions
338 * @{
339 */
340 #define RTC_ALARMMASK_NONE ((uint32_t)0x00000000)
341 #define RTC_ALARMMASK_DATEWEEKDAY RTC_ALRMAR_MSK4
342 #define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3
343 #define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2
344 #define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1
345 #define RTC_ALARMMASK_ALL ((uint32_t)0x80808080)
346
347 #define IS_ALARM_MASK(MASK) (((MASK) & 0x7F7F7F7F) == (uint32_t)RESET)
348 /**
349 * @}
350 */
351
352 /** @defgroup RTC_Alarms_Definitions Alarms Definitions
353 * @{
354 */
355 #define RTC_ALARM_A RTC_CR_ALRAE
356 #define RTC_ALARM_B RTC_CR_ALRBE
357
358 #define IS_ALARM(ALARM) (((ALARM) == RTC_ALARM_A) || ((ALARM) == RTC_ALARM_B))
359 /**
360 * @}
361 */
362
363 /**
364 * @}
365 */
366
367 /* Exported macro ------------------------------------------------------------*/
368 /** @defgroup RTC_Exported_macros RTC Exported Macros
369 * @{
370 */
371
372 /** @brief Reset RTC handle state
373 * @param __HANDLE__: RTC handle.
374 * @retval None
375 */
376 #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
377
378 /**
379 * @brief Disable the write protection for RTC registers.
380 * @param __HANDLE__: specifies the RTC handle.
381 * @retval None
382 */
383 #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) \
384 do{ \
385 (__HANDLE__)->Instance->WPR = 0xCA; \
386 (__HANDLE__)->Instance->WPR = 0x53; \
387 } while(0)
388
389 /**
390 * @brief Enable the write protection for RTC registers.
391 * @param __HANDLE__: specifies the RTC handle.
392 * @retval None
393 */
394 #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) \
395 do{ \
396 (__HANDLE__)->Instance->WPR = 0xFF; \
397 } while(0)
398
399 /**
400 * @brief Enable the RTC ALARMA peripheral.
401 * @param __HANDLE__: specifies the RTC handle.
402 * @retval None
403 */
404 #define __HAL_RTC_ALARMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRAE))
405
406 /**
407 * @brief Disable the RTC ALARMA peripheral.
408 * @param __HANDLE__: specifies the RTC handle.
409 * @retval None
410 */
411 #define __HAL_RTC_ALARMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRAE))
412
413 /**
414 * @brief Enable the RTC ALARMB peripheral.
415 * @param __HANDLE__: specifies the RTC handle.
416 * @retval None
417 */
418 #define __HAL_RTC_ALARMB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRBE))
419
420 /**
421 * @brief Disable the RTC ALARMB peripheral.
422 * @param __HANDLE__: specifies the RTC handle.
423 * @retval None
424 */
425 #define __HAL_RTC_ALARMB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRBE))
426
427 /**
428 * @brief Enable the RTC Alarm interrupt.
429 * @param __HANDLE__: specifies the RTC handle.
430 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
431 * This parameter can be any combination of the following values:
432 * @arg RTC_IT_ALRA: Alarm A interrupt
433 * @arg RTC_IT_ALRB: Alarm B interrupt
434 * @retval None
435 */
436 #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
437
438 /**
439 * @brief Disable the RTC Alarm interrupt.
440 * @param __HANDLE__: specifies the RTC handle.
441 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
442 * This parameter can be any combination of the following values:
443 * @arg RTC_IT_ALRA: Alarm A interrupt
444 * @arg RTC_IT_ALRB: Alarm B interrupt
445 * @retval None
446 */
447 #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
448
449 /**
450 * @brief Check whether the specified RTC Alarm interrupt has occurred or not.
451 * @param __HANDLE__: specifies the RTC handle.
452 * @param __FLAG__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
453 * This parameter can be:
454 * @arg RTC_IT_ALRA: Alarm A interrupt
455 * @arg RTC_IT_ALRB: Alarm B interrupt
456 * @retval None
457 */
458 #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __FLAG__) ((((((__HANDLE__)->Instance->ISR)& ((__FLAG__)>> 4)) & 0x0000FFFF) != RESET)? SET : RESET)
459
460 /**
461 * @brief Get the selected RTC Alarm's flag status.
462 * @param __HANDLE__: specifies the RTC handle.
463 * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
464 * This parameter can be:
465 * @arg RTC_FLAG_ALRAF
466 * @arg RTC_FLAG_ALRBF
467 * @arg RTC_FLAG_ALRAWF
468 * @arg RTC_FLAG_ALRBWF
469 * @retval None
470 */
471 #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
472
473 /**
474 * @brief Clear the RTC Alarm's pending flags.
475 * @param __HANDLE__: specifies the RTC handle.
476 * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
477 * This parameter can be:
478 * @arg RTC_FLAG_ALRAF
479 * @arg RTC_FLAG_ALRBF
480 * @retval None
481 */
482 #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
483
484
485 #define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)0x00020000) /*!< External interrupt line 17 Connected to the RTC Alarm event */
486 #define RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT ((uint32_t)0x00080000) /*!< External interrupt line 19 Connected to the RTC Tamper and Time Stamp events */
487 #define RTC_EXTI_LINE_WAKEUPTIMER_EVENT ((uint32_t)0x00100000) /*!< External interrupt line 20 Connected to the RTC Wakeup event */
488
489 /**
490 * @brief Enable the RTC Exti line.
491 * @param __EXTILINE__: specifies the RTC Exti sources to be enabled or disabled.
492 * This parameter can be:
493 * @arg RTC_EXTI_LINE_ALARM_EVENT
494 * @arg RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT
495 * @arg RTC_EXTI_LINE_WAKEUPTIMER_EVENT
496 * @retval None
497 */
498 #define __HAL_RTC_EXTI_ENABLE_IT(__EXTILINE__) (EXTI->IMR |= (__EXTILINE__))
499
500 /* alias define maintained for legacy */
501 #define __HAL_RTC_ENABLE_IT __HAL_RTC_EXTI_ENABLE_IT
502
503 /**
504 * @brief Disable the RTC Exti line.
505 * @param __EXTILINE__: specifies the RTC Exti sources to be enabled or disabled.
506 * This parameter can be:
507 * @arg RTC_EXTI_LINE_ALARM_EVENT
508 * @arg RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT
509 * @arg RTC_EXTI_LINE_WAKEUPTIMER_EVENT
510 * @retval None
511 */
512 #define __HAL_RTC_EXTI_DISABLE_IT(__EXTILINE__) (EXTI->IMR &= ~(__EXTILINE__))
513
514 /* alias define maintained for legacy */
515 #define __HAL_RTC_DISABLE_IT __HAL_RTC_EXTI_DISABLE_IT
516
517 /**
518 * @brief Generates a Software interrupt on selected EXTI line.
519 * @param __EXTILINE__: specifies the RTC Exti sources to be enabled or disabled.
520 * This parameter can be:
521 * @arg RTC_EXTI_LINE_ALARM_EVENT
522 * @arg RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT
523 * @arg RTC_EXTI_LINE_WAKEUPTIMER_EVENT
524 * @retval None
525 */
526 #define __HAL_RTC_EXTI_GENERATE_SWIT(__EXTILINE__) (EXTI->SWIER |= (__EXTILINE__))
527
528 /**
529 * @brief Clear the RTC Exti flags.
530 * @param __FLAG__: specifies the RTC Exti sources to be enabled or disabled.
531 * This parameter can be:
532 * @arg RTC_EXTI_LINE_ALARM_EVENT
533 * @arg RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT
534 * @arg RTC_EXTI_LINE_WAKEUPTIMER_EVENT
535 * @retval None
536 */
537 #define __HAL_RTC_EXTI_CLEAR_FLAG(__FLAG__) (EXTI->PR = (__FLAG__))
538
539 /* alias define maintained for legacy */
540 #define __HAL_RTC_CLEAR_FLAG __HAL_RTC_EXTI_CLEAR_FLAG
541
542 /**
543 * @}
544 */
545
546 /* Include RTC HAL Extension module */
547 #include "stm32l1xx_hal_rtc_ex.h"
548
549 /* Exported functions --------------------------------------------------------*/
550 /** @addtogroup RTC_Exported_Functions
551 * @{
552 */
553
554
555 /* Initialization and de-initialization functions ****************************/
556 /** @addtogroup RTC_Exported_Functions_Group1
557 * @{
558 */
559 HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
560 HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
561 void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
562 void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
563 /**
564 * @}
565 */
566
567 /* RTC Time and Date functions ************************************************/
568 /** @addtogroup RTC_Exported_Functions_Group1
569 * @{
570 */
571 HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
572 HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
573 HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
574 HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
575 /**
576 * @}
577 */
578
579 /* RTC Alarm functions ********************************************************/
580 /** @addtogroup RTC_Exported_Functions_Group2
581 * @{
582 */
583 HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
584 HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
585 HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
586 HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
587 void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
588 HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
589 void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
590 /**
591 * @}
592 */
593
594 /* Peripheral Control functions ***********************************************/
595 /** @addtogroup RTC_Exported_Functions_Group3
596 * @{
597 */
598 HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc);
599 /**
600 * @}
601 */
602
603 /* Peripheral State functions *************************************************/
604 /** @addtogroup RTC_Exported_Functions_Group5
605 * @{
606 */
607 HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
608 /**
609 * @}
610 */
611
612 /**
613 * @}
614 */
615 /* Private functions **********************************************************/
616 /** @addtogroup RTC_Internal_Functions
617 * @{
618 */
619 HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef* hrtc);
620 uint8_t RTC_ByteToBcd2(uint8_t Value);
621 uint8_t RTC_Bcd2ToByte(uint8_t Value);
622
623 /**
624 * @}
625 */
626
627 /**
628 * @}
629 */
630
631 /**
632 * @}
633 */
634
635 #ifdef __cplusplus
636 }
637 #endif
638
639 #endif /* __STM32L1xx_HAL_RTC_H */
640
641 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Imprint / Impressum