STM32L443xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_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) 2017 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 STM32L4xx_HAL_RTC_EX_H 00021 #define STM32L4xx_HAL_RTC_EX_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32l4xx_hal_def.h" 00029 00030 /** @addtogroup STM32L4xx_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_Definitions */ 00050 00051 uint32_t Interrupt; /*!< Specifies the Tamper Interrupt. 00052 This parameter can be a value of @ref RTCEx_Tamper_Interrupt_Definitions */ 00053 00054 uint32_t Trigger; /*!< Specifies the Tamper Trigger. 00055 This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */ 00056 00057 uint32_t NoErase; /*!< Specifies the Tamper no erase mode. 00058 This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp_Definitions */ 00059 00060 uint32_t MaskFlag; /*!< Specifies the Tamper Flag masking. 00061 This parameter can be a value of @ref RTCEx_Tamper_MaskFlag_Definitions */ 00062 00063 uint32_t Filter; /*!< Specifies the TAMP Filter Tamper. 00064 This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */ 00065 00066 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency. 00067 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */ 00068 00069 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration . 00070 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */ 00071 00072 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp . 00073 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */ 00074 00075 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection. 00076 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */ 00077 } RTC_TamperTypeDef; 00078 /** 00079 * @} 00080 */ 00081 00082 /** 00083 * @} 00084 */ 00085 00086 /* Exported constants --------------------------------------------------------*/ 00087 00088 /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants 00089 * @{ 00090 */ 00091 00092 /* ========================================================================== */ 00093 /* ##### RTC TimeStamp exported constants ##### */ 00094 /* ========================================================================== */ 00095 00096 /** @defgroup RTCEx_Time_Stamp_Edges_definitions RTCEx Time Stamp Edges Definitions 00097 * 00098 * @{ 00099 */ 00100 #define RTC_TIMESTAMPEDGE_RISING 0x00000000u 00101 #define RTC_TIMESTAMPEDGE_FALLING RTC_CR_TSEDGE 00102 /** 00103 * @} 00104 */ 00105 00106 /** @defgroup RTCEx_TimeStamp_Pin_Selection RTCEx TimeStamp Pin Selection 00107 * @{ 00108 */ 00109 #define RTC_TIMESTAMPPIN_DEFAULT 0x00000000u 00110 /** 00111 * @} 00112 */ 00113 00114 /* ========================================================================== */ 00115 /* ##### RTC Wake-up exported constants ##### */ 00116 /* ========================================================================== */ 00117 00118 /** @defgroup RTCEx_Wakeup_Timer_Definitions RTCEx Wakeup Timer Definitions 00119 * @{ 00120 */ 00121 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 0x00000000u 00122 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 RTC_CR_WUCKSEL_0 00123 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 RTC_CR_WUCKSEL_1 00124 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 (RTC_CR_WUCKSEL_0 | RTC_CR_WUCKSEL_1) 00125 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS RTC_CR_WUCKSEL_2 00126 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_2) 00127 /** 00128 * @} 00129 */ 00130 00131 /* ========================================================================== */ 00132 /* ##### Extended RTC Peripheral Control exported constants ##### */ 00133 /* ========================================================================== */ 00134 00135 /** @defgroup RTCEx_Smooth_calib_period_Definitions RTCEx Smooth Calib Period Definitions 00136 * @{ 00137 */ 00138 #define RTC_SMOOTHCALIB_PERIOD_32SEC 0x00000000u /*!< If RTCCLK = 32768 Hz, Smooth calibration 00139 period is 32s, else 2exp20 RTCCLK pulses */ 00140 #define RTC_SMOOTHCALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< If RTCCLK = 32768 Hz, Smooth calibration 00141 period is 16s, else 2exp19 RTCCLK pulses */ 00142 #define RTC_SMOOTHCALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< If RTCCLK = 32768 Hz, Smooth calibration 00143 period is 8s, else 2exp18 RTCCLK pulses */ 00144 /** 00145 * @} 00146 */ 00147 00148 /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTCEx Smooth calib Plus pulses Definitions 00149 * @{ 00150 */ 00151 #define RTC_SMOOTHCALIB_PLUSPULSES_SET RTC_CALR_CALP /*!< The number of RTCCLK pulses added 00152 during a X -second window = Y - CALM[8:0] 00153 with Y = 512, 256, 128 when X = 32, 16, 8 */ 00154 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET 0x00000000u /*!< The number of RTCCLK pulses subbstited 00155 during a 32-second window = CALM[8:0] */ 00156 /** 00157 * @} 00158 */ 00159 00160 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00161 /** @defgroup RTCEx_Smooth_Calib_Low_Power_Definitions RTCEx Smooth Calib Low Power Definitions 00162 * @{ 00163 */ 00164 #define RTC_LPCAL_SET RTC_CALR_LPCAL /*!< Calibration window is 220 ck_apre, 00165 which is the required configuration for 00166 ultra-low consumption mode. */ 00167 #define RTC_LPCAL_RESET 0x00000000u /*!< Calibration window is 220 RTCCLK, 00168 which is a high-consumption mode. 00169 This mode should be set only when less 00170 than 32s calibration window is required. */ 00171 /** 00172 * @} 00173 */ 00174 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00175 00176 /** @defgroup RTCEx_Calib_Output_selection_Definitions RTCEx Calib Output Selection Definitions 00177 * @{ 00178 */ 00179 #define RTC_CALIBOUTPUT_512HZ 0x00000000u 00180 #define RTC_CALIBOUTPUT_1HZ RTC_CR_COSEL 00181 /** 00182 * @} 00183 */ 00184 00185 /** @defgroup RTCEx_Add_1_Second_Parameter_Definitions RTC Add 1 Second Parameter Definitions 00186 * @{ 00187 */ 00188 #define RTC_SHIFTADD1S_RESET 0x00000000u 00189 #define RTC_SHIFTADD1S_SET RTC_SHIFTR_ADD1S 00190 /** 00191 * @} 00192 */ 00193 00194 00195 /* ========================================================================== */ 00196 /* ##### RTC Tamper exported constants ##### */ 00197 /* ========================================================================== */ 00198 00199 /** @defgroup RTCEx_Tamper_Pins_Definitions RTCEx Tamper Pins Definitions 00200 * @{ 00201 */ 00202 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00203 #if defined(RTC_TAMPER1_SUPPORT) 00204 #define RTC_TAMPER_1 TAMP_CR1_TAMP1E 00205 #endif /* RTC_TAMPER1_SUPPORT */ 00206 #define RTC_TAMPER_2 TAMP_CR1_TAMP2E 00207 #if defined(RTC_TAMPER3_SUPPORT) 00208 #define RTC_TAMPER_3 TAMP_CR1_TAMP3E 00209 #endif /* RTC_TAMPER3_SUPPORT */ 00210 #if defined(RTC_TAMPER3_SUPPORT) 00211 #define RTC_TAMPER_ALL (TAMP_CR1_TAMP1E | TAMP_CR1_TAMP2E | TAMP_CR1_TAMP3E) 00212 #else 00213 #define RTC_TAMPER_ALL (TAMP_CR1_TAMP1E | TAMP_CR1_TAMP2E) 00214 #endif 00215 #else /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00216 #if defined(RTC_TAMPER1_SUPPORT) 00217 #define RTC_TAMPER_1 RTC_TAMPCR_TAMP1E 00218 #endif /* RTC_TAMPER1_SUPPORT */ 00219 #define RTC_TAMPER_2 RTC_TAMPCR_TAMP2E 00220 #if defined(RTC_TAMPER3_SUPPORT) 00221 #define RTC_TAMPER_3 RTC_TAMPCR_TAMP3E 00222 #endif /* RTC_TAMPER3_SUPPORT */ 00223 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00224 /** 00225 * @} 00226 */ 00227 00228 /** @defgroup RTCEx_Tamper_Trigger_Definitions RTCEx Tamper Triggers Definitions 00229 * @{ 00230 */ 00231 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00232 #define RTC_TAMPERTRIGGER_RISINGEDGE 0x00u /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */ 00233 #define RTC_TAMPERTRIGGER_FALLINGEDGE 0x01u /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */ 00234 #define RTC_TAMPERTRIGGER_LOWLEVEL 0x02u /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */ 00235 #define RTC_TAMPERTRIGGER_HIGHLEVEL 0x03u /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */ 00236 #else 00237 #define RTC_TAMPERTRIGGER_RISINGEDGE ((uint32_t)0x00000000) 00238 #define RTC_TAMPERTRIGGER_FALLINGEDGE ((uint32_t)0x00000002) 00239 #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE 00240 #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE 00241 #endif 00242 /** 00243 * @} 00244 */ 00245 00246 /** @defgroup RTCEx_Tamper_MaskFlag_Definitions RTCEx Tamper Mask Flag Definitions 00247 * @{ 00248 */ 00249 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00250 #define RTC_TAMPERMASK_FLAG_DISABLE 0x00u 00251 #define RTC_TAMPERMASK_FLAG_ENABLE 0x01u 00252 #else 00253 #define RTC_TAMPERMASK_FLAG_DISABLE 0x00000000u 00254 #define RTC_TAMPERMASK_FLAG_ENABLE 0x00040000u 00255 #endif 00256 /** 00257 * @} 00258 */ 00259 00260 /** @defgroup RTCEx_Tamper_EraseBackUp_Definitions RTCEx Tamper EraseBackUp Definitions 00261 * @{ 00262 */ 00263 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00264 #define RTC_TAMPER_ERASE_BACKUP_ENABLE 0x00u 00265 #define RTC_TAMPER_ERASE_BACKUP_DISABLE 0x01u 00266 #else 00267 #define RTC_TAMPER_ERASE_BACKUP_ENABLE 0x00000000u 00268 #define RTC_TAMPER_ERASE_BACKUP_DISABLE 0x00020000u 00269 #endif 00270 /** 00271 * @} 00272 */ 00273 00274 /** @defgroup RTCEx_Tamper_Filter_Definitions RTCEx Tamper Filter Definitions 00275 * @{ 00276 */ 00277 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00278 #define RTC_TAMPERFILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */ 00279 00280 #define RTC_TAMPERFILTER_2SAMPLE TAMP_FLTCR_TAMPFLT_0 /*!< Tamper is activated after 2 00281 consecutive samples at the active level */ 00282 #define RTC_TAMPERFILTER_4SAMPLE TAMP_FLTCR_TAMPFLT_1 /*!< Tamper is activated after 4 00283 consecutive samples at the active level */ 00284 #define RTC_TAMPERFILTER_8SAMPLE TAMP_FLTCR_TAMPFLT /*!< Tamper is activated after 8 00285 consecutive samples at the active level */ 00286 #else /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00287 #define RTC_TAMPERFILTER_DISABLE 0x00000000u /*!< Tamper filter is disabled */ 00288 00289 #define RTC_TAMPERFILTER_2SAMPLE RTC_TAMPCR_TAMPFLT_0 /*!< Tamper is activated after 2 00290 consecutive samples at the active level */ 00291 #define RTC_TAMPERFILTER_4SAMPLE RTC_TAMPCR_TAMPFLT_1 /*!< Tamper is activated after 4 00292 consecutive samples at the active level */ 00293 #define RTC_TAMPERFILTER_8SAMPLE RTC_TAMPCR_TAMPFLT /*!< Tamper is activated after 8 00294 consecutive samples at the active level. */ 00295 #endif /*#if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00296 00297 /** 00298 * @} 00299 */ 00300 00301 /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTCEx Tamper Sampling Frequencies Definitions 00302 * @{ 00303 */ 00304 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00305 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 0x00000000U /*!< Each of the tamper inputs are sampled 00306 with a frequency = RTCCLK / 32768 */ 00307 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 TAMP_FLTCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled 00308 with a frequency = RTCCLK / 16384 */ 00309 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 TAMP_FLTCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled 00310 with a frequency = RTCCLK / 8192 */ 00311 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled 00312 with a frequency = RTCCLK / 4096 */ 00313 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 TAMP_FLTCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled 00314 with a frequency = RTCCLK / 2048 */ 00315 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled 00316 with a frequency = RTCCLK / 1024 */ 00317 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 (TAMP_FLTCR_TAMPFREQ_1 | TAMP_FLTCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled 00318 with a frequency = RTCCLK / 512 */ 00319 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 TAMP_FLTCR_TAMPFREQ /*!< Each of the tamper inputs are sampled 00320 with a frequency = RTCCLK / 256 */ 00321 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_MASK TAMP_FLTCR_TAMPFREQ /*!< Masking all bits except those of 00322 field TAMPFREQ[2:0]*/ 00323 #else /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00324 00325 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 0x00000000u /*!< Each of the tamper inputs are sampled 00326 with a frequency = RTCCLK / 32768 */ 00327 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 RTC_TAMPCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled 00328 with a frequency = RTCCLK / 16384 */ 00329 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 RTC_TAMPCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled 00330 with a frequency = RTCCLK / 8192 */ 00331 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled 00332 with a frequency = RTCCLK / 4096 */ 00333 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 RTC_TAMPCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled 00334 with a frequency = RTCCLK / 2048 */ 00335 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled 00336 with a frequency = RTCCLK / 1024 */ 00337 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 (RTC_TAMPCR_TAMPFREQ_1 | RTC_TAMPCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled 00338 with a frequency = RTCCLK / 512 */ 00339 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 RTC_TAMPCR_TAMPFREQ /*!< Each of the tamper inputs are sampled 00340 with a frequency = RTCCLK / 256 */ 00341 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_MASK RTC_TAMPCR_TAMPFREQ /*!< Masking all bits except those of 00342 field TAMPFREQ[2:0]*/ 00343 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00344 /** 00345 * @} 00346 */ 00347 00348 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTCEx Tamper Pin Precharge Duration Definitions 00349 * @{ 00350 */ 00351 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00352 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before 00353 sampling during 1 RTCCLK cycle */ 00354 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK TAMP_FLTCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before 00355 sampling during 2 RTCCLK cycles */ 00356 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK TAMP_FLTCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before 00357 sampling during 4 RTCCLK cycles */ 00358 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK TAMP_FLTCR_TAMPPRCH /*!< Tamper pins are pre-charged before 00359 sampling during 8 RTCCLK cycles */ 00360 #else /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00361 00362 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK 0x00000000u /*!< Tamper pins are pre-charged before 00363 sampling during 1 RTCCLK cycle */ 00364 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK RTC_TAMPCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before 00365 sampling during 2 RTCCLK cycles */ 00366 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK RTC_TAMPCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before 00367 sampling during 4 RTCCLK cycles */ 00368 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK RTC_TAMPCR_TAMPPRCH /*!< Tamper pins are pre-charged before 00369 sampling during 8 RTCCLK cycles */ 00370 #define RTC_TAMPERPRECHARGEDURATION_MASK RTC_TAMPCR_TAMPPRCH /*!< Masking all bits except those of 00371 field TAMPPRCH[1:0] */ 00372 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00373 /** 00374 * @} 00375 */ 00376 00377 /** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTCEx Tamper Pull Up Definitions 00378 * @{ 00379 */ 00380 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00381 #define RTC_TAMPER_PULLUP_ENABLE 0x00000000u /*!< Tamper pins are pre-charged before sampling */ 00382 #define RTC_TAMPER_PULLUP_DISABLE TAMP_FLTCR_TAMPPUDIS /*!< Tamper pins pre-charge is disabled */ 00383 #else 00384 #define RTC_TAMPER_PULLUP_ENABLE 0x00000000u /*!< TimeStamp on Tamper Detection event saved */ 00385 #define RTC_TAMPER_PULLUP_DISABLE RTC_TAMPCR_TAMPPUDIS /*!< TimeStamp on Tamper Detection event is not saved */ 00386 #endif 00387 00388 /** 00389 * @} 00390 */ 00391 00392 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTCEx Tamper TimeStamp On Tamper Detection Definitions 00393 * @{ 00394 */ 00395 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00396 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE 0x00000000u /*!< TimeStamp on Tamper Detection event is not saved */ 00397 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE RTC_CR_TAMPTS /*!< TimeStamp on Tamper Detection event saved */ 00398 #else 00399 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE 0x00000000u /*!< TimeStamp on Tamper Detection event is not saved */ 00400 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE RTC_TAMPCR_TAMPTS /*!< TimeStamp on Tamper Detection event saved */ 00401 #endif 00402 /** 00403 * @} 00404 */ 00405 00406 /** @defgroup RTCEx_Tamper_Interrupt_Definitions RTC Tamper Interrupts Definitions 00407 * @{ 00408 */ 00409 00410 #if defined(STM32L412xx) || defined(STM32L422xx) 00411 #define RTC_IT_TAMP1 TAMP_IER_TAMP1IE /*!< Tamper 1 Interrupt */ 00412 #define RTC_IT_TAMP2 TAMP_IER_TAMP2IE /*!< Tamper 2 Interrupt */ 00413 #define RTC_IT_TAMP (TAMP_IER_TAMP1IE | TAMP_IER_TAMP2IE) /*!< Enable all Tamper Interrupt */ 00414 #elif defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00415 #define RTC_IT_TAMP1 TAMP_IER_TAMP1IE /*!< Tamper 1 Interrupt */ 00416 #define RTC_IT_TAMP2 TAMP_IER_TAMP2IE /*!< Tamper 2 Interrupt */ 00417 #define RTC_IT_TAMP3 TAMP_IER_TAMP3IE /*!< Tamper 3 Interrupt */ 00418 #define RTC_IT_TAMP (TAMP_IER_TAMP1IE | TAMP_IER_TAMP2IE | TAMP_IER_TAMP3IE) /*!< Enable all Tamper Interrupt */ 00419 #else 00420 #define RTC_IT_TAMP RTC_TAMPCR_TAMPIE /*!< Enable all Tamper Interrupt */ 00421 #define RTC_IT_TAMP1 RTC_TAMPCR_TAMP1IE /*!< Enable Tamper 1 Interrupt */ 00422 #define RTC_IT_TAMP2 RTC_TAMPCR_TAMP2IE /*!< Enable Tamper 2 Interrupt */ 00423 #define RTC_IT_TAMP3 RTC_TAMPCR_TAMP3IE /*!< Enable Tamper 3 Interrupt */ 00424 #endif 00425 #define RTC_IT_TAMPALL RTC_IT_TAMP 00426 /** 00427 * @} 00428 */ 00429 00430 /** @defgroup RTCEx_Flags RTCEx Flags 00431 * @{ 00432 */ 00433 #if defined(STM32L412xx) || defined(STM32L422xx) 00434 #define RTC_FLAG_TAMP1F TAMP_SR_TAMP1F 00435 #define RTC_FLAG_TAMP2F TAMP_SR_TAMP2F 00436 #define RTC_FLAG_TAMPALL (RTC_FLAG_TAMP1F | RTC_FLAG_TAMP2F) 00437 #elif defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00438 #define RTC_FLAG_TAMP1F TAMP_SR_TAMP1F 00439 #define RTC_FLAG_TAMP2F TAMP_SR_TAMP2F 00440 #define RTC_FLAG_TAMP3F TAMP_SR_TAMP3F 00441 #define RTC_FLAG_TAMPALL (RTC_FLAG_TAMP1F | RTC_FLAG_TAMP2F | RTC_FLAG_TAMP3F) 00442 #else 00443 #define RTC_FLAG_TAMP1F RTC_ISR_TAMP1F 00444 #define RTC_FLAG_TAMP2F RTC_ISR_TAMP2F 00445 #define RTC_FLAG_TAMP3F RTC_ISR_TAMP3F 00446 #endif 00447 /** 00448 * @} 00449 */ 00450 00451 /* ========================================================================== */ 00452 /* ##### Extended RTC Backup registers exported constants ##### */ 00453 /* ========================================================================== */ 00454 00455 /** @defgroup RTCEx_Backup_Data_Registers_Number_Definitions RTC Backup Data Registers Number Definitions 00456 * @{ 00457 */ 00458 #if defined(RTC_BKP_NUMBER) 00459 #define BKP_REG_NUMBER RTC_BKP_NUMBER 00460 #endif /* RTC_BKP_NUMBER */ 00461 #if defined(TAMP_BKP_NUMBER) 00462 #define BKP_REG_NUMBER TAMP_BKP_NUMBER 00463 #endif /* TAMP_BKP_NUMBER */ 00464 /** 00465 * @} 00466 */ 00467 00468 /** @defgroup RTCEx_Backup_Data_Registers_Definitions RTCEx Backup Data Registers Definitions 00469 * @{ 00470 */ 00471 #define RTC_BKP_DR0 0x00u 00472 #define RTC_BKP_DR1 0x01u 00473 #define RTC_BKP_DR2 0x02u 00474 #define RTC_BKP_DR3 0x03u 00475 #define RTC_BKP_DR4 0x04u 00476 #define RTC_BKP_DR5 0x05u 00477 #define RTC_BKP_DR6 0x06u 00478 #define RTC_BKP_DR7 0x07u 00479 #define RTC_BKP_DR8 0x08u 00480 #define RTC_BKP_DR9 0x09u 00481 #define RTC_BKP_DR10 0x0Au 00482 #define RTC_BKP_DR11 0x0Bu 00483 #define RTC_BKP_DR12 0x0Cu 00484 #define RTC_BKP_DR13 0x0Du 00485 #define RTC_BKP_DR14 0x0Eu 00486 #define RTC_BKP_DR15 0x0Fu 00487 #define RTC_BKP_DR16 0x10u 00488 #define RTC_BKP_DR17 0x11u 00489 #define RTC_BKP_DR18 0x12u 00490 #define RTC_BKP_DR19 0x13u 00491 #define RTC_BKP_DR20 0x14u 00492 #define RTC_BKP_DR21 0x15u 00493 #define RTC_BKP_DR22 0x16u 00494 #define RTC_BKP_DR23 0x17u 00495 #define RTC_BKP_DR24 0x18u 00496 #define RTC_BKP_DR25 0x19u 00497 #define RTC_BKP_DR26 0x1Au 00498 #define RTC_BKP_DR27 0x1Bu 00499 #define RTC_BKP_DR28 0x1Cu 00500 #define RTC_BKP_DR29 0x1Du 00501 #define RTC_BKP_DR30 0x1Eu 00502 #define RTC_BKP_DR31 0x1Fu 00503 /** 00504 * @} 00505 */ 00506 00507 00508 00509 00510 /** @defgroup RTCEx_Tamper_Interrupt_Definitions RTC Tamper Interrupts Definitions 00511 * @{ 00512 */ 00513 #if defined(STM32L412xx) || defined(STM32L422xx) 00514 #define RTC_TAMPER1_INTERRUPT TAMP_IER_TAMP1IE 00515 #define RTC_TAMPER2_INTERRUPT TAMP_IER_TAMP2IE 00516 #define RTC_ALL_TAMPER_INTERRUPT (TAMP_IER_TAMP1IE | TAMP_IER_TAMP2IE) 00517 #elif defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00518 #define RTC_TAMPER1_INTERRUPT TAMP_IER_TAMP1IE 00519 #define RTC_TAMPER2_INTERRUPT TAMP_IER_TAMP2IE 00520 #define RTC_TAMPER3_INTERRUPT TAMP_IER_TAMP3IE 00521 #define RTC_ALL_TAMPER_INTERRUPT (TAMP_IER_TAMP1IE | TAMP_IER_TAMP2IE | TAMP_IER_TAMP3IE) 00522 #else /* #if defined(STM32L412xx) || defined(STM32L422xx) */ 00523 #if defined(RTC_TAMPER1_SUPPORT) 00524 #define RTC_TAMPER1_INTERRUPT RTC_TAMPCR_TAMP1IE 00525 #endif /* RTC_TAMPER1_SUPPORT */ 00526 #define RTC_TAMPER2_INTERRUPT RTC_TAMPCR_TAMP2IE 00527 #if defined(RTC_TAMPER3_SUPPORT) 00528 #define RTC_TAMPER3_INTERRUPT RTC_TAMPCR_TAMP3IE 00529 #endif /* RTC_TAMPER3_SUPPORT */ 00530 #define RTC_ALL_TAMPER_INTERRUPT RTC_TAMPCR_TAMPIE 00531 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) */ 00532 00533 00534 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00535 /** @defgroup RTCEx_Binary_Mode RTC Binary Mode (32-bit free-running counter configuration). 00536 * Warning : It Should not be confused with the Binary format @ref RTC_Input_parameter_format_definitions. 00537 * @{ 00538 */ 00539 #define RTC_BINARY_NONE 0x00000000u /*!< Free running BCD calendar mode (Binary mode disabled). */ 00540 #define RTC_BINARY_ONLY RTC_ICSR_BIN_0 /*!< Free running Binary mode (BCD mode disabled) */ 00541 #define RTC_BINARY_MIX RTC_ICSR_BIN_1 /*!< Free running BCD calendar and Binary modes */ 00542 /** 00543 * @} 00544 */ 00545 00546 /** @defgroup RTCEx_Binary_mix_BCDU If Binary mode is RTC_BINARY_MIX, the BCD calendar second is incremented using the SSR Least Significant Bits. 00547 * @{ 00548 */ 00549 #define RTC_BINARY_MIX_BCDU_0 0x00000000u /*!< The 1s BCD calendar increment is generated each time SS[7:0] = 0 */ 00550 #define RTC_BINARY_MIX_BCDU_1 (0x1UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[8:0] = 0 */ 00551 #define RTC_BINARY_MIX_BCDU_2 (0x2UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[9:0] = 0 */ 00552 #define RTC_BINARY_MIX_BCDU_3 (0x3UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[10:0] = 0 */ 00553 #define RTC_BINARY_MIX_BCDU_4 (0x4UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[11:0] = 0 */ 00554 #define RTC_BINARY_MIX_BCDU_5 (0x5UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[12:0] = 0 */ 00555 #define RTC_BINARY_MIX_BCDU_6 (0x6UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[13:0] = 0 */ 00556 #define RTC_BINARY_MIX_BCDU_7 (0x7UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[14:0] = 0 */ 00557 /** 00558 * @} 00559 */ 00560 00561 /** @defgroup RTCEx_Alarm_Sub_Seconds_binary_Masks_Definitions RTC Alarm Sub Seconds with binary mode Masks Definitions 00562 * @{ 00563 */ 00564 #define RTC_ALARMSUBSECONDBINMASK_ALL 0x00000000u /*!< All Alarm SS fields are masked. 00565 There is no comparison on sub seconds for Alarm */ 00566 #define RTC_ALARMSUBSECONDBINMASK_SS31_1 (1UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:1] are don't care in Alarm 00567 comparison. Only SS[0] is compared. */ 00568 #define RTC_ALARMSUBSECONDBINMASK_SS31_2 (2UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:2] are don't care in Alarm 00569 comparison. Only SS[1:0] are compared */ 00570 #define RTC_ALARMSUBSECONDBINMASK_SS31_3 (3UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:3] are don't care in Alarm 00571 comparison. Only SS[2:0] are compared */ 00572 #define RTC_ALARMSUBSECONDBINMASK_SS31_4 (4UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:4] are don't care in Alarm 00573 comparison. Only SS[3:0] are compared */ 00574 #define RTC_ALARMSUBSECONDBINMASK_SS31_5 (5UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:5] are don't care in Alarm 00575 comparison. Only SS[4:0] are compared */ 00576 #define RTC_ALARMSUBSECONDBINMASK_SS31_6 (6UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:6] are don't care in Alarm 00577 comparison. Only SS[5:0] are compared */ 00578 #define RTC_ALARMSUBSECONDBINMASK_SS31_7 (7UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:7] are don't care in Alarm 00579 comparison. Only SS[6:0] are compared */ 00580 #define RTC_ALARMSUBSECONDBINMASK_SS31_8 (8UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:8] are don't care in Alarm 00581 comparison. Only SS[7:0] are compared */ 00582 #define RTC_ALARMSUBSECONDBINMASK_SS31_9 (9UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:9] are don't care in Alarm 00583 comparison. Only SS[8:0] are compared */ 00584 #define RTC_ALARMSUBSECONDBINMASK_SS31_10 (10UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:10] are don't care in Alarm 00585 comparison. Only SS[9:0] are compared */ 00586 #define RTC_ALARMSUBSECONDBINMASK_SS31_11 (11UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:11] are don't care in Alarm 00587 comparison. Only SS[10:0] are compared */ 00588 #define RTC_ALARMSUBSECONDBINMASK_SS31_12 (12UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:12] are don't care in Alarm 00589 comparison.Only SS[11:0] are compared */ 00590 #define RTC_ALARMSUBSECONDBINMASK_SS31_13 (13UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:13] are don't care in Alarm 00591 comparison. Only SS[12:0] are compared */ 00592 #define RTC_ALARMSUBSECONDBINMASK_SS31_14 (14UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:14] are don't care in Alarm 00593 comparison. Only SS[13:0] are compared */ 00594 #define RTC_ALARMSUBSECONDBINMASK_SS31_15 (15UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:15] are don't care in Alarm 00595 comparison. Only SS[14:0] are compared */ 00596 #define RTC_ALARMSUBSECONDBINMASK_SS31_16 (16UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:16] are don't care in Alarm 00597 comparison. Only SS[15:0] are compared */ 00598 #define RTC_ALARMSUBSECONDBINMASK_SS31_17 (17UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:17] are don't care in Alarm 00599 comparison. Only SS[16:0] are compared */ 00600 #define RTC_ALARMSUBSECONDBINMASK_SS31_18 (18UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:18] are don't care in Alarm 00601 comparison. Only SS[17:0] are compared */ 00602 #define RTC_ALARMSUBSECONDBINMASK_SS31_19 (19UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:19] are don't care in Alarm 00603 comparison. Only SS[18:0] are compared */ 00604 #define RTC_ALARMSUBSECONDBINMASK_SS31_20 (20UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:20] are don't care in Alarm 00605 comparison. Only SS[19:0] are compared */ 00606 #define RTC_ALARMSUBSECONDBINMASK_SS31_21 (21UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:21] are don't care in Alarm 00607 comparison. Only SS[20:0] are compared */ 00608 #define RTC_ALARMSUBSECONDBINMASK_SS31_22 (22UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:22] are don't care in Alarm 00609 comparison. Only SS[21:0] are compared */ 00610 #define RTC_ALARMSUBSECONDBINMASK_SS31_23 (23UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:23] are don't care in Alarm 00611 comparison. Only SS[22:0] are compared */ 00612 #define RTC_ALARMSUBSECONDBINMASK_SS31_24 (24UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:24] are don't care in Alarm 00613 comparison. Only SS[23:0] are compared */ 00614 #define RTC_ALARMSUBSECONDBINMASK_SS31_25 (25UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:25] are don't care in Alarm 00615 comparison. Only SS[24:0] are compared */ 00616 #define RTC_ALARMSUBSECONDBINMASK_SS31_26 (26UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:26] are don't care in Alarm 00617 comparison. Only SS[25:0] are compared */ 00618 #define RTC_ALARMSUBSECONDBINMASK_SS31_27 (27UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:27] are don't care in Alarm 00619 comparison. Only SS[26:0] are compared */ 00620 #define RTC_ALARMSUBSECONDBINMASK_SS31_28 (28UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:28] are don't care in Alarm 00621 comparison. Only SS[27:0] are compared */ 00622 #define RTC_ALARMSUBSECONDBINMASK_SS31_29 (29UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:29] are don't care in Alarm 00623 comparison. Only SS[28:0] are compared */ 00624 #define RTC_ALARMSUBSECONDBINMASK_SS31_30 (30UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:30] are don't care in Alarm 00625 comparison. Only SS[29:0] are compared */ 00626 #define RTC_ALARMSUBSECONDBINMASK_SS31 (31UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31] is don't care in Alarm 00627 comparison. Only SS[30:0] are compared */ 00628 #define RTC_ALARMSUBSECONDBINMASK_NONE (32UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:0] are compared and must match to activate alarm. */ 00629 /** 00630 * @} 00631 */ 00632 00633 /** @defgroup RTCEx_Alarm_Sub_Seconds_binary_Clear_Definitions RTC Alarm Sub Seconds with binary mode auto clear Definitions 00634 * @{ 00635 */ 00636 #define RTC_ALARMSUBSECONDBIN_AUTOCLR_NO 0UL /*!< The synchronous Binary counter (SS[31:0] in RTC_SSR) is free-running. */ 00637 #define RTC_ALARMSUBSECONDBIN_AUTOCLR_YES RTC_ALRMASSR_SSCLR /*!< The synchronous Binary counter (SS[31:0] in RTC_SSR) is running from 0xFFFF FFFF to 00638 RTC_ALRMABINR -> SS[31:0] value and is automatically reloaded with 0xFFFF FFFF 00639 whenreaching RTC_ALRMABINR -> SS[31:0]. */ 00640 /** 00641 * @} 00642 */ 00643 #endif /* #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00644 00645 00646 /** 00647 * @} 00648 */ 00649 00650 /* Exported macros -----------------------------------------------------------*/ 00651 /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros 00652 * @{ 00653 */ 00654 00655 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00656 /** @brief Clear the specified RTC pending flag. 00657 * @param __HANDLE__ specifies the RTC Handle. 00658 * @param __FLAG__ specifies the flag to check. 00659 * This parameter can be any combination of the following values: 00660 * @arg @ref RTC_CLEAR_ITSF Clear Internal Time-stamp flag 00661 * @arg @ref RTC_CLEAR_TSOVF Clear Time-stamp overflow flag 00662 * @arg @ref RTC_CLEAR_TSF Clear Time-stamp flag 00663 * @arg @ref RTC_CLEAR_WUTF Clear Wakeup timer flag 00664 * @arg @ref RTC_CLEAR_ALRBF Clear Alarm B flag 00665 * @arg @ref RTC_CLEAR_ALRAF Clear Alarm A flag 00666 * @retval None 00667 */ 00668 #define __HAL_RTC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SCR = (__FLAG__)) 00669 00670 /** @brief Check whether the specified RTC flag is set or not. 00671 * @param __HANDLE__ specifies the RTC Handle. 00672 * @param __FLAG__ specifies the flag to check. 00673 * This parameter can be any combination of the following values: 00674 * @arg @ref RTC_FLAG_RECALPF Recalibration pending Flag 00675 * @arg @ref RTC_FLAG_INITF Initialization flag 00676 * @arg @ref RTC_FLAG_RSF Registers synchronization flag 00677 * @arg @ref RTC_FLAG_INITS Initialization status flag 00678 * @arg @ref RTC_FLAG_SHPF Shift operation pending flag 00679 * @arg @ref RTC_FLAG_WUTWF Wakeup timer write flag 00680 * @arg @ref RTC_FLAG_ALRBWF Alarm B write flag 00681 * @arg @ref RTC_FLAG_ALRAWF Alarm A write flag 00682 * @arg @ref RTC_FLAG_ITSF Internal Time-stamp flag 00683 * @arg @ref RTC_FLAG_TSOVF Time-stamp overflow flag 00684 * @arg @ref RTC_FLAG_TSF Time-stamp flag 00685 * @arg @ref RTC_FLAG_WUTF Wakeup timer flag 00686 * @arg @ref RTC_FLAG_ALRBF Alarm B flag 00687 * @arg @ref RTC_FLAG_ALRAF Alarm A flag 00688 * @retval None 00689 */ 00690 #define __HAL_RTC_GET_FLAG(__HANDLE__, __FLAG__) (((((__FLAG__)) >> 8U) == 1U) ? ((__HANDLE__)->Instance->ICSR & (1U << (((uint16_t)(__FLAG__)) & RTC_FLAG_MASK))) : \ 00691 ((__HANDLE__)->Instance->SR & (1U << (((uint16_t)(__FLAG__)) & RTC_FLAG_MASK)))) 00692 #endif /*#if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 00693 00694 /* ---------------------------------WAKEUPTIMER---------------------------------*/ 00695 /** @defgroup RTCEx_WakeUp_Timer RTC WakeUp Timer 00696 * @{ 00697 */ 00698 /** 00699 * @brief Enable the RTC WakeUp Timer peripheral. 00700 * @param __HANDLE__ specifies the RTC handle. 00701 * @retval None 00702 */ 00703 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE)) 00704 00705 /** 00706 * @brief Disable the RTC WakeUp Timer peripheral. 00707 * @param __HANDLE__ specifies the RTC handle. 00708 * @retval None 00709 */ 00710 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE)) 00711 00712 /** 00713 * @brief Enable the RTC WakeUpTimer interrupt. 00714 * @param __HANDLE__ specifies the RTC handle. 00715 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled. 00716 * This parameter can be: 00717 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt 00718 * @retval None 00719 */ 00720 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) 00721 00722 /** 00723 * @brief Disable the RTC WakeUpTimer interrupt. 00724 * @param __HANDLE__ specifies the RTC handle. 00725 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be disabled. 00726 * This parameter can be: 00727 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt 00728 * @retval None 00729 */ 00730 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) 00731 00732 00733 /** 00734 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not. 00735 * @param __HANDLE__ specifies the RTC handle. 00736 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to check. 00737 * This parameter can be: 00738 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt 00739 * @retval None 00740 */ 00741 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00742 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->MISR) & ((__INTERRUPT__) >> 12)) != 0U) ? 1U : 0U) 00743 #else 00744 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__) >> 4)) != 0U) ? 1U : 0U) 00745 #endif 00746 00747 /** 00748 * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not. 00749 * @param __HANDLE__ specifies the RTC handle. 00750 * @param __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check. 00751 * This parameter can be: 00752 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt 00753 * @retval None 00754 */ 00755 #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != 0U) ? 1U : 0U) 00756 00757 /** 00758 * @brief Get the selected RTC WakeUpTimer's flag status. 00759 * @param __HANDLE__ specifies the RTC handle. 00760 * @param __FLAG__ specifies the RTC WakeUpTimer Flag is pending or not. 00761 * This parameter can be: 00762 * @arg @ref RTC_FLAG_WUTF 00763 * @arg @ref RTC_FLAG_WUTWF 00764 * @retval Flag status 00765 */ 00766 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00767 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__), (__FLAG__))) 00768 #else 00769 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U) 00770 #endif 00771 00772 /** 00773 * @brief Clear the RTC Wake Up timers pending flags. 00774 * @param __HANDLE__ specifies the RTC handle. 00775 * @param __FLAG__ specifies the RTC WakeUpTimer Flag to clear. 00776 * This parameter can be: 00777 * @arg @ref RTC_FLAG_WUTF 00778 * @retval None 00779 */ 00780 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00781 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_CLEAR_FLAG((__HANDLE__), RTC_CLEAR_WUTF)) 00782 #else 00783 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 00784 #endif 00785 00786 00787 /* WAKE-UP TIMER EXTI */ 00788 /* ------------------ */ 00789 /** 00790 * @brief Enable interrupt on the RTC WakeUp Timer associated Exti line. 00791 * @retval None 00792 */ 00793 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00794 00795 /** 00796 * @brief Disable interrupt on the RTC WakeUp Timer associated Exti line. 00797 * @retval None 00798 */ 00799 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 00800 00801 /** 00802 * @brief Enable event on the RTC WakeUp Timer associated Exti line. 00803 * @retval None 00804 */ 00805 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00806 00807 /** 00808 * @brief Disable event on the RTC WakeUp Timer associated Exti line. 00809 * @retval None 00810 */ 00811 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 00812 00813 /** 00814 * @brief Enable falling edge trigger on the RTC WakeUp Timer associated Exti line. 00815 * @retval None 00816 */ 00817 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00818 00819 /** 00820 * @brief Disable falling edge trigger on the RTC WakeUp Timer associated Exti line. 00821 * @retval None 00822 */ 00823 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 00824 00825 /** 00826 * @brief Enable rising edge trigger on the RTC WakeUp Timer associated Exti line. 00827 * @retval None 00828 */ 00829 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00830 00831 /** 00832 * @brief Disable rising edge trigger on the RTC WakeUp Timer associated Exti line. 00833 * @retval None 00834 */ 00835 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 00836 00837 /** 00838 * @brief Enable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line. 00839 * @retval None 00840 */ 00841 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() do { \ 00842 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE(); \ 00843 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE(); \ 00844 } while(0) 00845 00846 /** 00847 * @brief Disable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line. 00848 * This parameter can be: 00849 * @retval None 00850 */ 00851 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() do { \ 00852 __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE(); \ 00853 __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE(); \ 00854 } while(0) 00855 00856 /** 00857 * @brief Check whether the RTC WakeUp Timer associated Exti line interrupt flag is set or not. 00858 * @retval Line Status. 00859 */ 00860 #define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR1 & RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00861 00862 /** 00863 * @brief Clear the RTC WakeUp Timer associated Exti line flag. 00864 * @retval None 00865 */ 00866 #define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00867 00868 /** 00869 * @brief Generate a Software interrupt on the RTC WakeUp Timer associated Exti line. 00870 * @retval None 00871 */ 00872 #define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00873 00874 /** 00875 * @} 00876 */ 00877 00878 /* ---------------------------------TIMESTAMP---------------------------------*/ 00879 /** @defgroup RTCEx_Timestamp RTC Timestamp 00880 * @{ 00881 */ 00882 /** 00883 * @brief Enable the RTC TimeStamp peripheral. 00884 * @param __HANDLE__ specifies the RTC handle. 00885 * @retval None 00886 */ 00887 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE)) 00888 00889 /** 00890 * @brief Disable the RTC TimeStamp peripheral. 00891 * @param __HANDLE__ specifies the RTC handle. 00892 * @retval None 00893 */ 00894 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE)) 00895 00896 /** 00897 * @brief Enable the RTC TimeStamp interrupt. 00898 * @param __HANDLE__ specifies the RTC handle. 00899 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be enabled. 00900 * This parameter can be: 00901 * @arg @ref RTC_IT_TS TimeStamp interrupt 00902 * @retval None 00903 */ 00904 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) 00905 00906 /** 00907 * @brief Disable the RTC TimeStamp interrupt. 00908 * @param __HANDLE__ specifies the RTC handle. 00909 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be disabled. 00910 * This parameter can be: 00911 * @arg @ref RTC_IT_TS TimeStamp interrupt 00912 * @retval None 00913 */ 00914 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) 00915 00916 /** 00917 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not. 00918 * @param __HANDLE__ specifies the RTC handle. 00919 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to check. 00920 * This parameter can be: 00921 * @arg @ref RTC_IT_TS TimeStamp interrupt 00922 * @retval None 00923 */ 00924 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00925 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->MISR) & ((__INTERRUPT__) >> 12)) != 0U) ? 1U : 0U) 00926 #else 00927 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__) >> 4)) != 0U) ? 1U : 0U) 00928 #endif 00929 /** 00930 * @brief Check whether the specified RTC Time Stamp interrupt has been enabled or not. 00931 * @param __HANDLE__ specifies the RTC handle. 00932 * @param __INTERRUPT__ specifies the RTC Time Stamp interrupt source to check. 00933 * This parameter can be: 00934 * @arg @ref RTC_IT_TS TimeStamp interrupt 00935 * @retval None 00936 */ 00937 #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != 0U) ? 1U : 0U) 00938 00939 /** 00940 * @brief Get the selected RTC TimeStamp's flag status. 00941 * @param __HANDLE__ specifies the RTC handle. 00942 * @param __FLAG__ specifies the RTC TimeStamp Flag is pending or not. 00943 * This parameter can be: 00944 * @arg @ref RTC_FLAG_TSF 00945 * @arg @ref RTC_FLAG_TSOVF 00946 * @retval Flag status 00947 */ 00948 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00949 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__),(__FLAG__))) 00950 #else 00951 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U) 00952 #endif 00953 00954 /** 00955 * @brief Clear the RTC Time Stamps pending flags. 00956 * @param __HANDLE__ specifies the RTC handle. 00957 * @param __FLAG__ specifies the RTC TimeStamp Flag to clear. 00958 * This parameter can be: 00959 * @arg @ref RTC_FLAG_TSF 00960 * @arg @ref RTC_FLAG_TSOVF 00961 * @retval None 00962 */ 00963 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00964 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_CLEAR_FLAG((__HANDLE__), (__FLAG__))) 00965 #else 00966 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 00967 #endif 00968 00969 /** 00970 * @brief Enable the RTC internal TimeStamp peripheral. 00971 * @param __HANDLE__ specifies the RTC handle. 00972 * @retval None 00973 */ 00974 #define __HAL_RTC_INTERNAL_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ITSE)) 00975 00976 /** 00977 * @brief Disable the RTC internal TimeStamp peripheral. 00978 * @param __HANDLE__ specifies the RTC handle. 00979 * @retval None 00980 */ 00981 #define __HAL_RTC_INTERNAL_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ITSE)) 00982 00983 /** 00984 * @brief Get the selected RTC Internal Time Stamps flag status. 00985 * @param __HANDLE__ specifies the RTC handle. 00986 * @param __FLAG__ specifies the RTC Internal Time Stamp Flag is pending or not. 00987 * This parameter can be: 00988 * @arg @ref RTC_FLAG_ITSF 00989 * @retval None 00990 */ 00991 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00992 #define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__),(__FLAG__))) 00993 #else 00994 #define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U) 00995 #endif 00996 00997 /** 00998 * @brief Clear the RTC Internal Time Stamps pending flags. 00999 * @param __HANDLE__ specifies the RTC handle. 01000 * @param __FLAG__ specifies the RTC Internal Time Stamp Flag source to clear. 01001 * This parameter can be: 01002 * @arg @ref RTC_FLAG_ITSF 01003 * @retval None 01004 */ 01005 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01006 #define __HAL_RTC_INTERNAL_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_CLEAR_FLAG((__HANDLE__), RTC_CLEAR_ITSF)) 01007 #else 01008 #define __HAL_RTC_INTERNAL_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 01009 #endif 01010 01011 01012 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01013 /** 01014 * @brief Enable the RTC TimeStamp on Tamper detection. 01015 * @param __HANDLE__ specifies the RTC handle. 01016 * @retval None 01017 */ 01018 #define __HAL_RTC_TAMPTS_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TAMPTS)) 01019 01020 /** 01021 * @brief Disable the RTC TimeStamp on Tamper detection. 01022 * @param __HANDLE__ specifies the RTC handle. 01023 * @retval None 01024 */ 01025 #define __HAL_RTC_TAMPTS_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TAMPTS)) 01026 01027 /** 01028 * @brief Enable the RTC Tamper detection output. 01029 * @param __HANDLE__ specifies the RTC handle. 01030 * @retval None 01031 */ 01032 #define __HAL_RTC_TAMPOE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TAMPOE)) 01033 01034 /** 01035 * @brief Disable the RTC Tamper detection output. 01036 * @param __HANDLE__ specifies the RTC handle. 01037 * @retval None 01038 */ 01039 #define __HAL_RTC_TAMPOE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TAMPOE)) 01040 01041 01042 /** 01043 * @} 01044 */ 01045 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 01046 01047 /* ------------------------------Calibration----------------------------------*/ 01048 /** @defgroup RTCEx_Calibration RTC Calibration 01049 * @{ 01050 */ 01051 01052 /** 01053 * @brief Enable the RTC calibration output. 01054 * @param __HANDLE__ specifies the RTC handle. 01055 * @retval None 01056 */ 01057 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE)) 01058 01059 /** 01060 * @brief Disable the calibration output. 01061 * @param __HANDLE__ specifies the RTC handle. 01062 * @retval None 01063 */ 01064 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE)) 01065 01066 /** 01067 * @brief Enable the clock reference detection. 01068 * @param __HANDLE__ specifies the RTC handle. 01069 * @retval None 01070 */ 01071 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON)) 01072 01073 /** 01074 * @brief Disable the clock reference detection. 01075 * @param __HANDLE__ specifies the RTC handle. 01076 * @retval None 01077 */ 01078 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON)) 01079 01080 /** 01081 * @brief Get the selected RTC shift operation's flag status. 01082 * @param __HANDLE__ specifies the RTC handle. 01083 * @param __FLAG__ specifies the RTC shift operation Flag is pending or not. 01084 * This parameter can be: 01085 * @arg @ref RTC_FLAG_SHPF 01086 * @retval None 01087 */ 01088 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01089 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__), (__FLAG__))) 01090 #else 01091 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U) 01092 #endif 01093 01094 /** 01095 * @} 01096 */ 01097 01098 01099 /* ------------------------------Tamper----------------------------------*/ 01100 /** @defgroup RTCEx_Tamper RTCEx tamper 01101 * @{ 01102 */ 01103 #if defined(RTC_TAMPER1_SUPPORT) 01104 /** 01105 * @brief Enable the RTC Tamper1 input detection. 01106 * @param __HANDLE__ specifies the RTC handle. 01107 * @retval None 01108 */ 01109 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01110 #define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->CR1 |= (TAMP_CR1_TAMP1E)) 01111 #else 01112 #define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP1E)) 01113 #endif 01114 01115 /** 01116 * @brief Disable the RTC Tamper1 input detection. 01117 * @param __HANDLE__ specifies the RTC handle. 01118 * @retval None 01119 */ 01120 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01121 #define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->CR1 &= ~(RTC_TAMPCR_TAMP1E)) 01122 #else 01123 #define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP1E)) 01124 #endif 01125 #endif /* RTC_TAMPER1_SUPPORT */ 01126 01127 /** 01128 * @brief Enable the RTC Tamper2 input detection. 01129 * @param __HANDLE__ specifies the RTC handle. 01130 * @retval None 01131 */ 01132 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01133 #define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->CR1 |= (TAMP_CR1_TAMP2E)) 01134 #else 01135 #define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP2E)) 01136 #endif 01137 01138 /** 01139 * @brief Disable the RTC Tamper2 input detection. 01140 * @param __HANDLE__ specifies the RTC handle. 01141 * @retval None 01142 */ 01143 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01144 #define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->CR1 &= ~(RTC_TAMPCR_TAMP2E)) 01145 #else 01146 #define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP2E)) 01147 #endif 01148 01149 #if defined(RTC_TAMPER3_SUPPORT) 01150 /** 01151 * @brief Enable the RTC Tamper3 input detection. 01152 * @param __HANDLE__ specifies the RTC handle. 01153 * @retval None 01154 */ 01155 #define __HAL_RTC_TAMPER3_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP3E)) 01156 01157 /** 01158 * @brief Disable the RTC Tamper3 input detection. 01159 * @param __HANDLE__ specifies the RTC handle. 01160 * @retval None 01161 */ 01162 #define __HAL_RTC_TAMPER3_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP3E)) 01163 #endif /* RTC_TAMPER3_SUPPORT */ 01164 01165 /**************************************************************************************************/ 01166 /** 01167 * @brief Enable the TAMP Tamper interrupt. 01168 * @param __HANDLE__ specifies the RTC handle. 01169 * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be enabled. 01170 * This parameter can be any combination of the following values: 01171 * @arg RTC_IT_TAMPALL: All tampers interrupts 01172 * @arg RTC_IT_TAMP1: Tamper1 interrupt 01173 * @arg RTC_IT_TAMP2: Tamper2 interrupt 01174 * @arg RTC_IT_TAMP3: Tamper3 interrupt 01175 * @retval None 01176 */ 01177 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01178 #define __HAL_RTC_TAMPER_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->IER |= (__INTERRUPT__)) 01179 #else 01180 #define __HAL_RTC_TAMPER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->TAMPCR |= (__INTERRUPT__)) 01181 #endif 01182 /** 01183 * @brief Disable the TAMP Tamper interrupt. 01184 * @param __HANDLE__ specifies the RTC handle. 01185 * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be disabled. 01186 * This parameter can be any combination of the following values: 01187 * @arg RTC_IT_TAMPALL: All tampers interrupts 01188 * @arg RTC_IT_TAMP1: Tamper1 interrupt 01189 * @arg RTC_IT_TAMP2: Tamper2 interrupt 01190 * @arg RTC_IT_TAMP3: Tamper3 interrupt 01191 * @retval None 01192 */ 01193 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01194 #define __HAL_RTC_TAMPER_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->IER &= ~(__INTERRUPT__)) 01195 #else 01196 #define __HAL_RTC_TAMPER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->TAMPCR &= ~(__INTERRUPT__)) 01197 #endif 01198 01199 01200 /**************************************************************************************************/ 01201 /** 01202 * @brief Check whether the specified RTC Tamper interrupt has occurred or not. 01203 * @param __HANDLE__ specifies the RTC handle. 01204 * @param __INTERRUPT__ specifies the RTC Tamper interrupt to check. 01205 * This parameter can be: 01206 * @arg RTC_IT_TAMPALL: All tampers interrupts 01207 * @arg RTC_IT_TAMP1: Tamper1 interrupt 01208 * @arg RTC_IT_TAMP2: Tamper2 interrupt 01209 * @arg RTC_IT_TAMP3: Tamper3 interrupt 01210 * @retval None 01211 */ 01212 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01213 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) ((((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->MISR) & (__INTERRUPT__)) != 0U) ? 1U : 0U) 01214 #else /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 01215 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & (__INTERRUPT__)) != 0U) ? 1U : 0U) 01216 #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 01217 /** 01218 * @brief Check whether the specified RTC Tamper interrupt has been enabled or not. 01219 * @param __HANDLE__ specifies the RTC handle. 01220 * @param __INTERRUPT__ specifies the RTC Tamper interrupt source to check. 01221 * This parameter can be: 01222 * @arg RTC_IT_TAMPALL: All tampers interrupts 01223 * @arg RTC_IT_TAMP1: Tamper1 interrupt 01224 * @arg RTC_IT_TAMP2: Tamper2 interrupt 01225 * @arg RTC_IT_TAMP3: Tamper3 interrupt 01226 * @retval None 01227 */ 01228 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01229 #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->IER) & (__INTERRUPT__)) != 0U) ? 1U : 0U) 01230 #else 01231 #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->TAMPCR) & (__INTERRUPT__)) != 0U) ? 1U : 0U) 01232 #endif 01233 01234 /** 01235 * @brief Get the selected RTC Tamper's flag status. 01236 * @param __HANDLE__ specifies the RTC handle. 01237 * @param __FLAG__ specifies the RTC Tamper Flag is pending or not. 01238 * This parameter can be: 01239 * @arg RTC_FLAG_TAMP1F: Tamper1 flag 01240 * @arg RTC_FLAG_TAMP2F: Tamper2 flag 01241 * @arg RTC_FLAG_TAMP3F: Tamper3 flag 01242 * @retval None 01243 */ 01244 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01245 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->SR) & (__FLAG__)) != 0U) 01246 #else 01247 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U) 01248 #endif 01249 /** 01250 * @brief Clear the RTC Tamper's pending flags. 01251 * @param __HANDLE__ specifies the RTC handle. 01252 * @param __FLAG__ specifies the RTC Tamper Flag to clear. 01253 * This parameter can be: 01254 * @arg RTC_FLAG_TAMP1F: Tamper1 flag 01255 * @arg RTC_FLAG_TAMP2F: Tamper2 flag 01256 * @arg RTC_FLAG_TAMP3F: Tamper3 flag 01257 * @retval None 01258 */ 01259 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01260 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->SCR) = (__FLAG__)) 01261 #else 01262 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 01263 #endif 01264 01265 /** 01266 * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line. 01267 * @retval None 01268 */ 01269 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 01270 01271 /** 01272 * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line. 01273 * @retval None 01274 */ 01275 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 01276 01277 /** 01278 * @brief Enable event on the RTC Tamper and Timestamp associated Exti line. 01279 * @retval None 01280 */ 01281 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 01282 01283 /** 01284 * @brief Disable event on the RTC Tamper and Timestamp associated Exti line. 01285 * @retval None 01286 */ 01287 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 01288 01289 /** 01290 * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 01291 * @retval None 01292 */ 01293 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 01294 01295 /** 01296 * @brief Disable falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 01297 * @retval None 01298 */ 01299 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 01300 01301 /** 01302 * @brief Enable rising edge trigger on the RTC Tamper and Timestamp associated Exti line. 01303 * @retval None 01304 */ 01305 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 01306 01307 /** 01308 * @brief Disable rising edge trigger on the RTC Tamper and Timestamp associated Exti line. 01309 * @retval None 01310 */ 01311 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 01312 01313 /** 01314 * @brief Enable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 01315 * @retval None 01316 */ 01317 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_FALLING_EDGE() do { \ 01318 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE(); \ 01319 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE(); \ 01320 } while(0) 01321 01322 /** 01323 * @brief Disable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 01324 * @retval None 01325 */ 01326 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_FALLING_EDGE() do { \ 01327 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE(); \ 01328 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE(); \ 01329 } while(0) 01330 01331 /** 01332 * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not. 01333 * @retval Line Status. 01334 */ 01335 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI->PR1 & RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 01336 01337 /** 01338 * @brief Clear the RTC Tamper and Timestamp associated Exti line flag. 01339 * @retval None 01340 */ 01341 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 01342 01343 /** 01344 * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line 01345 * @retval None 01346 */ 01347 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT() (EXTI->SWIER1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 01348 01349 /** 01350 * @} 01351 */ 01352 01353 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01354 /* --------------------------------- SSR Underflow ---------------------------------*/ 01355 /** @defgroup RTCEx_SSR_Underflow RTC SSR Underflow 01356 * @{ 01357 */ 01358 01359 /** 01360 * @brief Enable the RTC SSRU interrupt. 01361 * @param __HANDLE__ specifies the RTC handle. 01362 * @param __INTERRUPT__ specifies the RTC SSRU interrupt sources to be enabled. 01363 * This parameter can be: 01364 * @arg @ref RTC_IT_SSRU SSRU interrupt 01365 * @retval None 01366 */ 01367 #define __HAL_RTC_SSRU_ENABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR |= (__INTERRUPT__)) 01368 01369 /** 01370 * @brief Disable the RTC SSRU interrupt. 01371 * @param __HANDLE__ specifies the RTC handle. 01372 * @param __INTERRUPT__ specifies the RTC SSRU interrupt sources to be disabled. 01373 * This parameter can be: 01374 * @arg @ref RTC_IT_SSRU SSRU interrupt 01375 * @retval None 01376 */ 01377 #define __HAL_RTC_SSRU_DISABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR &= ~(__INTERRUPT__)) 01378 01379 01380 /** 01381 * @brief Check whether the specified RTC SSRU interrupt has occurred or not. 01382 * @param __HANDLE__ specifies the RTC handle. 01383 * @param __INTERRUPT__ specifies the RTC SSRU interrupt to check. 01384 * This parameter can be: 01385 * @arg @ref RTC_IT_SSRU SSRU interrupt 01386 * @retval None 01387 */ 01388 #define __HAL_RTC_SSRU_GET_IT(__HANDLE__, __INTERRUPT__) ((((RTC->MISR) & ((__INTERRUPT__) >> 1) != 0U) ? 1U : 0U) 01389 /** 01390 * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not. 01391 * @param __HANDLE__ specifies the RTC handle. 01392 * @param __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check. 01393 * This parameter can be: 01394 * @arg @ref RTC_IT_SSRU SSRU interrupt 01395 * @retval None 01396 */ 01397 #define __HAL_RTC_SSRU_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((RTC->CR) & (__INTERRUPT__)) != 0U) ? 1U : 0U) 01398 01399 /** 01400 * @brief Get the selected RTC SSRU's flag status. 01401 * @param __HANDLE__ specifies the RTC handle. 01402 * @param __FLAG__ specifies the RTC SSRU Flag is pending or not. 01403 * This parameter can be: 01404 * @arg @ref RTC_FLAG_SSRUF 01405 * @arg @ref RTC_FLAG_SSRUWF 01406 * @retval None 01407 */ 01408 #define __HAL_RTC_SSRU_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__), (__FLAG__))) 01409 01410 /** 01411 * @brief Clear the RTC Wake Up timer's pending flags. 01412 * @param __HANDLE__ specifies the RTC handle. 01413 * @param __FLAG__ specifies the RTC SSRU Flag to clear. 01414 * This parameter can be: 01415 * @arg @ref RTC_FLAG_SSRUF 01416 * @retval None 01417 */ 01418 #define __HAL_RTC_SSRU_CLEAR_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_CLEAR_FLAG((__HANDLE__), RTC_CLEAR_SSRUF)) 01419 01420 /* WAKE-UP TIMER EXTI */ 01421 /* ------------------ */ 01422 /** 01423 * @brief Enable interrupt on the RTC SSR Underflow associated Exti line. 01424 * @retval None 01425 */ 01426 #define __HAL_RTC_SSRU_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_SSRU_EVENT) 01427 01428 /** 01429 * @brief Disable interrupt on the RTC SSR Underflow associated Exti line. 01430 * @retval None 01431 */ 01432 #define __HAL_RTC_SSRU_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_SSRU_EVENT)) 01433 01434 /** 01435 * @brief Enable event on the RTC SSR Underflow associated Exti line. 01436 * @retval None 01437 */ 01438 #define __HAL_RTC_SSRU_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_SSRU_EVENT) 01439 01440 /** 01441 * @brief Disable event on the RTC SSR Underflow associated Exti line. 01442 * @retval None 01443 */ 01444 #define __HAL_RTC_SSRU_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_SSRU_EVENT)) 01445 01446 /** 01447 * @} 01448 */ 01449 01450 #endif /* #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 01451 01452 /** 01453 * @} 01454 */ 01455 01456 /* Exported functions --------------------------------------------------------*/ 01457 01458 /** @defgroup RTCEx_Exported_Functions RTCEx Exported Functions 01459 * @{ 01460 */ 01461 01462 /* ========================================================================== */ 01463 /* ##### RTC TimeStamp exported functions ##### */ 01464 /* ========================================================================== */ 01465 01466 /* RTC TimeStamp functions ****************************************************/ 01467 01468 /** @defgroup RTCEx_Exported_Functions_Group1 Extended RTC TimeStamp functions 01469 * @{ 01470 */ 01471 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin); 01472 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin); 01473 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc); 01474 HAL_StatusTypeDef HAL_RTCEx_SetInternalTimeStamp(RTC_HandleTypeDef *hrtc); 01475 HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTimeStamp(RTC_HandleTypeDef *hrtc); 01476 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format); 01477 void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc); 01478 void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc); 01479 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 01480 /** 01481 * @} 01482 */ 01483 01484 /* ========================================================================== */ 01485 /* ##### RTC Wake-up exported functions ##### */ 01486 /* ========================================================================== */ 01487 01488 /* RTC Wake-up functions ******************************************************/ 01489 01490 /** @defgroup RTCEx_Exported_Functions_Group2 Extended RTC Wake-up functions 01491 * @{ 01492 */ 01493 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); 01494 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01495 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock, uint32_t WakeUpAutoClr); 01496 #else 01497 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); 01498 #endif 01499 HAL_StatusTypeDef HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc); 01500 uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc); 01501 void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc); 01502 void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc); 01503 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 01504 /** 01505 * @} 01506 */ 01507 01508 /* ========================================================================== */ 01509 /* ##### Extended RTC Peripheral Control exported functions ##### */ 01510 /* ========================================================================== */ 01511 01512 /* Extended RTC Peripheral Control functions **********************************/ 01513 01514 /** @defgroup RTCEx_Exported_Functions_Group3 Extended Peripheral Control functions 01515 * @{ 01516 */ 01517 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue); 01518 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01519 HAL_StatusTypeDef HAL_RTCEx_SetLowPowerCalib(RTC_HandleTypeDef *hrtc, uint32_t LowPowerCalib); 01520 #endif 01521 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS); 01522 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput); 01523 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc); 01524 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc); 01525 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc); 01526 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc); 01527 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc); 01528 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01529 HAL_StatusTypeDef HAL_RTCEx_SetSSRU_IT(RTC_HandleTypeDef *hrtc); 01530 HAL_StatusTypeDef HAL_RTCEx_DeactivateSSRU(RTC_HandleTypeDef *hrtc); 01531 void HAL_RTCEx_SSRUIRQHandler(RTC_HandleTypeDef *hrtc); 01532 void HAL_RTCEx_SSRUEventCallback(RTC_HandleTypeDef *hrtc); 01533 #endif 01534 /** 01535 * @} 01536 */ 01537 01538 /* Extended RTC features functions *******************************************/ 01539 /** @defgroup RTCEx_Exported_Functions_Group4 Extended features functions 01540 * @{ 01541 */ 01542 01543 void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc); 01544 HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 01545 /** 01546 * @} 01547 */ 01548 01549 /** @defgroup RTCEx_Exported_Functions_Group5 Extended RTC Tamper functions 01550 * @{ 01551 */ 01552 HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper); 01553 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper); 01554 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper); 01555 01556 #if defined(RTC_TAMPER1_SUPPORT) 01557 HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 01558 #endif /* RTC_TAMPER1_SUPPORT */ 01559 HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 01560 #if defined(RTC_TAMPER3_SUPPORT) 01561 HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 01562 #endif /* RTC_TAMPER3_SUPPORT */ 01563 01564 #if defined(RTC_TAMPER1_SUPPORT) 01565 void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc); 01566 #endif /* RTC_TAMPER1_SUPPORT */ 01567 void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc); 01568 #if defined(RTC_TAMPER3_SUPPORT) 01569 void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc); 01570 #endif /* RTC_TAMPER3_SUPPORT */ 01571 01572 01573 /** 01574 * @} 01575 */ 01576 01577 /** @defgroup RTCEx_Exported_Functions_Group6 Extended RTC Backup register functions 01578 * @{ 01579 */ 01580 void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data); 01581 uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister); 01582 /** 01583 * @} 01584 */ 01585 01586 /** 01587 * @} 01588 */ 01589 01590 /* Private types -------------------------------------------------------------*/ 01591 /* Private variables ---------------------------------------------------------*/ 01592 /* Private constants ---------------------------------------------------------*/ 01593 /** @defgroup RTCEx_Private_Constants RTCEx Private Constants 01594 * @{ 01595 */ 01596 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01597 #define RTC_EXTI_LINE_SSRU_EVENT EXTI_IMR1_IM18 /*!< External interrupt line 18 Connected to the RTC SSR Underflow event */ 01598 #endif 01599 01600 #define RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT EXTI_IMR1_IM19 /*!< External interrupt line 19 Connected to the RTC Tamper and Time Stamp events */ 01601 01602 #define RTC_EXTI_LINE_WAKEUPTIMER_EVENT EXTI_IMR1_IM20 /*!< External interrupt line 20 Connected to the RTC Wakeup event */ 01603 01604 /** 01605 * @} 01606 */ 01607 01608 /* Private macros ------------------------------------------------------------*/ 01609 /** @defgroup RTCEx_Private_Macros RTCEx Private Macros 01610 * @{ 01611 */ 01612 01613 /** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters 01614 * @{ 01615 */ 01616 #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \ 01617 ((EDGE) == RTC_TIMESTAMPEDGE_FALLING)) 01618 01619 #define IS_RTC_TAMPER_INTERRUPT(INTERRUPT) ((((INTERRUPT) & (uint32_t)0xFFB6FFFB) == 0x00) && ((INTERRUPT) != 0U)) 01620 01621 #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_DEFAULT)) 01622 01623 #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \ 01624 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \ 01625 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \ 01626 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \ 01627 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \ 01628 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS)) 01629 01630 #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= RTC_WUTR_WUT) 01631 01632 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \ 01633 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \ 01634 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC)) 01635 01636 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \ 01637 ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET)) 01638 01639 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= RTC_CALR_CALM) 01640 01641 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01642 #define IS_RTC_LOW_POWER_CALIB(LPCAL) (((LPCAL) == RTC_LPCAL_SET) || \ 01643 ((LPCAL) == RTC_LPCAL_RESET)) 01644 #endif 01645 01646 #if defined(STM32L412xx) || defined(STM32L422xx) || defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01647 #define IS_RTC_TAMPER(__TAMPER__) ((((__TAMPER__) & RTC_TAMPER_ALL) != 0x00U) && \ 01648 (((__TAMPER__) & ~RTC_TAMPER_ALL) == 0x00U)) 01649 #else 01650 #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & (uint32_t)0xFFFFFFD6) == 0x00) && ((TAMPER) != 0U)) 01651 #endif 01652 01653 01654 #define IS_RTC_TAMPER_TRIGGER(__TRIGGER__) (((__TRIGGER__) == RTC_TAMPERTRIGGER_RISINGEDGE) || \ 01655 ((__TRIGGER__) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \ 01656 ((__TRIGGER__) == RTC_TAMPERTRIGGER_LOWLEVEL) || \ 01657 ((__TRIGGER__) == RTC_TAMPERTRIGGER_HIGHLEVEL)) 01658 01659 #define IS_RTC_TAMPER_ERASE_MODE(__MODE__) (((__MODE__) == RTC_TAMPER_ERASE_BACKUP_ENABLE) || \ 01660 ((__MODE__) == RTC_TAMPER_ERASE_BACKUP_DISABLE)) 01661 01662 #define IS_RTC_TAMPER_MASKFLAG_STATE(__STATE__) (((__STATE__) == RTC_TAMPERMASK_FLAG_ENABLE) || \ 01663 ((__STATE__) == RTC_TAMPERMASK_FLAG_DISABLE)) 01664 01665 #define IS_RTC_TAMPER_FILTER(__FILTER__) (((__FILTER__) == RTC_TAMPERFILTER_DISABLE) || \ 01666 ((__FILTER__) == RTC_TAMPERFILTER_2SAMPLE) || \ 01667 ((__FILTER__) == RTC_TAMPERFILTER_4SAMPLE) || \ 01668 ((__FILTER__) == RTC_TAMPERFILTER_8SAMPLE)) 01669 01670 #define IS_RTC_TAMPER_SAMPLING_FREQ(__FREQ__) (((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \ 01671 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \ 01672 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \ 01673 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \ 01674 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \ 01675 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \ 01676 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \ 01677 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256)) 01678 01679 #define IS_RTC_TAMPER_PRECHARGE_DURATION(__DURATION__) (((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \ 01680 ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \ 01681 ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \ 01682 ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK)) 01683 01684 #define IS_RTC_TAMPER_PULLUP_STATE(__STATE__) (((__STATE__) == RTC_TAMPER_PULLUP_ENABLE) || \ 01685 ((__STATE__) == RTC_TAMPER_PULLUP_DISABLE)) 01686 01687 #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \ 01688 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE)) 01689 01690 #define IS_RTC_BKP(__BKP__) ((__BKP__) < RTC_BKP_NUMBER) 01691 01692 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \ 01693 ((SEL) == RTC_SHIFTADD1S_SET)) 01694 01695 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= RTC_SHIFTR_SUBFS) 01696 01697 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \ 01698 ((OUTPUT) == RTC_CALIBOUTPUT_1HZ)) 01699 01700 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 01701 #define IS_RTC_BINARY_MODE(MODE) (((MODE) == RTC_BINARY_NONE) || \ 01702 ((MODE) == RTC_BINARY_ONLY) || \ 01703 ((MODE) == RTC_BINARY_MIX )) 01704 01705 #define IS_RTC_BINARY_MIX_BCDU(BDCU) (((BDCU) == RTC_BINARY_MIX_BCDU_0) || \ 01706 ((BDCU) == RTC_BINARY_MIX_BCDU_1) || \ 01707 ((BDCU) == RTC_BINARY_MIX_BCDU_2) || \ 01708 ((BDCU) == RTC_BINARY_MIX_BCDU_3) || \ 01709 ((BDCU) == RTC_BINARY_MIX_BCDU_4) || \ 01710 ((BDCU) == RTC_BINARY_MIX_BCDU_5) || \ 01711 ((BDCU) == RTC_BINARY_MIX_BCDU_6) || \ 01712 ((BDCU) == RTC_BINARY_MIX_BCDU_7)) 01713 01714 #define IS_RTC_ALARM_SUB_SECOND_BINARY_MASK(MASK) (((MASK) == 0u) || \ 01715 (((MASK) >= RTC_ALARMSUBSECONDBINMASK_SS31_1) && ((MASK) <= RTC_ALARMSUBSECONDBINMASK_NONE))) 01716 01717 #define IS_RTC_ALARMSUBSECONDBIN_AUTOCLR(SEL) (((SEL) == RTC_ALARMSUBSECONDBIN_AUTOCLR_NO) || \ 01718 ((SEL) == RTC_ALARMSUBSECONDBIN_AUTOCLR_YES)) 01719 #endif /* #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) */ 01720 /** 01721 * @} 01722 */ 01723 01724 /** 01725 * @} 01726 */ 01727 01728 /** 01729 * @} 01730 */ 01731 01732 /** 01733 * @} 01734 */ 01735 01736 #ifdef __cplusplus 01737 } 01738 #endif /* __cplusplus */ 01739 01740 #endif /* STM32L4xx_HAL_RTC_EX_H */