1 /** 2 ****************************************************************************** 3 * @file stm32l1xx_hal_rtc_ex.h 4 * @author MCD Application Team 5 * @brief Header file of RTC HAL Extended module. 6 ****************************************************************************** 7 * @attention 8 * 9 * <h2><center>© Copyright (c) 2017 STMicroelectronics. 10 * All rights reserved.</center></h2> 11 * 12 * This software component is licensed by ST under BSD 3-Clause license, 13 * the "License"; You may not use this file except in compliance with the 14 * License. You may obtain a copy of the License at: 15 * opensource.org/licenses/BSD-3-Clause 16 * 17 ****************************************************************************** 18 */ 19 20 /* Define to prevent recursive inclusion -------------------------------------*/ 21 #ifndef __STM32L1xx_HAL_RTC_EX_H 22 #define __STM32L1xx_HAL_RTC_EX_H 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /* Includes ------------------------------------------------------------------*/ 29 #include "stm32l1xx_hal_def.h" 30 31 /** @addtogroup STM32L1xx_HAL_Driver 32 * @{ 33 */ 34 35 /** @defgroup RTCEx RTCEx 36 * @{ 37 */ 38 39 /* Exported types ------------------------------------------------------------*/ 40 /** @defgroup RTCEx_Exported_Types RTCEx Exported Types 41 * @{ 42 */ 43 44 /** 45 * @brief RTC Tamper structure definition 46 */ 47 typedef struct 48 { 49 uint32_t Tamper; /*!< Specifies the Tamper Pin. 50 This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */ 51 52 uint32_t Trigger; /*!< Specifies the Tamper Trigger. 53 This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */ 54 55 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 56 uint32_t Filter; /*!< Specifies the RTC Filter Tamper. 57 This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */ 58 59 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency. 60 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */ 61 62 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration . 63 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */ 64 65 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp . 66 This parameter can be a value of @ref RTCEx_Tamper_Pull_Up_Definitions */ 67 68 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection. 69 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */ 70 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 71 } RTC_TamperTypeDef; 72 /** 73 * @} 74 */ 75 76 /* Exported constants --------------------------------------------------------*/ 77 /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants 78 * @{ 79 */ 80 81 /** @defgroup RTCEx_Output_selection_Definition RTCEx Output Selection Definition 82 * @{ 83 */ 84 #define RTC_TR_RESERVED_MASK (0x007F7F7FU) 85 #define RTC_DR_RESERVED_MASK (0x00FFFF3FU) 86 #define RTC_INIT_MASK (0xFFFFFFFFU) 87 #define RTC_RSF_MASK (0xFFFFFF5FU) 88 89 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 90 #define RTC_FLAGS_MASK ((uint32_t)(RTC_FLAG_ALRAWF | RTC_FLAG_ALRBWF | RTC_FLAG_WUTWF | \ 91 RTC_FLAG_SHPF | RTC_FLAG_INITS | RTC_FLAG_RSF | \ 92 RTC_FLAG_INITF | RTC_FLAG_ALRAF | RTC_FLAG_ALRBF | \ 93 RTC_FLAG_WUTF | RTC_FLAG_TSF | RTC_FLAG_TSOVF | \ 94 RTC_FLAG_TAMP1F | RTC_FLAG_TAMP2F | RTC_FLAG_TAMP3F | \ 95 RTC_FLAG_RECALPF)) 96 #else 97 #define RTC_FLAGS_MASK ((uint32_t)(RTC_FLAG_ALRAWF | RTC_FLAG_ALRBWF | RTC_FLAG_WUTWF | \ 98 RTC_FLAG_SHPF | RTC_FLAG_INITS | RTC_FLAG_RSF | \ 99 RTC_FLAG_INITF | RTC_FLAG_ALRAF | RTC_FLAG_ALRBF | \ 100 RTC_FLAG_WUTF | RTC_FLAG_TSF | RTC_FLAG_TSOVF | \ 101 RTC_FLAG_TAMP1F | \ 102 RTC_FLAG_RECALPF)) 103 104 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 105 /** 106 * @} 107 */ 108 109 /** @defgroup RTCEx_Backup_Registers_Definition RTCEx Backup Registers Definition 110 * @{ 111 */ 112 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 113 #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7FFFU) 114 #elif defined(STM32L100xB) || defined (STM32L151xB) || defined (STM32L152xB) 115 #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x1FFFU) 116 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 117 /** 118 * @} 119 */ 120 121 /** @defgroup RTC_Interrupts_Definitions Interrupts Definitions 122 * @{ 123 */ 124 #define RTC_IT_TS ((uint32_t)RTC_CR_TSIE) 125 #define RTC_IT_WUT ((uint32_t)RTC_CR_WUTIE) 126 #define RTC_IT_ALRB ((uint32_t)RTC_CR_ALRBIE) 127 #define RTC_IT_ALRA ((uint32_t)RTC_CR_ALRAIE) 128 #define RTC_IT_TAMP1 ((uint32_t)(RTC_TAFCR_TAMPIE | RTC_TAFCR_TAMP1E)) 129 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 130 #define RTC_IT_TAMP2 ((uint32_t)(RTC_TAFCR_TAMPIE | RTC_TAFCR_TAMP2E)) 131 #define RTC_IT_TAMP3 ((uint32_t)(RTC_TAFCR_TAMPIE | RTC_TAFCR_TAMP3E)) 132 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 133 /** 134 * @} 135 */ 136 137 /** @defgroup RTC_Flags_Definitions Flags Definitions 138 * @{ 139 */ 140 #define RTC_FLAG_RECALPF ((uint32_t)RTC_ISR_RECALPF) 141 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 142 #define RTC_FLAG_TAMP3F ((uint32_t)RTC_ISR_TAMP3F) 143 #define RTC_FLAG_TAMP2F ((uint32_t)RTC_ISR_TAMP2F) 144 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 145 #define RTC_FLAG_TAMP1F ((uint32_t)RTC_ISR_TAMP1F) 146 #define RTC_FLAG_TSOVF ((uint32_t)RTC_ISR_TSOVF) 147 #define RTC_FLAG_TSF ((uint32_t)RTC_ISR_TSF) 148 #define RTC_FLAG_WUTF ((uint32_t)RTC_ISR_WUTF) 149 #define RTC_FLAG_ALRBF ((uint32_t)RTC_ISR_ALRBF) 150 #define RTC_FLAG_ALRAF ((uint32_t)RTC_ISR_ALRAF) 151 #define RTC_FLAG_INITF ((uint32_t)RTC_ISR_INITF) 152 #define RTC_FLAG_RSF ((uint32_t)RTC_ISR_RSF) 153 #define RTC_FLAG_INITS ((uint32_t)RTC_ISR_INITS) 154 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 155 #define RTC_FLAG_SHPF ((uint32_t)RTC_ISR_SHPF) 156 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 157 #define RTC_FLAG_WUTWF ((uint32_t)RTC_ISR_WUTWF) 158 #define RTC_FLAG_ALRBWF ((uint32_t)RTC_ISR_ALRBWF) 159 #define RTC_FLAG_ALRAWF ((uint32_t)RTC_ISR_ALRAWF) 160 /** 161 * @} 162 */ 163 164 /** @defgroup RTCEx_Output_selection_Definitions Output selection Definitions 165 * @{ 166 */ 167 #define RTC_OUTPUT_DISABLE (0x00000000U) 168 #define RTC_OUTPUT_ALARMA (0x00200000U) 169 #define RTC_OUTPUT_ALARMB (0x00400000U) 170 #define RTC_OUTPUT_WAKEUP (0x00600000U) 171 172 #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_OUTPUT_DISABLE) || \ 173 ((OUTPUT) == RTC_OUTPUT_ALARMA) || \ 174 ((OUTPUT) == RTC_OUTPUT_ALARMB) || \ 175 ((OUTPUT) == RTC_OUTPUT_WAKEUP)) 176 /** 177 * @} 178 */ 179 180 /** @defgroup RTCEx_Backup_Registers_Definitions Backup Registers Definitions 181 * @{ 182 */ 183 #if RTC_BKP_NUMBER > 0 184 #define RTC_BKP_DR0 (0x00000000U) 185 #define RTC_BKP_DR1 (0x00000001U) 186 #define RTC_BKP_DR2 (0x00000002U) 187 #define RTC_BKP_DR3 (0x00000003U) 188 #define RTC_BKP_DR4 (0x00000004U) 189 #endif /* RTC_BKP_NUMBER > 0 */ 190 191 #if RTC_BKP_NUMBER > 5 192 #define RTC_BKP_DR5 (0x00000005U) 193 #define RTC_BKP_DR6 (0x00000006U) 194 #define RTC_BKP_DR7 (0x00000007U) 195 #define RTC_BKP_DR8 (0x00000008U) 196 #define RTC_BKP_DR9 (0x00000009U) 197 #define RTC_BKP_DR10 (0x0000000AU) 198 #define RTC_BKP_DR11 (0x0000000BU) 199 #define RTC_BKP_DR12 (0x0000000CU) 200 #define RTC_BKP_DR13 (0x0000000DU) 201 #define RTC_BKP_DR14 (0x0000000EU) 202 #define RTC_BKP_DR15 (0x0000000FU) 203 #define RTC_BKP_DR16 (0x00000010U) 204 #define RTC_BKP_DR17 (0x00000011U) 205 #define RTC_BKP_DR18 (0x00000012U) 206 #define RTC_BKP_DR19 (0x00000013U) 207 #endif /* RTC_BKP_NUMBER > 5 */ 208 209 #if RTC_BKP_NUMBER > 20 210 #define RTC_BKP_DR20 (0x00000014U) 211 #define RTC_BKP_DR21 (0x00000015U) 212 #define RTC_BKP_DR22 (0x00000016U) 213 #define RTC_BKP_DR23 (0x00000017U) 214 #define RTC_BKP_DR24 (0x00000018U) 215 #define RTC_BKP_DR25 (0x00000019U) 216 #define RTC_BKP_DR26 (0x0000001AU) 217 #define RTC_BKP_DR27 (0x0000001BU) 218 #define RTC_BKP_DR28 (0x0000001CU) 219 #define RTC_BKP_DR29 (0x0000001DU) 220 #define RTC_BKP_DR30 (0x0000001EU) 221 #define RTC_BKP_DR31 (0x0000001FU) 222 #endif /* RTC_BKP_NUMBER > 20 */ 223 224 #define IS_RTC_BKP(BKP) ((BKP) < (uint32_t) RTC_BKP_NUMBER) 225 /** 226 * @} 227 */ 228 229 /** @defgroup RTCEx_Time_Stamp_Edges_Definitions Time Stamp Edges Definitions 230 * @{ 231 */ 232 #define RTC_TIMESTAMPEDGE_RISING (0x00000000U) 233 #define RTC_TIMESTAMPEDGE_FALLING (0x00000008U) 234 235 #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \ 236 ((EDGE) == RTC_TIMESTAMPEDGE_FALLING)) 237 /** 238 * @} 239 */ 240 241 /** @defgroup RTCEx_Tamper_Pins_Definitions Tamper Pins Definitions 242 * @{ 243 */ 244 #define RTC_TAMPER_1 RTC_TAFCR_TAMP1E 245 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 246 #define RTC_TAMPER_2 RTC_TAFCR_TAMP2E 247 #define RTC_TAMPER_3 RTC_TAFCR_TAMP3E 248 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 249 250 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 251 #define IS_RTC_TAMPER(TAMPER) (((~(RTC_TAMPER_1|RTC_TAMPER_2|RTC_TAMPER_3) & (TAMPER)) == (uint32_t)RESET) && ((TAMPER) != (uint32_t)RESET)) 252 #else 253 #define IS_RTC_TAMPER(TAMPER) ((TAMPER) == RTC_TAMPER_1) 254 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 255 /** 256 * @} 257 */ 258 259 /** @defgroup RTCEx_Tamper_Trigger_Definitions Tamper Trigger Definitions 260 * @{ 261 */ 262 #define RTC_TAMPERTRIGGER_RISINGEDGE (0x00000000U) 263 #define RTC_TAMPERTRIGGER_FALLINGEDGE (0x00000002U) 264 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 265 #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE 266 #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE 267 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 268 269 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 270 #define IS_RTC_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) || \ 271 ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \ 272 ((TRIGGER) == RTC_TAMPERTRIGGER_LOWLEVEL) || \ 273 ((TRIGGER) == RTC_TAMPERTRIGGER_HIGHLEVEL)) 274 #elif defined(STM32L100xB) || defined (STM32L151xB) || defined (STM32L152xB) 275 #define IS_RTC_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) || \ 276 ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE)) 277 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 278 /** 279 * @} 280 */ 281 282 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 283 /** @defgroup RTCEx_Tamper_Filter_Definitions RTCex Tamper Filter Definitions 284 * @{ 285 */ 286 #define RTC_TAMPERFILTER_DISABLE (0x00000000U) /*!< Tamper filter is disabled */ 287 288 #define RTC_TAMPERFILTER_2SAMPLE (0x00000800U) /*!< Tamper is activated after 2 289 consecutive samples at the active level */ 290 #define RTC_TAMPERFILTER_4SAMPLE (0x00001000U) /*!< Tamper is activated after 4 291 consecutive samples at the active level */ 292 #define RTC_TAMPERFILTER_8SAMPLE (0x00001800U) /*!< Tamper is activated after 8 293 consecutive samples at the active level. */ 294 295 #define IS_RTC_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TAMPERFILTER_DISABLE) || \ 296 ((FILTER) == RTC_TAMPERFILTER_2SAMPLE) || \ 297 ((FILTER) == RTC_TAMPERFILTER_4SAMPLE) || \ 298 ((FILTER) == RTC_TAMPERFILTER_8SAMPLE)) 299 /** 300 * @} 301 */ 302 303 /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTCEx Tamper Sampling Frequencies Definitions 304 * @{ 305 */ 306 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 (0x00000000U) /*!< Each of the tamper inputs are sampled 307 with a frequency = RTCCLK / 32768 */ 308 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 (0x00000100U) /*!< Each of the tamper inputs are sampled 309 with a frequency = RTCCLK / 16384 */ 310 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 (0x00000200U) /*!< Each of the tamper inputs are sampled 311 with a frequency = RTCCLK / 8192 */ 312 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 (0x00000300U) /*!< Each of the tamper inputs are sampled 313 with a frequency = RTCCLK / 4096 */ 314 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 (0x00000400U) /*!< Each of the tamper inputs are sampled 315 with a frequency = RTCCLK / 2048 */ 316 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 (0x00000500U) /*!< Each of the tamper inputs are sampled 317 with a frequency = RTCCLK / 1024 */ 318 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 (0x00000600U) /*!< Each of the tamper inputs are sampled 319 with a frequency = RTCCLK / 512 */ 320 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 (0x00000700U) /*!< Each of the tamper inputs are sampled 321 with a frequency = RTCCLK / 256 */ 322 323 #define IS_RTC_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \ 324 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \ 325 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \ 326 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \ 327 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \ 328 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \ 329 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \ 330 ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256)) 331 /** 332 * @} 333 */ 334 335 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTCEx Tamper Pin Precharge Duration Definitions 336 * @{ 337 */ 338 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK (0x00000000U) /*!< Tamper pins are pre-charged before 339 sampling during 1 RTCCLK cycle */ 340 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK (0x00002000U) /*!< Tamper pins are pre-charged before 341 sampling during 2 RTCCLK cycles */ 342 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK (0x00004000U) /*!< Tamper pins are pre-charged before 343 sampling during 4 RTCCLK cycles */ 344 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK (0x00006000U) /*!< Tamper pins are pre-charged before 345 sampling during 8 RTCCLK cycles */ 346 347 #define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \ 348 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \ 349 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \ 350 ((DURATION) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK)) 351 /** 352 * @} 353 */ 354 355 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions TimeStampOnTamperDetection Definitions 356 * @{ 357 */ 358 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE ((uint32_t)RTC_TAFCR_TAMPTS) /*!< TimeStamp on Tamper Detection event saved */ 359 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE (0x00000000U) /*!< TimeStamp on Tamper Detection event is not saved */ 360 361 #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \ 362 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE)) 363 /** 364 * @} 365 */ 366 367 /** @defgroup RTCEx_Tamper_Pull_Up_Definitions Tamper Pull-Up Definitions 368 * @{ 369 */ 370 #define RTC_TAMPER_PULLUP_ENABLE (0x00000000U) /*!< TimeStamp on Tamper Detection event saved */ 371 #define RTC_TAMPER_PULLUP_DISABLE (RTC_TAFCR_TAMPPUDIS) /*!< TimeStamp on Tamper Detection event is not saved */ 372 373 #define IS_RTC_TAMPER_PULLUP_STATE(STATE) (((STATE) == RTC_TAMPER_PULLUP_ENABLE) || \ 374 ((STATE) == RTC_TAMPER_PULLUP_DISABLE)) 375 /** 376 * @} 377 */ 378 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 379 380 /** @defgroup RTCEx_Wakeup_Timer_Definitions Wakeup Timer Definitions 381 * @{ 382 */ 383 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 (0x00000000U) 384 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 (0x00000001U) 385 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 (0x00000002U) 386 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 (0x00000003U) 387 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS (0x00000004U) 388 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS (0x00000006U) 389 390 #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \ 391 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \ 392 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \ 393 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \ 394 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \ 395 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS)) 396 397 #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFF) 398 /** 399 * @} 400 */ 401 402 /** @defgroup RTCEx_Digital_Calibration_Definitions Digital Calibration Definitions 403 * @{ 404 */ 405 #define RTC_CALIBSIGN_POSITIVE (0x00000000U) 406 #define RTC_CALIBSIGN_NEGATIVE (0x00000080U) 407 408 #define IS_RTC_CALIB_SIGN(SIGN) (((SIGN) == RTC_CALIBSIGN_POSITIVE) || \ 409 ((SIGN) == RTC_CALIBSIGN_NEGATIVE)) 410 411 #define IS_RTC_CALIB_VALUE(VALUE) ((VALUE) < 0x20) 412 /** 413 * @} 414 */ 415 416 /** @defgroup RTCEx_Smooth_Calib_Period_Definitions Smooth Calib Period Definitions 417 * @{ 418 */ 419 #define RTC_SMOOTHCALIB_PERIOD_32SEC (0x00000000U) /*!< If RTCCLK = 32768 Hz, Smooth calibation 420 period is 32s, else 2exp20 RTCCLK seconds */ 421 #define RTC_SMOOTHCALIB_PERIOD_16SEC (0x00002000U) /*!< If RTCCLK = 32768 Hz, Smooth calibation 422 period is 16s, else 2exp19 RTCCLK seconds */ 423 #define RTC_SMOOTHCALIB_PERIOD_8SEC (0x00004000U) /*!< If RTCCLK = 32768 Hz, Smooth calibation 424 period is 8s, else 2exp18 RTCCLK seconds */ 425 426 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \ 427 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \ 428 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC)) 429 /** 430 * @} 431 */ 432 433 /** @defgroup RTCEx_Smooth_Calib_Plus_Pulses_Definitions Smooth Calib Plus Pulses Definitions 434 * @{ 435 */ 436 #define RTC_SMOOTHCALIB_PLUSPULSES_SET (0x00008000U) /*!< The number of RTCCLK pulses added 437 during a X -second window = Y - CALM[8:0] 438 with Y = 512, 256, 128 when X = 32, 16, 8 */ 439 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET (0x00000000U) /*!< The number of RTCCLK pulses subbstited 440 during a 32-second window = CALM[8:0] */ 441 442 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \ 443 ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET)) 444 /** 445 * @} 446 */ 447 448 /** @defgroup RTCEx_Smooth_Calib_Minus_Pulses_Definitions Smooth Calib Minus Pulses Definitions 449 * @{ 450 */ 451 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FFU) 452 /** 453 * @} 454 */ 455 456 /** @defgroup RTCEx_Add_1_Second_Parameter_Definitions Add 1 Second Parameter Definitions 457 * @{ 458 */ 459 #define RTC_SHIFTADD1S_RESET (0x00000000U) 460 #define RTC_SHIFTADD1S_SET (0x80000000U) 461 462 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \ 463 ((SEL) == RTC_SHIFTADD1S_SET)) 464 /** 465 * @} 466 */ 467 468 /** @defgroup RTCEx_Substract_Fraction_Of_Second_Value Substract Fraction Of Second Value 469 * @{ 470 */ 471 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFFU) 472 /** 473 * @} 474 */ 475 476 /** @defgroup RTCEx_Calib_Output_Selection_Definitions Calib Output Selection Definitions 477 * @{ 478 */ 479 #define RTC_CALIBOUTPUT_512HZ (0x00000000U) 480 #define RTC_CALIBOUTPUT_1HZ (0x00080000U) 481 482 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \ 483 ((OUTPUT) == RTC_CALIBOUTPUT_1HZ)) 484 /** 485 * @} 486 */ 487 488 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 489 /** @defgroup RTC_Alarm_Sub_Seconds_Value Alarm Sub Seconds Value 490 * @{ 491 */ 492 #define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= 0x00007FFFU) 493 /** 494 * @} 495 */ 496 497 /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions Alarm Sub Seconds Masks Definitions 498 * @{ 499 */ 500 #define RTC_ALARMSUBSECONDMASK_ALL (0x00000000U) /*!< All Alarm SS fields are masked. 501 There is no comparison on sub seconds 502 for Alarm */ 503 #define RTC_ALARMSUBSECONDMASK_SS14_1 (0x01000000U) /*!< SS[14:1] are don't care in Alarm 504 comparison. Only SS[0] is compared. */ 505 #define RTC_ALARMSUBSECONDMASK_SS14_2 (0x02000000U) /*!< SS[14:2] are don't care in Alarm 506 comparison. Only SS[1:0] are compared */ 507 #define RTC_ALARMSUBSECONDMASK_SS14_3 (0x03000000U) /*!< SS[14:3] are don't care in Alarm 508 comparison. Only SS[2:0] are compared */ 509 #define RTC_ALARMSUBSECONDMASK_SS14_4 (0x04000000U) /*!< SS[14:4] are don't care in Alarm 510 comparison. Only SS[3:0] are compared */ 511 #define RTC_ALARMSUBSECONDMASK_SS14_5 (0x05000000U) /*!< SS[14:5] are don't care in Alarm 512 comparison. Only SS[4:0] are compared */ 513 #define RTC_ALARMSUBSECONDMASK_SS14_6 (0x06000000U) /*!< SS[14:6] are don't care in Alarm 514 comparison. Only SS[5:0] are compared */ 515 #define RTC_ALARMSUBSECONDMASK_SS14_7 (0x07000000U) /*!< SS[14:7] are don't care in Alarm 516 comparison. Only SS[6:0] are compared */ 517 #define RTC_ALARMSUBSECONDMASK_SS14_8 (0x08000000U) /*!< SS[14:8] are don't care in Alarm 518 comparison. Only SS[7:0] are compared */ 519 #define RTC_ALARMSUBSECONDMASK_SS14_9 (0x09000000U) /*!< SS[14:9] are don't care in Alarm 520 comparison. Only SS[8:0] are compared */ 521 #define RTC_ALARMSUBSECONDMASK_SS14_10 (0x0A000000U) /*!< SS[14:10] are don't care in Alarm 522 comparison. Only SS[9:0] are compared */ 523 #define RTC_ALARMSUBSECONDMASK_SS14_11 (0x0B000000U) /*!< SS[14:11] are don't care in Alarm 524 comparison. Only SS[10:0] are compared */ 525 #define RTC_ALARMSUBSECONDMASK_SS14_12 (0x0C000000U) /*!< SS[14:12] are don't care in Alarm 526 comparison.Only SS[11:0] are compared */ 527 #define RTC_ALARMSUBSECONDMASK_SS14_13 (0x0D000000U) /*!< SS[14:13] are don't care in Alarm 528 comparison. Only SS[12:0] are compared */ 529 #define RTC_ALARMSUBSECONDMASK_SS14 (0x0E000000U) /*!< SS[14] is don't care in Alarm 530 comparison.Only SS[13:0] are compared */ 531 #define RTC_ALARMSUBSECONDMASK_NONE (0x0F000000U) /*!< SS[14:0] are compared and must match 532 to activate alarm. */ 533 534 #define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_ALARMSUBSECONDMASK_ALL) || \ 535 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_1) || \ 536 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_2) || \ 537 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_3) || \ 538 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_4) || \ 539 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_5) || \ 540 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_6) || \ 541 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_7) || \ 542 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_8) || \ 543 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_9) || \ 544 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_10) || \ 545 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_11) || \ 546 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_12) || \ 547 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_13) || \ 548 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14) || \ 549 ((MASK) == RTC_ALARMSUBSECONDMASK_NONE)) 550 /** 551 * @} 552 */ 553 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 554 555 /** 556 * @} 557 */ 558 559 /* Exported macros -----------------------------------------------------------*/ 560 /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros 561 * @{ 562 */ 563 564 /* ---------------------------------WAKEUPTIMER---------------------------------*/ 565 /** @defgroup RTCEx_WakeUp_Timer RTC WakeUp Timer 566 * @{ 567 */ 568 /** 569 * @brief Enable the RTC WakeUp Timer peripheral. 570 * @param __HANDLE__ specifies the RTC handle. 571 * @retval None 572 */ 573 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE)) 574 575 /** 576 * @brief Enable the RTC TimeStamp peripheral. 577 * @param __HANDLE__ specifies the RTC handle. 578 * @retval None 579 */ 580 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE)) 581 582 /** 583 * @brief Disable the RTC WakeUp Timer peripheral. 584 * @param __HANDLE__ specifies the RTC handle. 585 * @retval None 586 */ 587 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE)) 588 589 /** 590 * @brief Disable the RTC TimeStamp peripheral. 591 * @param __HANDLE__ specifies the RTC handle. 592 * @retval None 593 */ 594 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE)) 595 596 /** 597 * @brief Enable the Coarse calibration process. 598 * @param __HANDLE__ specifies the RTC handle. 599 * @retval None 600 */ 601 #define __HAL_RTC_COARSE_CALIB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_DCE)) 602 603 /** 604 * @brief Disable the Coarse calibration process. 605 * @param __HANDLE__ specifies the RTC handle. 606 * @retval None 607 */ 608 #define __HAL_RTC_COARSE_CALIB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_DCE)) 609 610 /** 611 * @brief Enable the RTC calibration output. 612 * @param __HANDLE__ specifies the RTC handle. 613 * @retval None 614 */ 615 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE)) 616 617 /** 618 * @brief Disable the calibration output. 619 * @param __HANDLE__ specifies the RTC handle. 620 * @retval None 621 */ 622 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE)) 623 624 /** 625 * @brief Enable the clock reference detection. 626 * @param __HANDLE__ specifies the RTC handle. 627 * @retval None 628 */ 629 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON)) 630 631 /** 632 * @brief Disable the clock reference detection. 633 * @param __HANDLE__ specifies the RTC handle. 634 * @retval None 635 */ 636 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON)) 637 638 /** 639 * @brief Enable the RTC TimeStamp interrupt. 640 * @param __HANDLE__ specifies the RTC handle. 641 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt sources to be enabled or disabled. 642 * This parameter can be: 643 * @arg RTC_IT_TS: TimeStamp interrupt 644 * @retval None 645 */ 646 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) 647 648 /** 649 * @brief Enable the RTC WakeUpTimer interrupt. 650 * @param __HANDLE__ specifies the RTC handle. 651 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled. 652 * This parameter can be: 653 * @arg RTC_IT_WUT: WakeUpTimer A interrupt 654 * @retval None 655 */ 656 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) 657 658 /** 659 * @brief Disable the RTC TimeStamp interrupt. 660 * @param __HANDLE__ specifies the RTC handle. 661 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt sources to be enabled or disabled. 662 * This parameter can be: 663 * @arg RTC_IT_TS: TimeStamp interrupt 664 * @retval None 665 */ 666 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) 667 668 /** 669 * @brief Disable the RTC WakeUpTimer interrupt. 670 * @param __HANDLE__ specifies the RTC handle. 671 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled. 672 * This parameter can be: 673 * @arg RTC_IT_WUT: WakeUpTimer A interrupt 674 * @retval None 675 */ 676 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) 677 678 /** 679 * @brief Enable the RTC Tamper1 input detection. 680 * @param __HANDLE__ specifies the RTC handle. 681 * @retval None 682 */ 683 #define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->TAFCR, RTC_TAFCR_TAMP1E) 684 685 /** 686 * @brief Disable the RTC Tamper1 input detection. 687 * @param __HANDLE__ specifies the RTC handle. 688 * @retval None 689 */ 690 #define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->TAFCR, RTC_TAFCR_TAMP1E) 691 692 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC)\ 693 || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA)\ 694 || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA)\ 695 || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 696 /** 697 * @brief Enable the RTC Tamper2 input detection. 698 * @param __HANDLE__ specifies the RTC handle. 699 * @retval None 700 */ 701 #define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->TAFCR, RTC_TAFCR_TAMP2E) 702 703 /** 704 * @brief Disable the RTC Tamper2 input detection. 705 * @param __HANDLE__ specifies the RTC handle. 706 * @retval None 707 */ 708 #define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->TAFCR, RTC_TAFCR_TAMP2E) 709 710 /** 711 * @brief Enable the RTC Tamper3 input detection. 712 * @param __HANDLE__ specifies the RTC handle. 713 * @retval None 714 */ 715 #define __HAL_RTC_TAMPER3_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->TAFCR, RTC_TAFCR_TAMP3E) 716 717 /** 718 * @brief Disable the RTC Tamper3 input detection. 719 * @param __HANDLE__ specifies the RTC handle. 720 * @retval None 721 */ 722 #define __HAL_RTC_TAMPER3_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->TAFCR, RTC_TAFCR_TAMP3E) 723 724 725 /** 726 * @brief Check whether the specified RTC Tamper interrupt has occurred or not. 727 * @param __HANDLE__ specifies the RTC handle. 728 * @param __INTERRUPT__ specifies the RTC Tamper interrupt to check. 729 * This parameter can be: 730 * @arg RTC_IT_TAMP1: Tamper1 interrupt 731 * @arg RTC_IT_TAMP2: Tamper2 interrupt 732 * @arg RTC_IT_TAMP3: Tamper3 interrupt 733 * @retval None 734 */ 735 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) == RTC_IT_TAMP1) ? (((((__HANDLE__)->Instance->ISR) & RTC_ISR_TAMP1F) != RESET) ? SET : RESET) : \ 736 ((__INTERRUPT__) == RTC_IT_TAMP2) ? (((((__HANDLE__)->Instance->ISR) & RTC_ISR_TAMP2F) != RESET) ? SET : RESET) : \ 737 (((((__HANDLE__)->Instance->ISR) & RTC_ISR_TAMP3F) != RESET) ? SET : RESET)) 738 #else 739 /** 740 * @brief Check whether the specified RTC Tamper interrupt has occurred or not. 741 * @param __HANDLE__ specifies the RTC handle. 742 * @param __INTERRUPT__ specifies the RTC Tamper interrupt to check. 743 * This parameter can be: 744 * @arg RTC_IT_TAMP1: Tamper1 interrupt 745 * @retval None 746 */ 747 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & RTC_ISR_TAMP1F) != RESET) ? SET : RESET) 748 749 #endif 750 751 /** 752 * @brief Enable the RTC Tamper interrupt. 753 * @param __HANDLE__ specifies the RTC handle. 754 * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be enabled 755 * This parameter can be any combination of the following values: 756 * @arg RTC_IT_TAMP1: Tamper1 interrupt 757 * @arg RTC_IT_TAMP2: Tamper2 interrupt (*) 758 * @arg RTC_IT_TAMP3: Tamper3 interrupt (*) 759 * @note (*) Available only on devices STM32L100xBA, STM32L151xBA, STM32L152xBA, STM32L100xC, 760 * STM32L151xC, STM32L152xC, STM32L162xC, STM32L151xCA, STM32L151xD, STM32L152xCA, 761 * STM32L152xD, STM32L162xCA, STM32L162xD, STM32L151xE, STM32L152xE, STM32L162xE 762 * STM32L151xDX, STM32L152xDX, STM32L162xDX 763 * @retval None 764 */ 765 #define __HAL_RTC_TAMPER_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT(((__HANDLE__)->Instance->TAFCR), RTC_TAFCR_TAMPIE) 766 767 /** 768 * @brief Disable the RTC Tamper interrupt. 769 * @param __HANDLE__ specifies the RTC handle. 770 * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be disabled. 771 * This parameter can be any combination of the following values: 772 * @arg RTC_IT_TAMP1: Tamper1 interrupt 773 * @arg RTC_IT_TAMP2: Tamper2 interrupt (*) 774 * @arg RTC_IT_TAMP3: Tamper3 interrupt (*) 775 * @note (*) Available only on devices STM32L100xBA, STM32L151xBA, STM32L152xBA, STM32L100xC, 776 * STM32L151xC, STM32L152xC, STM32L162xC, STM32L151xCA, STM32L151xD, STM32L152xCA, 777 * STM32L152xD, STM32L162xCA, STM32L162xD, STM32L151xE, STM32L152xE, STM32L162xE 778 * STM32L151xDX, STM32L152xDX, STM32L162xDX 779 * @retval None 780 */ 781 #define __HAL_RTC_TAMPER_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT(((__HANDLE__)->Instance->TAFCR), RTC_TAFCR_TAMPIE) 782 783 /** 784 * @brief Check whether the specified RTC Tamper interrupt has been enabled or not. 785 * @param __HANDLE__ specifies the RTC handle. 786 * @param __INTERRUPT__ specifies the RTC Tamper interrupt source to check. 787 * This parameter can be: 788 * @arg RTC_IT_TAMP1: Tamper1 interrupt 789 * @arg RTC_IT_TAMP2: Tamper2 interrupt (*) 790 * @arg RTC_IT_TAMP3: Tamper3 interrupt (*) 791 * @note (*) Available only on devices STM32L100xBA, STM32L151xBA, STM32L152xBA, STM32L100xC, 792 * STM32L151xC, STM32L152xC, STM32L162xC, STM32L151xCA, STM32L151xD, STM32L152xCA, 793 * STM32L152xD, STM32L162xCA, STM32L162xD, STM32L151xE, STM32L152xE, STM32L162xE 794 * STM32L151xDX, STM32L152xDX, STM32L162xDX 795 * @retval None 796 */ 797 #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->TAFCR) & RTC_TAFCR_TAMPIE) != RESET) ? SET : RESET) 798 799 /** 800 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not. 801 * @param __HANDLE__ specifies the RTC handle. 802 * @param __FLAG__ specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled. 803 * This parameter can be: 804 * @arg RTC_IT_WUT: WakeUpTimer A interrupt 805 * @retval None 806 */ 807 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET) 808 809 /** 810 * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not. 811 * @param __HANDLE__ specifies the RTC handle. 812 * @param __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check. 813 * This parameter can be: 814 * @arg RTC_IT_WUT: WakeUpTimer interrupt 815 * @retval None 816 */ 817 #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET) 818 819 /** 820 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not. 821 * @param __HANDLE__ specifies the RTC handle. 822 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt sources to be enabled or disabled. 823 * This parameter can be: 824 * @arg RTC_IT_TS: TimeStamp interrupt 825 * @retval None 826 */ 827 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4)) != RESET)? SET : RESET) 828 829 /** 830 * @brief Check whether the specified RTC Time Stamp interrupt has been enabled or not. 831 * @param __HANDLE__ specifies the RTC handle. 832 * @param __INTERRUPT__ specifies the RTC Time Stamp interrupt source to check. 833 * This parameter can be: 834 * @arg RTC_IT_TS: TimeStamp interrupt 835 * @retval None 836 */ 837 #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET) 838 839 /** 840 * @brief Get the selected RTC TimeStamp's flag status. 841 * @param __HANDLE__ specifies the RTC handle. 842 * @param __FLAG__ specifies the RTC TimeStamp Flag sources to be enabled or disabled. 843 * This parameter can be: 844 * @arg RTC_FLAG_TSF 845 * @arg RTC_FLAG_TSOVF 846 * @retval None 847 */ 848 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET) 849 850 /** 851 * @brief Get the selected RTC WakeUpTimer's flag status. 852 * @param __HANDLE__ specifies the RTC handle. 853 * @param __FLAG__ specifies the RTC WakeUpTimer Flag sources to be enabled or disabled. 854 * This parameter can be: 855 * @arg RTC_FLAG_WUTF 856 * @arg RTC_FLAG_WUTWF 857 * @retval None 858 */ 859 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET) 860 861 /** 862 * @brief Get the selected RTC Tamper's flag status. 863 * @param __HANDLE__ specifies the RTC handle. 864 * @param __FLAG__ specifies the RTC Tamper Flag sources to be enabled or disabled. 865 * This parameter can be: 866 * @arg RTC_FLAG_TAMP1F 867 * @arg RTC_FLAG_TAMP2F (*) 868 * @arg RTC_FLAG_TAMP3F (*) 869 * @note (*) Available only on devices STM32L100xBA, STM32L151xBA, STM32L152xBA, STM32L100xC, 870 * STM32L151xC, STM32L152xC, STM32L162xC, STM32L151xCA, STM32L151xD, STM32L152xCA, 871 * STM32L152xD, STM32L162xCA, STM32L162xD, STM32L151xE, STM32L152xE, STM32L162xE 872 * STM32L151xDX, STM32L152xDX, STM32L162xDX 873 * @retval None 874 */ 875 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET) 876 877 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC)\ 878 || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA)\ 879 || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA)\ 880 || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 881 /** 882 * @brief Get the selected RTC shift operation's flag status. 883 * @param __HANDLE__ specifies the RTC handle. 884 * @param __FLAG__ specifies the RTC shift operation Flag is pending or not. 885 * This parameter can be: 886 * @arg RTC_FLAG_SHPF 887 * @retval None 888 */ 889 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET) 890 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 891 892 /** 893 * @brief Clear the RTC Time Stamp's pending flags. 894 * @param __HANDLE__ specifies the RTC handle. 895 * @param __FLAG__ specifies the RTC Alarm Flag sources to be enabled or disabled. 896 * This parameter can be: 897 * @arg RTC_FLAG_TSF 898 * @retval None 899 */ 900 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 901 902 /** 903 * @brief Clear the RTC Tamper's pending flags. 904 * @param __HANDLE__ specifies the RTC handle. 905 * @param __FLAG__ specifies the RTC Tamper Flag sources to be enabled or disabled. 906 * This parameter can be: 907 * @arg RTC_FLAG_TAMP1F 908 * @arg RTC_FLAG_TAMP2F (*) 909 * @arg RTC_FLAG_TAMP3F (*) 910 * @note (*) Available only on devices STM32L100xBA, STM32L151xBA, STM32L152xBA, STM32L100xC, 911 * STM32L151xC, STM32L152xC, STM32L162xC, STM32L151xCA, STM32L151xD, STM32L152xCA, 912 * STM32L152xD, STM32L162xCA, STM32L162xD, STM32L151xE, STM32L152xE, STM32L162xE 913 * STM32L151xDX, STM32L152xDX, STM32L162xDX 914 * @retval None 915 */ 916 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 917 918 /** 919 * @brief Clear the RTC Wake Up timer's pending flags. 920 * @param __HANDLE__ specifies the RTC handle. 921 * @param __FLAG__ specifies the RTC WakeUpTimer Flag to clear. 922 * This parameter can be: 923 * @arg RTC_FLAG_WUTF 924 * @retval None 925 */ 926 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 927 928 /** 929 * @brief Enable interrupt on the RTC WakeUp Timer associated Exti line. 930 * @retval None 931 */ 932 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 933 934 /** 935 * @brief Disable interrupt on the RTC WakeUp Timer associated Exti line. 936 * @retval None 937 */ 938 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 939 940 /** 941 * @brief Enable event on the RTC WakeUp Timer associated Exti line. 942 * @retval None. 943 */ 944 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 945 946 /** 947 * @brief Disable event on the RTC WakeUp Timer associated Exti line. 948 * @retval None. 949 */ 950 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 951 952 /** 953 * @brief Enable falling edge trigger on the RTC WakeUp Timer associated Exti line. 954 * @retval None. 955 */ 956 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 957 958 /** 959 * @brief Disable falling edge trigger on the RTC WakeUp Timer associated Exti line. 960 * @retval None. 961 */ 962 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 963 964 /** 965 * @brief Enable rising edge trigger on the RTC WakeUp Timer associated Exti line. 966 * @retval None. 967 */ 968 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 969 970 /** 971 * @brief Disable rising edge trigger on the RTC WakeUp Timer associated Exti line. 972 * @retval None. 973 */ 974 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 975 976 /** 977 * @brief Enable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line. 978 * @retval None. 979 */ 980 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() do { __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE(); } while(0); 981 982 /** 983 * @brief Disable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line. 984 * This parameter can be: 985 * @retval None. 986 */ 987 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() do { __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE(); } while(0); 988 989 /** 990 * @brief Check whether the RTC WakeUp Timer associated Exti line interrupt flag is set or not. 991 * @retval Line Status. 992 */ 993 #define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 994 995 /** 996 * @brief Clear the RTC WakeUp Timer associated Exti line flag. 997 * @retval None. 998 */ 999 #define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 1000 1001 /** 1002 * @brief Generate a Software interrupt on the RTC WakeUp Timer associated Exti line. 1003 * @retval None. 1004 */ 1005 #define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 1006 1007 /** 1008 * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line. 1009 * @retval None 1010 */ 1011 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 1012 1013 /** 1014 * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line. 1015 * @retval None 1016 */ 1017 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 1018 1019 /** 1020 * @brief Enable event on the RTC Tamper and Timestamp associated Exti line. 1021 * @retval None. 1022 */ 1023 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 1024 1025 /** 1026 * @brief Disable event on the RTC Tamper and Timestamp associated Exti line. 1027 * @retval None. 1028 */ 1029 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 1030 1031 /** 1032 * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 1033 * @retval None. 1034 */ 1035 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 1036 1037 /** 1038 * @brief Disable falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 1039 * @retval None. 1040 */ 1041 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 1042 1043 /** 1044 * @brief Enable rising edge trigger on the RTC Tamper and Timestamp associated Exti line. 1045 * @retval None. 1046 */ 1047 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 1048 1049 /** 1050 * @brief Disable rising edge trigger on the RTC Tamper and Timestamp associated Exti line. 1051 * @retval None. 1052 */ 1053 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) 1054 1055 /** 1056 * @brief Enable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 1057 * @retval None. 1058 */ 1059 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_FALLING_EDGE() do { __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE(); } while(0); 1060 1061 /** 1062 * @brief Disable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line. 1063 * This parameter can be: 1064 * @retval None. 1065 */ 1066 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_FALLING_EDGE() do { __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE(); } while(0); 1067 1068 /** 1069 * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not. 1070 * @retval Line Status. 1071 */ 1072 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 1073 1074 /** 1075 * @brief Clear the RTC Tamper and Timestamp associated Exti line flag. 1076 * @retval None. 1077 */ 1078 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 1079 1080 /** 1081 * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line 1082 * @retval None. 1083 */ 1084 #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) 1085 1086 /** 1087 * @} 1088 */ 1089 1090 /* Exported functions --------------------------------------------------------*/ 1091 /** @defgroup RTCEx_Exported_Functions RTCEx Exported Functions 1092 * @{ 1093 */ 1094 1095 /* RTC TimeStamp and Tamper functions *****************************************/ 1096 /** @defgroup RTCEx_Exported_Functions_Group1 Extended RTC TimeStamp and Tamper functions 1097 * @{ 1098 */ 1099 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge); 1100 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge); 1101 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc); 1102 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format); 1103 HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper); 1104 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper); 1105 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper); 1106 void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc); 1107 1108 void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc); 1109 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 1110 void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc); 1111 void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc); 1112 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 1113 void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc); 1114 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 1115 HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 1116 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 1117 HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 1118 HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 1119 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 1120 /** 1121 * @} 1122 */ 1123 1124 /* RTC Wake-up functions ******************************************************/ 1125 /** @defgroup RTCEx_Exported_Functions_Group2 Extended RTC Wake-up functions 1126 * @{ 1127 */ 1128 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); 1129 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); 1130 HAL_StatusTypeDef HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc); 1131 uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc); 1132 void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc); 1133 void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc); 1134 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 1135 /** 1136 * @} 1137 */ 1138 1139 /* Extended Control functions ************************************************/ 1140 /** @defgroup RTCEx_Exported_Functions_Group3 Extended Peripheral Control functions 1141 * @{ 1142 */ 1143 void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data); 1144 uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister); 1145 1146 HAL_StatusTypeDef HAL_RTCEx_SetCoarseCalib(RTC_HandleTypeDef *hrtc, uint32_t CalibSign, uint32_t Value); 1147 HAL_StatusTypeDef HAL_RTCEx_DeactivateCoarseCalib(RTC_HandleTypeDef *hrtc); 1148 #if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) 1149 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue); 1150 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS); 1151 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput); 1152 #else 1153 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc); 1154 #endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */ 1155 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc); 1156 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc); 1157 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc); 1158 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc); 1159 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc); 1160 /** 1161 * @} 1162 */ 1163 1164 /* Extended RTC features functions *******************************************/ 1165 /** @defgroup RTCEx_Exported_Functions_Group4 Extended features functions 1166 * @{ 1167 */ 1168 void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc); 1169 HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 1170 /** 1171 * @} 1172 */ 1173 1174 /** 1175 * @} 1176 */ 1177 1178 /* Private types -------------------------------------------------------------*/ 1179 /* Private variables ---------------------------------------------------------*/ 1180 /* Private constants ---------------------------------------------------------*/ 1181 /** @defgroup RTCEx_Private_Constants RTCEx Private Constants 1182 * @{ 1183 */ 1184 #define RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT (0x00080000U) /*!< External interrupt line 19 Connected to the RTC Tamper and Time Stamp events */ 1185 #define RTC_EXTI_LINE_WAKEUPTIMER_EVENT (0x00100000U) /*!< External interrupt line 20 Connected to the RTC Wakeup event */ 1186 1187 /** 1188 * @} 1189 */ 1190 1191 /* Private macros ------------------------------------------------------------*/ 1192 /** @defgroup RTCEx_Private_Macros RTCEx Private Macros 1193 * @{ 1194 */ 1195 1196 /** 1197 * @} 1198 */ 1199 1200 /** 1201 * @} 1202 */ 1203 1204 /** 1205 * @} 1206 */ 1207 1208 /** 1209 * @} 1210 */ 1211 1212 #ifdef __cplusplus 1213 } 1214 #endif 1215 1216 #endif /* __STM32L1xx_HAL_RTC_EX_H */ 1217 1218 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 1219