|
STM32G474xx HAL用户手册
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32g4xx_hal_rtc_ex.h 00004 * @author MCD Application Team 00005 * @brief Header file of RTC HAL Extended 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_EX_H 00021 #define STM32G4xx_HAL_RTC_EX_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 RTCEx RTCEx 00035 * @{ 00036 */ 00037 00038 /* Exported types ------------------------------------------------------------*/ 00039 /** @defgroup RTCEx_Exported_Types RTCEx Exported Types 00040 * @{ 00041 */ 00042 00043 /** @defgroup RTCEx_Tamper_structure_definition RTCEx Tamper structure definition 00044 * @{ 00045 */ 00046 typedef struct 00047 { 00048 uint32_t Tamper; /*!< Specifies the Tamper Pin. 00049 This parameter can be a value of @ref RTCEx_Tamper_Pins */ 00050 00051 uint32_t Trigger; /*!< Specifies the Tamper Trigger. 00052 This parameter can be a value of @ref RTCEx_Tamper_Trigger */ 00053 00054 uint32_t NoErase; /*!< Specifies the Tamper no erase mode. 00055 This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp */ 00056 00057 uint32_t MaskFlag; /*!< Specifies the Tamper Flag masking. 00058 This parameter can be a value of @ref RTCEx_Tamper_MaskFlag */ 00059 00060 uint32_t Filter; /*!< Specifies the TAMP Filter Tamper. 00061 This parameter can be a value of @ref RTCEx_Tamper_Filter */ 00062 00063 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency. 00064 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies */ 00065 00066 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration . 00067 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration */ 00068 00069 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp . 00070 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP */ 00071 00072 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection. 00073 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection */ 00074 } RTC_TamperTypeDef; 00075 /** 00076 * @} 00077 */ 00078 00079 00080 /** @defgroup RTCEx_Internal_Tamper_structure_definition RTCEx Internal Tamper structure definition 00081 * @{ 00082 */ 00083 typedef struct 00084 { 00085 uint32_t IntTamper; /*!< Specifies the Internal Tamper Pin. 00086 This parameter can be a value of @ref RTCEx_Internal_Tamper_Pins */ 00087 00088 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection. 00089 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection */ 00090 } RTC_InternalTamperTypeDef; 00091 /** 00092 * @} 00093 */ 00094 00095 /** 00096 * @} 00097 */ 00098 00099 /* Exported constants --------------------------------------------------------*/ 00100 /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants 00101 * @{ 00102 */ 00103 00104 /** @defgroup RTCEx_Time_Stamp_Edges_definitions RTCEx Time Stamp Edges definition 00105 * @{ 00106 */ 00107 #define RTC_TIMESTAMPEDGE_RISING 0x00000000U 00108 #define RTC_TIMESTAMPEDGE_FALLING RTC_CR_TSEDGE 00109 /** 00110 * @} 00111 */ 00112 00113 /** @defgroup RTCEx_TimeStamp_Pin_Selections RTCEx TimeStamp Pin Selection 00114 * @{ 00115 */ 00116 #define RTC_TIMESTAMPPIN_DEFAULT 0x00000000U 00117 /** 00118 * @} 00119 */ 00120 00121 /** @defgroup RTCEx_Wakeup_Timer_Definitions RTCEx Wakeup Timer Definitions 00122 * @{ 00123 */ 00124 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 0x00000000U 00125 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 RTC_CR_WUCKSEL_0 00126 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 RTC_CR_WUCKSEL_1 00127 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 (RTC_CR_WUCKSEL_0 | RTC_CR_WUCKSEL_1) 00128 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS RTC_CR_WUCKSEL_2 00129 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_2) 00130 /** 00131 * @} 00132 */ 00133 00134 /** @defgroup RTCEx_Smooth_calib_period_Definitions RTCEx Smooth calib period Definitions 00135 * @{ 00136 */ 00137 #define RTC_SMOOTHCALIB_PERIOD_32SEC 0x00000000U /*!< If RTCCLK = 32768 Hz, Smooth calibration 00138 period is 32s, else 2exp20 RTCCLK pulses */ 00139 #define RTC_SMOOTHCALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< If RTCCLK = 32768 Hz, Smooth calibration 00140 period is 16s, else 2exp19 RTCCLK pulses */ 00141 #define RTC_SMOOTHCALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< If RTCCLK = 32768 Hz, Smooth calibration 00142 period is 8s, else 2exp18 RTCCLK pulses */ 00143 /** 00144 * @} 00145 */ 00146 00147 /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTCEx Smooth calib Plus pulses Definitions 00148 * @{ 00149 */ 00150 #define RTC_SMOOTHCALIB_PLUSPULSES_SET RTC_CALR_CALP /*!< The number of RTCCLK pulses added 00151 during a X -second window = Y - CALM[8:0] 00152 with Y = 512, 256, 128 when X = 32, 16, 8 */ 00153 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET 0x00000000U /*!< The number of RTCCLK pulses subbstited 00154 during a 32-second window = CALM[8:0] */ 00155 00156 /** 00157 * @} 00158 */ 00159 00160 /** @defgroup RTCEx_Calib_Output_selection_Definitions RTCEx Calib Output selection Definitions 00161 * @{ 00162 */ 00163 #define RTC_CALIBOUTPUT_512HZ 0x00000000U 00164 #define RTC_CALIBOUTPUT_1HZ RTC_CR_COSEL 00165 00166 /** 00167 * @} 00168 */ 00169 00170 00171 /** @defgroup RTCEx_Add_1_Second_Parameter_Definition RTCEx Add 1 Second Parameter Definitions 00172 * @{ 00173 */ 00174 #define RTC_SHIFTADD1S_RESET 0x00000000U 00175 #define RTC_SHIFTADD1S_SET RTC_SHIFTR_ADD1S 00176 /** 00177 * @} 00178 */ 00179 00180 /** @defgroup RTCEx_Tamper_Pins RTCEx Tamper Pins Definition 00181 * @{ 00182 */