|
STM32G474xx HAL用户手册
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32g4xx_ll_rtc.h 00004 * @author MCD Application Team 00005 * @brief Header file of RTC LL 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_LL_RTC_H 00021 #define STM32G4xx_LL_RTC_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32g4xx.h" 00029 00030 /** @addtogroup STM32G4xx_LL_Driver 00031 * @{ 00032 */ 00033 00034 #if defined(RTC) 00035 00036 /** @defgroup RTC_LL RTC 00037 * @{ 00038 */ 00039 00040 /* Private types -------------------------------------------------------------*/ 00041 /* Private variables ---------------------------------------------------------*/ 00042 /* Private constants ---------------------------------------------------------*/ 00043 /** @defgroup RTC_LL_Private_Constants RTC Private Constants 00044 * @{ 00045 */ 00046 /* Masks Definition */ 00047 #define RTC_LL_INIT_MASK 0xFFFFFFFFU 00048 #define RTC_LL_RSF_MASK 0xFFFFFF5FU 00049 00050 /* Write protection defines */ 00051 #define RTC_WRITE_PROTECTION_DISABLE (uint8_t)0xFF 00052 #define RTC_WRITE_PROTECTION_ENABLE_1 (uint8_t)0xCA 00053 #define RTC_WRITE_PROTECTION_ENABLE_2 (uint8_t)0x53 00054 00055 /* Defines used to combine date & time */ 00056 #define RTC_OFFSET_WEEKDAY 24U 00057 #define RTC_OFFSET_DAY 16U 00058 #define RTC_OFFSET_MONTH 8U 00059 #define RTC_OFFSET_HOUR 16U 00060 #define RTC_OFFSET_MINUTE 8U 00061 00062 /** 00063 * @} 00064 */ 00065 00066 /* Private macros ------------------------------------------------------------*/ 00067 #if defined(USE_FULL_LL_DRIVER) 00068 /** @defgroup RTC_LL_Private_Macros RTC Private Macros 00069 * @{ */ 00071 */ 00072 /** 00073 * @} 00074 */ 00075 #endif /*USE_FULL_LL_DRIVER*/ 00076 00077 #if !defined (UNUSED) 00078 #define UNUSED(x) ((void)(x)) 00079 #endif 00080 /* Exported types ------------------------------------------------------------*/ 00081 #if defined(USE_FULL_LL_DRIVER) 00082 /** @defgroup RTC_LL_ES_INIT RTC Exported Init structure 00083 * @{ 00084 */ 00085 00086 /** 00087 * @brief RTC Init structures definition 00088 */ 00089 typedef struct 00090 { 00091 uint32_t HourFormat; /*!< Specifies the RTC Hours Format. 00092 This parameter can be a value of @ref RTC_LL_EC_HOURFORMAT 00093 00094 This feature can be modified afterwards using unitary function 00095 @ref LL_RTC_SetHourFormat(). */ 00096 00097 uint32_t AsynchPrescaler; /*!< Specifies the RTC Asynchronous Predivider value. 00098 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F 00099 00100 This feature can be modified afterwards using unitary function 00101 @ref LL_RTC_SetAsynchPrescaler(). */ 00102 00103 uint32_t SynchPrescaler; /*!< Specifies the RTC Synchronous Predivider value. 00104 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF 00105 00106 This feature can be modified afterwards using unitary function 00107 @ref LL_RTC_SetSynchPrescaler(). */ 00108 } LL_RTC_InitTypeDef; 00109 /** 00110 * @brief RTC Time structure definition 00111 */ 00112 00112 typedef struct 00113 { 00114 uint32_t TimeFormat; /*!< Specifies the RTC AM/PM Time. 00115 This parameter can be a value of @ref RTC_LL_EC_TIME_FORMAT 00116 00117 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetFormat(). */ 00118 00119 uint8_t Hours; /*!< Specifies the RTC Time Hours. 00120 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the @ref LL_RTC_TIME_FORMAT_PM is selected. 00121 This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the @ref LL_RTC_TIME_FORMAT_AM_OR_24 is selected. 00122 00123 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetHour(). */ 00124 00125 uint8_t Minutes; /*!< Specifies the RTC Time Minutes. 00126 This parameter must be a number between Min_Data = 0 and Max_Data = 59 00127 00128 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetMinute(). */ 00129 00130 00131 * @brief RTC Time structure definition 00132 */ 00131 uint8_t Seconds; /*!< Specifies the RTC Time Seconds. 00134 This parameter must be a number between Min_Data = 0 and Max_Data = 59 This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetSecond(). */ } LL_RTC_TimeTypeDef; 00137 /** 00138 * @brief RTC Date structure definition 00139 */ 00140 typedef struct 00141 { 00142 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay. 00143 This parameter can be a value of @ref RTC_LL_EC_WEEKDAY 00144 00145 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetWeekDay(). */ 00146 00147 uint8_t Month; /*!< Specifies the RTC Date Month. 00148 This parameter can be a value of @ref RTC_LL_EC_MONTH 00149 00150 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetMonth(). */ 00151 00152 uint8_t Day; /*!< Specifies the RTC Date Day. 00153 This parameter must be a number between Min_Data = 1 and Max_Data = 31 00154 00155 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetDay(). */ 00156 00157 uint8_t Year; /*!< Specifies the RTC Date Year. 00158 This parameter must be a number between Min_Data = 0 and Max_Data = 99 00159 00160 This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetYear(). */ } LL_RTC_DateTypeDef; 00163 /** 00164 * @brief RTC Alarm structure definition 00165 */ 00166 typedef struct 00167 { 00168 LL_RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members. */ 00169 00170 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks. 00171 This parameter can be a value of @ref RTC_LL_EC_ALMA_MASK for ALARM A or @ref RTC_LL_EC_ALMB_MASK for ALARM B. 00172 00173 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetMask() for ALARM A 00174 or @ref LL_RTC_ALMB_SetMask() for ALARM B 00175 */ 00176 00177 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on day or WeekDay. 00178 This parameter can be a value of @ref RTC_LL_EC_ALMA_WEEKDAY_SELECTION for ALARM A or @ref RTC_LL_EC_ALMB_WEEKDAY_SELECTION for ALARM B 00179 00180 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_EnableWeekday() or @ref LL_RTC_ALMA_DisableWeekday() 00181 for ALARM A or @ref LL_RTC_ALMB_EnableWeekday() or @ref LL_RTC_ALMB_DisableWeekday() for ALARM B 00182 */ 00183 00184 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Day/WeekDay. 00185 If AlarmDateWeekDaySel set to day, this parameter must be a number between Min_Data = 1 and Max_Data = 31. 00186 00187 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetDay() 00188 for ALARM A or @ref LL_RTC_ALMB_SetDay() for ALARM B. 00189 00190 If AlarmDateWeekDaySel set to Weekday, this parameter can be a value of @ref RTC_LL_EC_WEEKDAY. 00191 00192 This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetWeekDay() 00193 for ALARM A or @ref LL_RTC_ALMB_SetWeekDay() for ALARM B. 00194 */ 00195 } LL_RTC_AlarmTypeDef; 00197 /** 00198 * @} 00199 */ 00200 #endif /* USE_FULL_LL_DRIVER */ 00201 00202 /* Exported constants --------------------------------------------------------*/ 00203 /** @defgroup RTC_LL_Exported_Constants RTC Exported Constants 00204 * @{ 00205 */ 00206 00207 #if defined(USE_FULL_LL_DRIVER) 00208 /** @defgroup RTC_LL_EC_FORMAT FORMAT 00209 * @{ 00210 */ 00211 #define LL_RTC_FORMAT_BIN 0x00000000U