2 ******************************************************************************
\r
3 * @file stm32f7xx_hal_rtc.h
\r
4 * @author MCD Application Team
\r
6 * @date 24-March-2015
\r
7 * @brief Header file of RTC HAL module.
\r
8 ******************************************************************************
\r
11 * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
\r
13 * Redistribution and use in source and binary forms, with or without modification,
\r
14 * are permitted provided that the following conditions are met:
\r
15 * 1. Redistributions of source code must retain the above copyright notice,
\r
16 * this list of conditions and the following disclaimer.
\r
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
\r
18 * this list of conditions and the following disclaimer in the documentation
\r
19 * and/or other materials provided with the distribution.
\r
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
\r
21 * may be used to endorse or promote products derived from this software
\r
22 * without specific prior written permission.
\r
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
\r
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
\r
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
\r
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
\r
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
\r
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
\r
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
\r
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
35 ******************************************************************************
\r
38 /* Define to prevent recursive inclusion -------------------------------------*/
\r
39 #ifndef __STM32F7xx_HAL_RTC_H
\r
40 #define __STM32F7xx_HAL_RTC_H
\r
46 /* Includes ------------------------------------------------------------------*/
\r
47 #include "stm32f7xx_hal_def.h"
\r
49 /** @addtogroup STM32F7xx_HAL_Driver
\r
57 /* Exported types ------------------------------------------------------------*/
\r
58 /** @defgroup RTC_Exported_Types RTC Exported Types
\r
63 * @brief HAL State structures definition
\r
67 HAL_RTC_STATE_RESET = 0x00, /*!< RTC not yet initialized or disabled */
\r
68 HAL_RTC_STATE_READY = 0x01, /*!< RTC initialized and ready for use */
\r
69 HAL_RTC_STATE_BUSY = 0x02, /*!< RTC process is ongoing */
\r
70 HAL_RTC_STATE_TIMEOUT = 0x03, /*!< RTC timeout state */
\r
71 HAL_RTC_STATE_ERROR = 0x04 /*!< RTC error state */
\r
73 }HAL_RTCStateTypeDef;
\r
76 * @brief RTC Configuration Structure definition
\r
80 uint32_t HourFormat; /*!< Specifies the RTC Hour Format.
\r
81 This parameter can be a value of @ref RTC_Hour_Formats */
\r
83 uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value.
\r
84 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F */
\r
86 uint32_t SynchPrediv; /*!< Specifies the RTC Synchronous Predivider value.
\r
87 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF */
\r
89 uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC output.
\r
90 This parameter can be a value of @ref RTCEx_Output_selection_Definitions */
\r
92 uint32_t OutPutPolarity; /*!< Specifies the polarity of the output signal.
\r
93 This parameter can be a value of @ref RTC_Output_Polarity_Definitions */
\r
95 uint32_t OutPutType; /*!< Specifies the RTC Output Pin mode.
\r
96 This parameter can be a value of @ref RTC_Output_Type_ALARM_OUT */
\r
100 * @brief RTC Time structure definition
\r
104 uint8_t Hours; /*!< Specifies the RTC Time Hour.
\r
105 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the RTC_HourFormat_12 is selected.
\r
106 This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the RTC_HourFormat_24 is selected */
\r
108 uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
\r
109 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
\r
111 uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
\r
112 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
\r
114 uint32_t SubSeconds; /*!< Specifies the RTC Time SubSeconds.
\r
115 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
\r
117 uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
\r
118 This parameter can be a value of @ref RTC_AM_PM_Definitions */
\r
120 uint32_t DayLightSaving; /*!< Specifies RTC_DayLightSaveOperation: the value of hour adjustment.
\r
121 This parameter can be a value of @ref RTC_DayLightSaving_Definitions */
\r
123 uint32_t StoreOperation; /*!< Specifies RTC_StoreOperation value to be written in the BCK bit
\r
124 in CR register to store the operation.
\r
125 This parameter can be a value of @ref RTC_StoreOperation_Definitions */
\r
129 * @brief RTC Date structure definition
\r
133 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
\r
134 This parameter can be a value of @ref RTC_WeekDay_Definitions */
\r
136 uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format).
\r
137 This parameter can be a value of @ref RTC_Month_Date_Definitions */
\r
139 uint8_t Date; /*!< Specifies the RTC Date.
\r
140 This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
\r
142 uint8_t Year; /*!< Specifies the RTC Date Year.
\r
143 This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
\r
148 * @brief RTC Alarm structure definition
\r
152 RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */
\r
154 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks.
\r
155 This parameter can be a value of @ref RTC_AlarmMask_Definitions */
\r
157 uint32_t AlarmSubSecondMask; /*!< Specifies the RTC Alarm SubSeconds Masks.
\r
158 This parameter can be a value of @ref RTC_Alarm_Sub_Seconds_Masks_Definitions */
\r
160 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay.
\r
161 This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */
\r
163 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay.
\r
164 If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range.
\r
165 If the Alarm WeekDay is selected, this parameter can be a value of @ref RTC_WeekDay_Definitions */
\r
167 uint32_t Alarm; /*!< Specifies the alarm .
\r
168 This parameter can be a value of @ref RTC_Alarms_Definitions */
\r
172 * @brief RTC Handle Structure definition
\r
176 RTC_TypeDef *Instance; /*!< Register base address */
\r
178 RTC_InitTypeDef Init; /*!< RTC required parameters */
\r
180 HAL_LockTypeDef Lock; /*!< RTC locking object */
\r
182 __IO HAL_RTCStateTypeDef State; /*!< Time communication state */
\r
184 }RTC_HandleTypeDef;
\r
190 /* Exported constants --------------------------------------------------------*/
\r
191 /** @defgroup RTC_Exported_Constants RTC Exported Constants
\r
195 /** @defgroup RTC_Hour_Formats RTC Hour Formats
\r
198 #define RTC_HOURFORMAT_24 ((uint32_t)0x00000000)
\r
199 #define RTC_HOURFORMAT_12 ((uint32_t)0x00000040)
\r
205 /** @defgroup RTC_Output_Polarity_Definitions RTC Output Polarity Definitions
\r
208 #define RTC_OUTPUT_POLARITY_HIGH ((uint32_t)0x00000000)
\r
209 #define RTC_OUTPUT_POLARITY_LOW ((uint32_t)0x00100000)
\r
214 /** @defgroup RTC_Output_Type_ALARM_OUT RTC Output Type ALARM OUT
\r
217 #define RTC_OUTPUT_TYPE_OPENDRAIN ((uint32_t)0x00000000)
\r
218 #define RTC_OUTPUT_TYPE_PUSHPULL ((uint32_t)RTC_OR_ALARMTYPE) /* 0x00000008 */
\r
223 /** @defgroup RTC_AM_PM_Definitions RTC AM PM Definitions
\r
226 #define RTC_HOURFORMAT12_AM ((uint8_t)0x00)
\r
227 #define RTC_HOURFORMAT12_PM ((uint8_t)0x40)
\r
232 /** @defgroup RTC_DayLightSaving_Definitions RTC DayLight Saving Definitions
\r
235 #define RTC_DAYLIGHTSAVING_SUB1H ((uint32_t)0x00020000)
\r
236 #define RTC_DAYLIGHTSAVING_ADD1H ((uint32_t)0x00010000)
\r
237 #define RTC_DAYLIGHTSAVING_NONE ((uint32_t)0x00000000)
\r
242 /** @defgroup RTC_StoreOperation_Definitions RTC Store Operation Definitions
\r
245 #define RTC_STOREOPERATION_RESET ((uint32_t)0x00000000)
\r
246 #define RTC_STOREOPERATION_SET ((uint32_t)0x00040000)
\r
251 /** @defgroup RTC_Input_parameter_format_definitions RTC Input Parameter Format Definitions
\r
254 #define RTC_FORMAT_BIN ((uint32_t)0x000000000)
\r
255 #define RTC_FORMAT_BCD ((uint32_t)0x000000001)
\r
260 /** @defgroup RTC_Month_Date_Definitions RTC Month Date Definitions
\r
263 /* Coded in BCD format */
\r
264 #define RTC_MONTH_JANUARY ((uint8_t)0x01)
\r
265 #define RTC_MONTH_FEBRUARY ((uint8_t)0x02)
\r
266 #define RTC_MONTH_MARCH ((uint8_t)0x03)
\r
267 #define RTC_MONTH_APRIL ((uint8_t)0x04)
\r
268 #define RTC_MONTH_MAY ((uint8_t)0x05)
\r
269 #define RTC_MONTH_JUNE ((uint8_t)0x06)
\r
270 #define RTC_MONTH_JULY ((uint8_t)0x07)
\r
271 #define RTC_MONTH_AUGUST ((uint8_t)0x08)
\r
272 #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09)
\r
273 #define RTC_MONTH_OCTOBER ((uint8_t)0x10)
\r
274 #define RTC_MONTH_NOVEMBER ((uint8_t)0x11)
\r
275 #define RTC_MONTH_DECEMBER ((uint8_t)0x12)
\r
280 /** @defgroup RTC_WeekDay_Definitions RTC WeekDay Definitions
\r
283 #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01)
\r
284 #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02)
\r
285 #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03)
\r
286 #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04)
\r
287 #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05)
\r
288 #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06)
\r
289 #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07)
\r
294 /** @defgroup RTC_AlarmDateWeekDay_Definitions RTC Alarm Date WeekDay Definitions
\r
297 #define RTC_ALARMDATEWEEKDAYSEL_DATE ((uint32_t)0x00000000)
\r
298 #define RTC_ALARMDATEWEEKDAYSEL_WEEKDAY ((uint32_t)0x40000000)
\r
303 /** @defgroup RTC_AlarmMask_Definitions RTC Alarm Mask Definitions
\r
306 #define RTC_ALARMMASK_NONE ((uint32_t)0x00000000)
\r
307 #define RTC_ALARMMASK_DATEWEEKDAY RTC_ALRMAR_MSK4
\r
308 #define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3
\r
309 #define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2
\r
310 #define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1
\r
311 #define RTC_ALARMMASK_ALL ((uint32_t)0x80808080)
\r
316 /** @defgroup RTC_Alarms_Definitions RTC Alarms Definitions
\r
319 #define RTC_ALARM_A RTC_CR_ALRAE
\r
320 #define RTC_ALARM_B RTC_CR_ALRBE
\r
325 /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions RTC Alarm Sub Seconds Masks Definitions
\r
328 #define RTC_ALARMSUBSECONDMASK_ALL ((uint32_t)0x00000000) /*!< All Alarm SS fields are masked.
\r
329 There is no comparison on sub seconds
\r
331 #define RTC_ALARMSUBSECONDMASK_SS14_1 ((uint32_t)0x01000000) /*!< SS[14:1] are don't care in Alarm
\r
332 comparison. Only SS[0] is compared. */
\r
333 #define RTC_ALARMSUBSECONDMASK_SS14_2 ((uint32_t)0x02000000) /*!< SS[14:2] are don't care in Alarm
\r
334 comparison. Only SS[1:0] are compared */
\r
335 #define RTC_ALARMSUBSECONDMASK_SS14_3 ((uint32_t)0x03000000) /*!< SS[14:3] are don't care in Alarm
\r
336 comparison. Only SS[2:0] are compared */
\r
337 #define RTC_ALARMSUBSECONDMASK_SS14_4 ((uint32_t)0x04000000) /*!< SS[14:4] are don't care in Alarm
\r
338 comparison. Only SS[3:0] are compared */
\r
339 #define RTC_ALARMSUBSECONDMASK_SS14_5 ((uint32_t)0x05000000) /*!< SS[14:5] are don't care in Alarm
\r
340 comparison. Only SS[4:0] are compared */
\r
341 #define RTC_ALARMSUBSECONDMASK_SS14_6 ((uint32_t)0x06000000) /*!< SS[14:6] are don't care in Alarm
\r
342 comparison. Only SS[5:0] are compared */
\r
343 #define RTC_ALARMSUBSECONDMASK_SS14_7 ((uint32_t)0x07000000) /*!< SS[14:7] are don't care in Alarm
\r
344 comparison. Only SS[6:0] are compared */
\r
345 #define RTC_ALARMSUBSECONDMASK_SS14_8 ((uint32_t)0x08000000) /*!< SS[14:8] are don't care in Alarm
\r
346 comparison. Only SS[7:0] are compared */
\r
347 #define RTC_ALARMSUBSECONDMASK_SS14_9 ((uint32_t)0x09000000) /*!< SS[14:9] are don't care in Alarm
\r
348 comparison. Only SS[8:0] are compared */
\r
349 #define RTC_ALARMSUBSECONDMASK_SS14_10 ((uint32_t)0x0A000000) /*!< SS[14:10] are don't care in Alarm
\r
350 comparison. Only SS[9:0] are compared */
\r
351 #define RTC_ALARMSUBSECONDMASK_SS14_11 ((uint32_t)0x0B000000) /*!< SS[14:11] are don't care in Alarm
\r
352 comparison. Only SS[10:0] are compared */
\r
353 #define RTC_ALARMSUBSECONDMASK_SS14_12 ((uint32_t)0x0C000000) /*!< SS[14:12] are don't care in Alarm
\r
354 comparison.Only SS[11:0] are compared */
\r
355 #define RTC_ALARMSUBSECONDMASK_SS14_13 ((uint32_t)0x0D000000) /*!< SS[14:13] are don't care in Alarm
\r
356 comparison. Only SS[12:0] are compared */
\r
357 #define RTC_ALARMSUBSECONDMASK_SS14 ((uint32_t)0x0E000000) /*!< SS[14] is don't care in Alarm
\r
358 comparison.Only SS[13:0] are compared */
\r
359 #define RTC_ALARMSUBSECONDMASK_NONE ((uint32_t)0x0F000000) /*!< SS[14:0] are compared and must match
\r
360 to activate alarm. */
\r
365 /** @defgroup RTC_Interrupts_Definitions RTC Interrupts Definitions
\r
368 #define RTC_IT_TS ((uint32_t)RTC_CR_TSIE)
\r
369 #define RTC_IT_WUT ((uint32_t)RTC_CR_WUTIE)
\r
370 #define RTC_IT_ALRA ((uint32_t)RTC_CR_ALRAIE)
\r
371 #define RTC_IT_ALRB ((uint32_t)RTC_CR_ALRBIE)
\r
372 #define RTC_IT_TAMP ((uint32_t)RTC_TAMPCR_TAMPIE) /* Used only to Enable the Tamper Interrupt */
\r
373 #define RTC_IT_TAMP1 ((uint32_t)RTC_TAMPCR_TAMP1IE)
\r
374 #define RTC_IT_TAMP2 ((uint32_t)RTC_TAMPCR_TAMP2IE)
\r
375 #define RTC_IT_TAMP3 ((uint32_t)RTC_TAMPCR_TAMP3IE)
\r
380 /** @defgroup RTC_Flags_Definitions RTC Flags Definitions
\r
383 #define RTC_FLAG_RECALPF ((uint32_t)RTC_ISR_RECALPF)
\r
384 #define RTC_FLAG_TAMP3F ((uint32_t)RTC_ISR_TAMP3F)
\r
385 #define RTC_FLAG_TAMP2F ((uint32_t)RTC_ISR_TAMP2F)
\r
386 #define RTC_FLAG_TAMP1F ((uint32_t)RTC_ISR_TAMP1F)
\r
387 #define RTC_FLAG_TSOVF ((uint32_t)RTC_ISR_TSOVF)
\r
388 #define RTC_FLAG_TSF ((uint32_t)RTC_ISR_TSF)
\r
389 #define RTC_FLAG_ITSF ((uint32_t)RTC_ISR_ITSF)
\r
390 #define RTC_FLAG_WUTF ((uint32_t)RTC_ISR_WUTF)
\r
391 #define RTC_FLAG_ALRBF ((uint32_t)RTC_ISR_ALRBF)
\r
392 #define RTC_FLAG_ALRAF ((uint32_t)RTC_ISR_ALRAF)
\r
393 #define RTC_FLAG_INITF ((uint32_t)RTC_ISR_INITF)
\r
394 #define RTC_FLAG_RSF ((uint32_t)RTC_ISR_RSF)
\r
395 #define RTC_FLAG_INITS ((uint32_t)RTC_ISR_INITS)
\r
396 #define RTC_FLAG_SHPF ((uint32_t)RTC_ISR_SHPF)
\r
397 #define RTC_FLAG_WUTWF ((uint32_t)RTC_ISR_WUTWF)
\r
398 #define RTC_FLAG_ALRBWF ((uint32_t)RTC_ISR_ALRBWF)
\r
399 #define RTC_FLAG_ALRAWF ((uint32_t)RTC_ISR_ALRAWF)
\r
408 /* Exported macro ------------------------------------------------------------*/
\r
409 /** @defgroup RTC_Exported_Macros RTC Exported Macros
\r
413 /** @brief Reset RTC handle state
\r
414 * @param __HANDLE__: specifies the RTC handle.
\r
417 #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
\r
420 * @brief Disable the write protection for RTC registers.
\r
421 * @param __HANDLE__: specifies the RTC handle.
\r
424 #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) \
\r
426 (__HANDLE__)->Instance->WPR = 0xCA; \
\r
427 (__HANDLE__)->Instance->WPR = 0x53; \
\r
431 * @brief Enable the write protection for RTC registers.
\r
432 * @param __HANDLE__: specifies the RTC handle.
\r
435 #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) \
\r
437 (__HANDLE__)->Instance->WPR = 0xFF; \
\r
441 * @brief Enable the RTC ALARMA peripheral.
\r
442 * @param __HANDLE__: specifies the RTC handle.
\r
445 #define __HAL_RTC_ALARMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRAE))
\r
448 * @brief Disable the RTC ALARMA peripheral.
\r
449 * @param __HANDLE__: specifies the RTC handle.
\r
452 #define __HAL_RTC_ALARMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRAE))
\r
455 * @brief Enable the RTC ALARMB peripheral.
\r
456 * @param __HANDLE__: specifies the RTC handle.
\r
459 #define __HAL_RTC_ALARMB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRBE))
\r
462 * @brief Disable the RTC ALARMB peripheral.
\r
463 * @param __HANDLE__: specifies the RTC handle.
\r
466 #define __HAL_RTC_ALARMB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRBE))
\r
469 * @brief Enable the RTC Alarm interrupt.
\r
470 * @param __HANDLE__: specifies the RTC handle.
\r
471 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
\r
472 * This parameter can be any combination of the following values:
\r
473 * @arg RTC_IT_ALRA: Alarm A interrupt
\r
474 * @arg RTC_IT_ALRB: Alarm B interrupt
\r
477 #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
\r
480 * @brief Disable the RTC Alarm interrupt.
\r
481 * @param __HANDLE__: specifies the RTC handle.
\r
482 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
\r
483 * This parameter can be any combination of the following values:
\r
484 * @arg RTC_IT_ALRA: Alarm A interrupt
\r
485 * @arg RTC_IT_ALRB: Alarm B interrupt
\r
488 #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
\r
491 * @brief Check whether the specified RTC Alarm interrupt has occurred or not.
\r
492 * @param __HANDLE__: specifies the RTC handle.
\r
493 * @param __INTERRUPT__: specifies the RTC Alarm interrupt to check.
\r
494 * This parameter can be:
\r
495 * @arg RTC_IT_ALRA: Alarm A interrupt
\r
496 * @arg RTC_IT_ALRB: Alarm B interrupt
\r
499 #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) ((((((__HANDLE__)->Instance->ISR)& ((__INTERRUPT__)>> 4)) & 0x0000FFFF) != RESET)? SET : RESET)
\r
502 * @brief Get the selected RTC Alarm's flag status.
\r
503 * @param __HANDLE__: specifies the RTC handle.
\r
504 * @param __FLAG__: specifies the RTC Alarm Flag to check.
\r
505 * This parameter can be:
\r
506 * @arg RTC_FLAG_ALRAF
\r
507 * @arg RTC_FLAG_ALRBF
\r
508 * @arg RTC_FLAG_ALRAWF
\r
509 * @arg RTC_FLAG_ALRBWF
\r
512 #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
\r
515 * @brief Clear the RTC Alarm's pending flags.
\r
516 * @param __HANDLE__: specifies the RTC handle.
\r
517 * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
\r
518 * This parameter can be:
\r
519 * @arg RTC_FLAG_ALRAF
\r
520 * @arg RTC_FLAG_ALRBF
\r
523 #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
\r
526 * @brief Check whether the specified RTC Alarm interrupt has been enabled or not.
\r
527 * @param __HANDLE__: specifies the RTC handle.
\r
528 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check.
\r
529 * This parameter can be:
\r
530 * @arg RTC_IT_ALRA: Alarm A interrupt
\r
531 * @arg RTC_IT_ALRB: Alarm B interrupt
\r
534 #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
\r
537 * @brief Enable interrupt on the RTC Alarm associated Exti line.
\r
540 #define __HAL_RTC_ALARM_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_ALARM_EVENT)
\r
543 * @brief Disable interrupt on the RTC Alarm associated Exti line.
\r
546 #define __HAL_RTC_ALARM_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
\r
549 * @brief Enable event on the RTC Alarm associated Exti line.
\r
552 #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_ALARM_EVENT)
\r
555 * @brief Disable event on the RTC Alarm associated Exti line.
\r
558 #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
\r
561 * @brief Enable falling edge trigger on the RTC Alarm associated Exti line.
\r
564 #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_ALARM_EVENT)
\r
567 * @brief Disable falling edge trigger on the RTC Alarm associated Exti line.
\r
570 #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
\r
573 * @brief Enable rising edge trigger on the RTC Alarm associated Exti line.
\r
576 #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_ALARM_EVENT)
\r
579 * @brief Disable rising edge trigger on the RTC Alarm associated Exti line.
\r
582 #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
\r
585 * @brief Enable rising & falling edge trigger on the RTC Alarm associated Exti line.
\r
588 #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE();
\r
591 * @brief Disable rising & falling edge trigger on the RTC Alarm associated Exti line.
\r
594 #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE();
\r
597 * @brief Check whether the RTC Alarm associated Exti line interrupt flag is set or not.
\r
598 * @retval Line Status.
\r
600 #define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_ALARM_EVENT)
\r
603 * @brief Clear the RTC Alarm associated Exti line flag.
\r
606 #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_ALARM_EVENT)
\r
609 * @brief Generate a Software interrupt on RTC Alarm associated Exti line.
\r
612 #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_ALARM_EVENT)
\r
617 /* Include RTC HAL Extension module */
\r
618 #include "stm32f7xx_hal_rtc_ex.h"
\r
620 /* Exported functions --------------------------------------------------------*/
\r
621 /** @addtogroup RTC_Exported_Functions
\r
625 /** @addtogroup RTC_Exported_Functions_Group1
\r
628 /* Initialization and de-initialization functions ****************************/
\r
629 HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
\r
630 HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
\r
631 void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
\r
632 void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
\r
637 /** @addtogroup RTC_Exported_Functions_Group2
\r
640 /* RTC Time and Date functions ************************************************/
\r
641 HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
\r
642 HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
\r
643 HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
\r
644 HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
\r
649 /** @addtogroup RTC_Exported_Functions_Group3
\r
652 /* RTC Alarm functions ********************************************************/
\r
653 HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
\r
654 HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
\r
655 HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
\r
656 HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
\r
657 void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
\r
658 HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
\r
659 void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
\r
664 /** @addtogroup RTC_Exported_Functions_Group4
\r
667 /* Peripheral Control functions ***********************************************/
\r
668 HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc);
\r
673 /** @addtogroup RTC_Exported_Functions_Group5
\r
676 /* Peripheral State functions *************************************************/
\r
677 HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
\r
686 /* Private types -------------------------------------------------------------*/
\r
687 /* Private variables ---------------------------------------------------------*/
\r
688 /* Private constants ---------------------------------------------------------*/
\r
689 /** @defgroup RTC_Private_Constants RTC Private Constants
\r
692 /* Masks Definition */
\r
693 #define RTC_TR_RESERVED_MASK ((uint32_t)0x007F7F7F)
\r
694 #define RTC_DR_RESERVED_MASK ((uint32_t)0x00FFFF3F)
\r
695 #define RTC_INIT_MASK ((uint32_t)0xFFFFFFFF)
\r
696 #define RTC_RSF_MASK ((uint32_t)0xFFFFFF5F)
\r
698 #define RTC_TIMEOUT_VALUE 1000
\r
700 #define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)0x00020000) /*!< External interrupt line 17 Connected to the RTC Alarm event */
\r
705 /* Private macros ------------------------------------------------------------*/
\r
706 /** @defgroup RTC_Private_Macros RTC Private Macros
\r
710 /** @defgroup RTC_IS_RTC_Definitions RTC Private macros to check input parameters
\r
713 #define IS_RTC_HOUR_FORMAT(__FORMAT__) (((__FORMAT__) == RTC_HOURFORMAT_12) || \
\r
714 ((__FORMAT__) == RTC_HOURFORMAT_24))
\r
715 #define IS_RTC_OUTPUT_POL(__POL__) (((__POL__) == RTC_OUTPUT_POLARITY_HIGH) || \
\r
716 ((__POL__) == RTC_OUTPUT_POLARITY_LOW))
\r
717 #define IS_RTC_OUTPUT_TYPE(__TYPE__) (((__TYPE__) == RTC_OUTPUT_TYPE_OPENDRAIN) || \
\r
718 ((__TYPE__) == RTC_OUTPUT_TYPE_PUSHPULL))
\r
719 #define IS_RTC_ASYNCH_PREDIV(__PREDIV__) ((__PREDIV__) <= (uint32_t)0x7F)
\r
720 #define IS_RTC_SYNCH_PREDIV(__PREDIV__) ((__PREDIV__) <= (uint32_t)0x7FFF)
\r
721 #define IS_RTC_HOUR12(__HOUR__) (((__HOUR__) > (uint32_t)0) && ((__HOUR__) <= (uint32_t)12))
\r
722 #define IS_RTC_HOUR24(__HOUR__) ((__HOUR__) <= (uint32_t)23)
\r
723 #define IS_RTC_MINUTES(__MINUTES__) ((__MINUTES__) <= (uint32_t)59)
\r
724 #define IS_RTC_SECONDS(__SECONDS__) ((__SECONDS__) <= (uint32_t)59)
\r
725 #define IS_RTC_HOURFORMAT12(__PM__) (((__PM__) == RTC_HOURFORMAT12_AM) || ((__PM__) == RTC_HOURFORMAT12_PM))
\r
726 #define IS_RTC_DAYLIGHT_SAVING(__SAVE__) (((__SAVE__) == RTC_DAYLIGHTSAVING_SUB1H) || \
\r
727 ((__SAVE__) == RTC_DAYLIGHTSAVING_ADD1H) || \
\r
728 ((__SAVE__) == RTC_DAYLIGHTSAVING_NONE))
\r
729 #define IS_RTC_STORE_OPERATION(__OPERATION__) (((__OPERATION__) == RTC_STOREOPERATION_RESET) || \
\r
730 ((__OPERATION__) == RTC_STOREOPERATION_SET))
\r
731 #define IS_RTC_FORMAT(__FORMAT__) (((__FORMAT__) == RTC_FORMAT_BIN) || ((__FORMAT__) == RTC_FORMAT_BCD))
\r
732 #define IS_RTC_YEAR(__YEAR__) ((__YEAR__) <= (uint32_t)99)
\r
733 #define IS_RTC_MONTH(__MONTH__) (((__MONTH__) >= (uint32_t)1) && ((__MONTH__) <= (uint32_t)12))
\r
734 #define IS_RTC_DATE(__DATE__) (((__DATE__) >= (uint32_t)1) && ((__DATE__) <= (uint32_t)31))
\r
735 #define IS_RTC_WEEKDAY(__WEEKDAY__) (((__WEEKDAY__) == RTC_WEEKDAY_MONDAY) || \
\r
736 ((__WEEKDAY__) == RTC_WEEKDAY_TUESDAY) || \
\r
737 ((__WEEKDAY__) == RTC_WEEKDAY_WEDNESDAY) || \
\r
738 ((__WEEKDAY__) == RTC_WEEKDAY_THURSDAY) || \
\r
739 ((__WEEKDAY__) == RTC_WEEKDAY_FRIDAY) || \
\r
740 ((__WEEKDAY__) == RTC_WEEKDAY_SATURDAY) || \
\r
741 ((__WEEKDAY__) == RTC_WEEKDAY_SUNDAY))
\r
743 #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(__DATE__) (((__DATE__) >(uint32_t) 0) && ((__DATE__) <= (uint32_t)31))
\r
744 #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(__WEEKDAY__) (((__WEEKDAY__) == RTC_WEEKDAY_MONDAY) || \
\r
745 ((__WEEKDAY__) == RTC_WEEKDAY_TUESDAY) || \
\r
746 ((__WEEKDAY__) == RTC_WEEKDAY_WEDNESDAY) || \
\r
747 ((__WEEKDAY__) == RTC_WEEKDAY_THURSDAY) || \
\r
748 ((__WEEKDAY__) == RTC_WEEKDAY_FRIDAY) || \
\r
749 ((__WEEKDAY__) == RTC_WEEKDAY_SATURDAY) || \
\r
750 ((__WEEKDAY__) == RTC_WEEKDAY_SUNDAY))
\r
751 #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(__SEL__) (((__SEL__) == RTC_ALARMDATEWEEKDAYSEL_DATE) || \
\r
752 ((__SEL__) == RTC_ALARMDATEWEEKDAYSEL_WEEKDAY))
\r
753 #define IS_RTC_ALARM_MASK(__MASK__) (((__MASK__) & 0x7F7F7F7F) == (uint32_t)RESET)
\r
754 #define IS_RTC_ALARM(__ALARM__) (((__ALARM__) == RTC_ALARM_A) || ((__ALARM__) == RTC_ALARM_B))
\r
755 #define IS_RTC_ALARM_SUB_SECOND_VALUE(__VALUE__) ((__VALUE__) <= (uint32_t)0x00007FFF)
\r
756 #define IS_RTC_ALARM_SUB_SECOND_MASK(__MASK__) (((__MASK__) == RTC_ALARMSUBSECONDMASK_ALL) || \
\r
757 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_1) || \
\r
758 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_2) || \
\r
759 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_3) || \
\r
760 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_4) || \
\r
761 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_5) || \
\r
762 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_6) || \
\r
763 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_7) || \
\r
764 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_8) || \
\r
765 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_9) || \
\r
766 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_10) || \
\r
767 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_11) || \
\r
768 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_12) || \
\r
769 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_13) || \
\r
770 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14) || \
\r
771 ((__MASK__) == RTC_ALARMSUBSECONDMASK_NONE))
\r
781 /* Private functions ---------------------------------------------------------*/
\r
782 /** @defgroup RTC_Private_Functions RTC Private Functions
\r
785 HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef* hrtc);
\r
786 uint8_t RTC_ByteToBcd2(uint8_t Value);
\r
787 uint8_t RTC_Bcd2ToByte(uint8_t Value);
\r
804 #endif /* __STM32F7xx_HAL_RTC_H */
\r
806 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r