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