STM32F479xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f4xx_hal_rtc_ex.h 00004 * @author MCD Application Team 00005 * @brief Header file of RTC HAL Extension module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * <h2><center>© Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved.</center></h2> 00011 * 00012 * This software component is licensed by ST under BSD 3-Clause license, 00013 * the "License"; You may not use this file except in compliance with the 00014 * License. You may obtain a copy of the License at: 00015 * opensource.org/licenses/BSD-3-Clause 00016 * 00017 ****************************************************************************** 00018 */ 00019 00020 /* Define to prevent recursive inclusion -------------------------------------*/ 00021 #ifndef __STM32F4xx_HAL_RTC_EX_H 00022 #define __STM32F4xx_HAL_RTC_EX_H 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 /* Includes ------------------------------------------------------------------*/ 00029 #include "stm32f4xx_hal_def.h" 00030 00031 /** @addtogroup STM32F4xx_HAL_Driver 00032 * @{ 00033 */ 00034 00035 /** @addtogroup RTCEx 00036 * @{ 00037 */ 00038 00039 /* Exported types ------------------------------------------------------------*/ 00040 /** @defgroup RTCEx_Exported_Types RTCEx Exported Types 00041 * @{ 00042 */ 00043 00044 /** 00045 * @brief RTC Tamper structure definition 00046 */ 00047 typedef struct 00048 { 00049 uint32_t Tamper; /*!< Specifies the Tamper Pin. 00050 This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */ 00051 00052 uint32_t PinSelection; /*!< Specifies the Tamper Pin. 00053 This parameter can be a value of @ref RTCEx_Tamper_Pins_Selection */ 00054 00055 uint32_t Trigger; /*!< Specifies the Tamper Trigger. 00056 This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */ 00057 00058 uint32_t Filter; /*!< Specifies the RTC Filter Tamper. 00059 This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */ 00060 00061 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency. 00062 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */ 00063 00064 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration . 00065 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */ 00066 00067 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp . 00068 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */ 00069 00070 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection. 00071 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */ 00072 }RTC_TamperTypeDef; 00073 /** 00074 * @} 00075 */ 00076 00077 /* Exported constants --------------------------------------------------------*/ 00078 /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants 00079 * @{ 00080 */ 00081 00082 /** @defgroup RTCEx_Backup_Registers_Definitions RTC Backup Registers Definitions 00083 * @{ 00084 */ 00085 #define RTC_BKP_DR0 0x00000000U 00086 #define RTC_BKP_DR1 0x00000001U 00087 #define RTC_BKP_DR2 0x00000002U 00088 #define RTC_BKP_DR3 0x00000003U 00089 #define RTC_BKP_DR4 0x00000004U 00090 #define RTC_BKP_DR5 0x00000005U 00091 #define RTC_BKP_DR6 0x00000006U 00092 #define RTC_BKP_DR7 0x00000007U 00093 #define RTC_BKP_DR8 0x00000008U 00094 #define RTC_BKP_DR9 0x00000009U 00095 #define RTC_BKP_DR10 0x0000000AU 00096 #define RTC_BKP_DR11 0x0000000BU 00097 #define RTC_BKP_DR12 0x0000000CU 00098 #define RTC_BKP_DR13 0x0000000DU 00099 #define RTC_BKP_DR14 0x0000000EU 00100 #define RTC_BKP_DR15 0x0000000FU 00101 #define RTC_BKP_DR16 0x00000010U 00102 #define RTC_BKP_DR17 0x00000011U 00103 #define RTC_BKP_DR18 0x00000012U 00104 #define RTC_BKP_DR19 0x00000013U 00105 /** 00106 * @} 00107 */ 00108 00109 /** @defgroup RTCEx_Time_Stamp_Edges_definitions RTC TimeStamp Edges Definitions 00110 * @{ 00111 */ 00112 #define RTC_TIMESTAMPEDGE_RISING 0x00000000U 00113 #define RTC_TIMESTAMPEDGE_FALLING 0x00000008U 00114 /** 00115 * @} 00116 */ 00117 00118 /** @defgroup RTCEx_Tamper_Pins_Definitions RTC Tamper Pins Definitions 00119 * @{ 00120 */ 00121 #define RTC_TAMPER_1 RTC_TAFCR_TAMP1E 00122 00123 #if !defined(STM32F412Zx) && !defined(STM32F412Vx) && !defined(STM32F412Rx) && !defined(STM32F412Cx) && !defined(STM32F413xx) && !defined(STM32F423xx) 00124 #define RTC_TAMPER_2 RTC_TAFCR_TAMP2E 00125 #endif 00126 /** 00127 * @} 00128 */ 00129 00130 /** @defgroup RTCEx_Tamper_Pins_Selection RTC tamper Pins Selection 00131 * @{ 00132 */ 00133 00134 #define RTC_TAMPERPIN_DEFAULT 0x00000000U 00135 00136 #if !defined(STM32F412Zx) && !defined(STM32F412Vx) && !defined(STM32F412Rx) && !defined(STM32F412Cx) && !defined(STM32F413xx) && !defined(STM32F423xx) 00137 #define RTC_TAMPERPIN_POS1 0x00010000U 00138 #endif 00139 /** 00140 * @} 00141 */ 00142 00143 /** @defgroup RTCEx_TimeStamp_Pin_Selection RTC TimeStamp Pins Selection 00144 * @{ 00145 */ 00146 #define RTC_TIMESTAMPPIN_DEFAULT 0x00000000U 00147 00148 #if !defined(STM32F412Zx) && !defined(STM32F412Vx) && !defined(STM32F412Rx) && !defined(STM32F412Cx) && !defined(STM32F413xx) && !defined(STM32F423xx) 00149 #define RTC_TIMESTAMPPIN_POS1 0x00020000U 00150 #endif 00151 /** 00152 * @} 00153 */ 00154 00155 /** @defgroup RTCEx_Tamper_Trigger_Definitions RTC Tamper Triggers Definitions 00156 * @{ 00157 */ 00158 #define RTC_TAMPERTRIGGER_RISINGEDGE 0x00000000U 00159 #define RTC_TAMPERTRIGGER_FALLINGEDGE 0x00000002U 00160 #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE 00161 #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE 00162 /** 00163 * @} 00164 */ 00165 00166 /** @defgroup RTCEx_Tamper_Filter_Definitions RTC Tamper Filter Definitions 00167 * @{ 00168 */ 00169 #define RTC_TAMPERFILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */ 00170 00171 #define RTC_TAMPERFILTER_2SAMPLE 0x00000800U /*!< Tamper is activated after 2 00172 consecutive samples at the active level */ 00173 #define RTC_TAMPERFILTER_4SAMPLE 0x00001000U /*!< Tamper is activated after 4 00174 consecutive samples at the active level */ 00175 #define RTC_TAMPERFILTER_8SAMPLE 0x00001800U /*!< Tamper is activated after 8 00176 consecutive samples at the active level. */ 00177 /** 00178 * @} 00179 */ 00180 00181 /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTC Tamper Sampling Frequencies Definitions 00182 * @{ 00183 */ 00184 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 0x00000000U /*!< Each of the tamper inputs are sampled 00185 with a frequency = RTCCLK / 32768 */ 00186 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 0x00000100U /*!< Each of the tamper inputs are sampled 00187 with a frequency = RTCCLK / 16384 */ 00188 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 0x00000200U /*!< Each of the tamper inputs are sampled 00189 with a frequency = RTCCLK / 8192 */ 00190 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 0x00000300U /*!< Each of the tamper inputs are sampled 00191 with a frequency = RTCCLK / 4096 */ 00192 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 0x00000400U /*!< Each of the tamper inputs are sampled 00193 with a frequency = RTCCLK / 2048 */ 00194 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 0x00000500U /*!< Each of the tamper inputs are sampled 00195 with a frequency = RTCCLK / 1024 */ 00196 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 0x00000600U /*!< Each of the tamper inputs are sampled 00197 with a frequency = RTCCLK / 512 */ 00198 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 0x00000700U /*!< Each of the tamper inputs are sampled 00199 with a frequency = RTCCLK / 256 */ 00200 /** 00201 * @} 00202 */ 00203 00204 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTC Tamper Pin Precharge Duration Definitions 00205 * @{ 00206 */ 00207 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before 00208 sampling during 1 RTCCLK cycle */ 00209 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK 0x00002000U /*!< Tamper pins are pre-charged before 00210 sampling during 2 RTCCLK cycles */ 00211 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK 0x00004000U /*!< Tamper pins are pre-charged before 00212 sampling during 4 RTCCLK cycles */ 00213 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK 0x00006000U /*!< Tamper pins are pre-charged before 00214 sampling during 8 RTCCLK cycles */ 00215 /** 00216 * @} 00217 */ 00218 00219 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTC Tamper TimeStamp On Tamper Detection Definitions 00220 * @{ 00221 */ 00222 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE ((uint32_t)RTC_TAFCR_TAMPTS) /*!< TimeStamp on Tamper Detection event saved */ 00223 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE 0x00000000U /*!< TimeStamp on Tamper Detection event is not saved */ 00224 /** 00225 * @} 00226 */ 00227 00228 /** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTC Tamper Pull Up Definitions 00229 * @{ 00230 */ 00231 #define RTC_TAMPER_PULLUP_ENABLE 0x00000000U /*!< TimeStamp on Tamper Detection event saved */ 00232 #define RTC_TAMPER_PULLUP_DISABLE ((uint32_t)RTC_TAFCR_TAMPPUDIS) /*!< TimeStamp on Tamper Detection event is not saved */ 00233 /** 00234 * @} 00235 */ 00236 00237 /** @defgroup RTCEx_Wakeup_Timer_Definitions RTC Wake-up Timer Definitions 00238 * @{ 00239 */ 00240 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 0x00000000U 00241 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 0x00000001U 00242 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 0x00000002U 00243 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 0x00000003U 00244 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS 0x00000004U 00245 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS 0x00000006U 00246 /** 00247 * @} 00248 */ 00249 00250 /** @defgroup RTCEx_Digital_Calibration_Definitions RTC Digital Calib Definitions 00251 * @{ 00252 */ 00253 #define RTC_CALIBSIGN_POSITIVE 0x00000000U 00254 #define RTC_CALIBSIGN_NEGATIVE 0x00000080U 00255 /** 00256 * @} 00257 */ 00258 00259 /** @defgroup RTCEx_Smooth_calib_period_Definitions RTC Smooth Calib Period Definitions 00260 * @{ 00261 */ 00262 #define RTC_SMOOTHCALIB_PERIOD_32SEC 0x00000000U /*!< If RTCCLK = 32768 Hz, Smooth calibration 00263 period is 32s, else 2exp20 RTCCLK seconds */ 00264 #define RTC_SMOOTHCALIB_PERIOD_16SEC 0x00002000U /*!< If RTCCLK = 32768 Hz, Smooth calibration 00265 period is 16s, else 2exp19 RTCCLK seconds */ 00266 #define RTC_SMOOTHCALIB_PERIOD_8SEC 0x00004000U /*!< If RTCCLK = 32768 Hz, Smooth calibration 00267 period is 8s, else 2exp18 RTCCLK seconds */ 00268 /** 00269 * @} 00270 */ 00271 00272 /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTC Smooth Calib Plus Pulses Definitions 00273 * @{ 00274 */ 00275 #define RTC_SMOOTHCALIB_PLUSPULSES_SET 0x00008000U /*!< The number of RTCCLK pulses added 00276 during a X -second window = Y - CALM[8:0] 00277 with Y = 512, 256, 128 when X = 32, 16, 8 */ 00278 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET 0x00000000U /*!< The number of RTCCLK pulses subbstited 00279 during a 32-second window = CALM[8:0] */ 00280 /** 00281 * @} 00282 */ 00283 00284 /** @defgroup RTCEx_Add_1_Second_Parameter_Definitions RTC Add 1 Second Parameter Definitions 00285 * @{ 00286 */ 00287 #define RTC_SHIFTADD1S_RESET 0x00000000U 00288 #define RTC_SHIFTADD1S_SET 0x80000000U 00289 /** 00290 * @} 00291 */ 00292 00293 00294 /** @defgroup RTCEx_Calib_Output_selection_Definitions RTC Calib Output Selection Definitions 00295 * @{ 00296 */ 00297 #define RTC_CALIBOUTPUT_512HZ 0x00000000U 00298 #define RTC_CALIBOUTPUT_1HZ 0x00080000U 00299 /** 00300 * @} 00301 */ 00302 00303 /** 00304 * @} 00305 */ 00306 00307 /* Exported macro ------------------------------------------------------------*/ 00308 /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros 00309 * @{ 00310 */ 00311 00312 /* ---------------------------------WAKEUPTIMER---------------------------------*/ 00313 /** @defgroup RTCEx_WakeUp_Timer RTC WakeUp Timer 00314 * @{ 00315 */ 00316 00317 /** 00318 * @brief Enable the RTC WakeUp Timer peripheral. 00319 * @param __HANDLE__ specifies the RTC handle. 00320 * @retval None 00321 */ 00322 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE)) 00323 00324 /** 00325 * @brief Disable the RTC Wake-up Timer peripheral. 00326 * @param __HANDLE__ specifies the RTC handle. 00327 * @retval None 00328 */ 00329 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE)) 00330 00331 /** 00332 * @brief Enable the RTC WakeUpTimer interrupt. 00333 * @param __HANDLE__ specifies the RTC handle. 00334 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled. 00335 * This parameter can be: 00336 * @arg RTC_IT_WUT: WakeUpTimer A interrupt 00337 * @retval None 00338 */ 00339 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) 00340 00341 /** 00342 * @brief Disable the RTC WakeUpTimer interrupt. 00343 * @param __HANDLE__ specifies the RTC handle. 00344 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled. 00345 * This parameter can be: 00346 * @arg RTC_IT_WUT: WakeUpTimer A interrupt 00347 * @retval None 00348 */ 00349 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) 00350 00351 /** 00352 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not. 00353 * @param __HANDLE__ specifies the RTC handle. 00354 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt to check. 00355 * This parameter can be: 00356 * @arg RTC_IT_WUT: WakeUpTimer A interrupt 00357 * @retval None 00358 */ 00359 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4U)) != RESET)? SET : RESET) 00360 00361 /** 00362 * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not. 00363 * @param __HANDLE__ specifies the RTC handle. 00364 * @param __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check. 00365 * This parameter can be: 00366 * @arg RTC_IT_WUT: WakeUpTimer interrupt 00367 * @retval None 00368 */ 00369 #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET) 00370 00371 /** 00372 * @brief Get the selected RTC WakeUpTimer's flag status. 00373 * @param __HANDLE__ specifies the RTC handle. 00374 * @param __FLAG__ specifies the RTC WakeUpTimer Flag to check. 00375 * This parameter can be: 00376 * @arg RTC_FLAG_WUTF 00377 * @arg RTC_FLAG_WUTWF 00378 * @retval None 00379 */ 00380 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET) 00381 00382 /** 00383 * @brief Clear the RTC Wake Up timer's pending flags. 00384 * @param __HANDLE__ specifies the RTC handle. 00385 * @param __FLAG__ specifies the RTC Tamper Flag sources to be enabled or disabled. 00386 * This parameter can be: 00387 * @arg RTC_FLAG_WUTF 00388 * @retval None 00389 */ 00390 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 00391 00392 /** 00393 * @brief Enable interrupt on the RTC Wake-up Timer associated Exti line. 00394 * @retval None 00395 */ 00396 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00397 00398 /** 00399 * @brief Disable interrupt on the RTC Wake-up Timer associated Exti line. 00400 * @retval None 00401 */ 00402 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 00403 00404 /** 00405 * @brief Enable event on the RTC Wake-up Timer associated Exti line. 00406 * @retval None. 00407 */ 00408 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00409 00410 /** 00411 * @brief Disable event on the RTC Wake-up Timer associated Exti line. 00412 * @retval None. 00413 */ 00414 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 00415 00416 /** 00417 * @brief Enable falling edge trigger on the RTC Wake-up Timer associated Exti line. 00418 * @retval None. 00419 */ 00420 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00421 00422 /** 00423 * @brief Disable falling edge trigger on the RTC Wake-up Timer associated Exti line. 00424 * @retval None. 00425 */ 00426 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 00427 00428 /** 00429 * @brief Enable rising edge trigger on the RTC Wake-up Timer associated Exti line. 00430 * @retval None. 00431 */ 00432 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00433 00434 /** 00435 * @brief Disable rising edge trigger on the RTC Wake-up Timer associated Exti line. 00436 * @retval None. 00437 */ 00438 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 00439 00440 /** 00441 * @brief Enable rising & falling edge trigger on the RTC Wake-up Timer associated Exti line. 00442 * @retval None. 00443 */ 00444 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() do { __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();\ 00445 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE();\ 00446 } while(0U) 00447 00448 /** 00449 * @brief Disable rising & falling edge trigger on the RTC Wake-up Timer associated Exti line. 00450 * This parameter can be: 00451 * @retval None. 00452 */ 00453 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() do { __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();\ 00454 __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE();\ 00455 } while(0U) 00456 00457 /** 00458 * @brief Check whether the RTC Wake-up Timer associated Exti line interrupt flag is set or not. 00459 * @retval Line Status. 00460 */ 00461 #define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00462 00463 /** 00464 * @brief Clear the RTC Wake-up Timer associated Exti line flag. 00465 * @retval None. 00466 */ 00467 #define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00468 00469 /** 00470 * @brief Generate a Software interrupt on the RTC Wake-up Timer associated Exti line. 00471 * @retval None. 00472 */ 00473 #define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 00474 00475 /** 00476 * @} 00477 */ 00478 00479 /* ---------------------------------TIMESTAMP---------------------------------*/ 00480 /** @defgroup RTCEx_Timestamp RTC Timestamp 00481 * @{ 00482 */ 00483 00484 /** 00485 * @brief Enable the RTC TimeStamp peripheral. 00486 * @param __HANDLE__ specifies the RTC handle. 00487 * @retval None 00488 */ 00489 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE)) 00490 00491 /** 00492 * @brief Disable the RTC TimeStamp peripheral. 00493 * @param __HANDLE__ specifies the RTC handle. 00494 * @retval None 00495 */ 00496 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE)) 00497 00498 /** 00499 * @brief Enable the RTC TimeStamp interrupt. 00500 * @param __HANDLE__ specifies the RTC handle. 00501 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt sources to be enabled or disabled. 00502 * This parameter can be: 00503 * @arg RTC_IT_TS: TimeStamp interrupt 00504 * @retval None 00505 */ 00506 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) 00507 00508 /** 00509 * @brief Disable the RTC TimeStamp interrupt. 00510 * @param __HANDLE__ specifies the RTC handle. 00511 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt sources to be enabled or disabled. 00512 * This parameter can be: 00513 * @arg RTC_IT_TS: TimeStamp interrupt 00514 * @retval None 00515 */ 00516 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) 00517 00518 /** 00519 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not. 00520 * @param __HANDLE__ specifies the RTC handle. 00521 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt to check. 00522 * This parameter can be: 00523 * @arg RTC_IT_TS: TimeStamp interrupt 00524 * @retval None 00525 */ 00526 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4U)) != RESET)? SET : RESET) 00527 00528 /** 00529 * @brief Check whether the specified RTC Time Stamp interrupt has been enabled or not. 00530 * @param __HANDLE__ specifies the RTC handle. 00531 * @param __INTERRUPT__ specifies the RTC Time Stamp interrupt source to check. 00532 * This parameter can be: 00533 * @arg RTC_IT_TS: TimeStamp interrupt 00534 * @retval None 00535 */ 00536 #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET) 00537 00538 /** 00539 * @brief Get the selected RTC TimeStamp's flag status. 00540 * @param __HANDLE__ specifies the RTC handle. 00541 * @param __FLAG__ specifies the RTC TimeStamp flag to check. 00542 * This parameter can be: 00543 * @arg RTC_FLAG_TSF 00544 * @arg RTC_FLAG_TSOVF 00545 * @retval None 00546 */ 00547 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET) 00548 00549 /** 00550 * @brief Clear the RTC Time Stamp's pending flags. 00551 * @param __HANDLE__ specifies the RTC handle. 00552 * @param __FLAG__ specifies the RTC Alarm Flag sources to be enabled or disabled. 00553 * This parameter can be: 00554 * @arg RTC_FLAG_TSF 00555 * @retval None 00556 */ 00557 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 00558 00559 /** 00560 * @} 00561 */ 00562 00563 /* ---------------------------------TAMPER------------------------------------*/ 00564 /** @defgroup RTCEx_Tamper RTC Tamper 00565 * @{ 00566 */ 00567 00568 /** 00569 * @brief Enable the RTC Tamper1 input detection. 00570 * @param __HANDLE__ specifies the RTC handle. 00571 * @retval None 00572 */ 00573 #define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR |= (RTC_TAFCR_TAMP1E)) 00574 00575 /** 00576 * @brief Disable the RTC Tamper1 input detection. 00577 * @param __HANDLE__ specifies the RTC handle. 00578 * @retval None 00579 */ 00580 #define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR &= ~(RTC_TAFCR_TAMP1E)) 00581 00582 #if !defined(STM32F412Zx) && !defined(STM32F412Vx) && !defined(STM32F412Rx) && !defined(STM32F412Cx) && !defined(STM32F413xx) && !defined(STM32F423xx) 00583 /** 00584 * @brief Enable the RTC Tamper2 input detection. 00585 * @param __HANDLE__ specifies the RTC handle. 00586 * @retval None 00587 */ 00588 #define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR |= (RTC_TAFCR_TAMP2E)) 00589 00590 /** 00591 * @brief Disable the RTC Tamper2 input detection. 00592 * @param __HANDLE__ specifies the RTC handle. 00593 * @retval None 00594 */ 00595 #define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR &= ~(RTC_TAFCR_TAMP2E)) 00596 #endif 00597 00598 /** 00599 * @brief Check whether the specified RTC Tamper interrupt has occurred or not. 00600 * @param __HANDLE__ specifies the RTC handle. 00601 * @param __INTERRUPT__ specifies the RTC Tamper interrupt to check. 00602 * This parameter can be: 00603 * @arg RTC_IT_TAMP1 00604 * @arg RTC_IT_TAMP2 00605 * @retval None 00606 */ 00607 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4U)) != RESET)? SET : RESET) 00608 00609 /** 00610 * @brief Check whether the specified RTC Tamper interrupt has been enabled or not. 00611 * @param __HANDLE__ specifies the RTC handle. 00612 * @param __INTERRUPT__ specifies the RTC Tamper interrupt source to check. 00613 * This parameter can be: 00614 * @arg RTC_IT_TAMP: Tamper interrupt 00615 * @retval None 00616 */ 00617 #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->TAFCR) & (__INTERRUPT__)) != RESET) ? SET : RESET) 00618 00619 /** 00620 * @brief Get the selected RTC Tamper's flag status. 00621 * @param __HANDLE__ specifies the RTC handle. 00622 * @param __FLAG__ specifies the RTC Tamper Flag sources to be enabled or disabled. 00623 * This parameter can be: 00624 * @arg RTC_FLAG_TAMP1F 00625 * @arg RTC_FLAG_TAMP2F 00626 * @retval None 00627 */ 00628 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET) 00629 00630 /** 00631 * @brief Clear the RTC Tamper's pending flags. 00632 * @param __HANDLE__ specifies the RTC handle. 00633 * @param __FLAG__ specifies the RTC Tamper Flag to clear. 00634 * This parameter can be: 00635 * @arg RTC_FLAG_TAMP1F 00636 * @arg RTC_FLAG_TAMP2F 00637 * @retval None 00638 */ 00639 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 00640 /** 00641 * @} 00642 */ 00643 00644 /* --------------------------TAMPER/TIMESTAMP---------------------------------*/ 00645 /** @defgroup RTCEx_Tamper_Timestamp EXTI RTC Tamper Timestamp EXTI 00646 * @{ 00647 */ 00648 00649 /** 00650 * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line. 00651 * @retval None 00652 */ 00653 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00654 00655 /** 00656 * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line. 00657 * @retval None 00658 */ 00659 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 00660 00661 /** 00662 * @brief Enable event on the RTC Tamper and Timestamp associated Exti line. 00663 * @retval None. 00664 */ 00665 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00666 00667 /** 00668 * @brief Disable event on the RTC Tamper and Timestamp associated Exti line. 00669 * @retval None. 00670 */ 00671 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 00672 00673 /** 00674 * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 00675 * @retval None. 00676 */ 00677 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00678 00679 /** 00680 * @brief Disable falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 00681 * @retval None. 00682 */ 00683 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 00684 00685 /** 00686 * @brief Enable rising edge trigger on the RTC Tamper and Timestamp associated Exti line. 00687 * @retval None. 00688 */ 00689 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00690 00691 /** 00692 * @brief Disable rising edge trigger on the RTC Tamper and Timestamp associated Exti line. 00693 * @retval None. 00694 */ 00695 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 00696 00697 /** 00698 * @brief Enable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 00699 * @retval None. 00700 */ 00701 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_FALLING_EDGE() do { __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE();\ 00702 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE(); \ 00703 } while(0U) 00704 00705 /** 00706 * @brief Disable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 00707 * This parameter can be: 00708 * @retval None. 00709 */ 00710 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_FALLING_EDGE() do { __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE();\ 00711 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE();\ 00712 } while(0U) 00713 00714 /** 00715 * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not. 00716 * @retval Line Status. 00717 */ 00718 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00719 00720 /** 00721 * @brief Clear the RTC Tamper and Timestamp associated Exti line flag. 00722 * @retval None. 00723 */ 00724 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00725 00726 /** 00727 * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line 00728 * @retval None. 00729 */ 00730 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 00731 /** 00732 * @} 00733 */ 00734 00735 /* ------------------------------Calibration----------------------------------*/ 00736 /** @defgroup RTCEx_Calibration RTC Calibration 00737 * @{ 00738 */ 00739 00740 /** 00741 * @brief Enable the Coarse calibration process. 00742 * @param __HANDLE__ specifies the RTC handle. 00743 * @retval None 00744 */ 00745 #define __HAL_RTC_COARSE_CALIB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_DCE)) 00746 00747 /** 00748 * @brief Disable the Coarse calibration process. 00749 * @param __HANDLE__ specifies the RTC handle. 00750 * @retval None 00751 */ 00752 #define __HAL_RTC_COARSE_CALIB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_DCE)) 00753 00754 /** 00755 * @brief Enable the RTC calibration output. 00756 * @param __HANDLE__ specifies the RTC handle. 00757 * @retval None 00758 */ 00759 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE)) 00760 00761 /** 00762 * @brief Disable the calibration output. 00763 * @param __HANDLE__ specifies the RTC handle. 00764 * @retval None 00765 */ 00766 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE)) 00767 00768 /** 00769 * @brief Enable the clock reference detection. 00770 * @param __HANDLE__ specifies the RTC handle. 00771 * @retval None 00772 */ 00773 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON)) 00774 00775 /** 00776 * @brief Disable the clock reference detection. 00777 * @param __HANDLE__ specifies the RTC handle. 00778 * @retval None 00779 */ 00780 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON)) 00781 00782 /** 00783 * @brief Get the selected RTC shift operation's flag status. 00784 * @param __HANDLE__ specifies the RTC handle. 00785 * @param __FLAG__ specifies the RTC shift operation Flag is pending or not. 00786 * This parameter can be: 00787 * @arg RTC_FLAG_SHPF 00788 * @retval None 00789 */ 00790 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET) 00791 /** 00792 * @} 00793 */ 00794 00795 /** 00796 * @} 00797 */ 00798 00799 /* Exported functions --------------------------------------------------------*/ 00800 /** @defgroup RTCEx_Exported_Functions RTCEx Exported Functions 00801 * @{ 00802 */ 00803 00804 /** @addtogroup RTCEx_Exported_Functions_Group1 00805 * @{ 00806 */ 00807 /* RTC TimeStamp and Tamper functions *****************************************/ 00808 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin); 00809 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin); 00810 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc); 00811 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format); 00812 00813 HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper); 00814 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper); 00815 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper); 00816 void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc); 00817 00818 void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc); 00819 void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc); 00820 void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc); 00821 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 00822 HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 00823 HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 00824 /** 00825 * @} 00826 */ 00827 00828 /** @addtogroup RTCEx_Exported_Functions_Group2 00829 * @{ 00830 */ 00831 /* RTC Wake-up functions ******************************************************/ 00832 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); 00833 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); 00834 uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc); 00835 uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc); 00836 void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc); 00837 void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc); 00838 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 00839 /** 00840 * @} 00841 */ 00842 00843 /** @addtogroup RTCEx_Exported_Functions_Group3 00844 * @{ 00845 */ 00846 /* Extension Control functions ************************************************/ 00847 void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data); 00848 uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister); 00849 00850 HAL_StatusTypeDef HAL_RTCEx_SetCoarseCalib(RTC_HandleTypeDef *hrtc, uint32_t CalibSign, uint32_t Value); 00851 HAL_StatusTypeDef HAL_RTCEx_DeactivateCoarseCalib(RTC_HandleTypeDef *hrtc); 00852 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue); 00853 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS); 00854 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput); 00855 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc); 00856 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc); 00857 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc); 00858 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc); 00859 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc); 00860 /** 00861 * @} 00862 */ 00863 00864 /** @addtogroup RTCEx_Exported_Functions_Group4 00865 * @{ 00866 */ 00867 /* Extension RTC features functions *******************************************/ 00868 void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc); 00869 HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 00870 /** 00871 * @} 00872 */ 00873 00874 /** 00875 * @} 00876 */ 00877 00878 /* Private types -------------------------------------------------------------*/ 00879 /* Private variables ---------------------------------------------------------*/ 00880 /* Private constants ---------------------------------------------------------*/ 00881 /** @defgroup RTCEx_Private_Constants RTCEx Private Constants 00882 * @{ 00883 */ 00884 #define RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT ((uint32_t)EXTI_IMR_MR21) /*!< External interrupt line 21 Connected to the RTC Tamper and Time Stamp events */ 00885 #define RTC_EXTI_LINE_WAKEUPTIMER_EVENT ((uint32_t)EXTI_IMR_MR22) /*!< External interrupt line 22 Connected to the RTC Wake-up event */ 00886 /** 00887 * @} 00888 */ 00889 00890 /* Private macros ------------------------------------------------------------*/ 00891 /** @defgroup RTCEx_Private_Macros RTCEx Private Macros 00892 * @{ 00893 */ 00894 00895 /** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters 00896 * @{ 00897 */ 00898 #define IS_RTC_BKP(BKP) (((BKP) == RTC_BKP_DR0) || \ 00899 ((BKP) == RTC_BKP_DR1) || \ 00900 ((BKP) == RTC_BKP_DR2) || \ 00901 ((BKP) == RTC_BKP_DR3) || \ 00902 ((BKP) == RTC_BKP_DR4) || \ 00903 ((BKP) == RTC_BKP_DR5) || \ 00904 ((BKP) == RTC_BKP_DR6) || \ 00905 ((BKP) == RTC_BKP_DR7) || \ 00906 ((BKP) == RTC_BKP_DR8) || \ 00907 ((BKP) == RTC_BKP_DR9) || \ 00908 ((BKP) == RTC_BKP_DR10) || \ 00909 ((BKP) == RTC_BKP_DR11) || \ 00910 ((BKP) == RTC_BKP_DR12) || \ 00911 ((BKP) == RTC_BKP_DR13) || \ 00912 ((BKP) == RTC_BKP_DR14) || \ 00913 ((BKP) == RTC_BKP_DR15) || \ 00914 ((BKP) == RTC_BKP_DR16) || \ 00915 ((BKP) == RTC_BKP_DR17) || \ 00916 ((BKP) == RTC_BKP_DR18) || \ 00917 ((BKP) == RTC_BKP_DR19)) 00918 #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \ 00919 ((EDGE) == RTC_TIMESTAMPEDGE_FALLING)) 00920 00921 #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) 00922 #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & ((uint32_t)!(RTC_TAFCR_TAMP1E ))) == 0x00U) && ((TAMPER) != (uint32_t)RESET)) 00923 #else 00924 #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & ((uint32_t)!(RTC_TAFCR_TAMP1E | RTC_TAFCR_TAMP2E))) == 0x00U) && ((TAMPER) != (uint32_t)RESET)) 00925 #endif 00926 00927 #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) 00928 #define IS_RTC_TAMPER_PIN(PIN) ((PIN) == RTC_TAMPERPIN_DEFAULT) 00929 #else 00930 #define IS_RTC_TAMPER_PIN(PIN) (((PIN) == RTC_TAMPERPIN_DEFAULT) || \ 00931 ((PIN) == RTC_TAMPERPIN_POS1)) 00932 #endif 00933 00934 #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) 00935 #define IS_RTC_TIMESTAMP_PIN(PIN) ((PIN) == RTC_TIMESTAMPPIN_DEFAULT) 00936 #else 00937 #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_DEFAULT) || \ 00938 ((PIN) == RTC_TIMESTAMPPIN_POS1)) 00939 #endif 00940 #define IS_RTC_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) || \ 00941 ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \ 00942 ((TRIGGER) == RTC_TAMPERTRIGGER_LOWLEVEL) || \ 00943 ((TRIGGER) == RTC_TAMPERTRIGGER_HIGHLEVEL)) 00944 #define IS_RTC_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TAMPERFILTER_DISABLE) || \ 00945 ((FILTER) == RTC_TAMPERFILTER_2SAMPLE) || \ 00946 ((FILTER) == RTC_TAMPERFILTER_4SAMPLE) || \ 00947 ((FILTER) == RTC_TAMPERFILTER_8SAMPLE)) 00948 #define IS_RTC_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \ 00949 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \ 00950 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \ 00951 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \ 00952 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \ 00953 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \ 00954 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \ 00955 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256)) 00956 #define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \ 00957 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \ 00958 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \ 00959 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK)) 00960 #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \ 00961 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE)) 00962 #define IS_RTC_TAMPER_PULLUP_STATE(STATE) (((STATE) == RTC_TAMPER_PULLUP_ENABLE) || \ 00963 ((STATE) == RTC_TAMPER_PULLUP_DISABLE)) 00964 #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \ 00965 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \ 00966 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \ 00967 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \ 00968 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \ 00969 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS)) 00970 00971 #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFFU) 00972 #define IS_RTC_CALIB_SIGN(SIGN) (((SIGN) == RTC_CALIBSIGN_POSITIVE) || \ 00973 ((SIGN) == RTC_CALIBSIGN_NEGATIVE)) 00974 00975 #define IS_RTC_CALIB_VALUE(VALUE) ((VALUE) < 0x20U) 00976 00977 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \ 00978 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \ 00979 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC)) 00980 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \ 00981 ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET)) 00982 00983 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FFU) 00984 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \ 00985 ((SEL) == RTC_SHIFTADD1S_SET)) 00986 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFFU) 00987 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \ 00988 ((OUTPUT) == RTC_CALIBOUTPUT_1HZ)) 00989 /** 00990 * @} 00991 */ 00992 00993 /** 00994 * @} 00995 */ 00996 00997 /** 00998 * @} 00999 */ 01000 01001 /** 01002 * @} 01003 */ 01004 01005 #ifdef __cplusplus 01006 } 01007 #endif 01008 01009 #endif /* __STM32F4xx_HAL_RTC_EX_H */ 01010 01011 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/