Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
stm32l4xx_hal_rtc_ex.h
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_hal_rtc_ex.h 00004 * @author MCD Application Team 00005 * @version V1.5.1 00006 * @date 31-May-2016 00007 * @brief Header file of RTC HAL Extended module. 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> 00012 * 00013 * Redistribution and use in source and binary forms, with or without modification, 00014 * are permitted provided that the following conditions are met: 00015 * 1. Redistributions of source code must retain the above copyright notice, 00016 * this list of conditions and the following disclaimer. 00017 * 2. Redistributions in binary form must reproduce the above copyright notice, 00018 * this list of conditions and the following disclaimer in the documentation 00019 * and/or other materials provided with the distribution. 00020 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00021 * may be used to endorse or promote products derived from this software 00022 * without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00025 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00026 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00028 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00029 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00030 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00032 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 ****************************************************************************** 00036 */ 00037 00038 /* Define to prevent recursive inclusion -------------------------------------*/ 00039 #ifndef __STM32L4xx_HAL_RTC_EX_H 00040 #define __STM32L4xx_HAL_RTC_EX_H 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 00046 /* Includes ------------------------------------------------------------------*/ 00047 #include "stm32l4xx_hal_def.h" 00048 00049 /** @addtogroup STM32L4xx_HAL_Driver 00050 * @{ 00051 */ 00052 00053 /** @addtogroup RTCEx 00054 * @{ 00055 */ 00056 00057 /* Exported types ------------------------------------------------------------*/ 00058 /** @defgroup RTCEx_Exported_Types RTCEx Exported Types 00059 * @{ 00060 */ 00061 /** 00062 * @brief RTC Tamper structure definition 00063 */ 00064 typedef struct 00065 { 00066 uint32_t Tamper; /*!< Specifies the Tamper Pin. 00067 This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */ 00068 00069 uint32_t Interrupt; /*!< Specifies the Tamper Interrupt. 00070 This parameter can be a value of @ref RTCEx_Tamper_Interrupt_Definitions */ 00071 00072 uint32_t Trigger; /*!< Specifies the Tamper Trigger. 00073 This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */ 00074 00075 uint32_t NoErase; /*!< Specifies the Tamper no erase mode. 00076 This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp_Definitions */ 00077 00078 uint32_t MaskFlag; /*!< Specifies the Tamper Flag masking. 00079 This parameter can be a value of @ref RTCEx_Tamper_MaskFlag_Definitions */ 00080 00081 uint32_t Filter; /*!< Specifies the RTC Filter Tamper. 00082 This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */ 00083 00084 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency. 00085 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */ 00086 00087 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration . 00088 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */ 00089 00090 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp . 00091 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */ 00092 00093 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection. 00094 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */ 00095 }RTC_TamperTypeDef; 00096 00097 /** 00098 * @} 00099 */ 00100 00101 /* Exported constants --------------------------------------------------------*/ 00102 /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants 00103 * @{ 00104 */ 00105 00106 /** @defgroup RTCEx_Output_selection_Definitions RTC Output Selection Definitions 00107 * @{ 00108 */ 00109 #define RTC_OUTPUT_DISABLE ((uint32_t)0x00000000) 00110 #define RTC_OUTPUT_ALARMA ((uint32_t)0x00200000) 00111 #define RTC_OUTPUT_ALARMB ((uint32_t)0x00400000) 00112 #define RTC_OUTPUT_WAKEUP ((uint32_t)0x00600000) 00113 /** 00114 * @} 00115 */ 00116 00117 /** @defgroup RTCEx_Backup_Registers_Definitions RTC Backup Registers Definitions 00118 * @{ 00119 */ 00120 #define RTC_BKP_DR0 ((uint32_t)0x00000000) 00121 #define RTC_BKP_DR1 ((uint32_t)0x00000001) 00122 #define RTC_BKP_DR2 ((uint32_t)0x00000002) 00123 #define RTC_BKP_DR3 ((uint32_t)0x00000003) 00124 #define RTC_BKP_DR4 ((uint32_t)0x00000004) 00125 #define RTC_BKP_DR5 ((uint32_t)0x00000005) 00126 #define RTC_BKP_DR6 ((uint32_t)0x00000006) 00127 #define RTC_BKP_DR7 ((uint32_t)0x00000007) 00128 #define RTC_BKP_DR8 ((uint32_t)0x00000008) 00129 #define RTC_BKP_DR9 ((uint32_t)0x00000009) 00130 #define RTC_BKP_DR10 ((uint32_t)0x0000000A) 00131 #define RTC_BKP_DR11 ((uint32_t)0x0000000B) 00132 #define RTC_BKP_DR12 ((uint32_t)0x0000000C) 00133 #define RTC_BKP_DR13 ((uint32_t)0x0000000D) 00134 #define RTC_BKP_DR14 ((uint32_t)0x0000000E) 00135 #define RTC_BKP_DR15 ((uint32_t)0x0000000F) 00136 #define RTC_BKP_DR16 ((uint32_t)0x00000010) 00137 #define RTC_BKP_DR17 ((uint32_t)0x00000011) 00138 #define RTC_BKP_DR18 ((uint32_t)0x00000012) 00139 #define RTC_BKP_DR19 ((uint32_t)0x00000013) 00140 #define RTC_BKP_DR20 ((uint32_t)0x00000014) 00141 #define RTC_BKP_DR21 ((uint32_t)0x00000015) 00142 #define RTC_BKP_DR22 ((uint32_t)0x00000016) 00143 #define RTC_BKP_DR23 ((uint32_t)0x00000017) 00144 #define RTC_BKP_DR24 ((uint32_t)0x00000018) 00145 #define RTC_BKP_DR25 ((uint32_t)0x00000019) 00146 #define RTC_BKP_DR26 ((uint32_t)0x0000001A) 00147 #define RTC_BKP_DR27 ((uint32_t)0x0000001B) 00148 #define RTC_BKP_DR28 ((uint32_t)0x0000001C) 00149 #define RTC_BKP_DR29 ((uint32_t)0x0000001D) 00150 #define RTC_BKP_DR30 ((uint32_t)0x0000001E) 00151 #define RTC_BKP_DR31 ((uint32_t)0x0000001F) 00152 /** 00153 * @} 00154 */ 00155 00156 /** @defgroup RTCEx_TimeStamp_Edges_definitions RTC TimeStamp Edges Definitions 00157 * @{ 00158 */ 00159 #define RTC_TIMESTAMPEDGE_RISING ((uint32_t)0x00000000) 00160 #define RTC_TIMESTAMPEDGE_FALLING ((uint32_t)0x00000008) 00161 /** 00162 * @} 00163 */ 00164 00165 /** @defgroup RTCEx_TimeStamp_Pin_Selection RTC TimeStamp Pins Selection 00166 * @{ 00167 */ 00168 #define RTC_TIMESTAMPPIN_DEFAULT ((uint32_t)0x00000000) 00169 /** 00170 * @} 00171 */ 00172 00173 /** @defgroup RTCEx_Tamper_Pins_Definitions RTC Tamper Pins Definitions 00174 * @{ 00175 */ 00176 #if defined(RTC_TAMPER1_SUPPORT) 00177 #define RTC_TAMPER_1 RTC_TAMPCR_TAMP1E 00178 #endif /* RTC_TAMPER1_SUPPORT */ 00179 #define RTC_TAMPER_2 RTC_TAMPCR_TAMP2E 00180 #if defined(RTC_TAMPER3_SUPPORT) 00181 #define RTC_TAMPER_3 RTC_TAMPCR_TAMP3E 00182 #endif /* RTC_TAMPER3_SUPPORT */ 00183 /** 00184 * @} 00185 */ 00186 00187 /** @defgroup RTCEx_Tamper_Interrupt_Definitions RTC Tamper Interrupts Definitions 00188 * @{ 00189 */ 00190 #if defined(RTC_TAMPER1_SUPPORT) 00191 #define RTC_TAMPER1_INTERRUPT RTC_TAMPCR_TAMP1IE 00192 #endif /* RTC_TAMPER1_SUPPORT */ 00193 #define RTC_TAMPER2_INTERRUPT RTC_TAMPCR_TAMP2IE 00194 #if defined(RTC_TAMPER3_SUPPORT) 00195 #define RTC_TAMPER3_INTERRUPT RTC_TAMPCR_TAMP3IE 00196 #endif /* RTC_TAMPER3_SUPPORT */ 00197 #define RTC_ALL_TAMPER_INTERRUPT RTC_TAMPCR_TAMPIE 00198 /** 00199 * @} 00200 */ 00201 00202 /** @defgroup RTCEx_Tamper_Trigger_Definitions RTC Tamper Triggers Definitions 00203 * @{ 00204 */ 00205 #define RTC_TAMPERTRIGGER_RISINGEDGE ((uint32_t)0x00000000) 00206 #define RTC_TAMPERTRIGGER_FALLINGEDGE ((uint32_t)0x00000002) 00207 #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE 00208 #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE 00209 /** 00210 * @} 00211 */ 00212 00213 /** @defgroup RTCEx_Tamper_EraseBackUp_Definitions RTC Tamper EraseBackUp Definitions 00214 * @{ 00215 */ 00216 #define RTC_TAMPER_ERASE_BACKUP_ENABLE ((uint32_t)0x00000000) 00217 #define RTC_TAMPER_ERASE_BACKUP_DISABLE ((uint32_t)0x00020000) 00218 /** 00219 * @} 00220 */ 00221 00222 /** @defgroup RTCEx_Tamper_MaskFlag_Definitions RTC Tamper Mask Flag Definitions 00223 * @{ 00224 */ 00225 #define RTC_TAMPERMASK_FLAG_DISABLE ((uint32_t)0x00000000) 00226 #define RTC_TAMPERMASK_FLAG_ENABLE ((uint32_t)0x00040000) 00227 /** 00228 * @} 00229 */ 00230 00231 /** @defgroup RTCEx_Tamper_Filter_Definitions RTC Tamper Filter Definitions 00232 * @{ 00233 */ 00234 #define RTC_TAMPERFILTER_DISABLE ((uint32_t)0x00000000) /*!< Tamper filter is disabled */ 00235 00236 #define RTC_TAMPERFILTER_2SAMPLE ((uint32_t)0x00000800) /*!< Tamper is activated after 2 00237 consecutive samples at the active level */ 00238 #define RTC_TAMPERFILTER_4SAMPLE ((uint32_t)0x00001000) /*!< Tamper is activated after 4 00239 consecutive samples at the active level */ 00240 #define RTC_TAMPERFILTER_8SAMPLE ((uint32_t)0x00001800) /*!< Tamper is activated after 8 00241 consecutive samples at the active level. */ 00242 /** 00243 * @} 00244 */ 00245 00246 /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTC Tamper Sampling Frequencies Definitions 00247 * @{ 00248 */ 00249 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 ((uint32_t)0x00000000) /*!< Each of the tamper inputs are sampled 00250 with a frequency = RTCCLK / 32768 */ 00251 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 ((uint32_t)0x00000100) /*!< Each of the tamper inputs are sampled 00252 with a frequency = RTCCLK / 16384 */ 00253 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 ((uint32_t)0x00000200) /*!< Each of the tamper inputs are sampled 00254 with a frequency = RTCCLK / 8192 */ 00255 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 ((uint32_t)0x00000300) /*!< Each of the tamper inputs are sampled 00256 with a frequency = RTCCLK / 4096 */ 00257 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 ((uint32_t)0x00000400) /*!< Each of the tamper inputs are sampled 00258 with a frequency = RTCCLK / 2048 */ 00259 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 ((uint32_t)0x00000500) /*!< Each of the tamper inputs are sampled 00260 with a frequency = RTCCLK / 1024 */ 00261 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 ((uint32_t)0x00000600) /*!< Each of the tamper inputs are sampled 00262 with a frequency = RTCCLK / 512 */ 00263 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 ((uint32_t)0x00000700) /*!< Each of the tamper inputs are sampled 00264 with a frequency = RTCCLK / 256 */ 00265 /** 00266 * @} 00267 */ 00268 00269 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTC Tamper Pin Precharge Duration Definitions 00270 * @{ 00271 */ 00272 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before 00273 sampling during 1 RTCCLK cycle */ 00274 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK ((uint32_t)0x00002000) /*!< Tamper pins are pre-charged before 00275 sampling during 2 RTCCLK cycles */ 00276 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK ((uint32_t)0x00004000) /*!< Tamper pins are pre-charged before 00277 sampling during 4 RTCCLK cycles */ 00278 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK ((uint32_t)0x00006000) /*!< Tamper pins are pre-charged before 00279 sampling during 8 RTCCLK cycles */ 00280 /** 00281 * @} 00282 */ 00283 00284 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTC Tamper TimeStamp On Tamper Detection Definitions 00285 * @{ 00286 */ 00287 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE ((uint32_t)RTC_TAMPCR_TAMPTS) /*!< TimeStamp on Tamper Detection event saved */ 00288 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event is not saved */ 00289 /** 00290 * @} 00291 */ 00292 00293 /** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTC Tamper Pull Up Definitions 00294 * @{ 00295 */ 00296 #define RTC_TAMPER_PULLUP_ENABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event saved */ 00297 #define RTC_TAMPER_PULLUP_DISABLE ((uint32_t)RTC_TAMPCR_TAMPPUDIS) /*!< TimeStamp on Tamper Detection event is not saved */ 00298 /** 00299 * @} 00300 */ 00301 00302 /** @defgroup RTCEx_Wakeup_Timer_Definitions RTC Wakeup Timer Definitions 00303 * @{ 00304 */ 00305 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 ((uint32_t)0x00000000) 00306 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 ((uint32_t)0x00000001) 00307 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 ((uint32_t)0x00000002) 00308 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 ((uint32_t)0x00000003) 00309 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS ((uint32_t)0x00000004) 00310 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS ((uint32_t)0x00000006) 00311 /** 00312 * @} 00313 */ 00314 00315 /** @defgroup RTCEx_Smooth_calib_period_Definitions RTC Smooth Calib Period Definitions 00316 * @{ 00317 */ 00318 #define RTC_SMOOTHCALIB_PERIOD_32SEC ((uint32_t)0x00000000) /*!< If RTCCLK = 32768 Hz, Smooth calibration 00319 period is 32s, else 2exp20 RTCCLK seconds */ 00320 #define RTC_SMOOTHCALIB_PERIOD_16SEC ((uint32_t)0x00002000) /*!< If RTCCLK = 32768 Hz, Smooth calibration 00321 period is 16s, else 2exp19 RTCCLK seconds */ 00322 #define RTC_SMOOTHCALIB_PERIOD_8SEC ((uint32_t)0x00004000) /*!< If RTCCLK = 32768 Hz, Smooth calibration 00323 period is 8s, else 2exp18 RTCCLK seconds */ 00324 /** 00325 * @} 00326 */ 00327 00328 /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTC Smooth Calib Plus Pulses Definitions 00329 * @{ 00330 */ 00331 #define RTC_SMOOTHCALIB_PLUSPULSES_SET ((uint32_t)0x00008000) /*!< The number of RTCCLK pulses added 00332 during a X -second window = Y - CALM[8:0] 00333 with Y = 512, 256, 128 when X = 32, 16, 8 */ 00334 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET ((uint32_t)0x00000000) /*!< The number of RTCCLK pulses subbstited 00335 during a 32-second window = CALM[8:0] */ 00336 /** 00337 * @} 00338 */ 00339 00340 /** @defgroup RTCEx_Calib_Output_selection_Definitions RTC Calib Output Selection Definitions 00341 * @{ 00342 */ 00343 #define RTC_CALIBOUTPUT_512HZ ((uint32_t)0x00000000) 00344 #define RTC_CALIBOUTPUT_1HZ ((uint32_t)0x00080000) 00345 /** 00346 * @} 00347 */ 00348 00349 /** @defgroup RTCEx_Add_1_Second_Parameter_Definitions RTC Add 1 Second Parameter Definitions 00350 * @{ 00351 */ 00352 #define RTC_SHIFTADD1S_RESET ((uint32_t)0x00000000) 00353 #define RTC_SHIFTADD1S_SET ((uint32_t)0x80000000) 00354 /** 00355 * @} 00356 */ 00357 00358 /** 00359 * @} 00360 */ 00361 00362 /* Exported macros -----------------------------------------------------------*/ 00363 /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros 00364 * @{ 00365 */ 00366 00367 /** 00368 * @brief Enable the RTC WakeUp Timer peripheral. 00369 * @param __HANDLE__: specifies the RTC handle. 00370 * @retval None 00371 */ 00372 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE)) 00373 00374 /** 00375 * @brief Disable the RTC WakeUp Timer peripheral. 00376 * @param __HANDLE__: specifies the RTC handle. 00377 * @retval None 00378 */ 00379 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE)) 00380 00381 /** 00382 * @brief Enable the RTC WakeUpTimer interrupt. 00383 * @param __HANDLE__: specifies the RTC handle. 00384 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled. 00385 * This parameter can be: 00386 * @arg RTC_IT_WUT: WakeUpTimer interrupt 00387 * @retval None 00388 */ 00389 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) 00390 00391 /** 00392 * @brief Disable the RTC WakeUpTimer interrupt. 00393 * @param __HANDLE__: specifies the RTC handle. 00394 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be disabled. 00395 * This parameter can be: 00396 * @arg RTC_IT_WUT: WakeUpTimer interrupt 00397 * @retval None 00398 */ 00399 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) 00400 00401 /** 00402 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not. 00403 * @param __HANDLE__: specifies the RTC handle. 00404 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to check. 00405 * This parameter can be: 00406 * @arg RTC_IT_WUT: WakeUpTimer interrupt 00407 * @retval None 00408 */ 00409 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4)) != RESET) ? SET : RESET) 00410 00411 /** 00412 * @brief Check whether the specified RTC Wake Up timer interrupt is enabled or not. 00413 * @param __HANDLE__: specifies the RTC handle. 00414 * @param __INTERRUPT__: specifies the RTC Wake Up timer interrupt sources to check. 00415 * This parameter can be: 00416 * @arg RTC_IT_WUT: WakeUpTimer interrupt 00417 * @retval None 00418 */ 00419 #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET) 00420 00421 /** 00422 * @brief Get the selected RTC WakeUpTimer's flag status. 00423 * @param __HANDLE__: specifies the RTC handle. 00424 * @param __FLAG__: specifies the RTC WakeUpTimer Flag is pending or not. 00425 * This parameter can be: 00426 * @arg RTC_FLAG_WUTF 00427 * @arg RTC_FLAG_WUTWF 00428 * @retval None 00429 */ 00430 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET) 00431 00432 /** 00433 * @brief Clear the RTC Wake Up timer's pending flags. 00434 * @param __HANDLE__: specifies the RTC handle. 00435 * @param __FLAG__: specifies the RTC WakeUpTimer Flag to clear. 00436 * This parameter can be: 00437 * @arg RTC_FLAG_WUTF 00438 * @retval None 00439 */ 00440 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 00441 00442 #if defined(RTC_TAMPER1_SUPPORT) 00443 /** 00444 * @brief Enable the RTC Tamper1 input detection. 00445 * @param __HANDLE__: specifies the RTC handle. 00446 * @retval None 00447 */ 00448 #define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP1E)) 00449 00450 /** 00451 * @brief Disable the RTC Tamper1 input detection. 00452 * @param __HANDLE__: specifies the RTC handle. 00453 * @retval None 00454 */ 00455 #define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP1E)) 00456 #endif /* RTC_TAMPER1_SUPPORT */ 00457 00458 /** 00459 * @brief Enable the RTC Tamper2 input detection. 00460 * @param __HANDLE__: specifies the RTC handle. 00461 * @retval None 00462 */ 00463 #define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP2E)) 00464 00465 /** 00466 * @brief Disable the RTC Tamper2 input detection. 00467 * @param __HANDLE__: specifies the RTC handle. 00468 * @retval None 00469 */ 00470 #define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP2E)) 00471 00472 #if defined(RTC_TAMPER3_SUPPORT) 00473 /** 00474 * @brief Enable the RTC Tamper3 input detection. 00475 * @param __HANDLE__: specifies the RTC handle. 00476 * @retval None 00477 */ 00478 #define __HAL_RTC_TAMPER3_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP3E)) 00479 00480 /** 00481 * @brief Disable the RTC Tamper3 input detection. 00482 * @param __HANDLE__: specifies the RTC handle. 00483 * @retval None 00484 */ 00485 #define __HAL_RTC_TAMPER3_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP3E)) 00486 #endif /* RTC_TAMPER3_SUPPORT */ 00487 00488 /** 00489 * @brief Enable the RTC Tamper interrupt. 00490 * @param __HANDLE__: specifies the RTC handle. 00491 * @param __INTERRUPT__: specifies the RTC Tamper interrupt sources to be enabled. 00492 * This parameter can be any combination of the following values: 00493 * @arg RTC_IT_TAMP: All tampers interrupts 00494 * @arg RTC_IT_TAMP1: Tamper1 interrupt 00495 * @arg RTC_IT_TAMP2: Tamper2 interrupt 00496 * @arg RTC_IT_TAMP3: Tamper3 interrupt 00497 * @retval None 00498 */ 00499 #define __HAL_RTC_TAMPER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->TAMPCR |= (__INTERRUPT__)) 00500 00501 /** 00502 * @brief Disable the RTC Tamper interrupt. 00503 * @param __HANDLE__: specifies the RTC handle. 00504 * @param __INTERRUPT__: specifies the RTC Tamper interrupt sources to be disabled. 00505 * This parameter can be any combination of the following values: 00506 * @arg RTC_IT_TAMP: All tampers interrupts 00507 * @arg RTC_IT_TAMP1: Tamper1 interrupt 00508 * @arg RTC_IT_TAMP2: Tamper2 interrupt 00509 * @arg RTC_IT_TAMP3: Tamper3 interrupt 00510 * @retval None 00511 */ 00512 #define __HAL_RTC_TAMPER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->TAMPCR &= ~(__INTERRUPT__)) 00513 00514 /** 00515 * @brief Check whether the specified RTC Tamper interrupt has occurred or not. 00516 * @param __HANDLE__: specifies the RTC handle. 00517 * @param __INTERRUPT__: specifies the RTC Tamper interrupt to check. 00518 * This parameter can be: 00519 * @arg RTC_IT_TAMP1: Tamper1 interrupt 00520 * @arg RTC_IT_TAMP2: Tamper2 interrupt 00521 * @arg RTC_IT_TAMP3: Tamper3 interrupt 00522 * @retval None 00523 */ 00524 #if defined(RTC_TAMPER1_SUPPORT) && defined(RTC_TAMPER3_SUPPORT) 00525 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) == RTC_IT_TAMP1) ? (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 3)) != RESET) ? SET : RESET) : \ 00526 ((__INTERRUPT__) == RTC_IT_TAMP2) ? (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 5)) != RESET) ? SET : RESET) : \ 00527 (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 7)) != RESET) ? SET : RESET)) 00528 #else 00529 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 5)) != RESET) ? SET : RESET) 00530 #endif /* RTC_TAMPER1_SUPPORT && RTC_TAMPER3_SUPPORT */ 00531 00532 /** 00533 * @brief Check whether the specified RTC Tamper interrupt is enabled or not. 00534 * @param __HANDLE__: specifies the RTC handle. 00535 * @param __INTERRUPT__: specifies the RTC Tamper interrupt source to check. 00536 * This parameter can be: 00537 * @arg RTC_IT_TAMP: All tampers interrupts 00538 * @arg RTC_IT_TAMP1: Tamper1 interrupt 00539 * @arg RTC_IT_TAMP2: Tamper2 interrupt 00540 * @arg RTC_IT_TAMP3: Tamper3 interrupt 00541 * @retval None 00542 */ 00543 #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->TAMPCR) & (__INTERRUPT__)) != RESET) ? SET : RESET) 00544 00545 /** 00546 * @brief Get the selected RTC Tamper's flag status. 00547 * @param __HANDLE__: specifies the RTC handle. 00548 * @param __FLAG__: specifies the RTC Tamper Flag is pending or not. 00549 * This parameter can be: 00550 * @arg RTC_FLAG_TAMP1F: Tamper1 flag 00551 * @arg RTC_FLAG_TAMP2F: Tamper2 flag 00552 * @arg RTC_FLAG_TAMP3F: Tamper3 flag 00553 * @retval None 00554 */ 00555 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET) 00556 00557 /** 00558 * @brief Clear the RTC Tamper's pending flags. 00559 * @param __HANDLE__: specifies the RTC handle. 00560 * @param __FLAG__: specifies the RTC Tamper Flag sources to clear. 00561 * This parameter can be: 00562 * @arg RTC_FLAG_TAMP1F: Tamper1 flag 00563 * @arg RTC_FLAG_TAMP2F: Tamper2 flag 00564 * @arg RTC_FLAG_TAMP3F: Tamper3 flag 00565 * @retval None 00566 */ 00567 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 00568 00569 /** 00570 * @brief Enable the RTC TimeStamp peripheral. 00571 * @param __HANDLE__: specifies the RTC handle. 00572 * @retval None 00573 */ 00574 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE)) 00575 00576 /** 00577 * @brief Disable the RTC TimeStamp peripheral. 00578 * @param __HANDLE__: specifies the RTC handle. 00579 * @retval None 00580 */ 00581 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE)) 00582 00583 /** 00584 * @brief Enable the RTC TimeStamp interrupt. 00585 * @param __HANDLE__: specifies the RTC handle. 00586 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt source to be enabled. 00587 * This parameter can be: 00588 * @arg RTC_IT_TS: TimeStamp interrupt 00589 * @retval None 00590 */ 00591 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) 00592 00593 /** 00594 * @brief Disable the RTC TimeStamp interrupt. 00595 * @param __HANDLE__: specifies the RTC handle. 00596 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt source to be disabled. 00597 * This parameter can be: 00598 * @arg RTC_IT_TS: TimeStamp interrupt 00599 * @retval None 00600 */ 00601 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) 00602 00603 /** 00604 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not. 00605 * @param __HANDLE__: specifies the RTC handle. 00606 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt source to check. 00607 * This parameter can be: 00608 * @arg RTC_IT_TS: TimeStamp interrupt 00609 * @retval None 00610 */ 00611 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4)) != RESET) ? SET : RESET) 00612 00613 /** 00614 * @brief Check whether the specified RTC Time Stamp interrupt is enabled or not. 00615 * @param __HANDLE__: specifies the RTC handle. 00616 * @param __INTERRUPT__: specifies the RTC Time Stamp interrupt source to check. 00617 * This parameter can be: 00618 * @arg RTC_IT_TS: TimeStamp interrupt 00619 * @retval None 00620 */ 00621 #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET) 00622 00623 /** 00624 * @brief Get the selected RTC TimeStamp's flag status. 00625 * @param __HANDLE__: specifies the RTC handle. 00626 * @param __FLAG__: specifies the RTC TimeStamp Flag is pending or not. 00627 * This parameter can be: 00628 * @arg RTC_FLAG_TSF 00629 * @arg RTC_FLAG_TSOVF 00630 * @retval None 00631 */ 00632 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET) 00633 00634 /** 00635 * @brief Clear the RTC Time Stamp's pending flags. 00636 * @param __HANDLE__: specifies the RTC handle. 00637 * @param __FLAG__: specifies the RTC Alarm Flag sources to clear. 00638 * This parameter can be: 00639 * @arg RTC_FLAG_TSF 00640 * @arg RTC_FLAG_TSOVF 00641 * @retval None 00642 */ 00643 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 00644 00645 /** 00646 * @brief Enable the RTC internal TimeStamp peripheral. 00647 * @param __HANDLE__: specifies the RTC handle. 00648 * @retval None 00649 */ 00650 #define __HAL_RTC_INTERNAL_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ITSE)) 00651 00652 /** 00653 * @brief Disable the RTC internal TimeStamp peripheral. 00654 * @param __HANDLE__: specifies the RTC handle. 00655 * @retval None 00656 */ 00657 #define __HAL_RTC_INTERNAL_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ITSE)) 00658 00659 /** 00660 * @brief Get the selected RTC Internal Time Stamp's flag status. 00661 * @param __HANDLE__: specifies the RTC handle. 00662 * @param __FLAG__: specifies the RTC Internal Time Stamp Flag is pending or not. 00663 * This parameter can be: 00664 * @arg RTC_FLAG_ITSF 00665 * @retval None 00666 */ 00667 #define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET) 00668 00669 /** 00670 * @brief Clear the RTC Internal Time Stamp's pending flags. 00671 * @param __HANDLE__: specifies the RTC handle. 00672 * @param __FLAG__: specifies the RTC Internal Time Stamp Flag source to clear. 00673 * This parameter can be: 00674 * @arg RTC_FLAG_ITSF 00675 * @retval None 00676 */ 00677 #define __HAL_RTC_INTERNAL_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 00678 00679 /** 00680 * @brief Enable the RTC calibration output. 00681 * @param __HANDLE__: specifies the RTC handle. 00682 * @retval None 00683 */ 00684 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE)) 00685 00686 /** 00687 * @brief Disable the calibration output. 00688 * @param __HANDLE__: specifies the RTC handle. 00689 * @retval None 00690 */ 00691 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE)) 00692 00693 /** 00694 * @brief Enable the clock reference detection. 00695 * @param __HANDLE__: specifies the RTC handle. 00696 * @retval None 00697 */ 00698 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON)) 00699 00700 /** 00701 * @brief Disable the clock reference detection. 00702 * @param __HANDLE__: specifies the RTC handle. 00703 * @retval None 00704 */ 00705 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON)) 00706 00707 /** 00708 * @brief Get the selected RTC shift operation's flag status. 00709 * @param __HANDLE__: specifies the RTC handle. 00710 * @param __FLAG__: specifies the RTC shift operation Flag is pending or not. 00711 * This parameter can be: 00712 * @arg RTC_FLAG_SHPF 00713 * @retval None 00714 */ 00715 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET) 00716 00717 /** 00718 * @brief Enable interrupt on the RTC WakeUp Timer associated Exti line. 00719 * @retval None 00720 */ 00721 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00722 00723 /** 00724 * @brief Disable interrupt on the RTC WakeUp Timer associated Exti line. 00725 * @retval None 00726 */ 00727 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 00728 00729 /** 00730 * @brief Enable event on the RTC WakeUp Timer associated Exti line. 00731 * @retval None 00732 */ 00733 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00734 00735 /** 00736 * @brief Disable event on the RTC WakeUp Timer associated Exti line. 00737 * @retval None 00738 */ 00739 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 00740 00741 /** 00742 * @brief Enable falling edge trigger on the RTC WakeUp Timer associated Exti line. 00743 * @retval None 00744 */ 00745 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00746 00747 /** 00748 * @brief Disable falling edge trigger on the RTC WakeUp Timer associated Exti line. 00749 * @retval None 00750 */ 00751 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 00752 00753 /** 00754 * @brief Enable rising edge trigger on the RTC WakeUp Timer associated Exti line. 00755 * @retval None 00756 */ 00757 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00758 00759 /** 00760 * @brief Disable rising edge trigger on the RTC WakeUp Timer associated Exti line. 00761 * @retval None 00762 */ 00763 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 00764 00765 /** 00766 * @brief Enable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line. 00767 * @retval None 00768 */ 00769 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() do { \ 00770 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE(); \ 00771 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE(); \ 00772 } while(0) 00773 00774 /** 00775 * @brief Disable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line. 00776 * This parameter can be: 00777 * @retval None 00778 */ 00779 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() do { \ 00780 __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE(); \ 00781 __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE(); \ 00782 } while(0) 00783 00784 /** 00785 * @brief Check whether the RTC WakeUp Timer associated Exti line interrupt flag is set or not. 00786 * @retval Line Status. 00787 */ 00788 #define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR1 & RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00789 00790 /** 00791 * @brief Clear the RTC WakeUp Timer associated Exti line flag. 00792 * @retval None 00793 */ 00794 #define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00795 00796 /** 00797 * @brief Generate a Software interrupt on the RTC WakeUp Timer associated Exti line. 00798 * @retval None 00799 */ 00800 #define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00801 00802 /** 00803 * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line. 00804 * @retval None 00805 */ 00806 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00807 00808 /** 00809 * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line. 00810 * @retval None 00811 */ 00812 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 00813 00814 /** 00815 * @brief Enable event on the RTC Tamper and Timestamp associated Exti line. 00816 * @retval None 00817 */ 00818 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00819 00820 /** 00821 * @brief Disable event on the RTC Tamper and Timestamp associated Exti line. 00822 * @retval None 00823 */ 00824 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 00825 00826 /** 00827 * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 00828 * @retval None 00829 */ 00830 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00831 00832 /** 00833 * @brief Disable falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 00834 * @retval None 00835 */ 00836 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 00837 00838 /** 00839 * @brief Enable rising edge trigger on the RTC Tamper and Timestamp associated Exti line. 00840 * @retval None 00841 */ 00842 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00843 00844 /** 00845 * @brief Disable rising edge trigger on the RTC Tamper and Timestamp associated Exti line. 00846 * @retval None 00847 */ 00848 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 00849 00850 /** 00851 * @brief Enable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 00852 * @retval None 00853 */ 00854 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_FALLING_EDGE() do { \ 00855 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE(); \ 00856 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE(); \ 00857 } while(0) 00858 00859 /** 00860 * @brief Disable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 00861 * This parameter can be: 00862 * @retval None 00863 */ 00864 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_FALLING_EDGE() do { \ 00865 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE(); \ 00866 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE(); \ 00867 } while(0) 00868 00869 /** 00870 * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not. 00871 * @retval Line Status. 00872 */ 00873 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI->PR1 & RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00874 00875 /** 00876 * @brief Clear the RTC Tamper and Timestamp associated Exti line flag. 00877 * @retval None 00878 */ 00879 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00880 00881 /** 00882 * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line 00883 * @retval None 00884 */ 00885 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT() (EXTI->SWIER1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00886 00887 /** 00888 * @} 00889 */ 00890 00891 /* Exported functions --------------------------------------------------------*/ 00892 /** @addtogroup RTCEx_Exported_Functions 00893 * @{ 00894 */ 00895 00896 /* RTC TimeStamp and Tamper functions *****************************************/ 00897 /** @addtogroup RTCEx_Exported_Functions_Group1 00898 * @{ 00899 */ 00900 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin); 00901 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin); 00902 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc); 00903 HAL_StatusTypeDef HAL_RTCEx_SetInternalTimeStamp(RTC_HandleTypeDef *hrtc); 00904 HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTimeStamp(RTC_HandleTypeDef *hrtc); 00905 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format); 00906 00907 HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper); 00908 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper); 00909 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper); 00910 void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc); 00911 00912 #if defined(RTC_TAMPER1_SUPPORT) 00913 void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc); 00914 #endif /* RTC_TAMPER1_SUPPORT */ 00915 void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc); 00916 #if defined(RTC_TAMPER3_SUPPORT) 00917 void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc); 00918 #endif /* RTC_TAMPER3_SUPPORT */ 00919 void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc); 00920 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 00921 #if defined(RTC_TAMPER1_SUPPORT) 00922 HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 00923 #endif /* RTC_TAMPER1_SUPPORT */ 00924 HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 00925 #if defined(RTC_TAMPER3_SUPPORT) 00926 HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 00927 #endif /* RTC_TAMPER3_SUPPORT */ 00928 /** 00929 * @} 00930 */ 00931 00932 /* RTC Wake-up functions ******************************************************/ 00933 /** @addtogroup RTCEx_Exported_Functions_Group2 00934 * @{ 00935 */ 00936 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); 00937 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); 00938 uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc); 00939 uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc); 00940 void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc); 00941 void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc); 00942 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 00943 /** 00944 * @} 00945 */ 00946 00947 /* Extended Control functions ************************************************/ 00948 /** @addtogroup RTCEx_Exported_Functions_Group3 00949 * @{ 00950 */ 00951 void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data); 00952 uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister); 00953 00954 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue); 00955 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS); 00956 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput); 00957 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc); 00958 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc); 00959 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc); 00960 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc); 00961 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc); 00962 /** 00963 * @} 00964 */ 00965 00966 /* Extended RTC features functions *******************************************/ 00967 /** @addtogroup RTCEx_Exported_Functions_Group4 00968 * @{ 00969 */ 00970 void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc); 00971 HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 00972 /** 00973 * @} 00974 */ 00975 00976 /** 00977 * @} 00978 */ 00979 00980 /* Private types -------------------------------------------------------------*/ 00981 /* Private variables ---------------------------------------------------------*/ 00982 /* Private constants ---------------------------------------------------------*/ 00983 /** @defgroup RTCEx_Private_Constants RTCEx Private Constants 00984 * @{ 00985 */ 00986 #define RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT ((uint32_t)0x00080000) /*!< External interrupt line 19 Connected to the RTC Tamper and Time Stamp events */ 00987 #define RTC_EXTI_LINE_WAKEUPTIMER_EVENT ((uint32_t)0x00100000) /*!< External interrupt line 20 Connected to the RTC Wakeup event */ 00988 00989 /** 00990 * @} 00991 */ 00992 00993 /* Private macros ------------------------------------------------------------*/ 00994 /** @defgroup RTCEx_Private_Macros RTCEx Private Macros 00995 * @{ 00996 */ 00997 00998 /** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters 00999 * @{ 01000 */ 01001 01002 #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_OUTPUT_DISABLE) || \ 01003 ((OUTPUT) == RTC_OUTPUT_ALARMA) || \ 01004 ((OUTPUT) == RTC_OUTPUT_ALARMB) || \ 01005 ((OUTPUT) == RTC_OUTPUT_WAKEUP)) 01006 01007 #define IS_RTC_BKP(BKP) ((BKP) < (uint32_t) RTC_BKP_NUMBER) 01008 01009 #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \ 01010 ((EDGE) == RTC_TIMESTAMPEDGE_FALLING)) 01011 01012 #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & (uint32_t)0xFFFFFFD6) == 0x00) && ((TAMPER) != (uint32_t)RESET)) 01013 01014 #define IS_RTC_TAMPER_INTERRUPT(INTERRUPT) ((((INTERRUPT) & (uint32_t)0xFFB6FFFB) == 0x00) && ((INTERRUPT) != (uint32_t)RESET)) 01015 01016 #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_DEFAULT)) 01017 01018 #define IS_RTC_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) || \ 01019 ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \ 01020 ((TRIGGER) == RTC_TAMPERTRIGGER_LOWLEVEL) || \ 01021 ((TRIGGER) == RTC_TAMPERTRIGGER_HIGHLEVEL)) 01022 01023 #define IS_RTC_TAMPER_ERASE_MODE(MODE) (((MODE) == RTC_TAMPER_ERASE_BACKUP_ENABLE) || \ 01024 ((MODE) == RTC_TAMPER_ERASE_BACKUP_DISABLE)) 01025 01026 #define IS_RTC_TAMPER_MASKFLAG_STATE(STATE) (((STATE) == RTC_TAMPERMASK_FLAG_ENABLE) || \ 01027 ((STATE) == RTC_TAMPERMASK_FLAG_DISABLE)) 01028 01029 #define IS_RTC_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TAMPERFILTER_DISABLE) || \ 01030 ((FILTER) == RTC_TAMPERFILTER_2SAMPLE) || \ 01031 ((FILTER) == RTC_TAMPERFILTER_4SAMPLE) || \ 01032 ((FILTER) == RTC_TAMPERFILTER_8SAMPLE)) 01033 01034 #define IS_RTC_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \ 01035 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \ 01036 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \ 01037 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \ 01038 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \ 01039 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \ 01040 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \ 01041 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256)) 01042 01043 #define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \ 01044 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \ 01045 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \ 01046 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK)) 01047 01048 #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \ 01049 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE)) 01050 01051 #define IS_RTC_TAMPER_PULLUP_STATE(STATE) (((STATE) == RTC_TAMPER_PULLUP_ENABLE) || \ 01052 ((STATE) == RTC_TAMPER_PULLUP_DISABLE)) 01053 01054 #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \ 01055 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \ 01056 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \ 01057 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \ 01058 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \ 01059 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS)) 01060 01061 #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFF) 01062 01063 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \ 01064 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \ 01065 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC)) 01066 01067 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \ 01068 ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET)) 01069 01070 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FF) 01071 01072 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \ 01073 ((SEL) == RTC_SHIFTADD1S_SET)) 01074 01075 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFF) 01076 01077 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \ 01078 ((OUTPUT) == RTC_CALIBOUTPUT_1HZ)) 01079 01080 /** 01081 * @} 01082 */ 01083 01084 /** 01085 * @} 01086 */ 01087 01088 /** 01089 * @} 01090 */ 01091 01092 /** 01093 * @} 01094 */ 01095 01096 #ifdef __cplusplus 01097 } 01098 #endif 01099 01100 #endif /* __STM32L4xx_HAL_RTC_EX_H */ 01101 01102 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 10:59:58 by
