Merge pull request #10592 from iNavFlight/MrD_Update-parameter-description
[inav.git] / lib / main / STM32F7 / Drivers / STM32F7xx_HAL_Driver / Inc / stm32f7xx_hal_rtc.h
blobbabfab8c0e58a87761a8bb80a6e8b9282f6ae0c0
1 /**
2 ******************************************************************************
3 * @file stm32f7xx_hal_rtc.h
4 * @author MCD Application Team
5 * @version V1.2.2
6 * @date 14-April-2017
7 * @brief Header file of RTC HAL module.
8 ******************************************************************************
9 * @attention
11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
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.
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.
35 ******************************************************************************
36 */
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F7xx_HAL_RTC_H
40 #define __STM32F7xx_HAL_RTC_H
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f7xx_hal_def.h"
49 /** @addtogroup STM32F7xx_HAL_Driver
50 * @{
53 /** @addtogroup RTC
54 * @{
55 */
57 /* Exported types ------------------------------------------------------------*/
58 /** @defgroup RTC_Exported_Types RTC Exported Types
59 * @{
62 /**
63 * @brief HAL State structures definition
64 */
65 typedef enum
67 HAL_RTC_STATE_RESET = 0x00U, /*!< RTC not yet initialized or disabled */
68 HAL_RTC_STATE_READY = 0x01U, /*!< RTC initialized and ready for use */
69 HAL_RTC_STATE_BUSY = 0x02U, /*!< RTC process is ongoing */
70 HAL_RTC_STATE_TIMEOUT = 0x03U, /*!< RTC timeout state */
71 HAL_RTC_STATE_ERROR = 0x04U /*!< RTC error state */
73 }HAL_RTCStateTypeDef;
75 /**
76 * @brief RTC Configuration Structure definition
78 typedef struct
80 uint32_t HourFormat; /*!< Specifies the RTC Hour Format.
81 This parameter can be a value of @ref RTC_Hour_Formats */
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 */
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 */
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 */
92 uint32_t OutPutPolarity; /*!< Specifies the polarity of the output signal.
93 This parameter can be a value of @ref RTC_Output_Polarity_Definitions */
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;
99 /**
100 * @brief RTC Time structure definition
102 typedef struct
104 uint8_t Hours; /*!< Specifies the RTC Time Hour.
105 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the RTC_HourFormat_12 is selected.
106 This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the RTC_HourFormat_24 is selected */
108 uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
109 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
111 uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
112 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
114 uint32_t SubSeconds; /*!< Specifies the RTC_SSR RTC Sub Second register content.
115 This parameter corresponds to a time unit range between [0-1] Second
116 with [1 Sec / SecondFraction +1] granularity */
118 uint32_t SecondFraction; /*!< Specifies the range or granularity of Sub Second register content
119 corresponding to Synchronous pre-scaler factor value (PREDIV_S)
120 This parameter corresponds to a time unit range between [0-1] Second
121 with [1 Sec / SecondFraction +1] granularity.
122 This field will be used only by HAL_RTC_GetTime function */
124 uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
125 This parameter can be a value of @ref RTC_AM_PM_Definitions */
127 uint32_t DayLightSaving; /*!< Specifies RTC_DayLightSaveOperation: the value of hour adjustment.
128 This parameter can be a value of @ref RTC_DayLightSaving_Definitions */
130 uint32_t StoreOperation; /*!< Specifies RTC_StoreOperation value to be written in the BCK bit
131 in CR register to store the operation.
132 This parameter can be a value of @ref RTC_StoreOperation_Definitions */
133 }RTC_TimeTypeDef;
135 /**
136 * @brief RTC Date structure definition
138 typedef struct
140 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
141 This parameter can be a value of @ref RTC_WeekDay_Definitions */
143 uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format).
144 This parameter can be a value of @ref RTC_Month_Date_Definitions */
146 uint8_t Date; /*!< Specifies the RTC Date.
147 This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
149 uint8_t Year; /*!< Specifies the RTC Date Year.
150 This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
152 }RTC_DateTypeDef;
154 /**
155 * @brief RTC Alarm structure definition
157 typedef struct
159 RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */
161 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks.
162 This parameter can be a value of @ref RTC_AlarmMask_Definitions */
164 uint32_t AlarmSubSecondMask; /*!< Specifies the RTC Alarm SubSeconds Masks.
165 This parameter can be a value of @ref RTC_Alarm_Sub_Seconds_Masks_Definitions */
167 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay.
168 This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */
170 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay.
171 If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range.
172 If the Alarm WeekDay is selected, this parameter can be a value of @ref RTC_WeekDay_Definitions */
174 uint32_t Alarm; /*!< Specifies the alarm .
175 This parameter can be a value of @ref RTC_Alarms_Definitions */
176 }RTC_AlarmTypeDef;
178 /**
179 * @brief RTC Handle Structure definition
181 typedef struct
183 RTC_TypeDef *Instance; /*!< Register base address */
185 RTC_InitTypeDef Init; /*!< RTC required parameters */
187 HAL_LockTypeDef Lock; /*!< RTC locking object */
189 __IO HAL_RTCStateTypeDef State; /*!< Time communication state */
191 }RTC_HandleTypeDef;
194 * @}
197 /* Exported constants --------------------------------------------------------*/
198 /** @defgroup RTC_Exported_Constants RTC Exported Constants
199 * @{
202 /** @defgroup RTC_Hour_Formats RTC Hour Formats
203 * @{
205 #define RTC_HOURFORMAT_24 0x00000000U
206 #define RTC_HOURFORMAT_12 0x00000040U
208 * @}
212 /** @defgroup RTC_Output_Polarity_Definitions RTC Output Polarity Definitions
213 * @{
215 #define RTC_OUTPUT_POLARITY_HIGH 0x00000000U
216 #define RTC_OUTPUT_POLARITY_LOW 0x00100000U
218 * @}
221 /** @defgroup RTC_Output_Type_ALARM_OUT RTC Output Type ALARM OUT
222 * @{
224 #define RTC_OUTPUT_TYPE_OPENDRAIN 0x00000000U
225 #define RTC_OUTPUT_TYPE_PUSHPULL RTC_OR_ALARMTYPE /* 0x00000008 */
227 * @}
230 /** @defgroup RTC_AM_PM_Definitions RTC AM PM Definitions
231 * @{
233 #define RTC_HOURFORMAT12_AM ((uint8_t)0x00U)
234 #define RTC_HOURFORMAT12_PM ((uint8_t)0x40U)
236 * @}
239 /** @defgroup RTC_DayLightSaving_Definitions RTC DayLight Saving Definitions
240 * @{
242 #define RTC_DAYLIGHTSAVING_SUB1H 0x00020000U
243 #define RTC_DAYLIGHTSAVING_ADD1H 0x00010000U
244 #define RTC_DAYLIGHTSAVING_NONE 0x00000000U
246 * @}
249 /** @defgroup RTC_StoreOperation_Definitions RTC Store Operation Definitions
250 * @{
252 #define RTC_STOREOPERATION_RESET 0x00000000U
253 #define RTC_STOREOPERATION_SET 0x00040000U
255 * @}
258 /** @defgroup RTC_Input_parameter_format_definitions RTC Input Parameter Format Definitions
259 * @{
261 #define RTC_FORMAT_BIN 0x00000000U
262 #define RTC_FORMAT_BCD 0x00000001U
264 * @}
267 /** @defgroup RTC_Month_Date_Definitions RTC Month Date Definitions
268 * @{
270 /* Coded in BCD format */
271 #define RTC_MONTH_JANUARY ((uint8_t)0x01U)
272 #define RTC_MONTH_FEBRUARY ((uint8_t)0x02U)
273 #define RTC_MONTH_MARCH ((uint8_t)0x03U)
274 #define RTC_MONTH_APRIL ((uint8_t)0x04U)
275 #define RTC_MONTH_MAY ((uint8_t)0x05U)
276 #define RTC_MONTH_JUNE ((uint8_t)0x06U)
277 #define RTC_MONTH_JULY ((uint8_t)0x07U)
278 #define RTC_MONTH_AUGUST ((uint8_t)0x08U)
279 #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09U)
280 #define RTC_MONTH_OCTOBER ((uint8_t)0x10U)
281 #define RTC_MONTH_NOVEMBER ((uint8_t)0x11U)
282 #define RTC_MONTH_DECEMBER ((uint8_t)0x12U)
284 * @}
287 /** @defgroup RTC_WeekDay_Definitions RTC WeekDay Definitions
288 * @{
290 #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01U)
291 #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02U)
292 #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03U)
293 #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04U)
294 #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05U)
295 #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06U)
296 #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07U)
298 * @}
301 /** @defgroup RTC_AlarmDateWeekDay_Definitions RTC Alarm Date WeekDay Definitions
302 * @{
304 #define RTC_ALARMDATEWEEKDAYSEL_DATE 0x00000000U
305 #define RTC_ALARMDATEWEEKDAYSEL_WEEKDAY 0x40000000U
307 * @}
310 /** @defgroup RTC_AlarmMask_Definitions RTC Alarm Mask Definitions
311 * @{
313 #define RTC_ALARMMASK_NONE 0x00000000U
314 #define RTC_ALARMMASK_DATEWEEKDAY RTC_ALRMAR_MSK4
315 #define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3
316 #define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2
317 #define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1
318 #define RTC_ALARMMASK_ALL 0x80808080U
320 * @}
323 /** @defgroup RTC_Alarms_Definitions RTC Alarms Definitions
324 * @{
326 #define RTC_ALARM_A RTC_CR_ALRAE
327 #define RTC_ALARM_B RTC_CR_ALRBE
329 * @}
332 /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions RTC Alarm Sub Seconds Masks Definitions
333 * @{
335 #define RTC_ALARMSUBSECONDMASK_ALL 0x00000000U /*!< All Alarm SS fields are masked.
336 There is no comparison on sub seconds
337 for Alarm */
338 #define RTC_ALARMSUBSECONDMASK_SS14_1 0x01000000U /*!< SS[14:1] are don't care in Alarm
339 comparison. Only SS[0] is compared. */
340 #define RTC_ALARMSUBSECONDMASK_SS14_2 0x02000000U /*!< SS[14:2] are don't care in Alarm
341 comparison. Only SS[1:0] are compared */
342 #define RTC_ALARMSUBSECONDMASK_SS14_3 0x03000000U /*!< SS[14:3] are don't care in Alarm
343 comparison. Only SS[2:0] are compared */
344 #define RTC_ALARMSUBSECONDMASK_SS14_4 0x04000000U /*!< SS[14:4] are don't care in Alarm
345 comparison. Only SS[3:0] are compared */
346 #define RTC_ALARMSUBSECONDMASK_SS14_5 0x05000000U /*!< SS[14:5] are don't care in Alarm
347 comparison. Only SS[4:0] are compared */
348 #define RTC_ALARMSUBSECONDMASK_SS14_6 0x06000000U /*!< SS[14:6] are don't care in Alarm
349 comparison. Only SS[5:0] are compared */
350 #define RTC_ALARMSUBSECONDMASK_SS14_7 0x07000000U /*!< SS[14:7] are don't care in Alarm
351 comparison. Only SS[6:0] are compared */
352 #define RTC_ALARMSUBSECONDMASK_SS14_8 0x08000000U /*!< SS[14:8] are don't care in Alarm
353 comparison. Only SS[7:0] are compared */
354 #define RTC_ALARMSUBSECONDMASK_SS14_9 0x09000000U /*!< SS[14:9] are don't care in Alarm
355 comparison. Only SS[8:0] are compared */
356 #define RTC_ALARMSUBSECONDMASK_SS14_10 0x0A000000U /*!< SS[14:10] are don't care in Alarm
357 comparison. Only SS[9:0] are compared */
358 #define RTC_ALARMSUBSECONDMASK_SS14_11 0x0B000000U /*!< SS[14:11] are don't care in Alarm
359 comparison. Only SS[10:0] are compared */
360 #define RTC_ALARMSUBSECONDMASK_SS14_12 0x0C000000U /*!< SS[14:12] are don't care in Alarm
361 comparison.Only SS[11:0] are compared */
362 #define RTC_ALARMSUBSECONDMASK_SS14_13 0x0D000000U /*!< SS[14:13] are don't care in Alarm
363 comparison. Only SS[12:0] are compared */
364 #define RTC_ALARMSUBSECONDMASK_SS14 0x0E000000U /*!< SS[14] is don't care in Alarm
365 comparison.Only SS[13:0] are compared */
366 #define RTC_ALARMSUBSECONDMASK_NONE 0x0F000000U /*!< SS[14:0] are compared and must match
367 to activate alarm. */
369 * @}
372 /** @defgroup RTC_Interrupts_Definitions RTC Interrupts Definitions
373 * @{
375 #define RTC_IT_TS RTC_CR_TSIE
376 #define RTC_IT_WUT RTC_CR_WUTIE
377 #define RTC_IT_ALRA RTC_CR_ALRAIE
378 #define RTC_IT_ALRB RTC_CR_ALRBIE
379 #define RTC_IT_TAMP RTC_TAMPCR_TAMPIE /* Used only to Enable the Tamper Interrupt */
380 #define RTC_IT_TAMP1 RTC_TAMPCR_TAMP1IE
381 #define RTC_IT_TAMP2 RTC_TAMPCR_TAMP2IE
382 #define RTC_IT_TAMP3 RTC_TAMPCR_TAMP3IE
384 * @}
387 /** @defgroup RTC_Flags_Definitions RTC Flags Definitions
388 * @{
390 #define RTC_FLAG_RECALPF RTC_ISR_RECALPF
391 #define RTC_FLAG_TAMP3F RTC_ISR_TAMP3F
392 #define RTC_FLAG_TAMP2F RTC_ISR_TAMP2F
393 #define RTC_FLAG_TAMP1F RTC_ISR_TAMP1F
394 #define RTC_FLAG_TSOVF RTC_ISR_TSOVF
395 #define RTC_FLAG_TSF RTC_ISR_TSF
396 #define RTC_FLAG_ITSF RTC_ISR_ITSF
397 #define RTC_FLAG_WUTF RTC_ISR_WUTF
398 #define RTC_FLAG_ALRBF RTC_ISR_ALRBF
399 #define RTC_FLAG_ALRAF RTC_ISR_ALRAF
400 #define RTC_FLAG_INITF RTC_ISR_INITF
401 #define RTC_FLAG_RSF RTC_ISR_RSF
402 #define RTC_FLAG_INITS RTC_ISR_INITS
403 #define RTC_FLAG_SHPF RTC_ISR_SHPF
404 #define RTC_FLAG_WUTWF RTC_ISR_WUTWF
405 #define RTC_FLAG_ALRBWF RTC_ISR_ALRBWF
406 #define RTC_FLAG_ALRAWF RTC_ISR_ALRAWF
408 * @}
412 * @}
415 /* Exported macro ------------------------------------------------------------*/
416 /** @defgroup RTC_Exported_Macros RTC Exported Macros
417 * @{
420 /** @brief Reset RTC handle state
421 * @param __HANDLE__: specifies the RTC handle.
422 * @retval None
424 #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
427 * @brief Disable the write protection for RTC registers.
428 * @param __HANDLE__: specifies the RTC handle.
429 * @retval None
431 #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) \
432 do{ \
433 (__HANDLE__)->Instance->WPR = 0xCAU; \
434 (__HANDLE__)->Instance->WPR = 0x53U; \
435 } while(0U)
438 * @brief Enable the write protection for RTC registers.
439 * @param __HANDLE__: specifies the RTC handle.
440 * @retval None
442 #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) \
443 do{ \
444 (__HANDLE__)->Instance->WPR = 0xFFU; \
445 } while(0U)
448 * @brief Enable the RTC ALARMA peripheral.
449 * @param __HANDLE__: specifies the RTC handle.
450 * @retval None
452 #define __HAL_RTC_ALARMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRAE))
455 * @brief Disable the RTC ALARMA peripheral.
456 * @param __HANDLE__: specifies the RTC handle.
457 * @retval None
459 #define __HAL_RTC_ALARMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRAE))
462 * @brief Enable the RTC ALARMB peripheral.
463 * @param __HANDLE__: specifies the RTC handle.
464 * @retval None
466 #define __HAL_RTC_ALARMB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRBE))
469 * @brief Disable the RTC ALARMB peripheral.
470 * @param __HANDLE__: specifies the RTC handle.
471 * @retval None
473 #define __HAL_RTC_ALARMB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRBE))
476 * @brief Enable the RTC Alarm interrupt.
477 * @param __HANDLE__: specifies the RTC handle.
478 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
479 * This parameter can be any combination of the following values:
480 * @arg RTC_IT_ALRA: Alarm A interrupt
481 * @arg RTC_IT_ALRB: Alarm B interrupt
482 * @retval None
484 #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
487 * @brief Disable the RTC Alarm interrupt.
488 * @param __HANDLE__: specifies the RTC handle.
489 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
490 * This parameter can be any combination of the following values:
491 * @arg RTC_IT_ALRA: Alarm A interrupt
492 * @arg RTC_IT_ALRB: Alarm B interrupt
493 * @retval None
495 #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
498 * @brief Check whether the specified RTC Alarm interrupt has occurred or not.
499 * @param __HANDLE__: specifies the RTC handle.
500 * @param __INTERRUPT__: specifies the RTC Alarm interrupt to check.
501 * This parameter can be:
502 * @arg RTC_IT_ALRA: Alarm A interrupt
503 * @arg RTC_IT_ALRB: Alarm B interrupt
504 * @retval None
506 #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) ((((((__HANDLE__)->Instance->ISR)& ((__INTERRUPT__)>> 4U)) & 0x0000FFFFU) != RESET)? SET : RESET)
509 * @brief Get the selected RTC Alarm's flag status.
510 * @param __HANDLE__: specifies the RTC handle.
511 * @param __FLAG__: specifies the RTC Alarm Flag to check.
512 * This parameter can be:
513 * @arg RTC_FLAG_ALRAF
514 * @arg RTC_FLAG_ALRBF
515 * @arg RTC_FLAG_ALRAWF
516 * @arg RTC_FLAG_ALRBWF
517 * @retval None
519 #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
522 * @brief Clear the RTC Alarm's pending flags.
523 * @param __HANDLE__: specifies the RTC handle.
524 * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
525 * This parameter can be:
526 * @arg RTC_FLAG_ALRAF
527 * @arg RTC_FLAG_ALRBF
528 * @retval None
530 #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFFU)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
533 * @brief Check whether the specified RTC Alarm interrupt has been enabled or not.
534 * @param __HANDLE__: specifies the RTC handle.
535 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check.
536 * This parameter can be:
537 * @arg RTC_IT_ALRA: Alarm A interrupt
538 * @arg RTC_IT_ALRB: Alarm B interrupt
539 * @retval None
541 #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
544 * @brief Enable interrupt on the RTC Alarm associated Exti line.
545 * @retval None
547 #define __HAL_RTC_ALARM_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_ALARM_EVENT)
550 * @brief Disable interrupt on the RTC Alarm associated Exti line.
551 * @retval None
553 #define __HAL_RTC_ALARM_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
556 * @brief Enable event on the RTC Alarm associated Exti line.
557 * @retval None.
559 #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_ALARM_EVENT)
562 * @brief Disable event on the RTC Alarm associated Exti line.
563 * @retval None.
565 #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
568 * @brief Enable falling edge trigger on the RTC Alarm associated Exti line.
569 * @retval None.
571 #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_ALARM_EVENT)
574 * @brief Disable falling edge trigger on the RTC Alarm associated Exti line.
575 * @retval None.
577 #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
580 * @brief Enable rising edge trigger on the RTC Alarm associated Exti line.
581 * @retval None.
583 #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_ALARM_EVENT)
586 * @brief Disable rising edge trigger on the RTC Alarm associated Exti line.
587 * @retval None.
589 #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_ALARM_EVENT))
592 * @brief Enable rising & falling edge trigger on the RTC Alarm associated Exti line.
593 * @retval None.
595 #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE();
598 * @brief Disable rising & falling edge trigger on the RTC Alarm associated Exti line.
599 * @retval None.
601 #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE();
604 * @brief Check whether the RTC Alarm associated Exti line interrupt flag is set or not.
605 * @retval Line Status.
607 #define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_ALARM_EVENT)
610 * @brief Clear the RTC Alarm associated Exti line flag.
611 * @retval None.
613 #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_ALARM_EVENT)
616 * @brief Generate a Software interrupt on RTC Alarm associated Exti line.
617 * @retval None.
619 #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_ALARM_EVENT)
621 * @}
624 /* Include RTC HAL Extension module */
625 #include "stm32f7xx_hal_rtc_ex.h"
627 /* Exported functions --------------------------------------------------------*/
628 /** @addtogroup RTC_Exported_Functions
629 * @{
632 /** @addtogroup RTC_Exported_Functions_Group1
633 * @{
635 /* Initialization and de-initialization functions ****************************/
636 HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
637 HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
638 void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
639 void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
641 * @}
644 /** @addtogroup RTC_Exported_Functions_Group2
645 * @{
647 /* RTC Time and Date functions ************************************************/
648 HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
649 HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
650 HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
651 HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
653 * @}
656 /** @addtogroup RTC_Exported_Functions_Group3
657 * @{
659 /* RTC Alarm functions ********************************************************/
660 HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
661 HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
662 HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
663 HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
664 void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
665 HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
666 void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
668 * @}
671 /** @addtogroup RTC_Exported_Functions_Group4
672 * @{
674 /* Peripheral Control functions ***********************************************/
675 HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc);
677 * @}
680 /** @addtogroup RTC_Exported_Functions_Group5
681 * @{
683 /* Peripheral State functions *************************************************/
684 HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
686 * @}
690 * @}
693 /* Private types -------------------------------------------------------------*/
694 /* Private variables ---------------------------------------------------------*/
695 /* Private constants ---------------------------------------------------------*/
696 /** @defgroup RTC_Private_Constants RTC Private Constants
697 * @{
699 /* Masks Definition */
700 #define RTC_TR_RESERVED_MASK 0x007F7F7FU
701 #define RTC_DR_RESERVED_MASK 0x00FFFF3FU
702 #define RTC_INIT_MASK 0xFFFFFFFFU
703 #define RTC_RSF_MASK 0xFFFFFF5FU
705 #define RTC_TIMEOUT_VALUE 1000U
707 #define RTC_EXTI_LINE_ALARM_EVENT EXTI_IMR_IM17 /*!< External interrupt line 17 Connected to the RTC Alarm event */
709 * @}
712 /* Private macros ------------------------------------------------------------*/
713 /** @defgroup RTC_Private_Macros RTC Private Macros
714 * @{
717 /** @defgroup RTC_IS_RTC_Definitions RTC Private macros to check input parameters
718 * @{
720 #define IS_RTC_HOUR_FORMAT(__FORMAT__) (((__FORMAT__) == RTC_HOURFORMAT_12) || \
721 ((__FORMAT__) == RTC_HOURFORMAT_24))
722 #define IS_RTC_OUTPUT_POL(__POL__) (((__POL__) == RTC_OUTPUT_POLARITY_HIGH) || \
723 ((__POL__) == RTC_OUTPUT_POLARITY_LOW))
724 #define IS_RTC_OUTPUT_TYPE(__TYPE__) (((__TYPE__) == RTC_OUTPUT_TYPE_OPENDRAIN) || \
725 ((__TYPE__) == RTC_OUTPUT_TYPE_PUSHPULL))
726 #define IS_RTC_ASYNCH_PREDIV(__PREDIV__) ((__PREDIV__) <= 0x7FU)
727 #define IS_RTC_SYNCH_PREDIV(__PREDIV__) ((__PREDIV__) <= 0x7FFFU)
728 #define IS_RTC_HOUR12(__HOUR__) (((__HOUR__) > 0U) && ((__HOUR__) <= 12U))
729 #define IS_RTC_HOUR24(__HOUR__) ((__HOUR__) <= 23U)
730 #define IS_RTC_MINUTES(__MINUTES__) ((__MINUTES__) <= 59U)
731 #define IS_RTC_SECONDS(__SECONDS__) ((__SECONDS__) <= 59U)
732 #define IS_RTC_HOURFORMAT12(__PM__) (((__PM__) == RTC_HOURFORMAT12_AM) || ((__PM__) == RTC_HOURFORMAT12_PM))
733 #define IS_RTC_DAYLIGHT_SAVING(__SAVE__) (((__SAVE__) == RTC_DAYLIGHTSAVING_SUB1H) || \
734 ((__SAVE__) == RTC_DAYLIGHTSAVING_ADD1H) || \
735 ((__SAVE__) == RTC_DAYLIGHTSAVING_NONE))
736 #define IS_RTC_STORE_OPERATION(__OPERATION__) (((__OPERATION__) == RTC_STOREOPERATION_RESET) || \
737 ((__OPERATION__) == RTC_STOREOPERATION_SET))
738 #define IS_RTC_FORMAT(__FORMAT__) (((__FORMAT__) == RTC_FORMAT_BIN) || ((__FORMAT__) == RTC_FORMAT_BCD))
739 #define IS_RTC_YEAR(__YEAR__) ((__YEAR__) <= 99U)
740 #define IS_RTC_MONTH(__MONTH__) (((__MONTH__) >= 1U) && ((__MONTH__) <= 12U))
741 #define IS_RTC_DATE(__DATE__) (((__DATE__) >= 1U) && ((__DATE__) <= 31U))
742 #define IS_RTC_WEEKDAY(__WEEKDAY__) (((__WEEKDAY__) == RTC_WEEKDAY_MONDAY) || \
743 ((__WEEKDAY__) == RTC_WEEKDAY_TUESDAY) || \
744 ((__WEEKDAY__) == RTC_WEEKDAY_WEDNESDAY) || \
745 ((__WEEKDAY__) == RTC_WEEKDAY_THURSDAY) || \
746 ((__WEEKDAY__) == RTC_WEEKDAY_FRIDAY) || \
747 ((__WEEKDAY__) == RTC_WEEKDAY_SATURDAY) || \
748 ((__WEEKDAY__) == RTC_WEEKDAY_SUNDAY))
750 #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(__DATE__) (((__DATE__) >0U) && ((__DATE__) <= 31U))
751 #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(__WEEKDAY__) (((__WEEKDAY__) == RTC_WEEKDAY_MONDAY) || \
752 ((__WEEKDAY__) == RTC_WEEKDAY_TUESDAY) || \
753 ((__WEEKDAY__) == RTC_WEEKDAY_WEDNESDAY) || \
754 ((__WEEKDAY__) == RTC_WEEKDAY_THURSDAY) || \
755 ((__WEEKDAY__) == RTC_WEEKDAY_FRIDAY) || \
756 ((__WEEKDAY__) == RTC_WEEKDAY_SATURDAY) || \
757 ((__WEEKDAY__) == RTC_WEEKDAY_SUNDAY))
758 #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(__SEL__) (((__SEL__) == RTC_ALARMDATEWEEKDAYSEL_DATE) || \
759 ((__SEL__) == RTC_ALARMDATEWEEKDAYSEL_WEEKDAY))
760 #define IS_RTC_ALARM_MASK(__MASK__) (((__MASK__) & 0x7F7F7F7FU) == (uint32_t)RESET)
761 #define IS_RTC_ALARM(__ALARM__) (((__ALARM__) == RTC_ALARM_A) || ((__ALARM__) == RTC_ALARM_B))
762 #define IS_RTC_ALARM_SUB_SECOND_VALUE(__VALUE__) ((__VALUE__) <= 0x00007FFFU)
763 #define IS_RTC_ALARM_SUB_SECOND_MASK(__MASK__) (((__MASK__) == RTC_ALARMSUBSECONDMASK_ALL) || \
764 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_1) || \
765 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_2) || \
766 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_3) || \
767 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_4) || \
768 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_5) || \
769 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_6) || \
770 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_7) || \
771 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_8) || \
772 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_9) || \
773 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_10) || \
774 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_11) || \
775 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_12) || \
776 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14_13) || \
777 ((__MASK__) == RTC_ALARMSUBSECONDMASK_SS14) || \
778 ((__MASK__) == RTC_ALARMSUBSECONDMASK_NONE))
781 * @}
785 * @}
788 /* Private functions ---------------------------------------------------------*/
789 /** @defgroup RTC_Private_Functions RTC Private Functions
790 * @{
792 HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef* hrtc);
793 uint8_t RTC_ByteToBcd2(uint8_t Value);
794 uint8_t RTC_Bcd2ToByte(uint8_t Value);
796 * @}
800 * @}
804 * @}
807 #ifdef __cplusplus
809 #endif
811 #endif /* __STM32F7xx_HAL_RTC_H */
813 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/