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