1 /** 2 ****************************************************************************** 3 * @file stm32wlxx_hal_rtc_ex.h 4 * @author MCD Application Team 5 * @brief Header file of RTC HAL Extended module. 6 ****************************************************************************** 7 * @attention 8 * 9 * Copyright (c) 2020 STMicroelectronics. 10 * All rights reserved. 11 * 12 * This software is licensed under terms that can be found in the LICENSE file 13 * in the root directory of this software component. 14 * If no LICENSE file comes with this software, it is provided AS-IS. 15 * 16 ****************************************************************************** 17 */ 18 19 /* Define to prevent recursive inclusion -------------------------------------*/ 20 #ifndef STM32WLxx_HAL_RTC_EX_H 21 #define STM32WLxx_HAL_RTC_EX_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /* Includes ------------------------------------------------------------------*/ 28 #include "stm32wlxx_hal_def.h" 29 30 /** @addtogroup STM32WLxx_HAL_Driver 31 * @{ 32 */ 33 34 /** @defgroup RTCEx RTCEx 35 * @{ 36 */ 37 38 /* Exported types ------------------------------------------------------------*/ 39 /** @defgroup RTCEx_Exported_Types RTCEx Exported Types 40 * @{ 41 */ 42 43 /** @defgroup RTCEx_Tamper_structure_definition RTCEx Tamper structure definition 44 * @{ 45 */ 46 typedef struct 47 { 48 uint32_t Tamper; /*!< Specifies the Tamper Pin. 49 This parameter can be a value of @ref RTCEx_Tamper_Pins */ 50 51 uint32_t Trigger; /*!< Specifies the Tamper Trigger. 52 This parameter can be a value of @ref RTCEx_Tamper_Trigger */ 53 54 uint32_t NoErase; /*!< Specifies the Tamper no erase mode. 55 This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp */ 56 57 uint32_t MaskFlag; /*!< Specifies the Tamper Flag masking. 58 This parameter can be a value of @ref RTCEx_Tamper_MaskFlag */ 59 60 uint32_t Filter; /*!< Specifies the TAMP Filter Tamper. 61 This parameter can be a value of @ref RTCEx_Tamper_Filter */ 62 63 uint32_t SamplingFrequency; /*!< Specifies the sampling frequency. 64 This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies */ 65 66 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration . 67 This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration */ 68 69 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp . 70 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP */ 71 72 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection. 73 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection */ 74 } RTC_TamperTypeDef; 75 /** 76 * @} 77 */ 78 79 /** @defgroup RTCEx_Internal_Tamper_structure_definition RTCEx Internal Tamper structure definition 80 * @{ 81 */ 82 typedef struct 83 { 84 uint32_t IntTamper; /*!< Specifies the Internal Tamper Pin. 85 This parameter can be a value of @ref RTCEx_Internal_Tamper_Pins */ 86 87 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection. 88 This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection */ 89 90 uint32_t NoErase; /*!< Specifies the internal Tamper no erase mode. 91 This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp */ 92 } RTC_InternalTamperTypeDef; 93 /** 94 * @} 95 */ 96 97 /** 98 * @} 99 */ 100 101 /* Exported constants --------------------------------------------------------*/ 102 /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants 103 * @{ 104 */ 105 106 /** @defgroup RTCEx_Time_Stamp_Edges_definitions RTCEx Time Stamp Edges definition 107 * @{ 108 */ 109 #define RTC_TIMESTAMPEDGE_RISING 0x00000000u 110 #define RTC_TIMESTAMPEDGE_FALLING RTC_CR_TSEDGE 111 /** 112 * @} 113 */ 114 115 /** @defgroup RTCEx_TimeStamp_Pin_Selections RTCEx TimeStamp Pin Selection 116 * @{ 117 */ 118 #define RTC_TIMESTAMPPIN_DEFAULT 0x00000000u 119 /** 120 * @} 121 */ 122 123 /** @defgroup RTCEx_Wakeup_Timer_Definitions RTCEx Wakeup Timer Definitions 124 * @{ 125 */ 126 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 0x00000000u 127 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 RTC_CR_WUCKSEL_0 128 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 RTC_CR_WUCKSEL_1 129 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 (RTC_CR_WUCKSEL_0 | RTC_CR_WUCKSEL_1) 130 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS RTC_CR_WUCKSEL_2 131 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_2) 132 /** 133 * @} 134 */ 135 136 /** @defgroup RTCEx_Smooth_calib_period_Definitions RTCEx Smooth calib period Definitions 137 * @{ 138 */ 139 #define RTC_SMOOTHCALIB_PERIOD_32SEC 0x00000000u /*!< If RTCCLK = 32768 Hz, Smooth calibration 140 period is 32s, else 2exp20 RTCCLK pulses */ 141 #define RTC_SMOOTHCALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< If RTCCLK = 32768 Hz, Smooth calibration 142 period is 16s, else 2exp19 RTCCLK pulses */ 143 #define RTC_SMOOTHCALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< If RTCCLK = 32768 Hz, Smooth calibration 144 period is 8s, else 2exp18 RTCCLK pulses */ 145 /** 146 * @} 147 */ 148 149 /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTCEx Smooth calib Plus pulses Definitions 150 * @{ 151 */ 152 #define RTC_SMOOTHCALIB_PLUSPULSES_SET RTC_CALR_CALP /*!< The number of RTCCLK pulses added 153 during a X -second window = Y - CALM[8:0] 154 with Y = 512, 256, 128 when X = 32, 16, 8 */ 155 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET 0x00000000u /*!< The number of RTCCLK pulses subbstited 156 during a 32-second window = CALM[8:0] */ 157 /** 158 * @} 159 */ 160 161 /** @defgroup RTCEx_Smooth_calib_low_power_Definitions RTCEx Smooth calib Low Power Definitions 162 * @{ 163 */ 164 #define RTC_LPCAL_SET RTC_CALR_LPCAL /*!< Calibration window is 220 ck_apre, 165 which is the required configuration for 166 ultra-low consumption mode. */ 167 #define RTC_LPCAL_RESET 0x00000000u /*!< Calibration window is 220 RTCCLK, 168 which is a high-consumption mode. 169 This mode should be set only when less 170 than 32s calibration window is required. */ 171 /** 172 * @} 173 */ 174 175 /** @defgroup RTCEx_Calib_Output_selection_Definitions RTCEx Calib Output selection Definitions 176 * @{ 177 */ 178 #define RTC_CALIBOUTPUT_512HZ 0x00000000u 179 #define RTC_CALIBOUTPUT_1HZ RTC_CR_COSEL 180 181 /** 182 * @} 183 */ 184 185 186 /** @defgroup RTCEx_Add_1_Second_Parameter_Definition RTCEx Add 1 Second Parameter Definitions 187 * @{ 188 */ 189 #define RTC_SHIFTADD1S_RESET 0x00000000u 190 #define RTC_SHIFTADD1S_SET RTC_SHIFTR_ADD1S 191 /** 192 * @} 193 */ 194 195 /** @defgroup RTCEx_Tamper_Pins RTCEx Tamper Pins Definition 196 * @{ 197 */ 198 #define RTC_TAMPER_1 TAMP_CR1_TAMP1E 199 #define RTC_TAMPER_2 TAMP_CR1_TAMP2E 200 #define RTC_TAMPER_3 TAMP_CR1_TAMP3E 201 #define RTC_TAMPER_ALL (TAMP_CR1_TAMP1E | TAMP_CR1_TAMP2E | TAMP_CR1_TAMP3E) 202 /** 203 * @} 204 */ 205 206 /** @defgroup RTCEx_Internal_Tamper_Pins RTCEx Internal Tamper Pins Definition 207 * @{ 208 */ 209 #define RTC_INT_TAMPER_3 TAMP_CR1_ITAMP3E 210 #define RTC_INT_TAMPER_5 TAMP_CR1_ITAMP5E 211 #define RTC_INT_TAMPER_6 TAMP_CR1_ITAMP6E 212 #define RTC_INT_TAMPER_8 TAMP_CR1_ITAMP8E 213 #define RTC_INT_TAMPER_ALL (TAMP_CR1_ITAMP3E | TAMP_CR1_ITAMP5E | TAMP_CR1_ITAMP6E | TAMP_CR1_ITAMP8E) 214 /** 215 * @} 216 */ 217 218 /** @defgroup RTCEx_Tamper_Trigger RTCEx Tamper Trigger 219 * @{ 220 */ 221 #define RTC_TAMPERTRIGGER_RISINGEDGE 0x00u /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */ 222 #define RTC_TAMPERTRIGGER_FALLINGEDGE 0x01u /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */ 223 #define RTC_TAMPERTRIGGER_LOWLEVEL 0x02u /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */ 224 #define RTC_TAMPERTRIGGER_HIGHLEVEL 0x03u /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */ 225 /** 226 * @} 227 */ 228 229 /** @defgroup RTCEx_Tamper_MaskFlag RTCEx Tamper MaskFlag 230 * @{ 231 */ 232 #define RTC_TAMPERMASK_FLAG_DISABLE 0x00u 233 #define RTC_TAMPERMASK_FLAG_ENABLE 0x01u 234 /** 235 * @} 236 */ 237 238 /** @defgroup RTCEx_Tamper_EraseBackUp RTCEx Tamper EraseBackUp 239 * @{ 240 */ 241 #define RTC_TAMPER_ERASE_BACKUP_ENABLE 0x00u 242 #define RTC_TAMPER_ERASE_BACKUP_DISABLE 0x01u 243 /** 244 * @} 245 */ 246 247 /** @defgroup RTCEx_Tamper_Filter RTCEx Tamper Filter 248 * @{ 249 */ 250 #define RTC_TAMPERFILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */ 251 #define RTC_TAMPERFILTER_2SAMPLE TAMP_FLTCR_TAMPFLT_0 /*!< Tamper is activated after 2 252 consecutive samples at the active level */ 253 #define RTC_TAMPERFILTER_4SAMPLE TAMP_FLTCR_TAMPFLT_1 /*!< Tamper is activated after 4 254 consecutive samples at the active level */ 255 #define RTC_TAMPERFILTER_8SAMPLE TAMP_FLTCR_TAMPFLT /*!< Tamper is activated after 8 256 consecutive samples at the active level */ 257 /** 258 * @} 259 */ 260 261 /** @defgroup RTCEx_Tamper_Sampling_Frequencies RTCEx Tamper Sampling Frequencies 262 * @{ 263 */ 264 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 0x00000000U /*!< Each of the tamper inputs are sampled 265 with a frequency = RTCCLK / 32768 */ 266 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 TAMP_FLTCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled 267 with a frequency = RTCCLK / 16384 */ 268 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 TAMP_FLTCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled 269 with a frequency = RTCCLK / 8192 */ 270 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled 271 with a frequency = RTCCLK / 4096 */ 272 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 TAMP_FLTCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled 273 with a frequency = RTCCLK / 2048 */ 274 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled 275 with a frequency = RTCCLK / 1024 */ 276 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 (TAMP_FLTCR_TAMPFREQ_1 | TAMP_FLTCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled 277 with a frequency = RTCCLK / 512 */ 278 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_1 | \ 279 TAMP_FLTCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled 280 with a frequency = RTCCLK / 256 */ 281 /** 282 * @} 283 */ 284 285 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration RTCEx Tamper Pin Precharge Duration 286 * @{ 287 */ 288 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before 289 sampling during 1 RTCCLK cycle */ 290 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK TAMP_FLTCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before 291 sampling during 2 RTCCLK cycles */ 292 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK TAMP_FLTCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before 293 sampling during 4 RTCCLK cycles */ 294 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK (TAMP_FLTCR_TAMPPRCH_0 | TAMP_FLTCR_TAMPPRCH_1) /*!< Tamper pins are pre-charged before 295 sampling during 8 RTCCLK cycles */ 296 /** 297 * @} 298 */ 299 300 /** @defgroup RTCEx_Tamper_Pull_UP RTCEx Tamper Pull UP 301 * @{ 302 */ 303 #define RTC_TAMPER_PULLUP_ENABLE 0x00000000u /*!< Tamper pins are pre-charged before sampling */ 304 #define RTC_TAMPER_PULLUP_DISABLE TAMP_FLTCR_TAMPPUDIS /*!< Tamper pins pre-charge is disabled */ 305 /** 306 * @} 307 */ 308 309 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection RTCEx Tamper TimeStamp On Tamper Detection Definitions 310 * @{ 311 */ 312 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE 0x00000000u /*!< TimeStamp on Tamper Detection event is not saved */ 313 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE RTC_CR_TAMPTS /*!< TimeStamp on Tamper Detection event saved */ 314 /** 315 * @} 316 */ 317 318 /** @defgroup RTCEx_Internal_Tamper_Interrupt RTCEx Internal Tamper Interrupt 319 * @{ 320 */ 321 #define RTC_IT_TAMP_1 TAMP_IER_TAMP1IE /*!< Tamper 1 Interrupt */ 322 #define RTC_IT_TAMP_2 TAMP_IER_TAMP2IE /*!< Tamper 2 Interrupt */ 323 #define RTC_IT_TAMP_3 TAMP_IER_TAMP3IE /*!< Tamper 3 Interrupt */ 324 #define RTC_IT_TAMP_ALL (TAMP_IER_TAMP1IE | TAMP_IER_TAMP2IE | TAMP_IER_TAMP3IE) 325 326 #define RTC_IT_INT_TAMP_3 TAMP_IER_ITAMP3IE 327 #define RTC_IT_INT_TAMP_5 TAMP_IER_ITAMP5IE 328 #define RTC_IT_INT_TAMP_6 TAMP_IER_ITAMP6IE 329 #define RTC_IT_INT_TAMP_8 TAMP_IER_ITAMP8IE 330 #define RTC_IT_INT_TAMP_ALL (TAMP_IER_ITAMP3IE | TAMP_IER_ITAMP5IE | TAMP_IER_ITAMP6IE | TAMP_IER_ITAMP8IE) 331 /** 332 * @} 333 */ 334 335 /** @defgroup RTCEx_Flags RTCEx Flags 336 * @{ 337 */ 338 #define RTC_FLAG_TAMP_1 TAMP_SR_TAMP1F 339 #define RTC_FLAG_TAMP_2 TAMP_SR_TAMP2F 340 #define RTC_FLAG_TAMP_3 TAMP_SR_TAMP3F 341 #define RTC_FLAG_TAMP_ALL (RTC_FLAG_TAMP1 | RTC_FLAG_TAMP2 | RTC_FLAG_TAMP3 ) 342 343 344 #define RTC_FLAG_INT_TAMP_3 TAMP_SR_ITAMP3F 345 #define RTC_FLAG_INT_TAMP_5 TAMP_SR_ITAMP5F 346 #define RTC_FLAG_INT_TAMP_6 TAMP_SR_ITAMP6F 347 #define RTC_FLAG_INT_TAMP_8 TAMP_SR_ITAMP8F 348 #define RTC_FLAG_INT_TAMP_ALL (RTC_FLAG_INT_TAMP3 | RTC_FLAG_INT_TAMP5 | RTC_FLAG_INT_TAMP6 | RTC_FLAG_INT_TAMP8) 349 /** 350 * @} 351 */ 352 353 354 /** @defgroup RTCEx_MonotonicCounter_Instance RTCEx Monotonic Counter Instance Definition 355 * @{ 356 */ 357 #define RTC_MONOTONIC_COUNTER_1 0u /*!< Monotonic counter 1 */ 358 /** 359 * @} 360 */ 361 362 363 /** @defgroup RTCEx_Backup_Registers RTCEx Backup Registers Definition 364 * @{ 365 */ 366 #define RTC_BKP_NUMBER RTC_BACKUP_NB 367 #define RTC_BKP_DR0 0x00u 368 #define RTC_BKP_DR1 0x01u 369 #define RTC_BKP_DR2 0x02u 370 #define RTC_BKP_DR3 0x03u 371 #define RTC_BKP_DR4 0x04u 372 #define RTC_BKP_DR5 0x05u 373 #define RTC_BKP_DR6 0x06u 374 #define RTC_BKP_DR7 0x07u 375 #define RTC_BKP_DR8 0x08u 376 #define RTC_BKP_DR9 0x09u 377 #define RTC_BKP_DR10 0x0Au 378 #define RTC_BKP_DR11 0x0Bu 379 #define RTC_BKP_DR12 0x0Cu 380 #define RTC_BKP_DR13 0x0Du 381 #define RTC_BKP_DR14 0x0Eu 382 #define RTC_BKP_DR15 0x0Fu 383 #define RTC_BKP_DR16 0x10u 384 #define RTC_BKP_DR17 0x11u 385 #define RTC_BKP_DR18 0x12u 386 #define RTC_BKP_DR19 0x13u 387 /** 388 * @} 389 */ 390 391 /** @defgroup RTCEx_Binary_Mode RTC Binary Mode (32-bit free-running counter configuration). 392 * Warning : It Should not be confused with the Binary format @ref RTC_Input_parameter_format_definitions. 393 * @{ 394 */ 395 #define RTC_BINARY_NONE 0x00000000u /*!< Free running BCD calendar mode (Binary mode disabled). */ 396 #define RTC_BINARY_ONLY RTC_ICSR_BIN_0 /*!< Free running Binary mode (BCD mode disabled) */ 397 #define RTC_BINARY_MIX RTC_ICSR_BIN_1 /*!< Free running BCD calendar and Binary mode */ 398 /** 399 * @} 400 */ 401 402 /** @defgroup RTCEx_Binary_mix_BCDU If Binary mode is RTC_BINARY_MIX, the BCD calendar second is incremented using the SSR Least Significant Bits. 403 * @{ 404 */ 405 #define RTC_BINARY_MIX_BCDU_0 0x00000000u /*!< The 1s BCD calendar increment is generated each time SS[7:0] = 0 */ 406 #define RTC_BINARY_MIX_BCDU_1 (0x1UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[8:0] = 0 */ 407 #define RTC_BINARY_MIX_BCDU_2 (0x2UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[9:0] = 0 */ 408 #define RTC_BINARY_MIX_BCDU_3 (0x3UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[10:0] = 0 */ 409 #define RTC_BINARY_MIX_BCDU_4 (0x4UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[11:0] = 0 */ 410 #define RTC_BINARY_MIX_BCDU_5 (0x5UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[12:0] = 0 */ 411 #define RTC_BINARY_MIX_BCDU_6 (0x6UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[13:0] = 0 */ 412 #define RTC_BINARY_MIX_BCDU_7 (0x7UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[14:0] = 0 */ 413 /** 414 * @} 415 */ 416 417 /** @defgroup RTCEx_Alarm_Sub_Seconds_binary_Masks_Definitions RTC Alarm Sub Seconds with binary mode Masks Definitions 418 * @{ 419 */ 420 #define RTC_ALARMSUBSECONDBINMASK_ALL 0x00000000u /*!< All Alarm SS fields are masked. 421 There is no comparison on sub seconds for Alarm */ 422 #define RTC_ALARMSUBSECONDBINMASK_SS31_1 (1UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:1] are don't care in Alarm 423 comparison. Only SS[0] is compared. */ 424 #define RTC_ALARMSUBSECONDBINMASK_SS31_2 (2UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:2] are don't care in Alarm 425 comparison. Only SS[1:0] are compared */ 426 #define RTC_ALARMSUBSECONDBINMASK_SS31_3 (3UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:3] are don't care in Alarm 427 comparison. Only SS[2:0] are compared */ 428 #define RTC_ALARMSUBSECONDBINMASK_SS31_4 (4UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:4] are don't care in Alarm 429 comparison. Only SS[3:0] are compared */ 430 #define RTC_ALARMSUBSECONDBINMASK_SS31_5 (5UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:5] are don't care in Alarm 431 comparison. Only SS[4:0] are compared */ 432 #define RTC_ALARMSUBSECONDBINMASK_SS31_6 (6UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:6] are don't care in Alarm 433 comparison. Only SS[5:0] are compared */ 434 #define RTC_ALARMSUBSECONDBINMASK_SS31_7 (7UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:7] are don't care in Alarm 435 comparison. Only SS[6:0] are compared */ 436 #define RTC_ALARMSUBSECONDBINMASK_SS31_8 (8UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:8] are don't care in Alarm 437 comparison. Only SS[7:0] are compared */ 438 #define RTC_ALARMSUBSECONDBINMASK_SS31_9 (9UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:9] are don't care in Alarm 439 comparison. Only SS[8:0] are compared */ 440 #define RTC_ALARMSUBSECONDBINMASK_SS31_10 (10UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:10] are don't care in Alarm 441 comparison. Only SS[9:0] are compared */ 442 #define RTC_ALARMSUBSECONDBINMASK_SS31_11 (11UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:11] are don't care in Alarm 443 comparison. Only SS[10:0] are compared */ 444 #define RTC_ALARMSUBSECONDBINMASK_SS31_12 (12UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:12] are don't care in Alarm 445 comparison.Only SS[11:0] are compared */ 446 #define RTC_ALARMSUBSECONDBINMASK_SS31_13 (13UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:13] are don't care in Alarm 447 comparison. Only SS[12:0] are compared */ 448 #define RTC_ALARMSUBSECONDBINMASK_SS31_14 (14UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:14] are don't care in Alarm 449 comparison. Only SS[13:0] are compared */ 450 #define RTC_ALARMSUBSECONDBINMASK_SS31_15 (15UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:15] are don't care in Alarm 451 comparison. Only SS[14:0] are compared */ 452 #define RTC_ALARMSUBSECONDBINMASK_SS31_16 (16UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:16] are don't care in Alarm 453 comparison. Only SS[15:0] are compared */ 454 #define RTC_ALARMSUBSECONDBINMASK_SS31_17 (17UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:17] are don't care in Alarm 455 comparison. Only SS[16:0] are compared */ 456 #define RTC_ALARMSUBSECONDBINMASK_SS31_18 (18UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:18] are don't care in Alarm 457 comparison. Only SS[17:0] are compared */ 458 #define RTC_ALARMSUBSECONDBINMASK_SS31_19 (19UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:19] are don't care in Alarm 459 comparison. Only SS[18:0] are compared */ 460 #define RTC_ALARMSUBSECONDBINMASK_SS31_20 (20UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:20] are don't care in Alarm 461 comparison. Only SS[19:0] are compared */ 462 #define RTC_ALARMSUBSECONDBINMASK_SS31_21 (21UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:21] are don't care in Alarm 463 comparison. Only SS[20:0] are compared */ 464 #define RTC_ALARMSUBSECONDBINMASK_SS31_22 (22UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:22] are don't care in Alarm 465 comparison. Only SS[21:0] are compared */ 466 #define RTC_ALARMSUBSECONDBINMASK_SS31_23 (23UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:23] are don't care in Alarm 467 comparison. Only SS[22:0] are compared */ 468 #define RTC_ALARMSUBSECONDBINMASK_SS31_24 (24UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:24] are don't care in Alarm 469 comparison. Only SS[23:0] are compared */ 470 #define RTC_ALARMSUBSECONDBINMASK_SS31_25 (25UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:25] are don't care in Alarm 471 comparison. Only SS[24:0] are compared */ 472 #define RTC_ALARMSUBSECONDBINMASK_SS31_26 (26UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:26] are don't care in Alarm 473 comparison. Only SS[25:0] are compared */ 474 #define RTC_ALARMSUBSECONDBINMASK_SS31_27 (27UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:27] are don't care in Alarm 475 comparison. Only SS[26:0] are compared */ 476 #define RTC_ALARMSUBSECONDBINMASK_SS31_28 (28UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:28] are don't care in Alarm 477 comparison. Only SS[27:0] are compared */ 478 #define RTC_ALARMSUBSECONDBINMASK_SS31_29 (29UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:29] are don't care in Alarm 479 comparison. Only SS[28:0] are compared */ 480 #define RTC_ALARMSUBSECONDBINMASK_SS31_30 (30UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:30] are don't care in Alarm 481 comparison. Only SS[29:0] are compared */ 482 #define RTC_ALARMSUBSECONDBINMASK_SS31 (31UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31] is don't care in Alarm 483 comparison. Only SS[30:0] are compared */ 484 #define RTC_ALARMSUBSECONDBINMASK_NONE (32UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:0] are compared and must match to activate alarm. */ 485 /** 486 * @} 487 */ 488 489 /** @defgroup RTCEx_Alarm_Sub_Seconds_binary_Clear_Definitions RTC Alarm Sub Seconds with binary mode auto clear Definitions 490 * @{ 491 */ 492 #define RTC_ALARMSUBSECONDBIN_AUTOCLR_NO 0UL /*!< The synchronous Binary counter (SS[31:0] in RTC_SSR) is free-running. */ 493 #define RTC_ALARMSUBSECONDBIN_AUTOCLR_YES RTC_ALRMASSR_SSCLR /*!< The synchronous Binary counter (SS[31:0] in RTC_SSR) is running from 0xFFFF FFFF to 494 RTC_ALRMABINR -> SS[31:0] value and is automatically reloaded with 0xFFFF FFFF 495 whenreaching RTC_ALRMABINR -> SS[31:0]. */ 496 /** 497 * @} 498 */ 499 500 /** 501 * @} 502 */ 503 504 /* Exported macros -----------------------------------------------------------*/ 505 /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros 506 * @{ 507 */ 508 509 /** @brief Clear the specified RTC pending flag. 510 * @param __HANDLE__ specifies the RTC Handle. 511 * @param __FLAG__ specifies the flag to check. 512 * This parameter can be any combination of the following values: 513 * @arg @ref RTC_CLEAR_ITSF Clear Internal Time-stamp flag 514 * @arg @ref RTC_CLEAR_TSOVF Clear Time-stamp overflow flag 515 * @arg @ref RTC_CLEAR_TSF Clear Time-stamp flag 516 * @arg @ref RTC_CLEAR_WUTF Clear Wakeup timer flag 517 * @arg @ref RTC_CLEAR_ALRBF Clear Alarm B flag 518 * @arg @ref RTC_CLEAR_ALRAF Clear Alarm A flag 519 * @retval None 520 */ 521 #define __HAL_RTC_CLEAR_FLAG(__HANDLE__, __FLAG__) (RTC->SCR = (__FLAG__)) 522 523 /** @brief Check whether the specified RTC flag is set or not. 524 * @param __HANDLE__ specifies the RTC Handle. 525 * @param __FLAG__ specifies the flag to check. 526 * This parameter can be any combination of the following values: 527 * @arg @ref RTC_FLAG_RECALPF Recalibration pending Flag 528 * @arg @ref RTC_FLAG_INITF Initialization flag 529 * @arg @ref RTC_FLAG_RSF Registers synchronization flag 530 * @arg @ref RTC_FLAG_INITS Initialization status flag 531 * @arg @ref RTC_FLAG_SHPF Shift operation pending flag 532 * @arg @ref RTC_FLAG_WUTWF Wakeup timer write flag 533 * @arg @ref RTC_FLAG_ITSF Internal Time-stamp flag 534 * @arg @ref RTC_FLAG_TSOVF Time-stamp overflow flag 535 * @arg @ref RTC_FLAG_TSF Time-stamp flag 536 * @arg @ref RTC_FLAG_WUTF Wakeup timer flag 537 * @arg @ref RTC_FLAG_ALRBF Alarm B flag 538 * @arg @ref RTC_FLAG_ALRAF Alarm A flag 539 * @retval None 540 */ 541 #define __HAL_RTC_GET_FLAG(__HANDLE__, __FLAG__) (((((__FLAG__)) >> 8U) == 1U) ? (RTC->ICSR & (1U << (((uint16_t)(__FLAG__)) & RTC_FLAG_MASK))) : \ 542 (RTC->SR & (1U << (((uint16_t)(__FLAG__)) & RTC_FLAG_MASK)))) 543 544 /* ---------------------------------WAKEUPTIMER---------------------------------*/ 545 /** @defgroup RTCEx_WakeUp_Timer RTC WakeUp Timer 546 * @{ 547 */ 548 /** 549 * @brief Enable the RTC WakeUp Timer peripheral. 550 * @param __HANDLE__ specifies the RTC handle. 551 * @retval None 552 */ 553 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_WUTE)) 554 555 /** 556 * @brief Disable the RTC WakeUp Timer peripheral. 557 * @param __HANDLE__ specifies the RTC handle. 558 * @retval None 559 */ 560 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_WUTE)) 561 562 /** 563 * @brief Enable the RTC WakeUpTimer interrupt. 564 * @param __HANDLE__ specifies the RTC handle. 565 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled. 566 * This parameter can be: 567 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt 568 * @retval None 569 */ 570 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR |= (__INTERRUPT__)) 571 572 /** 573 * @brief Disable the RTC WakeUpTimer interrupt. 574 * @param __HANDLE__ specifies the RTC handle. 575 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be disabled. 576 * This parameter can be: 577 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt 578 * @retval None 579 */ 580 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR &= ~(__INTERRUPT__)) 581 582 583 /** 584 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not. 585 * @param __HANDLE__ specifies the RTC handle. 586 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt to check. 587 * This parameter can be: 588 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt 589 * @retval None 590 */ 591 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) ((((RTC->MISR) & ((__INTERRUPT__)>> 12U)) != 0UL) ? 1UL : 0UL) 592 /** 593 * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not. 594 * @param __HANDLE__ specifies the RTC handle. 595 * @param __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check. 596 * This parameter can be: 597 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt 598 * @retval None 599 */ 600 #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((RTC->CR) & (__INTERRUPT__)) != 0UL) ? 1UL : 0UL) 601 602 /** 603 * @brief Get the selected RTC WakeUpTimers flag status. 604 * @param __HANDLE__ specifies the RTC handle. 605 * @param __FLAG__ specifies the RTC WakeUpTimer Flag is pending or not. 606 * This parameter can be: 607 * @arg @ref RTC_FLAG_WUTF 608 * @arg @ref RTC_FLAG_WUTWF 609 * @retval None 610 */ 611 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__), (__FLAG__))) 612 613 /** 614 * @brief Clear the RTC Wake Up timers pending flags. 615 * @param __HANDLE__ specifies the RTC handle. 616 * @param __FLAG__ specifies the RTC WakeUpTimer Flag to clear. 617 * This parameter can be: 618 * @arg @ref RTC_FLAG_WUTF 619 * @retval None 620 */ 621 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_CLEAR_FLAG((__HANDLE__), RTC_CLEAR_WUTF)) 622 623 /* WAKE-UP TIMER EXTI */ 624 /* ------------------ */ 625 #if defined(CORE_CM0PLUS) 626 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->C2IMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 627 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->C2IMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 628 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->C2EMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 629 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->C2EMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 630 #else 631 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 632 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 633 #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) 634 #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) 635 #endif 636 637 /** 638 * @} 639 */ 640 641 642 643 644 645 /* ---------------------------------TIMESTAMP---------------------------------*/ 646 /** @defgroup RTCEx_Timestamp RTC Timestamp 647 * @{ 648 */ 649 /** 650 * @brief Enable the RTC TimeStamp peripheral. 651 * @param __HANDLE__ specifies the RTC handle. 652 * @retval None 653 */ 654 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_TSE)) 655 656 /** 657 * @brief Disable the RTC TimeStamp peripheral. 658 * @param __HANDLE__ specifies the RTC handle. 659 * @retval None 660 */ 661 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_TSE)) 662 663 /** 664 * @brief Enable the RTC TimeStamp interrupt. 665 * @param __HANDLE__ specifies the RTC handle. 666 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be enabled. 667 * This parameter can be: 668 * @arg @ref RTC_IT_TS TimeStamp interrupt 669 * @retval None 670 */ 671 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR |= (__INTERRUPT__)) 672 673 /** 674 * @brief Disable the RTC TimeStamp interrupt. 675 * @param __HANDLE__ specifies the RTC handle. 676 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be disabled. 677 * This parameter can be: 678 * @arg @ref RTC_IT_TS TimeStamp interrupt 679 * @retval None 680 */ 681 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR &= ~(__INTERRUPT__)) 682 683 /** 684 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not. 685 * @param __HANDLE__ specifies the RTC handle. 686 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt to check. 687 * This parameter can be: 688 * @arg @ref RTC_IT_TS TimeStamp interrupt 689 * @retval None 690 */ 691 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) ((((RTC->MISR) & ((__INTERRUPT__)>> 12U)) != 0U) ? 1UL : 0UL) 692 /** 693 * @brief Check whether the specified RTC Time Stamp interrupt has been enabled or not. 694 * @param __HANDLE__ specifies the RTC handle. 695 * @param __INTERRUPT__ specifies the RTC Time Stamp interrupt source to check. 696 * This parameter can be: 697 * @arg @ref RTC_IT_TS TimeStamp interrupt 698 * @retval None 699 */ 700 #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((RTC->CR) & (__INTERRUPT__)) != 0U) ? 1UL : 0UL) 701 702 /** 703 * @brief Get the selected RTC TimeStamps flag status. 704 * @param __HANDLE__ specifies the RTC handle. 705 * @param __FLAG__ specifies the RTC TimeStamp Flag is pending or not. 706 * This parameter can be: 707 * @arg @ref RTC_FLAG_TSF 708 * @arg @ref RTC_FLAG_TSOVF 709 * @retval None 710 */ 711 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__),(__FLAG__))) 712 713 /** 714 * @brief Clear the RTC Time Stamps pending flags. 715 * @param __HANDLE__ specifies the RTC handle. 716 * @param __FLAG__ specifies the RTC TimeStamp Flag to clear. 717 * This parameter can be: 718 * @arg @ref RTC_FLAG_TSF 719 * @arg @ref RTC_FLAG_TSOVF 720 * @retval None 721 */ 722 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_CLEAR_FLAG((__HANDLE__), (__FLAG__))) 723 724 /* TIMESTAMP EXTI */ 725 /* -------------- */ 726 #if defined(CORE_CM0PLUS) 727 #define __HAL_RTC_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->C2IMR1 |= RTC_EXTI_LINE_TIMESTAMP_EVENT) 728 #define __HAL_RTC_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->C2IMR1 &= ~(RTC_EXTI_LINE_TIMESTAMP_EVENT)) 729 #define __HAL_RTC_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->C2EMR1 |= RTC_EXTI_LINE_TIMESTAMP_EVENT) 730 #define __HAL_RTC_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->C2EMR1 &= ~(RTC_EXTI_LINE_TIMESTAMP_EVENT)) 731 #else 732 #define __HAL_RTC_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_TIMESTAMP_EVENT) 733 #define __HAL_RTC_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_TIMESTAMP_EVENT)) 734 #define __HAL_RTC_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_TIMESTAMP_EVENT) 735 #define __HAL_RTC_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_TIMESTAMP_EVENT)) 736 #endif 737 738 /** 739 * @brief Enable the RTC internal TimeStamp peripheral. 740 * @param __HANDLE__ specifies the RTC handle. 741 * @retval None 742 */ 743 #define __HAL_RTC_INTERNAL_TIMESTAMP_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_ITSE)) 744 745 /** 746 * @brief Disable the RTC internal TimeStamp peripheral. 747 * @param __HANDLE__ specifies the RTC handle. 748 * @retval None 749 */ 750 #define __HAL_RTC_INTERNAL_TIMESTAMP_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_ITSE)) 751 752 /** 753 * @brief Get the selected RTC Internal Time Stamps flag status. 754 * @param __HANDLE__ specifies the RTC handle. 755 * @param __FLAG__ specifies the RTC Internal Time Stamp Flag is pending or not. 756 * This parameter can be: 757 * @arg @ref RTC_FLAG_ITSF 758 * @retval None 759 */ 760 #define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__),(__FLAG__))) 761 762 /** 763 * @brief Clear the RTC Internal Time Stamps pending flags. 764 * @param __HANDLE__ specifies the RTC handle. 765 * @param __FLAG__ specifies the RTC Internal Time Stamp Flag source to clear. 766 * This parameter can be: 767 * @arg @ref RTC_FLAG_ITSF 768 * @retval None 769 */ 770 #define __HAL_RTC_INTERNAL_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_CLEAR_FLAG((__HANDLE__), RTC_CLEAR_ITSF)) 771 772 /** 773 * @brief Enable the RTC TimeStamp on Tamper detection. 774 * @param __HANDLE__ specifies the RTC handle. 775 * @retval None 776 */ 777 #define __HAL_RTC_TAMPTS_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_TAMPTS)) 778 779 /** 780 * @brief Disable the RTC TimeStamp on Tamper detection. 781 * @param __HANDLE__ specifies the RTC handle. 782 * @retval None 783 */ 784 #define __HAL_RTC_TAMPTS_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_TAMPTS)) 785 786 /** 787 * @brief Enable the RTC Tamper detection output. 788 * @param __HANDLE__ specifies the RTC handle. 789 * @retval None 790 */ 791 #define __HAL_RTC_TAMPOE_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_TAMPOE)) 792 793 /** 794 * @brief Disable the RTC Tamper detection output. 795 * @param __HANDLE__ specifies the RTC handle. 796 * @retval None 797 */ 798 #define __HAL_RTC_TAMPOE_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_TAMPOE)) 799 800 801 /** 802 * @} 803 */ 804 805 806 /* ------------------------------Calibration----------------------------------*/ 807 /** @defgroup RTCEx_Calibration RTC Calibration 808 * @{ 809 */ 810 811 /** 812 * @brief Enable the RTC calibration output. 813 * @param __HANDLE__ specifies the RTC handle. 814 * @retval None 815 */ 816 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_COE)) 817 818 /** 819 * @brief Disable the calibration output. 820 * @param __HANDLE__ specifies the RTC handle. 821 * @retval None 822 */ 823 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_COE)) 824 825 826 /** 827 * @brief Enable the clock reference detection. 828 * @param __HANDLE__ specifies the RTC handle. 829 * @retval None 830 */ 831 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_REFCKON)) 832 833 /** 834 * @brief Disable the clock reference detection. 835 * @param __HANDLE__ specifies the RTC handle. 836 * @retval None 837 */ 838 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_REFCKON)) 839 840 841 /** 842 * @brief Get the selected RTC shift operations flag status. 843 * @param __HANDLE__ specifies the RTC handle. 844 * @param __FLAG__ specifies the RTC shift operation Flag is pending or not. 845 * This parameter can be: 846 * @arg @ref RTC_FLAG_SHPF 847 * @retval None 848 */ 849 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__), (__FLAG__))) 850 /** 851 * @} 852 */ 853 854 855 /* ------------------------------Tamper----------------------------------*/ 856 /** @defgroup RTCEx_Tamper RTCEx tamper 857 * @{ 858 */ 859 /** 860 * @brief Enable the TAMP Tamper input detection. 861 * @param __HANDLE__ specifies the RTC handle. 862 * @param __TAMPER__ specifies the RTC Tamper source to be enabled. 863 * This parameter can be any combination of the following values: 864 * @arg RTC_TAMPER_ALL: All tampers 865 * @arg RTC_TAMPER_1: Tamper1 866 * @arg RTC_TAMPER_2: Tamper2 867 * @arg RTC_TAMPER_3: Tamper3 868 * @arg RTC_IT_INT_TAMP_ALL: All Internal Tamper interrupts 869 * @arg RTC_IT_INT_TAMP_3: Internal Tamper3 interrupt 870 * @arg RTC_IT_INT_TAMP_5: Internal Tamper5 interrupt 871 * @arg RTC_IT_INT_TAMP_6: Internal Tamper6 interrupt 872 * @arg RTC_IT_INT_TAMP_8: Internal Tamper8 interrupt 873 * @retval None 874 */ 875 #define __HAL_RTC_TAMPER_ENABLE(__HANDLE__, __TAMPER__) (TAMP->CR1 |= (__TAMPER__)) 876 877 /** 878 * @brief Disable the TAMP Tamper input detection. 879 * @param __HANDLE__ specifies the RTC handle. 880 * @param __TAMPER__ specifies the RTC Tamper sources to be enabled. 881 * This parameter can be any combination of the following values: 882 * @arg RTC_TAMPER_ALL: All tampers 883 * @arg RTC_TAMPER_1: Tamper1 884 * @arg RTC_TAMPER_2: Tamper2 885 * @arg RTC_TAMPER_3: Tamper3 886 * @arg RTC_IT_INT_TAMP_ALL: All Internal Tamper interrupts 887 * @arg RTC_IT_INT_TAMP_3: Internal Tamper3 interrupt 888 * @arg RTC_IT_INT_TAMP_5: Internal Tamper5 interrupt 889 * @arg RTC_IT_INT_TAMP_6: Internal Tamper6 interrupt 890 * @arg RTC_IT_INT_TAMP_8: Internal Tamper8 interrupt 891 */ 892 #define __HAL_RTC_TAMPER_DISABLE(__HANDLE__, __TAMPER__) (TAMP->CR1 &= ~(__TAMPER__)) 893 894 895 /**************************************************************************************************/ 896 /** 897 * @brief Enable the TAMP Tamper interrupt. 898 * @param __HANDLE__ specifies the RTC handle. 899 * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be enabled. 900 * This parameter can be any combination of the following values: 901 * @arg RTC_IT_TAMP_ALL: All tampers interrupts 902 * @arg RTC_IT_TAMP_1: Tamper1 interrupt 903 * @arg RTC_IT_TAMP_2: Tamper2 interrupt 904 * @arg RTC_IT_TAMP_3: Tamper3 interrupt 905 * @arg RTC_IT_INT_TAMP_ALL: All Internal Tamper interrupts 906 * @arg RTC_IT_INT_TAMP_3: Internal Tamper3 interrupt 907 * @arg RTC_IT_INT_TAMP_5: Internal Tamper5 interrupt 908 * @arg RTC_IT_INT_TAMP_6: Internal Tamper6 interrupt 909 * @arg RTC_IT_INT_TAMP_8: Internal Tamper8 interrupt 910 * @retval None 911 */ 912 #define __HAL_RTC_TAMPER_ENABLE_IT(__HANDLE__, __INTERRUPT__) (TAMP->IER |= (__INTERRUPT__)) 913 914 /** 915 * @brief Disable the TAMP Tamper interrupt. 916 * @param __HANDLE__ specifies the RTC handle. 917 * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be disabled. 918 * This parameter can be any combination of the following values: 919 * @arg RTC_IT_TAMP_ALL: All tampers interrupts 920 * @arg RTC_IT_TAMP_1: Tamper1 interrupt 921 * @arg RTC_IT_TAMP_2: Tamper2 interrupt 922 * @arg RTC_IT_TAMP_3: Tamper3 interrupt 923 * @arg RTC_IT_INT_TAMP_ALL: All Internal Tamper interrupts 924 * @arg RTC_IT_INT_TAMP_3: Internal Tamper3 interrupt 925 * @arg RTC_IT_INT_TAMP_5: Internal Tamper5 interrupt 926 * @arg RTC_IT_INT_TAMP_6: Internal Tamper6 interrupt 927 * @arg RTC_IT_INT_TAMP_8: Internal Tamper8 interrupt 928 * @retval None 929 */ 930 #define __HAL_RTC_TAMPER_DISABLE_IT(__HANDLE__, __INTERRUPT__) (TAMP->IER &= ~(__INTERRUPT__)) 931 932 933 /**************************************************************************************************/ 934 /** 935 * @brief Check whether the specified RTC Tamper interrupt has occurred or not. 936 * @param __HANDLE__ specifies the RTC handle. 937 * @param __INTERRUPT__ specifies the RTC Tamper interrupt to check. 938 * This parameter can be: 939 * @arg RTC_IT_TAMP_ALL: All tampers interrupts 940 * @arg RTC_IT_TAMP_1: Tamper1 interrupt 941 * @arg RTC_IT_TAMP_2: Tamper2 interrupt 942 * @arg RTC_IT_TAMP_3: Tamper3 interrupt 943 * @arg RTC_IT_INT_TAMP_ALL: All Internal Tamper interrupts 944 * @arg RTC_IT_INT_TAMP_3: Internal Tamper3 interrupt 945 * @arg RTC_IT_INT_TAMP_5: Internal Tamper5 interrupt 946 * @arg RTC_IT_INT_TAMP_6: Internal Tamper6 interrupt 947 * @arg RTC_IT_INT_TAMP_8: Internal Tamper8 interrupt 948 * @retval None 949 */ 950 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) ((((TAMP->MISR) & (__INTERRUPT__)) != 0U) ? 1UL : 0UL) 951 952 953 /** 954 * @brief Check whether the specified RTC Tamper interrupt has been enabled or not. 955 * @param __HANDLE__ specifies the RTC handle. 956 * @param __INTERRUPT__ specifies the RTC Tamper interrupt source to check. 957 * This parameter can be: 958 * @arg RTC_IT_TAMP_ALL: All tampers interrupts 959 * @arg RTC_IT_TAMP_1: Tamper1 interrupt 960 * @arg RTC_IT_TAMP_2: Tamper2 interrupt 961 * @arg RTC_IT_TAMP_3: Tamper3 interrupt 962 * @arg RTC_IT_INT_TAMP_ALL: All internal tampers interrupts 963 * @arg RTC_IT_INT_TAMP_3: Internal Tamper3 interrupt 964 * @arg RTC_IT_INT_TAMP_5: Internal Tamper5 interrupt 965 * @arg RTC_IT_INT_TAMP_6: Internal Tamper6 interrupt 966 * @arg RTC_IT_INT_TAMP_8: Internal Tamper8 interrupt 967 * @retval None 968 */ 969 #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((TAMP->IER) & (__INTERRUPT__)) != 0U) ? 1UL : 0UL) 970 971 972 /** 973 * @brief Get the selected RTC Tampers flag status. 974 * @param __HANDLE__ specifies the RTC handle. 975 * @param __FLAG__ specifies the RTC Tamper Flag is pending or not. 976 * This parameter can be: 977 * @arg RTC_FLAG_TAMP_1: Tamper1 flag 978 * @arg RTC_FLAG_TAMP_2: Tamper2 flag 979 * @arg RTC_FLAG_TAMP_3: Tamper3 flag 980 * @arg RTC_FLAG_INT_TAMP_3: Internal Tamper3 interrupt 981 * @arg RTC_FLAG_INT_TAMP_5: Internal Tamper5 interrupt 982 * @arg RTC_FLAG_INT_TAMP_6: Internal Tamper6 interrupt 983 * @arg RTC_FLAG_INT_TAMP_8: Internal Tamper8 interrupt 984 * @retval None 985 */ 986 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) ((((TAMP->SR) & (__FLAG__)) != 0U) ? 1UL : 0UL) 987 988 /** 989 * @brief Clear the RTC Tamper's pending flags. 990 * @param __HANDLE__ specifies the RTC handle. 991 * @param __FLAG__ specifies the RTC Tamper Flag to clear. 992 * This parameter can be: 993 * @arg RTC_FLAG_TAMP_ALL: All tampers flag 994 * @arg RTC_FLAG_TAMP_1: Tamper1 flag 995 * @arg RTC_FLAG_TAMP_2: Tamper2 flag 996 * @arg RTC_FLAG_TAMP_3: Tamper3 flag 997 * @arg RTC_FLAG_INT_TAMP_ALL: All Internal Tamper flags 998 * @arg RTC_FLAG_INT_TAMP_3: Internal Tamper3 interrupt 999 * @arg RTC_FLAG_INT_TAMP_5: Internal Tamper5 interrupt 1000 * @arg RTC_FLAG_INT_TAMP_6: Internal Tamper6 interrupt 1001 * @arg RTC_FLAG_INT_TAMP_8: Internal Tamper8 interrupt 1002 * @retval None 1003 */ 1004 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) (((TAMP->SCR) = (__FLAG__))) 1005 1006 /* TAMPER EXTI */ 1007 /* ----------- */ 1008 #if defined(CORE_CM0PLUS) 1009 #define __HAL_RTC_TAMPER_EXTI_ENABLE_IT() (EXTI->C2IMR1 |= RTC_EXTI_LINE_TAMPER_EVENT) 1010 #define __HAL_RTC_TAMPER_EXTI_DISABLE_IT() (EXTI->C2IMR1 &= ~(RTC_EXTI_LINE_TAMPER_EVENT)) 1011 #define __HAL_RTC_TAMPER_EXTI_ENABLE_EVENT() (EXTI->C2EMR1 |= RTC_EXTI_LINE_TAMPER_EVENT) 1012 #define __HAL_RTC_TAMPER_EXTI_DISABLE_EVENT() (EXTI->C2EMR1 &= ~(RTC_EXTI_LINE_TAMPER_EVENT)) 1013 #else 1014 #define __HAL_RTC_TAMPER_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_TAMPER_EVENT) 1015 #define __HAL_RTC_TAMPER_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_TAMPER_EVENT)) 1016 #define __HAL_RTC_TAMPER_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_TAMPER_EVENT) 1017 #define __HAL_RTC_TAMPER_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_TAMPER_EVENT)) 1018 #endif 1019 1020 /** 1021 * @} 1022 */ 1023 1024 /* --------------------------------- SSR Underflow ---------------------------------*/ 1025 /** @defgroup RTCEx_SSR_Underflow RTC SSR Underflow 1026 * @{ 1027 */ 1028 1029 /** 1030 * @brief Enable the RTC SSRU interrupt. 1031 * @param __HANDLE__ specifies the RTC handle. 1032 * @param __INTERRUPT__ specifies the RTC SSRU interrupt sources to be enabled. 1033 * This parameter can be: 1034 * @arg @ref RTC_IT_SSRU SSRU interrupt 1035 * @retval None 1036 */ 1037 #define __HAL_RTC_SSRU_ENABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR |= (__INTERRUPT__)) 1038 1039 /** 1040 * @brief Disable the RTC SSRU interrupt. 1041 * @param __HANDLE__ specifies the RTC handle. 1042 * @param __INTERRUPT__ specifies the RTC SSRU interrupt sources to be disabled. 1043 * This parameter can be: 1044 * @arg @ref RTC_IT_SSRU SSRU interrupt 1045 * @retval None 1046 */ 1047 #define __HAL_RTC_SSRU_DISABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR &= ~(__INTERRUPT__)) 1048 1049 1050 /** 1051 * @brief Check whether the specified RTC SSRU interrupt has occurred or not. 1052 * @param __HANDLE__ specifies the RTC handle. 1053 * @param __INTERRUPT__ specifies the RTC SSRU interrupt to check. 1054 * This parameter can be: 1055 * @arg @ref RTC_IT_SSRU SSRU interrupt 1056 * @retval None 1057 */ 1058 #define __HAL_RTC_SSRU_GET_IT(__HANDLE__, __INTERRUPT__) (((RTC->MISR) & ((__INTERRUPT__) >> 1) != 0U) ? 1U : 0U) 1059 /** 1060 * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not. 1061 * @param __HANDLE__ specifies the RTC handle. 1062 * @param __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check. 1063 * This parameter can be: 1064 * @arg @ref RTC_IT_SSRU SSRU interrupt 1065 * @retval None 1066 */ 1067 #define __HAL_RTC_SSRU_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((RTC->CR) & (__INTERRUPT__)) != 0U) ? 1U : 0U) 1068 1069 /** 1070 * @brief Get the selected RTC SSRU's flag status. 1071 * @param __HANDLE__ specifies the RTC handle. 1072 * @param __FLAG__ specifies the RTC SSRU Flag is pending or not. 1073 * This parameter can be: 1074 * @arg @ref RTC_FLAG_SSRUF 1075 * @retval None 1076 */ 1077 #define __HAL_RTC_SSRU_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__), (__FLAG__))) 1078 1079 /** 1080 * @brief Clear the RTC Wake Up timer's pending flags. 1081 * @param __HANDLE__ specifies the RTC handle. 1082 * @param __FLAG__ specifies the RTC SSRU Flag to clear. 1083 * This parameter can be: 1084 * @arg @ref RTC_FLAG_SSRUF 1085 * @retval None 1086 */ 1087 #define __HAL_RTC_SSRU_CLEAR_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_CLEAR_FLAG((__HANDLE__), RTC_CLEAR_SSRUF)) 1088 1089 /* SSR Underflow EXTI */ 1090 /* ------------------ */ 1091 #if defined(CORE_CM0PLUS) 1092 #define __HAL_RTC_SSRU_EXTI_ENABLE_IT() (EXTI->C2IMR1 |= RTC_EXTI_LINE_SSRU_EVENT) 1093 #define __HAL_RTC_SSRU_EXTI_DISABLE_IT() (EXTI->C2IMR1 &= ~(RTC_EXTI_LINE_SSRU_EVENT)) 1094 #define __HAL_RTC_SSRU_EXTI_ENABLE_EVENT() (EXTI->C2EMR1 |= RTC_EXTI_LINE_SSRU_EVENT) 1095 #define __HAL_RTC_SSRU_EXTI_DISABLE_EVENT() (EXTI->C2EMR1 &= ~(RTC_EXTI_LINE_SSRU_EVENT)) 1096 #else 1097 #define __HAL_RTC_SSRU_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_SSRU_EVENT) 1098 #define __HAL_RTC_SSRU_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_SSRU_EVENT)) 1099 #define __HAL_RTC_SSRU_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_SSRU_EVENT) 1100 #define __HAL_RTC_SSRU_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_SSRU_EVENT)) 1101 #endif 1102 1103 /** 1104 * @} 1105 */ 1106 1107 /** 1108 * @} 1109 */ 1110 1111 /* Exported functions --------------------------------------------------------*/ 1112 /** @defgroup RTCEx_Exported_Functions RTCEx Exported Functions 1113 * @{ 1114 */ 1115 1116 /* RTC TimeStamp functions *****************************************/ 1117 /** @defgroup RTCEx_Exported_Functions_Group1 Extended RTC TimeStamp functions 1118 * @{ 1119 */ 1120 1121 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin); 1122 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin); 1123 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc); 1124 HAL_StatusTypeDef HAL_RTCEx_SetInternalTimeStamp(RTC_HandleTypeDef *hrtc); 1125 HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTimeStamp(RTC_HandleTypeDef *hrtc); 1126 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format); 1127 void HAL_RTCEx_TimeStampIRQHandler(RTC_HandleTypeDef *hrtc); 1128 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 1129 void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc); 1130 /** 1131 * @} 1132 */ 1133 1134 1135 /* RTC Wake-up functions ******************************************************/ 1136 /** @defgroup RTCEx_Exported_Functions_Group2 Extended RTC Wake-up functions 1137 * @{ 1138 */ 1139 1140 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); 1141 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock, uint32_t WakeUpAutoClr); 1142 HAL_StatusTypeDef HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc); 1143 uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc); 1144 void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc); 1145 void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc); 1146 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 1147 /** 1148 * @} 1149 */ 1150 1151 /* Extended Control functions ************************************************/ 1152 /** @defgroup RTCEx_Exported_Functions_Group3 Extended Peripheral Control functions 1153 * @{ 1154 */ 1155 1156 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue); 1157 HAL_StatusTypeDef HAL_RTCEx_SetLowPowerCalib(RTC_HandleTypeDef *hrtc, uint32_t LowPowerCalib); 1158 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS); 1159 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput); 1160 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc); 1161 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc); 1162 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc); 1163 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc); 1164 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc); 1165 HAL_StatusTypeDef HAL_RTCEx_MonotonicCounterIncrement(RTC_HandleTypeDef *hrtc, uint32_t Instance); 1166 HAL_StatusTypeDef HAL_RTCEx_MonotonicCounterGet(RTC_HandleTypeDef *hrtc, uint32_t Instance, uint32_t *Value); 1167 HAL_StatusTypeDef HAL_RTCEx_SetSSRU_IT(RTC_HandleTypeDef *hrtc); 1168 HAL_StatusTypeDef HAL_RTCEx_DeactivateSSRU(RTC_HandleTypeDef *hrtc); 1169 void HAL_RTCEx_SSRUIRQHandler(RTC_HandleTypeDef *hrtc); 1170 void HAL_RTCEx_SSRUEventCallback(RTC_HandleTypeDef *hrtc); 1171 /** 1172 * @} 1173 */ 1174 1175 /* Extended RTC features functions *******************************************/ 1176 /** @defgroup RTCEx_Exported_Functions_Group4 Extended features functions 1177 * @{ 1178 */ 1179 1180 void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc); 1181 HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); 1182 /** 1183 * @} 1184 */ 1185 1186 /** @defgroup RTCEx_Exported_Functions_Group5 Extended RTC Tamper functions 1187 * @{ 1188 */ 1189 HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper); 1190 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper); 1191 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper); 1192 HAL_StatusTypeDef HAL_RTCEx_PollForTamperEvent(RTC_HandleTypeDef *hrtc, uint32_t Tamper, uint32_t Timeout); 1193 HAL_StatusTypeDef HAL_RTCEx_SetInternalTamper(RTC_HandleTypeDef *hrtc, RTC_InternalTamperTypeDef *sIntTamper); 1194 HAL_StatusTypeDef HAL_RTCEx_SetInternalTamper_IT(RTC_HandleTypeDef *hrtc, RTC_InternalTamperTypeDef *sIntTamper); 1195 HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTamper(RTC_HandleTypeDef *hrtc, uint32_t IntTamper); 1196 HAL_StatusTypeDef HAL_RTCEx_PollForInternalTamperEvent(RTC_HandleTypeDef *hrtc, uint32_t IntTamper, uint32_t Timeout); 1197 void HAL_RTCEx_TamperIRQHandler(RTC_HandleTypeDef *hrtc); 1198 void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc); 1199 void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc); 1200 void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc); 1201 void HAL_RTCEx_InternalTamper3EventCallback(RTC_HandleTypeDef *hrtc); 1202 void HAL_RTCEx_InternalTamper5EventCallback(RTC_HandleTypeDef *hrtc); 1203 void HAL_RTCEx_InternalTamper6EventCallback(RTC_HandleTypeDef *hrtc); 1204 void HAL_RTCEx_InternalTamper8EventCallback(RTC_HandleTypeDef *hrtc); 1205 /** 1206 * @} 1207 */ 1208 1209 /** @defgroup RTCEx_Exported_Functions_Group6 Extended RTC Backup register functions 1210 * @{ 1211 */ 1212 void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data); 1213 uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister); 1214 /** 1215 * @} 1216 */ 1217 1218 /** 1219 * @} 1220 */ 1221 1222 /* Private types -------------------------------------------------------------*/ 1223 /* Private variables ---------------------------------------------------------*/ 1224 /* Private constants ---------------------------------------------------------*/ 1225 /** @defgroup RTCEx_Private_Constants RTCEx Private Constants 1226 * @{ 1227 */ 1228 /*#define RTC_EXTI_LINE_ALARM_EVENT EXTI_IMR1_IM17 */ /*!< External interrupt line 17 Connected to the RTC Alarm event (defined in rtc.h) */ 1229 #define RTC_EXTI_LINE_SSRU_EVENT EXTI_IMR1_IM18 /*!< External interrupt line 18 Connected to the RTC SSR Underflow event */ 1230 #define RTC_EXTI_LINE_TIMESTAMP_EVENT EXTI_IMR1_IM19 /*!< External interrupt line 19 Connected to the RTC Time Stamp events */ 1231 #define RTC_EXTI_LINE_WAKEUPTIMER_EVENT EXTI_IMR1_IM20 /*!< External interrupt line 20 Connected to the RTC Wakeup event */ 1232 #define RTC_EXTI_LINE_TAMPER_EVENT EXTI_IMR1_IM19 /*!< External interrupt line 19 Connected to the RTC tamper events */ 1233 /** 1234 * @} 1235 */ 1236 1237 /* Private macros ------------------------------------------------------------*/ 1238 /** @defgroup RTCEx_Private_Macros RTCEx Private Macros 1239 * @{ 1240 */ 1241 1242 /** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters 1243 * @{ 1244 */ 1245 #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \ 1246 ((EDGE) == RTC_TIMESTAMPEDGE_FALLING)) 1247 1248 1249 #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_DEFAULT)) 1250 1251 1252 1253 #define IS_RTC_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \ 1254 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE)) 1255 1256 #define IS_RTC_TAMPER_TAMPERDETECTIONOUTPUT(MODE) (((MODE) == RTC_TAMPERDETECTIONOUTPUT_ENABLE) || \ 1257 ((MODE) == RTC_TAMPERDETECTIONOUTPUT_DISABLE)) 1258 1259 #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \ 1260 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \ 1261 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \ 1262 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \ 1263 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \ 1264 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS)) 1265 1266 #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= RTC_WUTR_WUT) 1267 1268 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \ 1269 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \ 1270 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC)) 1271 1272 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \ 1273 ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET)) 1274 1275 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= RTC_CALR_CALM) 1276 1277 #define IS_RTC_LOW_POWER_CALIB(LPCAL) (((LPCAL) == RTC_LPCAL_SET) || \ 1278 ((LPCAL) == RTC_LPCAL_RESET)) 1279 1280 1281 #define IS_RTC_TAMPER(__TAMPER__) ((((__TAMPER__) & RTC_TAMPER_ALL) != 0x00U) && \ 1282 (((__TAMPER__) & ~RTC_TAMPER_ALL) == 0x00U)) 1283 1284 #define IS_RTC_INTERNAL_TAMPER(__INT_TAMPER__) ((((__INT_TAMPER__) & RTC_INT_TAMPER_ALL) != 0x00U) && \ 1285 (((__INT_TAMPER__) & ~RTC_INT_TAMPER_ALL) == 0x00U)) 1286 1287 #define IS_RTC_TAMPER_TRIGGER(__TRIGGER__) (((__TRIGGER__) == RTC_TAMPERTRIGGER_RISINGEDGE) || \ 1288 ((__TRIGGER__) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \ 1289 ((__TRIGGER__) == RTC_TAMPERTRIGGER_LOWLEVEL) || \ 1290 ((__TRIGGER__) == RTC_TAMPERTRIGGER_HIGHLEVEL)) 1291 1292 #define IS_RTC_TAMPER_ERASE_MODE(__MODE__) (((__MODE__) == RTC_TAMPER_ERASE_BACKUP_ENABLE) || \ 1293 ((__MODE__) == RTC_TAMPER_ERASE_BACKUP_DISABLE)) 1294 1295 #define IS_RTC_TAMPER_MASKFLAG_STATE(__STATE__) (((__STATE__) == RTC_TAMPERMASK_FLAG_ENABLE) || \ 1296 ((__STATE__) == RTC_TAMPERMASK_FLAG_DISABLE)) 1297 1298 #define IS_RTC_TAMPER_FILTER(__FILTER__) (((__FILTER__) == RTC_TAMPERFILTER_DISABLE) || \ 1299 ((__FILTER__) == RTC_TAMPERFILTER_2SAMPLE) || \ 1300 ((__FILTER__) == RTC_TAMPERFILTER_4SAMPLE) || \ 1301 ((__FILTER__) == RTC_TAMPERFILTER_8SAMPLE)) 1302 1303 #define IS_RTC_TAMPER_SAMPLING_FREQ(__FREQ__) (((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \ 1304 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \ 1305 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \ 1306 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \ 1307 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \ 1308 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \ 1309 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \ 1310 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256)) 1311 1312 #define IS_RTC_TAMPER_PRECHARGE_DURATION(__DURATION__) (((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \ 1313 ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \ 1314 ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \ 1315 ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK)) 1316 1317 #define IS_RTC_TAMPER_PULLUP_STATE(__STATE__) (((__STATE__) == RTC_TAMPER_PULLUP_ENABLE) || \ 1318 ((__STATE__) == RTC_TAMPER_PULLUP_DISABLE)) 1319 1320 #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \ 1321 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE)) 1322 1323 #define IS_RTC_BKP(__BKP__) ((__BKP__) < RTC_BKP_NUMBER) 1324 1325 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \ 1326 ((SEL) == RTC_SHIFTADD1S_SET)) 1327 1328 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= RTC_SHIFTR_SUBFS) 1329 1330 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \ 1331 ((OUTPUT) == RTC_CALIBOUTPUT_1HZ)) 1332 1333 #define IS_RTC_BINARY_MODE(MODE) (((MODE) == RTC_BINARY_NONE) || \ 1334 ((MODE) == RTC_BINARY_ONLY) || \ 1335 ((MODE) == RTC_BINARY_MIX )) 1336 1337 #define IS_RTC_BINARY_MIX_BCDU(BDCU) (((BDCU) == RTC_BINARY_MIX_BCDU_0) || \ 1338 ((BDCU) == RTC_BINARY_MIX_BCDU_1) || \ 1339 ((BDCU) == RTC_BINARY_MIX_BCDU_2) || \ 1340 ((BDCU) == RTC_BINARY_MIX_BCDU_3) || \ 1341 ((BDCU) == RTC_BINARY_MIX_BCDU_4) || \ 1342 ((BDCU) == RTC_BINARY_MIX_BCDU_5) || \ 1343 ((BDCU) == RTC_BINARY_MIX_BCDU_6) || \ 1344 ((BDCU) == RTC_BINARY_MIX_BCDU_7)) 1345 1346 #define IS_RTC_ALARM_SUB_SECOND_BINARY_MASK(MASK) (((MASK) == 0u) || \ 1347 (((MASK) >= RTC_ALARMSUBSECONDBINMASK_SS31_1) && ((MASK) <= RTC_ALARMSUBSECONDBINMASK_NONE))) 1348 1349 #define IS_RTC_ALARMSUBSECONDBIN_AUTOCLR(SEL) (((SEL) == RTC_ALARMSUBSECONDBIN_AUTOCLR_NO) || \ 1350 ((SEL) == RTC_ALARMSUBSECONDBIN_AUTOCLR_YES)) 1351 /** 1352 * @} 1353 */ 1354 1355 /** 1356 * @} 1357 */ 1358 1359 /** 1360 * @} 1361 */ 1362 1363 /** 1364 * @} 1365 */ 1366 1367 #ifdef __cplusplus 1368 } 1369 #endif 1370 1371 #endif /* STM32WLxx_HAL_RTC_EX_H */ 1372