|
STM32G474xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32g4xx_hal_rtc.h 00004 * @author MCD Application Team 00005 * @brief Header file of RTC HAL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * Copyright (c) 2019 STMicroelectronics. 00010 * All rights reserved. 00011 * 00012 * This software is licensed under terms that can be found in the LICENSE file 00013 * in the root directory of this software component. 00014 * If no LICENSE file comes with this software, it is provided AS-IS. 00015 * 00016 ****************************************************************************** 00017 */ 00018 00019 /* Define to prevent recursive inclusion -------------------------------------*/ 00020 #ifndef STM32G4xx_HAL_RTC_H 00021 #define STM32G4xx_HAL_RTC_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32g4xx_hal_def.h" 00029 00030 /** @addtogroup STM32G4xx_HAL_Driver 00031 * @{ 00032 */ 00033 00034 /** @defgroup RTC RTC 00035 * @{ 00036 */ 00037 00038 /* Exported types ------------------------------------------------------------*/ 00039 /** @defgroup RTC_Exported_Types RTC Exported Types 00040 * @{ 00041 */ 00042 00043 /** 00044 * @brief HAL State structures definition 00045 */ 00046 typedef enum 00047 { 00048 HAL_RTC_STATE_RESET = 0x00U, /*!< RTC not yet initialized or disabled */ 00049 HAL_RTC_STATE_READY = 0x01U, /*!< RTC initialized and ready for use */ 00050 HAL_RTC_STATE_BUSY = 0x02U, /*!< RTC process is ongoing */ 00051 HAL_RTC_STATE_TIMEOUT = 0x03U, /*!< RTC timeout state */ 00052 HAL_RTC_STATE_ERROR = 0x04U /*!< RTC error state */ 00053 00054 } HAL_RTCStateTypeDef; 00055 00056 /** 00057 * @brief RTC Configuration Structure definition 00058 */ 00059 typedef struct 00060 { 00061 uint32_t HourFormat; /*!< Specifies the RTC Hour Format. 00062 This parameter can be a value of @ref RTC_Hour_Formats */ 00063 00064 uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value. 00065 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F */ 00066 00067 uint32_t SynchPrediv; /*!< Specifies the RTC Synchronous Predivider value. 00068 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF */ 00069 00070 uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC output. 00071 This parameter can be a value of @ref RTCEx_Output_selection_Definitions */ 00072 00073 uint32_t OutPutRemap; /*!< Specifies the remap for RTC output. 00074 This parameter can be a value of @ref RTC_Output_ALARM_OUT_Remap */ 00075 00076 uint32_t OutPutPolarity; /*!< Specifies the polarity of the output signal. 00077 This parameter can be a value of @ref RTC_Output_Polarity_Definitions */ 00078 00079 uint32_t OutPutType; /*!< Specifies the RTC Output Pin mode. 00080 This parameter can be a value of @ref RTC_Output_Type_ALARM_OUT */ 00081 00082 uint32_t OutPutPullUp; /*!< Specifies the RTC Output Pull-Up mode. 00083 This parameter can be a value of @ref RTC_Output_PullUp_ALARM_OUT */ 00084 } RTC_InitTypeDef; 00085 00086 /** 00087 * @brief RTC Time structure definition 00088 */ 00089 typedef struct 00090 { 00091 uint8_t Hours; /*!< Specifies the RTC Time Hour. 00092 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the RTC_HourFormat_12 is selected. 00093 This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the RTC_HourFormat_24 is selected */ 00094 00095 uint8_t Minutes; /*!< Specifies the RTC Time Minutes. 00096 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */ 00097 00098 uint8_t Seconds; /*!< Specifies the RTC Time Seconds. 00099 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */ 00100 00101 uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time. 00102 This parameter can be a value of @ref RTC_AM_PM_Definitions */ 00103 00104 uint32_t SubSeconds; /*!< Specifies the RTC_SSR RTC Sub Second register content. 00105 This parameter corresponds to a time unit range between [0-1] Second 00106 with [1 Sec / SecondFraction +1] granularity */ 00107 00108 uint32_t SecondFraction; /*!< Specifies the range or granularity of Sub Second register content 00109 corresponding to Synchronous pre-scaler factor value (PREDIV_S) 00111 This parameter corresponds to a time unit range between [0-1] Second 00113 with [1 Sec / SecondFraction +1] granularity. 00114 This field will be used only by HAL_RTC_GetTime function */ 00115 00116 uint32_t DayLightSaving; /*!< This interface is deprecated. To manage Daylight Saving Time, 00117 please use HAL_RTC_DST_xxx functions */ 00118 00119 uint32_t StoreOperation; /*!< This interface is deprecated. To manage Daylight Saving Time, 00120 please use HAL_RTC_DST_xxx functions */ 00121 } RTC_TimeTypeDef; 00122 00123 /** 00124 * @brief RTC Date structure definition 00125 */ 00126 typedef struct 00127 { 00128 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay. 00129 This parameter can be a value of @ref RTC_WeekDay_Definitions */ 00130 00131 uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format). 00132 This parameter can be a value of @ref RTC_Month_Date_Definitions */ 00134 00135 uint8_t Date; /*!< Specifies the RTC Date. 00136 This parameter must be a number between Min_Data = 1 and Max_Data = 31 */ 00137 00138 uint8_t Year; /*!< Specifies the RTC Date Year. 00139 This parameter must be a number between Min_Data = 0 and Max_Data = 99 */ 00141 } RTC_DateTypeDef; 00142 00143 /** 00144 * @brief RTC Alarm structure definition 00145 */ 00146 typedef struct 00147 { 00148 RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */ 00149 00150 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks. 00151 This parameter can be a value of @ref RTC_AlarmMask_Definitions */ 00152 00153 uint32_t AlarmSubSecondMask; /*!< Specifies the RTC Alarm SubSeconds Masks. 00154 This parameter can be a value of @ref RTC_Alarm_Sub_Seconds_Masks_Definitions */ 00155 00156 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay. 00157 This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */ 00158 00159 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay. 00161 If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range. 00162 If the Alarm WeekDay is selected, this parameter can be a value of @ref RTC_WeekDay_Definitions */ 00163 00164 uint32_t Alarm; /*!< Specifies the alarm . 00166 This parameter can be a value of @ref RTC_Alarms_Definitions */ 00167 } RTC_AlarmTypeDef; 00168 <