Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /**
sahilmgandhi 18:6a4db94011d3 2 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 3 * @file stm32f4xx_hal_rtc_ex.h
sahilmgandhi 18:6a4db94011d3 4 * @author MCD Application Team
sahilmgandhi 18:6a4db94011d3 5 * @version V1.5.0
sahilmgandhi 18:6a4db94011d3 6 * @date 06-May-2016
sahilmgandhi 18:6a4db94011d3 7 * @brief Header file of RTC HAL Extension module.
sahilmgandhi 18:6a4db94011d3 8 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 9 * @attention
sahilmgandhi 18:6a4db94011d3 10 *
sahilmgandhi 18:6a4db94011d3 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
sahilmgandhi 18:6a4db94011d3 12 *
sahilmgandhi 18:6a4db94011d3 13 * Redistribution and use in source and binary forms, with or without modification,
sahilmgandhi 18:6a4db94011d3 14 * are permitted provided that the following conditions are met:
sahilmgandhi 18:6a4db94011d3 15 * 1. Redistributions of source code must retain the above copyright notice,
sahilmgandhi 18:6a4db94011d3 16 * this list of conditions and the following disclaimer.
sahilmgandhi 18:6a4db94011d3 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
sahilmgandhi 18:6a4db94011d3 18 * this list of conditions and the following disclaimer in the documentation
sahilmgandhi 18:6a4db94011d3 19 * and/or other materials provided with the distribution.
sahilmgandhi 18:6a4db94011d3 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
sahilmgandhi 18:6a4db94011d3 21 * may be used to endorse or promote products derived from this software
sahilmgandhi 18:6a4db94011d3 22 * without specific prior written permission.
sahilmgandhi 18:6a4db94011d3 23 *
sahilmgandhi 18:6a4db94011d3 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
sahilmgandhi 18:6a4db94011d3 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sahilmgandhi 18:6a4db94011d3 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
sahilmgandhi 18:6a4db94011d3 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
sahilmgandhi 18:6a4db94011d3 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sahilmgandhi 18:6a4db94011d3 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
sahilmgandhi 18:6a4db94011d3 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
sahilmgandhi 18:6a4db94011d3 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
sahilmgandhi 18:6a4db94011d3 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
sahilmgandhi 18:6a4db94011d3 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sahilmgandhi 18:6a4db94011d3 34 *
sahilmgandhi 18:6a4db94011d3 35 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 36 */
sahilmgandhi 18:6a4db94011d3 37
sahilmgandhi 18:6a4db94011d3 38 /* Define to prevent recursive inclusion -------------------------------------*/
sahilmgandhi 18:6a4db94011d3 39 #ifndef __STM32F4xx_HAL_RTC_EX_H
sahilmgandhi 18:6a4db94011d3 40 #define __STM32F4xx_HAL_RTC_EX_H
sahilmgandhi 18:6a4db94011d3 41
sahilmgandhi 18:6a4db94011d3 42 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 43 extern "C" {
sahilmgandhi 18:6a4db94011d3 44 #endif
sahilmgandhi 18:6a4db94011d3 45
sahilmgandhi 18:6a4db94011d3 46 /* Includes ------------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 47 #include "stm32f4xx_hal_def.h"
sahilmgandhi 18:6a4db94011d3 48
sahilmgandhi 18:6a4db94011d3 49 /** @addtogroup STM32F4xx_HAL_Driver
sahilmgandhi 18:6a4db94011d3 50 * @{
sahilmgandhi 18:6a4db94011d3 51 */
sahilmgandhi 18:6a4db94011d3 52
sahilmgandhi 18:6a4db94011d3 53 /** @addtogroup RTCEx
sahilmgandhi 18:6a4db94011d3 54 * @{
sahilmgandhi 18:6a4db94011d3 55 */
sahilmgandhi 18:6a4db94011d3 56
sahilmgandhi 18:6a4db94011d3 57 /* Exported types ------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 58 /** @defgroup RTCEx_Exported_Types RTCEx Exported Types
sahilmgandhi 18:6a4db94011d3 59 * @{
sahilmgandhi 18:6a4db94011d3 60 */
sahilmgandhi 18:6a4db94011d3 61
sahilmgandhi 18:6a4db94011d3 62 /**
sahilmgandhi 18:6a4db94011d3 63 * @brief RTC Tamper structure definition
sahilmgandhi 18:6a4db94011d3 64 */
sahilmgandhi 18:6a4db94011d3 65 typedef struct
sahilmgandhi 18:6a4db94011d3 66 {
sahilmgandhi 18:6a4db94011d3 67 uint32_t Tamper; /*!< Specifies the Tamper Pin.
sahilmgandhi 18:6a4db94011d3 68 This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */
sahilmgandhi 18:6a4db94011d3 69
sahilmgandhi 18:6a4db94011d3 70 uint32_t PinSelection; /*!< Specifies the Tamper Pin.
sahilmgandhi 18:6a4db94011d3 71 This parameter can be a value of @ref RTCEx_Tamper_Pins_Selection */
sahilmgandhi 18:6a4db94011d3 72
sahilmgandhi 18:6a4db94011d3 73 uint32_t Trigger; /*!< Specifies the Tamper Trigger.
sahilmgandhi 18:6a4db94011d3 74 This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */
sahilmgandhi 18:6a4db94011d3 75
sahilmgandhi 18:6a4db94011d3 76 uint32_t Filter; /*!< Specifies the RTC Filter Tamper.
sahilmgandhi 18:6a4db94011d3 77 This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */
sahilmgandhi 18:6a4db94011d3 78
sahilmgandhi 18:6a4db94011d3 79 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency.
sahilmgandhi 18:6a4db94011d3 80 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */
sahilmgandhi 18:6a4db94011d3 81
sahilmgandhi 18:6a4db94011d3 82 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration .
sahilmgandhi 18:6a4db94011d3 83 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */
sahilmgandhi 18:6a4db94011d3 84
sahilmgandhi 18:6a4db94011d3 85 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp .
sahilmgandhi 18:6a4db94011d3 86 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */
sahilmgandhi 18:6a4db94011d3 87
sahilmgandhi 18:6a4db94011d3 88 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection.
sahilmgandhi 18:6a4db94011d3 89 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */
sahilmgandhi 18:6a4db94011d3 90 }RTC_TamperTypeDef;
sahilmgandhi 18:6a4db94011d3 91 /**
sahilmgandhi 18:6a4db94011d3 92 * @}
sahilmgandhi 18:6a4db94011d3 93 */
sahilmgandhi 18:6a4db94011d3 94
sahilmgandhi 18:6a4db94011d3 95 /* Exported constants --------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 96 /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants
sahilmgandhi 18:6a4db94011d3 97 * @{
sahilmgandhi 18:6a4db94011d3 98 */
sahilmgandhi 18:6a4db94011d3 99
sahilmgandhi 18:6a4db94011d3 100 /** @defgroup RTCEx_Backup_Registers_Definitions RTC Backup Registers Definitions
sahilmgandhi 18:6a4db94011d3 101 * @{
sahilmgandhi 18:6a4db94011d3 102 */
sahilmgandhi 18:6a4db94011d3 103 #define RTC_BKP_DR0 ((uint32_t)0x00000000U)
sahilmgandhi 18:6a4db94011d3 104 #define RTC_BKP_DR1 ((uint32_t)0x00000001U)
sahilmgandhi 18:6a4db94011d3 105 #define RTC_BKP_DR2 ((uint32_t)0x00000002U)
sahilmgandhi 18:6a4db94011d3 106 #define RTC_BKP_DR3 ((uint32_t)0x00000003U)
sahilmgandhi 18:6a4db94011d3 107 #define RTC_BKP_DR4 ((uint32_t)0x00000004U)
sahilmgandhi 18:6a4db94011d3 108 #define RTC_BKP_DR5 ((uint32_t)0x00000005U)
sahilmgandhi 18:6a4db94011d3 109 #define RTC_BKP_DR6 ((uint32_t)0x00000006U)
sahilmgandhi 18:6a4db94011d3 110 #define RTC_BKP_DR7 ((uint32_t)0x00000007U)
sahilmgandhi 18:6a4db94011d3 111 #define RTC_BKP_DR8 ((uint32_t)0x00000008U)
sahilmgandhi 18:6a4db94011d3 112 #define RTC_BKP_DR9 ((uint32_t)0x00000009U)
sahilmgandhi 18:6a4db94011d3 113 #define RTC_BKP_DR10 ((uint32_t)0x0000000AU)
sahilmgandhi 18:6a4db94011d3 114 #define RTC_BKP_DR11 ((uint32_t)0x0000000BU)
sahilmgandhi 18:6a4db94011d3 115 #define RTC_BKP_DR12 ((uint32_t)0x0000000CU)
sahilmgandhi 18:6a4db94011d3 116 #define RTC_BKP_DR13 ((uint32_t)0x0000000DU)
sahilmgandhi 18:6a4db94011d3 117 #define RTC_BKP_DR14 ((uint32_t)0x0000000EU)
sahilmgandhi 18:6a4db94011d3 118 #define RTC_BKP_DR15 ((uint32_t)0x0000000FU)
sahilmgandhi 18:6a4db94011d3 119 #define RTC_BKP_DR16 ((uint32_t)0x00000010U)
sahilmgandhi 18:6a4db94011d3 120 #define RTC_BKP_DR17 ((uint32_t)0x00000011U)
sahilmgandhi 18:6a4db94011d3 121 #define RTC_BKP_DR18 ((uint32_t)0x00000012U)
sahilmgandhi 18:6a4db94011d3 122 #define RTC_BKP_DR19 ((uint32_t)0x00000013U)
sahilmgandhi 18:6a4db94011d3 123 /**
sahilmgandhi 18:6a4db94011d3 124 * @}
sahilmgandhi 18:6a4db94011d3 125 */
sahilmgandhi 18:6a4db94011d3 126
sahilmgandhi 18:6a4db94011d3 127 /** @defgroup RTCEx_Time_Stamp_Edges_definitions RTC TimeStamp Edges Definitions
sahilmgandhi 18:6a4db94011d3 128 * @{
sahilmgandhi 18:6a4db94011d3 129 */
sahilmgandhi 18:6a4db94011d3 130 #define RTC_TIMESTAMPEDGE_RISING ((uint32_t)0x00000000U)
sahilmgandhi 18:6a4db94011d3 131 #define RTC_TIMESTAMPEDGE_FALLING ((uint32_t)0x00000008U)
sahilmgandhi 18:6a4db94011d3 132 /**
sahilmgandhi 18:6a4db94011d3 133 * @}
sahilmgandhi 18:6a4db94011d3 134 */
sahilmgandhi 18:6a4db94011d3 135
sahilmgandhi 18:6a4db94011d3 136 /** @defgroup RTCEx_Tamper_Pins_Definitions RTC Tamper Pins Definitions
sahilmgandhi 18:6a4db94011d3 137 * @{
sahilmgandhi 18:6a4db94011d3 138 */
sahilmgandhi 18:6a4db94011d3 139 #define RTC_TAMPER_1 RTC_TAFCR_TAMP1E
sahilmgandhi 18:6a4db94011d3 140 #define RTC_TAMPER_2 RTC_TAFCR_TAMP2E
sahilmgandhi 18:6a4db94011d3 141 /**
sahilmgandhi 18:6a4db94011d3 142 * @}
sahilmgandhi 18:6a4db94011d3 143 */
sahilmgandhi 18:6a4db94011d3 144
sahilmgandhi 18:6a4db94011d3 145 /** @defgroup RTCEx_Tamper_Pins_Selection RTC tamper Pins Selection
sahilmgandhi 18:6a4db94011d3 146 * @{
sahilmgandhi 18:6a4db94011d3 147 */
sahilmgandhi 18:6a4db94011d3 148 #define RTC_TAMPERPIN_DEFAULT ((uint32_t)0x00000000U)
sahilmgandhi 18:6a4db94011d3 149 #define RTC_TAMPERPIN_POS1 ((uint32_t)0x00010000U)
sahilmgandhi 18:6a4db94011d3 150 /**
sahilmgandhi 18:6a4db94011d3 151 * @}
sahilmgandhi 18:6a4db94011d3 152 */
sahilmgandhi 18:6a4db94011d3 153
sahilmgandhi 18:6a4db94011d3 154 /** @defgroup RTCEx_TimeStamp_Pin_Selection RTC TimeStamp Pins Selection
sahilmgandhi 18:6a4db94011d3 155 * @{
sahilmgandhi 18:6a4db94011d3 156 */
sahilmgandhi 18:6a4db94011d3 157 #define RTC_TIMESTAMPPIN_DEFAULT ((uint32_t)0x00000000U)
sahilmgandhi 18:6a4db94011d3 158 #define RTC_TIMESTAMPPIN_POS1 ((uint32_t)0x00020000U)
sahilmgandhi 18:6a4db94011d3 159 /**
sahilmgandhi 18:6a4db94011d3 160 * @}
sahilmgandhi 18:6a4db94011d3 161 */
sahilmgandhi 18:6a4db94011d3 162
sahilmgandhi 18:6a4db94011d3 163 /** @defgroup RTCEx_Tamper_Trigger_Definitions RTC Tamper Triggers Definitions
sahilmgandhi 18:6a4db94011d3 164 * @{
sahilmgandhi 18:6a4db94011d3 165 */
sahilmgandhi 18:6a4db94011d3 166 #define RTC_TAMPERTRIGGER_RISINGEDGE ((uint32_t)0x00000000U)
sahilmgandhi 18:6a4db94011d3 167 #define RTC_TAMPERTRIGGER_FALLINGEDGE ((uint32_t)0x00000002U)
sahilmgandhi 18:6a4db94011d3 168 #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE
sahilmgandhi 18:6a4db94011d3 169 #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE
sahilmgandhi 18:6a4db94011d3 170 /**
sahilmgandhi 18:6a4db94011d3 171 * @}
sahilmgandhi 18:6a4db94011d3 172 */
sahilmgandhi 18:6a4db94011d3 173
sahilmgandhi 18:6a4db94011d3 174 /** @defgroup RTCEx_Tamper_Filter_Definitions RTC Tamper Filter Definitions
sahilmgandhi 18:6a4db94011d3 175 * @{
sahilmgandhi 18:6a4db94011d3 176 */
sahilmgandhi 18:6a4db94011d3 177 #define RTC_TAMPERFILTER_DISABLE ((uint32_t)0x00000000U) /*!< Tamper filter is disabled */
sahilmgandhi 18:6a4db94011d3 178
sahilmgandhi 18:6a4db94011d3 179 #define RTC_TAMPERFILTER_2SAMPLE ((uint32_t)0x00000800U) /*!< Tamper is activated after 2
sahilmgandhi 18:6a4db94011d3 180 consecutive samples at the active level */
sahilmgandhi 18:6a4db94011d3 181 #define RTC_TAMPERFILTER_4SAMPLE ((uint32_t)0x00001000U) /*!< Tamper is activated after 4
sahilmgandhi 18:6a4db94011d3 182 consecutive samples at the active level */
sahilmgandhi 18:6a4db94011d3 183 #define RTC_TAMPERFILTER_8SAMPLE ((uint32_t)0x00001800U) /*!< Tamper is activated after 8
sahilmgandhi 18:6a4db94011d3 184 consecutive samples at the active level. */
sahilmgandhi 18:6a4db94011d3 185 /**
sahilmgandhi 18:6a4db94011d3 186 * @}
sahilmgandhi 18:6a4db94011d3 187 */
sahilmgandhi 18:6a4db94011d3 188
sahilmgandhi 18:6a4db94011d3 189 /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTC Tamper Sampling Frequencies Definitions
sahilmgandhi 18:6a4db94011d3 190 * @{
sahilmgandhi 18:6a4db94011d3 191 */
sahilmgandhi 18:6a4db94011d3 192 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 ((uint32_t)0x00000000U) /*!< Each of the tamper inputs are sampled
sahilmgandhi 18:6a4db94011d3 193 with a frequency = RTCCLK / 32768 */
sahilmgandhi 18:6a4db94011d3 194 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 ((uint32_t)0x00000100U) /*!< Each of the tamper inputs are sampled
sahilmgandhi 18:6a4db94011d3 195 with a frequency = RTCCLK / 16384 */
sahilmgandhi 18:6a4db94011d3 196 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 ((uint32_t)0x00000200U) /*!< Each of the tamper inputs are sampled
sahilmgandhi 18:6a4db94011d3 197 with a frequency = RTCCLK / 8192 */
sahilmgandhi 18:6a4db94011d3 198 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 ((uint32_t)0x00000300U) /*!< Each of the tamper inputs are sampled
sahilmgandhi 18:6a4db94011d3 199 with a frequency = RTCCLK / 4096 */
sahilmgandhi 18:6a4db94011d3 200 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 ((uint32_t)0x00000400U) /*!< Each of the tamper inputs are sampled
sahilmgandhi 18:6a4db94011d3 201 with a frequency = RTCCLK / 2048 */
sahilmgandhi 18:6a4db94011d3 202 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 ((uint32_t)0x00000500U) /*!< Each of the tamper inputs are sampled
sahilmgandhi 18:6a4db94011d3 203 with a frequency = RTCCLK / 1024 */
sahilmgandhi 18:6a4db94011d3 204 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 ((uint32_t)0x00000600U) /*!< Each of the tamper inputs are sampled
sahilmgandhi 18:6a4db94011d3 205 with a frequency = RTCCLK / 512 */
sahilmgandhi 18:6a4db94011d3 206 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 ((uint32_t)0x00000700U) /*!< Each of the tamper inputs are sampled
sahilmgandhi 18:6a4db94011d3 207 with a frequency = RTCCLK / 256 */
sahilmgandhi 18:6a4db94011d3 208 /**
sahilmgandhi 18:6a4db94011d3 209 * @}
sahilmgandhi 18:6a4db94011d3 210 */
sahilmgandhi 18:6a4db94011d3 211
sahilmgandhi 18:6a4db94011d3 212 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTC Tamper Pin Precharge Duration Definitions
sahilmgandhi 18:6a4db94011d3 213 * @{
sahilmgandhi 18:6a4db94011d3 214 */
sahilmgandhi 18:6a4db94011d3 215 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK ((uint32_t)0x00000000U) /*!< Tamper pins are pre-charged before
sahilmgandhi 18:6a4db94011d3 216 sampling during 1 RTCCLK cycle */
sahilmgandhi 18:6a4db94011d3 217 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK ((uint32_t)0x00002000U) /*!< Tamper pins are pre-charged before
sahilmgandhi 18:6a4db94011d3 218 sampling during 2 RTCCLK cycles */
sahilmgandhi 18:6a4db94011d3 219 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK ((uint32_t)0x00004000U) /*!< Tamper pins are pre-charged before
sahilmgandhi 18:6a4db94011d3 220 sampling during 4 RTCCLK cycles */
sahilmgandhi 18:6a4db94011d3 221 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK ((uint32_t)0x00006000U) /*!< Tamper pins are pre-charged before
sahilmgandhi 18:6a4db94011d3 222 sampling during 8 RTCCLK cycles */
sahilmgandhi 18:6a4db94011d3 223 /**
sahilmgandhi 18:6a4db94011d3 224 * @}
sahilmgandhi 18:6a4db94011d3 225 */
sahilmgandhi 18:6a4db94011d3 226
sahilmgandhi 18:6a4db94011d3 227 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTC Tamper TimeStamp On Tamper Detection Definitions
sahilmgandhi 18:6a4db94011d3 228 * @{
sahilmgandhi 18:6a4db94011d3 229 */
sahilmgandhi 18:6a4db94011d3 230 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE ((uint32_t)RTC_TAFCR_TAMPTS) /*!< TimeStamp on Tamper Detection event saved */
sahilmgandhi 18:6a4db94011d3 231 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE ((uint32_t)0x00000000U) /*!< TimeStamp on Tamper Detection event is not saved */
sahilmgandhi 18:6a4db94011d3 232 /**
sahilmgandhi 18:6a4db94011d3 233 * @}
sahilmgandhi 18:6a4db94011d3 234 */
sahilmgandhi 18:6a4db94011d3 235
sahilmgandhi 18:6a4db94011d3 236 /** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTC Tamper Pull Up Definitions
sahilmgandhi 18:6a4db94011d3 237 * @{
sahilmgandhi 18:6a4db94011d3 238 */
sahilmgandhi 18:6a4db94011d3 239 #define RTC_TAMPER_PULLUP_ENABLE ((uint32_t)0x00000000U) /*!< TimeStamp on Tamper Detection event saved */
sahilmgandhi 18:6a4db94011d3 240 #define RTC_TAMPER_PULLUP_DISABLE ((uint32_t)RTC_TAFCR_TAMPPUDIS) /*!< TimeStamp on Tamper Detection event is not saved */
sahilmgandhi 18:6a4db94011d3 241 /**
sahilmgandhi 18:6a4db94011d3 242 * @}
sahilmgandhi 18:6a4db94011d3 243 */
sahilmgandhi 18:6a4db94011d3 244
sahilmgandhi 18:6a4db94011d3 245 /** @defgroup RTCEx_Wakeup_Timer_Definitions RTC Wake-up Timer Definitions
sahilmgandhi 18:6a4db94011d3 246 * @{
sahilmgandhi 18:6a4db94011d3 247 */
sahilmgandhi 18:6a4db94011d3 248 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 ((uint32_t)0x00000000U)
sahilmgandhi 18:6a4db94011d3 249 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 ((uint32_t)0x00000001U)
sahilmgandhi 18:6a4db94011d3 250 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 ((uint32_t)0x00000002U)
sahilmgandhi 18:6a4db94011d3 251 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 ((uint32_t)0x00000003U)
sahilmgandhi 18:6a4db94011d3 252 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS ((uint32_t)0x00000004U)
sahilmgandhi 18:6a4db94011d3 253 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS ((uint32_t)0x00000006U)
sahilmgandhi 18:6a4db94011d3 254 /**
sahilmgandhi 18:6a4db94011d3 255 * @}
sahilmgandhi 18:6a4db94011d3 256 */
sahilmgandhi 18:6a4db94011d3 257
sahilmgandhi 18:6a4db94011d3 258 /** @defgroup RTCEx_Digital_Calibration_Definitions RTC Digital Calib Definitions
sahilmgandhi 18:6a4db94011d3 259 * @{
sahilmgandhi 18:6a4db94011d3 260 */
sahilmgandhi 18:6a4db94011d3 261 #define RTC_CALIBSIGN_POSITIVE ((uint32_t)0x00000000U)
sahilmgandhi 18:6a4db94011d3 262 #define RTC_CALIBSIGN_NEGATIVE ((uint32_t)0x00000080U)
sahilmgandhi 18:6a4db94011d3 263 /**
sahilmgandhi 18:6a4db94011d3 264 * @}
sahilmgandhi 18:6a4db94011d3 265 */
sahilmgandhi 18:6a4db94011d3 266
sahilmgandhi 18:6a4db94011d3 267 /** @defgroup RTCEx_Smooth_calib_period_Definitions RTC Smooth Calib Period Definitions
sahilmgandhi 18:6a4db94011d3 268 * @{
sahilmgandhi 18:6a4db94011d3 269 */
sahilmgandhi 18:6a4db94011d3 270 #define RTC_SMOOTHCALIB_PERIOD_32SEC ((uint32_t)0x00000000U) /*!< If RTCCLK = 32768 Hz, Smooth calibration
sahilmgandhi 18:6a4db94011d3 271 period is 32s, else 2exp20 RTCCLK seconds */
sahilmgandhi 18:6a4db94011d3 272 #define RTC_SMOOTHCALIB_PERIOD_16SEC ((uint32_t)0x00002000U) /*!< If RTCCLK = 32768 Hz, Smooth calibration
sahilmgandhi 18:6a4db94011d3 273 period is 16s, else 2exp19 RTCCLK seconds */
sahilmgandhi 18:6a4db94011d3 274 #define RTC_SMOOTHCALIB_PERIOD_8SEC ((uint32_t)0x00004000U) /*!< If RTCCLK = 32768 Hz, Smooth calibration
sahilmgandhi 18:6a4db94011d3 275 period is 8s, else 2exp18 RTCCLK seconds */
sahilmgandhi 18:6a4db94011d3 276 /**
sahilmgandhi 18:6a4db94011d3 277 * @}
sahilmgandhi 18:6a4db94011d3 278 */
sahilmgandhi 18:6a4db94011d3 279
sahilmgandhi 18:6a4db94011d3 280 /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTC Smooth Calib Plus Pulses Definitions
sahilmgandhi 18:6a4db94011d3 281 * @{
sahilmgandhi 18:6a4db94011d3 282 */
sahilmgandhi 18:6a4db94011d3 283 #define RTC_SMOOTHCALIB_PLUSPULSES_SET ((uint32_t)0x00008000U) /*!< The number of RTCCLK pulses added
sahilmgandhi 18:6a4db94011d3 284 during a X -second window = Y - CALM[8:0]
sahilmgandhi 18:6a4db94011d3 285 with Y = 512, 256, 128 when X = 32, 16, 8 */
sahilmgandhi 18:6a4db94011d3 286 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET ((uint32_t)0x00000000U) /*!< The number of RTCCLK pulses subbstited
sahilmgandhi 18:6a4db94011d3 287 during a 32-second window = CALM[8:0] */
sahilmgandhi 18:6a4db94011d3 288 /**
sahilmgandhi 18:6a4db94011d3 289 * @}
sahilmgandhi 18:6a4db94011d3 290 */
sahilmgandhi 18:6a4db94011d3 291
sahilmgandhi 18:6a4db94011d3 292 /** @defgroup RTCEx_Add_1_Second_Parameter_Definitions RTC Add 1 Second Parameter Definitions
sahilmgandhi 18:6a4db94011d3 293 * @{
sahilmgandhi 18:6a4db94011d3 294 */
sahilmgandhi 18:6a4db94011d3 295 #define RTC_SHIFTADD1S_RESET ((uint32_t)0x00000000U)
sahilmgandhi 18:6a4db94011d3 296 #define RTC_SHIFTADD1S_SET ((uint32_t)0x80000000U)
sahilmgandhi 18:6a4db94011d3 297 /**
sahilmgandhi 18:6a4db94011d3 298 * @}
sahilmgandhi 18:6a4db94011d3 299 */
sahilmgandhi 18:6a4db94011d3 300
sahilmgandhi 18:6a4db94011d3 301
sahilmgandhi 18:6a4db94011d3 302 /** @defgroup RTCEx_Calib_Output_selection_Definitions RTC Calib Output Selection Definitions
sahilmgandhi 18:6a4db94011d3 303 * @{
sahilmgandhi 18:6a4db94011d3 304 */
sahilmgandhi 18:6a4db94011d3 305 #define RTC_CALIBOUTPUT_512HZ ((uint32_t)0x00000000U)
sahilmgandhi 18:6a4db94011d3 306 #define RTC_CALIBOUTPUT_1HZ ((uint32_t)0x00080000U)
sahilmgandhi 18:6a4db94011d3 307 /**
sahilmgandhi 18:6a4db94011d3 308 * @}
sahilmgandhi 18:6a4db94011d3 309 */
sahilmgandhi 18:6a4db94011d3 310
sahilmgandhi 18:6a4db94011d3 311 /**
sahilmgandhi 18:6a4db94011d3 312 * @}
sahilmgandhi 18:6a4db94011d3 313 */
sahilmgandhi 18:6a4db94011d3 314
sahilmgandhi 18:6a4db94011d3 315 /* Exported macro ------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 316 /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros
sahilmgandhi 18:6a4db94011d3 317 * @{
sahilmgandhi 18:6a4db94011d3 318 */
sahilmgandhi 18:6a4db94011d3 319
sahilmgandhi 18:6a4db94011d3 320 /* ---------------------------------WAKEUPTIMER---------------------------------*/
sahilmgandhi 18:6a4db94011d3 321 /** @defgroup RTCEx_WakeUp_Timer RTC WakeUp Timer
sahilmgandhi 18:6a4db94011d3 322 * @{
sahilmgandhi 18:6a4db94011d3 323 */
sahilmgandhi 18:6a4db94011d3 324
sahilmgandhi 18:6a4db94011d3 325 /**
sahilmgandhi 18:6a4db94011d3 326 * @brief Enable the RTC WakeUp Timer peripheral.
sahilmgandhi 18:6a4db94011d3 327 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 328 * @retval None
sahilmgandhi 18:6a4db94011d3 329 */
sahilmgandhi 18:6a4db94011d3 330 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE))
sahilmgandhi 18:6a4db94011d3 331
sahilmgandhi 18:6a4db94011d3 332 /**
sahilmgandhi 18:6a4db94011d3 333 * @brief Disable the RTC Wake-up Timer peripheral.
sahilmgandhi 18:6a4db94011d3 334 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 335 * @retval None
sahilmgandhi 18:6a4db94011d3 336 */
sahilmgandhi 18:6a4db94011d3 337 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE))
sahilmgandhi 18:6a4db94011d3 338
sahilmgandhi 18:6a4db94011d3 339 /**
sahilmgandhi 18:6a4db94011d3 340 * @brief Enable the RTC WakeUpTimer interrupt.
sahilmgandhi 18:6a4db94011d3 341 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 342 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
sahilmgandhi 18:6a4db94011d3 343 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 344 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
sahilmgandhi 18:6a4db94011d3 345 * @retval None
sahilmgandhi 18:6a4db94011d3 346 */
sahilmgandhi 18:6a4db94011d3 347 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
sahilmgandhi 18:6a4db94011d3 348
sahilmgandhi 18:6a4db94011d3 349 /**
sahilmgandhi 18:6a4db94011d3 350 * @brief Disable the RTC WakeUpTimer interrupt.
sahilmgandhi 18:6a4db94011d3 351 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 352 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
sahilmgandhi 18:6a4db94011d3 353 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 354 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
sahilmgandhi 18:6a4db94011d3 355 * @retval None
sahilmgandhi 18:6a4db94011d3 356 */
sahilmgandhi 18:6a4db94011d3 357 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
sahilmgandhi 18:6a4db94011d3 358
sahilmgandhi 18:6a4db94011d3 359 /**
sahilmgandhi 18:6a4db94011d3 360 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
sahilmgandhi 18:6a4db94011d3 361 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 362 * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt to check.
sahilmgandhi 18:6a4db94011d3 363 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 364 * @arg RTC_IT_WUT: WakeUpTimer A interrupt
sahilmgandhi 18:6a4db94011d3 365 * @retval None
sahilmgandhi 18:6a4db94011d3 366 */
sahilmgandhi 18:6a4db94011d3 367 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4U)) != RESET)? SET : RESET)
sahilmgandhi 18:6a4db94011d3 368
sahilmgandhi 18:6a4db94011d3 369 /**
sahilmgandhi 18:6a4db94011d3 370 * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not.
sahilmgandhi 18:6a4db94011d3 371 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 372 * @param __INTERRUPT__: specifies the RTC Wake Up timer interrupt sources to check.
sahilmgandhi 18:6a4db94011d3 373 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 374 * @arg RTC_IT_WUT: WakeUpTimer interrupt
sahilmgandhi 18:6a4db94011d3 375 * @retval None
sahilmgandhi 18:6a4db94011d3 376 */
sahilmgandhi 18:6a4db94011d3 377 #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
sahilmgandhi 18:6a4db94011d3 378
sahilmgandhi 18:6a4db94011d3 379 /**
sahilmgandhi 18:6a4db94011d3 380 * @brief Get the selected RTC WakeUpTimer's flag status.
sahilmgandhi 18:6a4db94011d3 381 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 382 * @param __FLAG__: specifies the RTC WakeUpTimer Flag to check.
sahilmgandhi 18:6a4db94011d3 383 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 384 * @arg RTC_FLAG_WUTF
sahilmgandhi 18:6a4db94011d3 385 * @arg RTC_FLAG_WUTWF
sahilmgandhi 18:6a4db94011d3 386 * @retval None
sahilmgandhi 18:6a4db94011d3 387 */
sahilmgandhi 18:6a4db94011d3 388 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
sahilmgandhi 18:6a4db94011d3 389
sahilmgandhi 18:6a4db94011d3 390 /**
sahilmgandhi 18:6a4db94011d3 391 * @brief Clear the RTC Wake Up timer's pending flags.
sahilmgandhi 18:6a4db94011d3 392 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 393 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
sahilmgandhi 18:6a4db94011d3 394 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 395 * @arg RTC_FLAG_WUTF
sahilmgandhi 18:6a4db94011d3 396 * @retval None
sahilmgandhi 18:6a4db94011d3 397 */
sahilmgandhi 18:6a4db94011d3 398 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
sahilmgandhi 18:6a4db94011d3 399
sahilmgandhi 18:6a4db94011d3 400 /**
sahilmgandhi 18:6a4db94011d3 401 * @brief Enable interrupt on the RTC Wake-up Timer associated Exti line.
sahilmgandhi 18:6a4db94011d3 402 * @retval None
sahilmgandhi 18:6a4db94011d3 403 */
sahilmgandhi 18:6a4db94011d3 404 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
sahilmgandhi 18:6a4db94011d3 405
sahilmgandhi 18:6a4db94011d3 406 /**
sahilmgandhi 18:6a4db94011d3 407 * @brief Disable interrupt on the RTC Wake-up Timer associated Exti line.
sahilmgandhi 18:6a4db94011d3 408 * @retval None
sahilmgandhi 18:6a4db94011d3 409 */
sahilmgandhi 18:6a4db94011d3 410 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
sahilmgandhi 18:6a4db94011d3 411
sahilmgandhi 18:6a4db94011d3 412 /**
sahilmgandhi 18:6a4db94011d3 413 * @brief Enable event on the RTC Wake-up Timer associated Exti line.
sahilmgandhi 18:6a4db94011d3 414 * @retval None.
sahilmgandhi 18:6a4db94011d3 415 */
sahilmgandhi 18:6a4db94011d3 416 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
sahilmgandhi 18:6a4db94011d3 417
sahilmgandhi 18:6a4db94011d3 418 /**
sahilmgandhi 18:6a4db94011d3 419 * @brief Disable event on the RTC Wake-up Timer associated Exti line.
sahilmgandhi 18:6a4db94011d3 420 * @retval None.
sahilmgandhi 18:6a4db94011d3 421 */
sahilmgandhi 18:6a4db94011d3 422 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
sahilmgandhi 18:6a4db94011d3 423
sahilmgandhi 18:6a4db94011d3 424 /**
sahilmgandhi 18:6a4db94011d3 425 * @brief Enable falling edge trigger on the RTC Wake-up Timer associated Exti line.
sahilmgandhi 18:6a4db94011d3 426 * @retval None.
sahilmgandhi 18:6a4db94011d3 427 */
sahilmgandhi 18:6a4db94011d3 428 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
sahilmgandhi 18:6a4db94011d3 429
sahilmgandhi 18:6a4db94011d3 430 /**
sahilmgandhi 18:6a4db94011d3 431 * @brief Disable falling edge trigger on the RTC Wake-up Timer associated Exti line.
sahilmgandhi 18:6a4db94011d3 432 * @retval None.
sahilmgandhi 18:6a4db94011d3 433 */
sahilmgandhi 18:6a4db94011d3 434 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
sahilmgandhi 18:6a4db94011d3 435
sahilmgandhi 18:6a4db94011d3 436 /**
sahilmgandhi 18:6a4db94011d3 437 * @brief Enable rising edge trigger on the RTC Wake-up Timer associated Exti line.
sahilmgandhi 18:6a4db94011d3 438 * @retval None.
sahilmgandhi 18:6a4db94011d3 439 */
sahilmgandhi 18:6a4db94011d3 440 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
sahilmgandhi 18:6a4db94011d3 441
sahilmgandhi 18:6a4db94011d3 442 /**
sahilmgandhi 18:6a4db94011d3 443 * @brief Disable rising edge trigger on the RTC Wake-up Timer associated Exti line.
sahilmgandhi 18:6a4db94011d3 444 * @retval None.
sahilmgandhi 18:6a4db94011d3 445 */
sahilmgandhi 18:6a4db94011d3 446 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
sahilmgandhi 18:6a4db94011d3 447
sahilmgandhi 18:6a4db94011d3 448 /**
sahilmgandhi 18:6a4db94011d3 449 * @brief Enable rising & falling edge trigger on the RTC Wake-up Timer associated Exti line.
sahilmgandhi 18:6a4db94011d3 450 * @retval None.
sahilmgandhi 18:6a4db94011d3 451 */
sahilmgandhi 18:6a4db94011d3 452 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() do { __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();\
sahilmgandhi 18:6a4db94011d3 453 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE();\
sahilmgandhi 18:6a4db94011d3 454 } while(0)
sahilmgandhi 18:6a4db94011d3 455
sahilmgandhi 18:6a4db94011d3 456 /**
sahilmgandhi 18:6a4db94011d3 457 * @brief Disable rising & falling edge trigger on the RTC Wake-up Timer associated Exti line.
sahilmgandhi 18:6a4db94011d3 458 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 459 * @retval None.
sahilmgandhi 18:6a4db94011d3 460 */
sahilmgandhi 18:6a4db94011d3 461 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() do { __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();\
sahilmgandhi 18:6a4db94011d3 462 __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE();\
sahilmgandhi 18:6a4db94011d3 463 } while(0)
sahilmgandhi 18:6a4db94011d3 464
sahilmgandhi 18:6a4db94011d3 465 /**
sahilmgandhi 18:6a4db94011d3 466 * @brief Check whether the RTC Wake-up Timer associated Exti line interrupt flag is set or not.
sahilmgandhi 18:6a4db94011d3 467 * @retval Line Status.
sahilmgandhi 18:6a4db94011d3 468 */
sahilmgandhi 18:6a4db94011d3 469 #define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
sahilmgandhi 18:6a4db94011d3 470
sahilmgandhi 18:6a4db94011d3 471 /**
sahilmgandhi 18:6a4db94011d3 472 * @brief Clear the RTC Wake-up Timer associated Exti line flag.
sahilmgandhi 18:6a4db94011d3 473 * @retval None.
sahilmgandhi 18:6a4db94011d3 474 */
sahilmgandhi 18:6a4db94011d3 475 #define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
sahilmgandhi 18:6a4db94011d3 476
sahilmgandhi 18:6a4db94011d3 477 /**
sahilmgandhi 18:6a4db94011d3 478 * @brief Generate a Software interrupt on the RTC Wake-up Timer associated Exti line.
sahilmgandhi 18:6a4db94011d3 479 * @retval None.
sahilmgandhi 18:6a4db94011d3 480 */
sahilmgandhi 18:6a4db94011d3 481 #define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
sahilmgandhi 18:6a4db94011d3 482
sahilmgandhi 18:6a4db94011d3 483 /**
sahilmgandhi 18:6a4db94011d3 484 * @}
sahilmgandhi 18:6a4db94011d3 485 */
sahilmgandhi 18:6a4db94011d3 486
sahilmgandhi 18:6a4db94011d3 487 /* ---------------------------------TIMESTAMP---------------------------------*/
sahilmgandhi 18:6a4db94011d3 488 /** @defgroup RTCEx_Timestamp RTC Timestamp
sahilmgandhi 18:6a4db94011d3 489 * @{
sahilmgandhi 18:6a4db94011d3 490 */
sahilmgandhi 18:6a4db94011d3 491
sahilmgandhi 18:6a4db94011d3 492 /**
sahilmgandhi 18:6a4db94011d3 493 * @brief Enable the RTC TimeStamp peripheral.
sahilmgandhi 18:6a4db94011d3 494 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 495 * @retval None
sahilmgandhi 18:6a4db94011d3 496 */
sahilmgandhi 18:6a4db94011d3 497 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE))
sahilmgandhi 18:6a4db94011d3 498
sahilmgandhi 18:6a4db94011d3 499 /**
sahilmgandhi 18:6a4db94011d3 500 * @brief Disable the RTC TimeStamp peripheral.
sahilmgandhi 18:6a4db94011d3 501 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 502 * @retval None
sahilmgandhi 18:6a4db94011d3 503 */
sahilmgandhi 18:6a4db94011d3 504 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE))
sahilmgandhi 18:6a4db94011d3 505
sahilmgandhi 18:6a4db94011d3 506 /**
sahilmgandhi 18:6a4db94011d3 507 * @brief Enable the RTC TimeStamp interrupt.
sahilmgandhi 18:6a4db94011d3 508 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 509 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
sahilmgandhi 18:6a4db94011d3 510 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 511 * @arg RTC_IT_TS: TimeStamp interrupt
sahilmgandhi 18:6a4db94011d3 512 * @retval None
sahilmgandhi 18:6a4db94011d3 513 */
sahilmgandhi 18:6a4db94011d3 514 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
sahilmgandhi 18:6a4db94011d3 515
sahilmgandhi 18:6a4db94011d3 516 /**
sahilmgandhi 18:6a4db94011d3 517 * @brief Disable the RTC TimeStamp interrupt.
sahilmgandhi 18:6a4db94011d3 518 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 519 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
sahilmgandhi 18:6a4db94011d3 520 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 521 * @arg RTC_IT_TS: TimeStamp interrupt
sahilmgandhi 18:6a4db94011d3 522 * @retval None
sahilmgandhi 18:6a4db94011d3 523 */
sahilmgandhi 18:6a4db94011d3 524 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
sahilmgandhi 18:6a4db94011d3 525
sahilmgandhi 18:6a4db94011d3 526 /**
sahilmgandhi 18:6a4db94011d3 527 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not.
sahilmgandhi 18:6a4db94011d3 528 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 529 * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt to check.
sahilmgandhi 18:6a4db94011d3 530 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 531 * @arg RTC_IT_TS: TimeStamp interrupt
sahilmgandhi 18:6a4db94011d3 532 * @retval None
sahilmgandhi 18:6a4db94011d3 533 */
sahilmgandhi 18:6a4db94011d3 534 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4U)) != RESET)? SET : RESET)
sahilmgandhi 18:6a4db94011d3 535
sahilmgandhi 18:6a4db94011d3 536 /**
sahilmgandhi 18:6a4db94011d3 537 * @brief Check whether the specified RTC Time Stamp interrupt has been enabled or not.
sahilmgandhi 18:6a4db94011d3 538 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 539 * @param __INTERRUPT__: specifies the RTC Time Stamp interrupt source to check.
sahilmgandhi 18:6a4db94011d3 540 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 541 * @arg RTC_IT_TS: TimeStamp interrupt
sahilmgandhi 18:6a4db94011d3 542 * @retval None
sahilmgandhi 18:6a4db94011d3 543 */
sahilmgandhi 18:6a4db94011d3 544 #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
sahilmgandhi 18:6a4db94011d3 545
sahilmgandhi 18:6a4db94011d3 546 /**
sahilmgandhi 18:6a4db94011d3 547 * @brief Get the selected RTC TimeStamp's flag status.
sahilmgandhi 18:6a4db94011d3 548 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 549 * @param __FLAG__: specifies the RTC TimeStamp flag to check.
sahilmgandhi 18:6a4db94011d3 550 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 551 * @arg RTC_FLAG_TSF
sahilmgandhi 18:6a4db94011d3 552 * @arg RTC_FLAG_TSOVF
sahilmgandhi 18:6a4db94011d3 553 * @retval None
sahilmgandhi 18:6a4db94011d3 554 */
sahilmgandhi 18:6a4db94011d3 555 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
sahilmgandhi 18:6a4db94011d3 556
sahilmgandhi 18:6a4db94011d3 557 /**
sahilmgandhi 18:6a4db94011d3 558 * @brief Clear the RTC Time Stamp's pending flags.
sahilmgandhi 18:6a4db94011d3 559 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 560 * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
sahilmgandhi 18:6a4db94011d3 561 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 562 * @arg RTC_FLAG_TSF
sahilmgandhi 18:6a4db94011d3 563 * @retval None
sahilmgandhi 18:6a4db94011d3 564 */
sahilmgandhi 18:6a4db94011d3 565 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
sahilmgandhi 18:6a4db94011d3 566
sahilmgandhi 18:6a4db94011d3 567 /**
sahilmgandhi 18:6a4db94011d3 568 * @}
sahilmgandhi 18:6a4db94011d3 569 */
sahilmgandhi 18:6a4db94011d3 570
sahilmgandhi 18:6a4db94011d3 571 /* ---------------------------------TAMPER------------------------------------*/
sahilmgandhi 18:6a4db94011d3 572 /** @defgroup RTCEx_Tamper RTC Tamper
sahilmgandhi 18:6a4db94011d3 573 * @{
sahilmgandhi 18:6a4db94011d3 574 */
sahilmgandhi 18:6a4db94011d3 575
sahilmgandhi 18:6a4db94011d3 576 /**
sahilmgandhi 18:6a4db94011d3 577 * @brief Enable the RTC Tamper1 input detection.
sahilmgandhi 18:6a4db94011d3 578 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 579 * @retval None
sahilmgandhi 18:6a4db94011d3 580 */
sahilmgandhi 18:6a4db94011d3 581 #define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR |= (RTC_TAFCR_TAMP1E))
sahilmgandhi 18:6a4db94011d3 582
sahilmgandhi 18:6a4db94011d3 583 /**
sahilmgandhi 18:6a4db94011d3 584 * @brief Disable the RTC Tamper1 input detection.
sahilmgandhi 18:6a4db94011d3 585 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 586 * @retval None
sahilmgandhi 18:6a4db94011d3 587 */
sahilmgandhi 18:6a4db94011d3 588 #define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR &= ~(RTC_TAFCR_TAMP1E))
sahilmgandhi 18:6a4db94011d3 589
sahilmgandhi 18:6a4db94011d3 590 /**
sahilmgandhi 18:6a4db94011d3 591 * @brief Enable the RTC Tamper2 input detection.
sahilmgandhi 18:6a4db94011d3 592 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 593 * @retval None
sahilmgandhi 18:6a4db94011d3 594 */
sahilmgandhi 18:6a4db94011d3 595 #define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR |= (RTC_TAFCR_TAMP2E))
sahilmgandhi 18:6a4db94011d3 596
sahilmgandhi 18:6a4db94011d3 597 /**
sahilmgandhi 18:6a4db94011d3 598 * @brief Disable the RTC Tamper2 input detection.
sahilmgandhi 18:6a4db94011d3 599 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 600 * @retval None
sahilmgandhi 18:6a4db94011d3 601 */
sahilmgandhi 18:6a4db94011d3 602 #define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR &= ~(RTC_TAFCR_TAMP2E))
sahilmgandhi 18:6a4db94011d3 603
sahilmgandhi 18:6a4db94011d3 604 /**
sahilmgandhi 18:6a4db94011d3 605 * @brief Check whether the specified RTC Tamper interrupt has occurred or not.
sahilmgandhi 18:6a4db94011d3 606 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 607 * @param __INTERRUPT__: specifies the RTC Tamper interrupt to check.
sahilmgandhi 18:6a4db94011d3 608 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 609 * @arg RTC_IT_TAMP1
sahilmgandhi 18:6a4db94011d3 610 * @arg RTC_IT_TAMP2
sahilmgandhi 18:6a4db94011d3 611 * @retval None
sahilmgandhi 18:6a4db94011d3 612 */
sahilmgandhi 18:6a4db94011d3 613 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4U)) != RESET)? SET : RESET)
sahilmgandhi 18:6a4db94011d3 614
sahilmgandhi 18:6a4db94011d3 615 /**
sahilmgandhi 18:6a4db94011d3 616 * @brief Check whether the specified RTC Tamper interrupt has been enabled or not.
sahilmgandhi 18:6a4db94011d3 617 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 618 * @param __INTERRUPT__: specifies the RTC Tamper interrupt source to check.
sahilmgandhi 18:6a4db94011d3 619 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 620 * @arg RTC_IT_TAMP: Tamper interrupt
sahilmgandhi 18:6a4db94011d3 621 * @retval None
sahilmgandhi 18:6a4db94011d3 622 */
sahilmgandhi 18:6a4db94011d3 623 #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->TAFCR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
sahilmgandhi 18:6a4db94011d3 624
sahilmgandhi 18:6a4db94011d3 625 /**
sahilmgandhi 18:6a4db94011d3 626 * @brief Get the selected RTC Tamper's flag status.
sahilmgandhi 18:6a4db94011d3 627 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 628 * @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
sahilmgandhi 18:6a4db94011d3 629 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 630 * @arg RTC_FLAG_TAMP1F
sahilmgandhi 18:6a4db94011d3 631 * @arg RTC_FLAG_TAMP2F
sahilmgandhi 18:6a4db94011d3 632 * @retval None
sahilmgandhi 18:6a4db94011d3 633 */
sahilmgandhi 18:6a4db94011d3 634 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
sahilmgandhi 18:6a4db94011d3 635
sahilmgandhi 18:6a4db94011d3 636 /**
sahilmgandhi 18:6a4db94011d3 637 * @brief Clear the RTC Tamper's pending flags.
sahilmgandhi 18:6a4db94011d3 638 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 639 * @param __FLAG__: specifies the RTC Tamper Flag to clear.
sahilmgandhi 18:6a4db94011d3 640 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 641 * @arg RTC_FLAG_TAMP1F
sahilmgandhi 18:6a4db94011d3 642 * @arg RTC_FLAG_TAMP2F
sahilmgandhi 18:6a4db94011d3 643 * @retval None
sahilmgandhi 18:6a4db94011d3 644 */
sahilmgandhi 18:6a4db94011d3 645 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
sahilmgandhi 18:6a4db94011d3 646 /**
sahilmgandhi 18:6a4db94011d3 647 * @}
sahilmgandhi 18:6a4db94011d3 648 */
sahilmgandhi 18:6a4db94011d3 649
sahilmgandhi 18:6a4db94011d3 650 /* --------------------------TAMPER/TIMESTAMP---------------------------------*/
sahilmgandhi 18:6a4db94011d3 651 /** @defgroup RTCEx_Tamper_Timestamp EXTI RTC Tamper Timestamp EXTI
sahilmgandhi 18:6a4db94011d3 652 * @{
sahilmgandhi 18:6a4db94011d3 653 */
sahilmgandhi 18:6a4db94011d3 654
sahilmgandhi 18:6a4db94011d3 655 /**
sahilmgandhi 18:6a4db94011d3 656 * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line.
sahilmgandhi 18:6a4db94011d3 657 * @retval None
sahilmgandhi 18:6a4db94011d3 658 */
sahilmgandhi 18:6a4db94011d3 659 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
sahilmgandhi 18:6a4db94011d3 660
sahilmgandhi 18:6a4db94011d3 661 /**
sahilmgandhi 18:6a4db94011d3 662 * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line.
sahilmgandhi 18:6a4db94011d3 663 * @retval None
sahilmgandhi 18:6a4db94011d3 664 */
sahilmgandhi 18:6a4db94011d3 665 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
sahilmgandhi 18:6a4db94011d3 666
sahilmgandhi 18:6a4db94011d3 667 /**
sahilmgandhi 18:6a4db94011d3 668 * @brief Enable event on the RTC Tamper and Timestamp associated Exti line.
sahilmgandhi 18:6a4db94011d3 669 * @retval None.
sahilmgandhi 18:6a4db94011d3 670 */
sahilmgandhi 18:6a4db94011d3 671 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
sahilmgandhi 18:6a4db94011d3 672
sahilmgandhi 18:6a4db94011d3 673 /**
sahilmgandhi 18:6a4db94011d3 674 * @brief Disable event on the RTC Tamper and Timestamp associated Exti line.
sahilmgandhi 18:6a4db94011d3 675 * @retval None.
sahilmgandhi 18:6a4db94011d3 676 */
sahilmgandhi 18:6a4db94011d3 677 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
sahilmgandhi 18:6a4db94011d3 678
sahilmgandhi 18:6a4db94011d3 679 /**
sahilmgandhi 18:6a4db94011d3 680 * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
sahilmgandhi 18:6a4db94011d3 681 * @retval None.
sahilmgandhi 18:6a4db94011d3 682 */
sahilmgandhi 18:6a4db94011d3 683 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
sahilmgandhi 18:6a4db94011d3 684
sahilmgandhi 18:6a4db94011d3 685 /**
sahilmgandhi 18:6a4db94011d3 686 * @brief Disable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
sahilmgandhi 18:6a4db94011d3 687 * @retval None.
sahilmgandhi 18:6a4db94011d3 688 */
sahilmgandhi 18:6a4db94011d3 689 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
sahilmgandhi 18:6a4db94011d3 690
sahilmgandhi 18:6a4db94011d3 691 /**
sahilmgandhi 18:6a4db94011d3 692 * @brief Enable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
sahilmgandhi 18:6a4db94011d3 693 * @retval None.
sahilmgandhi 18:6a4db94011d3 694 */
sahilmgandhi 18:6a4db94011d3 695 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
sahilmgandhi 18:6a4db94011d3 696
sahilmgandhi 18:6a4db94011d3 697 /**
sahilmgandhi 18:6a4db94011d3 698 * @brief Disable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
sahilmgandhi 18:6a4db94011d3 699 * @retval None.
sahilmgandhi 18:6a4db94011d3 700 */
sahilmgandhi 18:6a4db94011d3 701 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
sahilmgandhi 18:6a4db94011d3 702
sahilmgandhi 18:6a4db94011d3 703 /**
sahilmgandhi 18:6a4db94011d3 704 * @brief Enable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
sahilmgandhi 18:6a4db94011d3 705 * @retval None.
sahilmgandhi 18:6a4db94011d3 706 */
sahilmgandhi 18:6a4db94011d3 707 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_FALLING_EDGE() do { __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE();\
sahilmgandhi 18:6a4db94011d3 708 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE(); \
sahilmgandhi 18:6a4db94011d3 709 } while(0)
sahilmgandhi 18:6a4db94011d3 710
sahilmgandhi 18:6a4db94011d3 711 /**
sahilmgandhi 18:6a4db94011d3 712 * @brief Disable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
sahilmgandhi 18:6a4db94011d3 713 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 714 * @retval None.
sahilmgandhi 18:6a4db94011d3 715 */
sahilmgandhi 18:6a4db94011d3 716 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_FALLING_EDGE() do { __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE();\
sahilmgandhi 18:6a4db94011d3 717 __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE();\
sahilmgandhi 18:6a4db94011d3 718 } while(0)
sahilmgandhi 18:6a4db94011d3 719
sahilmgandhi 18:6a4db94011d3 720 /**
sahilmgandhi 18:6a4db94011d3 721 * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not.
sahilmgandhi 18:6a4db94011d3 722 * @retval Line Status.
sahilmgandhi 18:6a4db94011d3 723 */
sahilmgandhi 18:6a4db94011d3 724 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
sahilmgandhi 18:6a4db94011d3 725
sahilmgandhi 18:6a4db94011d3 726 /**
sahilmgandhi 18:6a4db94011d3 727 * @brief Clear the RTC Tamper and Timestamp associated Exti line flag.
sahilmgandhi 18:6a4db94011d3 728 * @retval None.
sahilmgandhi 18:6a4db94011d3 729 */
sahilmgandhi 18:6a4db94011d3 730 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
sahilmgandhi 18:6a4db94011d3 731
sahilmgandhi 18:6a4db94011d3 732 /**
sahilmgandhi 18:6a4db94011d3 733 * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line
sahilmgandhi 18:6a4db94011d3 734 * @retval None.
sahilmgandhi 18:6a4db94011d3 735 */
sahilmgandhi 18:6a4db94011d3 736 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
sahilmgandhi 18:6a4db94011d3 737 /**
sahilmgandhi 18:6a4db94011d3 738 * @}
sahilmgandhi 18:6a4db94011d3 739 */
sahilmgandhi 18:6a4db94011d3 740
sahilmgandhi 18:6a4db94011d3 741 /* ------------------------------Calibration----------------------------------*/
sahilmgandhi 18:6a4db94011d3 742 /** @defgroup RTCEx_Calibration RTC Calibration
sahilmgandhi 18:6a4db94011d3 743 * @{
sahilmgandhi 18:6a4db94011d3 744 */
sahilmgandhi 18:6a4db94011d3 745
sahilmgandhi 18:6a4db94011d3 746 /**
sahilmgandhi 18:6a4db94011d3 747 * @brief Enable the Coarse calibration process.
sahilmgandhi 18:6a4db94011d3 748 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 749 * @retval None
sahilmgandhi 18:6a4db94011d3 750 */
sahilmgandhi 18:6a4db94011d3 751 #define __HAL_RTC_COARSE_CALIB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_DCE))
sahilmgandhi 18:6a4db94011d3 752
sahilmgandhi 18:6a4db94011d3 753 /**
sahilmgandhi 18:6a4db94011d3 754 * @brief Disable the Coarse calibration process.
sahilmgandhi 18:6a4db94011d3 755 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 756 * @retval None
sahilmgandhi 18:6a4db94011d3 757 */
sahilmgandhi 18:6a4db94011d3 758 #define __HAL_RTC_COARSE_CALIB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_DCE))
sahilmgandhi 18:6a4db94011d3 759
sahilmgandhi 18:6a4db94011d3 760 /**
sahilmgandhi 18:6a4db94011d3 761 * @brief Enable the RTC calibration output.
sahilmgandhi 18:6a4db94011d3 762 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 763 * @retval None
sahilmgandhi 18:6a4db94011d3 764 */
sahilmgandhi 18:6a4db94011d3 765 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE))
sahilmgandhi 18:6a4db94011d3 766
sahilmgandhi 18:6a4db94011d3 767 /**
sahilmgandhi 18:6a4db94011d3 768 * @brief Disable the calibration output.
sahilmgandhi 18:6a4db94011d3 769 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 770 * @retval None
sahilmgandhi 18:6a4db94011d3 771 */
sahilmgandhi 18:6a4db94011d3 772 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE))
sahilmgandhi 18:6a4db94011d3 773
sahilmgandhi 18:6a4db94011d3 774 /**
sahilmgandhi 18:6a4db94011d3 775 * @brief Enable the clock reference detection.
sahilmgandhi 18:6a4db94011d3 776 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 777 * @retval None
sahilmgandhi 18:6a4db94011d3 778 */
sahilmgandhi 18:6a4db94011d3 779 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON))
sahilmgandhi 18:6a4db94011d3 780
sahilmgandhi 18:6a4db94011d3 781 /**
sahilmgandhi 18:6a4db94011d3 782 * @brief Disable the clock reference detection.
sahilmgandhi 18:6a4db94011d3 783 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 784 * @retval None
sahilmgandhi 18:6a4db94011d3 785 */
sahilmgandhi 18:6a4db94011d3 786 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON))
sahilmgandhi 18:6a4db94011d3 787
sahilmgandhi 18:6a4db94011d3 788 /**
sahilmgandhi 18:6a4db94011d3 789 * @brief Get the selected RTC shift operation's flag status.
sahilmgandhi 18:6a4db94011d3 790 * @param __HANDLE__: specifies the RTC handle.
sahilmgandhi 18:6a4db94011d3 791 * @param __FLAG__: specifies the RTC shift operation Flag is pending or not.
sahilmgandhi 18:6a4db94011d3 792 * This parameter can be:
sahilmgandhi 18:6a4db94011d3 793 * @arg RTC_FLAG_SHPF
sahilmgandhi 18:6a4db94011d3 794 * @retval None
sahilmgandhi 18:6a4db94011d3 795 */
sahilmgandhi 18:6a4db94011d3 796 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
sahilmgandhi 18:6a4db94011d3 797 /**
sahilmgandhi 18:6a4db94011d3 798 * @}
sahilmgandhi 18:6a4db94011d3 799 */
sahilmgandhi 18:6a4db94011d3 800
sahilmgandhi 18:6a4db94011d3 801 /**
sahilmgandhi 18:6a4db94011d3 802 * @}
sahilmgandhi 18:6a4db94011d3 803 */
sahilmgandhi 18:6a4db94011d3 804
sahilmgandhi 18:6a4db94011d3 805 /* Exported functions --------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 806 /** @defgroup RTCEx_Exported_Functions RTCEx Exported Functions
sahilmgandhi 18:6a4db94011d3 807 * @{
sahilmgandhi 18:6a4db94011d3 808 */
sahilmgandhi 18:6a4db94011d3 809
sahilmgandhi 18:6a4db94011d3 810 /** @addtogroup RTCEx_Exported_Functions_Group1
sahilmgandhi 18:6a4db94011d3 811 * @{
sahilmgandhi 18:6a4db94011d3 812 */
sahilmgandhi 18:6a4db94011d3 813 /* RTC TimeStamp and Tamper functions *****************************************/
sahilmgandhi 18:6a4db94011d3 814 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
sahilmgandhi 18:6a4db94011d3 815 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
sahilmgandhi 18:6a4db94011d3 816 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 817 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format);
sahilmgandhi 18:6a4db94011d3 818
sahilmgandhi 18:6a4db94011d3 819 HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
sahilmgandhi 18:6a4db94011d3 820 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
sahilmgandhi 18:6a4db94011d3 821 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper);
sahilmgandhi 18:6a4db94011d3 822 void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 823
sahilmgandhi 18:6a4db94011d3 824 void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 825 void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 826 void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 827 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
sahilmgandhi 18:6a4db94011d3 828 HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
sahilmgandhi 18:6a4db94011d3 829 HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
sahilmgandhi 18:6a4db94011d3 830 /**
sahilmgandhi 18:6a4db94011d3 831 * @}
sahilmgandhi 18:6a4db94011d3 832 */
sahilmgandhi 18:6a4db94011d3 833
sahilmgandhi 18:6a4db94011d3 834 /** @addtogroup RTCEx_Exported_Functions_Group2
sahilmgandhi 18:6a4db94011d3 835 * @{
sahilmgandhi 18:6a4db94011d3 836 */
sahilmgandhi 18:6a4db94011d3 837 /* RTC Wake-up functions ******************************************************/
sahilmgandhi 18:6a4db94011d3 838 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
sahilmgandhi 18:6a4db94011d3 839 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
sahilmgandhi 18:6a4db94011d3 840 uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 841 uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 842 void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 843 void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 844 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
sahilmgandhi 18:6a4db94011d3 845 /**
sahilmgandhi 18:6a4db94011d3 846 * @}
sahilmgandhi 18:6a4db94011d3 847 */
sahilmgandhi 18:6a4db94011d3 848
sahilmgandhi 18:6a4db94011d3 849 /** @addtogroup RTCEx_Exported_Functions_Group3
sahilmgandhi 18:6a4db94011d3 850 * @{
sahilmgandhi 18:6a4db94011d3 851 */
sahilmgandhi 18:6a4db94011d3 852 /* Extension Control functions ************************************************/
sahilmgandhi 18:6a4db94011d3 853 void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
sahilmgandhi 18:6a4db94011d3 854 uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
sahilmgandhi 18:6a4db94011d3 855
sahilmgandhi 18:6a4db94011d3 856 HAL_StatusTypeDef HAL_RTCEx_SetCoarseCalib(RTC_HandleTypeDef *hrtc, uint32_t CalibSign, uint32_t Value);
sahilmgandhi 18:6a4db94011d3 857 HAL_StatusTypeDef HAL_RTCEx_DeactivateCoarseCalib(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 858 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue);
sahilmgandhi 18:6a4db94011d3 859 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
sahilmgandhi 18:6a4db94011d3 860 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput);
sahilmgandhi 18:6a4db94011d3 861 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 862 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 863 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 864 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 865 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 866 /**
sahilmgandhi 18:6a4db94011d3 867 * @}
sahilmgandhi 18:6a4db94011d3 868 */
sahilmgandhi 18:6a4db94011d3 869
sahilmgandhi 18:6a4db94011d3 870 /** @addtogroup RTCEx_Exported_Functions_Group4
sahilmgandhi 18:6a4db94011d3 871 * @{
sahilmgandhi 18:6a4db94011d3 872 */
sahilmgandhi 18:6a4db94011d3 873 /* Extension RTC features functions *******************************************/
sahilmgandhi 18:6a4db94011d3 874 void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc);
sahilmgandhi 18:6a4db94011d3 875 HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
sahilmgandhi 18:6a4db94011d3 876 /**
sahilmgandhi 18:6a4db94011d3 877 * @}
sahilmgandhi 18:6a4db94011d3 878 */
sahilmgandhi 18:6a4db94011d3 879
sahilmgandhi 18:6a4db94011d3 880 /**
sahilmgandhi 18:6a4db94011d3 881 * @}
sahilmgandhi 18:6a4db94011d3 882 */
sahilmgandhi 18:6a4db94011d3 883
sahilmgandhi 18:6a4db94011d3 884 /* Private types -------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 885 /* Private variables ---------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 886 /* Private constants ---------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 887 /** @defgroup RTCEx_Private_Constants RTCEx Private Constants
sahilmgandhi 18:6a4db94011d3 888 * @{
sahilmgandhi 18:6a4db94011d3 889 */
sahilmgandhi 18:6a4db94011d3 890 #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 */
sahilmgandhi 18:6a4db94011d3 891 #define RTC_EXTI_LINE_WAKEUPTIMER_EVENT ((uint32_t)EXTI_IMR_MR22) /*!< External interrupt line 22 Connected to the RTC Wake-up event */
sahilmgandhi 18:6a4db94011d3 892 /**
sahilmgandhi 18:6a4db94011d3 893 * @}
sahilmgandhi 18:6a4db94011d3 894 */
sahilmgandhi 18:6a4db94011d3 895
sahilmgandhi 18:6a4db94011d3 896 /* Private macros ------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 897 /** @defgroup RTCEx_Private_Macros RTCEx Private Macros
sahilmgandhi 18:6a4db94011d3 898 * @{
sahilmgandhi 18:6a4db94011d3 899 */
sahilmgandhi 18:6a4db94011d3 900
sahilmgandhi 18:6a4db94011d3 901 /** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters
sahilmgandhi 18:6a4db94011d3 902 * @{
sahilmgandhi 18:6a4db94011d3 903 */
sahilmgandhi 18:6a4db94011d3 904 #define IS_RTC_BKP(BKP) (((BKP) == RTC_BKP_DR0) || \
sahilmgandhi 18:6a4db94011d3 905 ((BKP) == RTC_BKP_DR1) || \
sahilmgandhi 18:6a4db94011d3 906 ((BKP) == RTC_BKP_DR2) || \
sahilmgandhi 18:6a4db94011d3 907 ((BKP) == RTC_BKP_DR3) || \
sahilmgandhi 18:6a4db94011d3 908 ((BKP) == RTC_BKP_DR4) || \
sahilmgandhi 18:6a4db94011d3 909 ((BKP) == RTC_BKP_DR5) || \
sahilmgandhi 18:6a4db94011d3 910 ((BKP) == RTC_BKP_DR6) || \
sahilmgandhi 18:6a4db94011d3 911 ((BKP) == RTC_BKP_DR7) || \
sahilmgandhi 18:6a4db94011d3 912 ((BKP) == RTC_BKP_DR8) || \
sahilmgandhi 18:6a4db94011d3 913 ((BKP) == RTC_BKP_DR9) || \
sahilmgandhi 18:6a4db94011d3 914 ((BKP) == RTC_BKP_DR10) || \
sahilmgandhi 18:6a4db94011d3 915 ((BKP) == RTC_BKP_DR11) || \
sahilmgandhi 18:6a4db94011d3 916 ((BKP) == RTC_BKP_DR12) || \
sahilmgandhi 18:6a4db94011d3 917 ((BKP) == RTC_BKP_DR13) || \
sahilmgandhi 18:6a4db94011d3 918 ((BKP) == RTC_BKP_DR14) || \
sahilmgandhi 18:6a4db94011d3 919 ((BKP) == RTC_BKP_DR15) || \
sahilmgandhi 18:6a4db94011d3 920 ((BKP) == RTC_BKP_DR16) || \
sahilmgandhi 18:6a4db94011d3 921 ((BKP) == RTC_BKP_DR17) || \
sahilmgandhi 18:6a4db94011d3 922 ((BKP) == RTC_BKP_DR18) || \
sahilmgandhi 18:6a4db94011d3 923 ((BKP) == RTC_BKP_DR19))
sahilmgandhi 18:6a4db94011d3 924 #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \
sahilmgandhi 18:6a4db94011d3 925 ((EDGE) == RTC_TIMESTAMPEDGE_FALLING))
sahilmgandhi 18:6a4db94011d3 926 #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & ((uint32_t)!(RTC_TAFCR_TAMP1E | RTC_TAFCR_TAMP2E))) == 0x00U) && ((TAMPER) != (uint32_t)RESET))
sahilmgandhi 18:6a4db94011d3 927
sahilmgandhi 18:6a4db94011d3 928 #define IS_RTC_TAMPER_PIN(PIN) (((PIN) == RTC_TAMPERPIN_DEFAULT) || \
sahilmgandhi 18:6a4db94011d3 929 ((PIN) == RTC_TAMPERPIN_POS1))
sahilmgandhi 18:6a4db94011d3 930
sahilmgandhi 18:6a4db94011d3 931 #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_DEFAULT) || \
sahilmgandhi 18:6a4db94011d3 932 ((PIN) == RTC_TIMESTAMPPIN_POS1))
sahilmgandhi 18:6a4db94011d3 933
sahilmgandhi 18:6a4db94011d3 934 #define IS_RTC_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) || \
sahilmgandhi 18:6a4db94011d3 935 ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \
sahilmgandhi 18:6a4db94011d3 936 ((TRIGGER) == RTC_TAMPERTRIGGER_LOWLEVEL) || \
sahilmgandhi 18:6a4db94011d3 937 ((TRIGGER) == RTC_TAMPERTRIGGER_HIGHLEVEL))
sahilmgandhi 18:6a4db94011d3 938 #define IS_RTC_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TAMPERFILTER_DISABLE) || \
sahilmgandhi 18:6a4db94011d3 939 ((FILTER) == RTC_TAMPERFILTER_2SAMPLE) || \
sahilmgandhi 18:6a4db94011d3 940 ((FILTER) == RTC_TAMPERFILTER_4SAMPLE) || \
sahilmgandhi 18:6a4db94011d3 941 ((FILTER) == RTC_TAMPERFILTER_8SAMPLE))
sahilmgandhi 18:6a4db94011d3 942 #define IS_RTC_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \
sahilmgandhi 18:6a4db94011d3 943 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \
sahilmgandhi 18:6a4db94011d3 944 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \
sahilmgandhi 18:6a4db94011d3 945 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \
sahilmgandhi 18:6a4db94011d3 946 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \
sahilmgandhi 18:6a4db94011d3 947 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \
sahilmgandhi 18:6a4db94011d3 948 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \
sahilmgandhi 18:6a4db94011d3 949 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256))
sahilmgandhi 18:6a4db94011d3 950 #define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \
sahilmgandhi 18:6a4db94011d3 951 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \
sahilmgandhi 18:6a4db94011d3 952 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \
sahilmgandhi 18:6a4db94011d3 953 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK))
sahilmgandhi 18:6a4db94011d3 954 #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \
sahilmgandhi 18:6a4db94011d3 955 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE))
sahilmgandhi 18:6a4db94011d3 956 #define IS_RTC_TAMPER_PULLUP_STATE(STATE) (((STATE) == RTC_TAMPER_PULLUP_ENABLE) || \
sahilmgandhi 18:6a4db94011d3 957 ((STATE) == RTC_TAMPER_PULLUP_DISABLE))
sahilmgandhi 18:6a4db94011d3 958 #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \
sahilmgandhi 18:6a4db94011d3 959 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \
sahilmgandhi 18:6a4db94011d3 960 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \
sahilmgandhi 18:6a4db94011d3 961 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \
sahilmgandhi 18:6a4db94011d3 962 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \
sahilmgandhi 18:6a4db94011d3 963 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS))
sahilmgandhi 18:6a4db94011d3 964
sahilmgandhi 18:6a4db94011d3 965 #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFFU)
sahilmgandhi 18:6a4db94011d3 966 #define IS_RTC_CALIB_SIGN(SIGN) (((SIGN) == RTC_CALIBSIGN_POSITIVE) || \
sahilmgandhi 18:6a4db94011d3 967 ((SIGN) == RTC_CALIBSIGN_NEGATIVE))
sahilmgandhi 18:6a4db94011d3 968
sahilmgandhi 18:6a4db94011d3 969 #define IS_RTC_CALIB_VALUE(VALUE) ((VALUE) < 0x20U)
sahilmgandhi 18:6a4db94011d3 970
sahilmgandhi 18:6a4db94011d3 971 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \
sahilmgandhi 18:6a4db94011d3 972 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \
sahilmgandhi 18:6a4db94011d3 973 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC))
sahilmgandhi 18:6a4db94011d3 974 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \
sahilmgandhi 18:6a4db94011d3 975 ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET))
sahilmgandhi 18:6a4db94011d3 976
sahilmgandhi 18:6a4db94011d3 977 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FFU)
sahilmgandhi 18:6a4db94011d3 978 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \
sahilmgandhi 18:6a4db94011d3 979 ((SEL) == RTC_SHIFTADD1S_SET))
sahilmgandhi 18:6a4db94011d3 980 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFFU)
sahilmgandhi 18:6a4db94011d3 981 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \
sahilmgandhi 18:6a4db94011d3 982 ((OUTPUT) == RTC_CALIBOUTPUT_1HZ))
sahilmgandhi 18:6a4db94011d3 983 /**
sahilmgandhi 18:6a4db94011d3 984 * @}
sahilmgandhi 18:6a4db94011d3 985 */
sahilmgandhi 18:6a4db94011d3 986
sahilmgandhi 18:6a4db94011d3 987 /**
sahilmgandhi 18:6a4db94011d3 988 * @}
sahilmgandhi 18:6a4db94011d3 989 */
sahilmgandhi 18:6a4db94011d3 990
sahilmgandhi 18:6a4db94011d3 991 /**
sahilmgandhi 18:6a4db94011d3 992 * @}
sahilmgandhi 18:6a4db94011d3 993 */
sahilmgandhi 18:6a4db94011d3 994
sahilmgandhi 18:6a4db94011d3 995 /**
sahilmgandhi 18:6a4db94011d3 996 * @}
sahilmgandhi 18:6a4db94011d3 997 */
sahilmgandhi 18:6a4db94011d3 998
sahilmgandhi 18:6a4db94011d3 999 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 1000 }
sahilmgandhi 18:6a4db94011d3 1001 #endif
sahilmgandhi 18:6a4db94011d3 1002
sahilmgandhi 18:6a4db94011d3 1003 #endif /* __STM32F4xx_HAL_RTC_EX_H */
sahilmgandhi 18:6a4db94011d3 1004
sahilmgandhi 18:6a4db94011d3 1005 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/