1 /** 2 ****************************************************************************** 3 * @file stm32h7rsxx_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) 2022 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 STM32H7RSxx_HAL_RTC_EX_H 21 #define STM32H7RSxx_HAL_RTC_EX_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /* Includes ------------------------------------------------------------------*/ 28 #include "stm32h7rsxx_hal_def.h" 29 30 /** @addtogroup STM32H7RSxx_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 65 @ref RTCEx_Tamper_Sampling_Frequencies */ 66 67 uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration. 68 This parameter can be a value of 69 @ref RTCEx_Tamper_Pin_Precharge_Duration */ 70 71 uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp. 72 This parameter can be a value of @ref RTCEx_Tamper_Pull_UP */ 73 74 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection. 75 This parameter can be a value of 76 @ref RTCEx_Tamper_TimeStampOnTamperDetection */ 77 } RTC_TamperTypeDef; 78 /** 79 * @} 80 */ 81 82 83 /** @defgroup RTCEx_Active_Seed_Size Seed size Definitions 84 * @{ 85 */ 86 #define RTC_ATAMP_SEED_NB_UINT32 4U 87 /** 88 * @} 89 */ 90 91 92 /** @defgroup RTCEx_ActiveTamper_structures_definition RTCEx Active Tamper structures definitions 93 * @{ 94 */ 95 typedef struct 96 { 97 uint32_t Enable; /*!< Specifies the Tamper input is active. 98 This parameter can be a value of @ref RTCEx_ActiveTamper_Enable */ 99 100 uint32_t Interrupt; /*!< Specifies the interrupt mode. 101 This parameter can be a value of @ref RTCEx_ActiveTamper_Interrupt */ 102 103 uint32_t Output; /*!< Specifies the TAMP output to be compared with. 104 The same output can be used for several tamper inputs. 105 This parameter can be a value of @ref RTCEx_ActiveTamper_Sel */ 106 107 uint32_t NoErase; /*!< Specifies the Tamper no erase mode. 108 This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp */ 109 110 uint32_t MaskFlag; /*!< Specifies the Tamper Flag masking. 111 This parameter can be a value of @ref RTCEx_Tamper_MaskFlag */ 112 113 } RTC_ATampInputTypeDef; 114 115 116 typedef struct 117 { 118 uint32_t ActiveFilter; /*!< Specifies the Active tamper filter enable. 119 This parameter can be a value of @ref RTCEx_ActiveTamper_Filter */ 120 121 uint32_t ActiveAsyncPrescaler; /*!< Specifies the Active Tamper asynchronous Prescaler clock. 122 This parameter can be a value of 123 @ref RTCEx_ActiveTamper_Async_prescaler */ 124 125 uint32_t TimeStampOnTamperDetection; /*!< Specifies the timeStamp on tamper detection. 126 This parameter can be a value of 127 @ref RTCEx_Tamper_TimeStampOnTamperDetection */ 128 129 uint32_t ActiveOutputChangePeriod; /*!< Specifies the Active Tamper output change period. 130 This parameter can be a value from 0 to 7 */ 131 132 uint32_t Seed[RTC_ATAMP_SEED_NB_UINT32]; 133 /*!< Specifies the RNG Seed value. 134 This parameter is an array of value from 0 to 0xFFFFFFFF */ 135 136 RTC_ATampInputTypeDef TampInput[RTC_TAMP_NB]; 137 /*!< Specifies configuration of all active tampers. 138 The index of TampInput[RTC_TAMP_NB] can be a value of RTCEx_ActiveTamper_Sel */ 139 } RTC_ActiveTampersTypeDef; 140 /** 141 * @} 142 */ 143 144 /** @defgroup RTCEx_Internal_Tamper_structure_definition RTCEx Internal Tamper structure definition 145 * @{ 146 */ 147 typedef struct 148 { 149 uint32_t IntTamper; /*!< Specifies the Internal Tamper Pin. 150 This parameter can be a value of @ref RTCEx_Internal_Tamper_Pins */ 151 152 uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection. 153 This parameter can be a value of 154 @ref RTCEx_Tamper_TimeStampOnTamperDetection */ 155 156 uint32_t NoErase; /*!< Specifies the internal Tamper no erase mode. 157 This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp */ 158 159 } RTC_InternalTamperTypeDef; 160 /** 161 * @} 162 */ 163 164 /** @defgroup RTCEx_Privilege_State_structure_definition RTCEx Privilege structure definition 165 * @{ 166 */ 167 typedef struct 168 { 169 uint32_t rtcPrivilegeFull; /*!< Specifies If the RTC is fully privileged or not. 170 This parameter can be a value of @ref RTCEx_RTC_Privilege_Full */ 171 172 uint32_t rtcPrivilegeFeatures; /*!< Specifies the privileged features. 173 This parameter is only relevant if RTC is not fully privileged 174 (rtcPrivilegeFull == RTC_PRIVILEGE_FULL_NO). 175 This parameter can be a combination of 176 @ref RTCEx_RTC_Privilege_Features */ 177 178 uint32_t tampPrivilegeFull; /*!< Specifies If the TAMP is fully privileged or not execpt monotonic 179 counters and BackUp registers. 180 This parameter can be a value of @ref RTCEx_TAMP_Privilege_Full */ 181 182 uint32_t backupRegisterPrivZone; /*!< Specifies backup register zone to be privileged. 183 This parameter can be a combination of 184 @ref RTCEx_Backup_Reg_Privilege_zone */ 185 186 uint32_t backupRegisterStartZone2; /*!< Specifies the backup register start zone 2. 187 Zone 1 : read protection write protection. 188 Zone 2 : read non-protection write protection. 189 This parameter can be RTC_BKP_DRx where x can be from 0 to 31 to specify 190 the register */ 191 192 uint32_t backupRegisterStartZone3; /*!< Specifies the backup register start zone 3. 193 Zone 3 : read non-protection write non-protection. 194 This parameter can be RTC_BKP_DRx where x can be from 0 to 31 to specify 195 the register */ 196 197 uint32_t MonotonicCounterPrivilege; /*!< Specifies If the monotonic counter is privileged or not. 198 This parameter can be a value of 199 @ref RTCEx_TAMP_Monotonic_Counter_Privilege */ 200 } RTC_PrivilegeStateTypeDef; 201 /** 202 * @} 203 */ 204 205 /** 206 * @} 207 */ 208 209 /* Exported constants --------------------------------------------------------*/ 210 /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants 211 * @{ 212 */ 213 214 #if defined(RTC_CR_TSEDGE) 215 /** @defgroup RTCEx_Time_Stamp_Edges_definitions RTCEx Time Stamp Edges definition 216 * @{ 217 */ 218 #define RTC_TIMESTAMPEDGE_RISING 0U 219 #define RTC_TIMESTAMPEDGE_FALLING RTC_CR_TSEDGE 220 /** 221 * @} 222 */ 223 #endif /* RTC_CR_TSEDGE */ 224 225 /** @defgroup RTCEx_TimeStamp_Pin_Selections RTCEx TimeStamp Pin Selection 226 * @{ 227 */ 228 #define RTC_TIMESTAMPPIN_DEFAULT 0U 229 /** 230 * @} 231 */ 232 233 /** @defgroup RTCEx_Wakeup_Timer_Definitions RTCEx Wakeup Timer Definitions 234 * @{ 235 */ 236 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 0U 237 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 RTC_CR_WUCKSEL_0 238 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 RTC_CR_WUCKSEL_1 239 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 (RTC_CR_WUCKSEL_0 | RTC_CR_WUCKSEL_1) 240 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS RTC_CR_WUCKSEL_2 241 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_2) 242 /** 243 * @} 244 */ 245 246 /** @defgroup RTCEx_Smooth_calib_period_Definitions RTCEx Smooth calib period Definitions 247 * @{ 248 */ 249 #define RTC_SMOOTHCALIB_PERIOD_32SEC 0U /*!< If RTCCLK = 32768 Hz, Smooth calibration period 250 is 32s, else 2exp20 RTCCLK pulses */ 251 #define RTC_SMOOTHCALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< If RTCCLK = 32768 Hz, Smooth calibration period 252 is 16s, else 2exp19 RTCCLK pulses */ 253 #define RTC_SMOOTHCALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< If RTCCLK = 32768 Hz, Smooth calibration period 254 is 8s, else 2exp18 RTCCLK pulses */ 255 /** 256 * @} 257 */ 258 259 /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTCEx Smooth calib Plus pulses Definitions 260 * @{ 261 */ 262 #define RTC_SMOOTHCALIB_PLUSPULSES_SET RTC_CALR_CALP /*!< The number of RTCCLK pulses added 263 during a X -second window = Y - CALM[8:0] 264 with Y = 512, 256, 128 when X = 32, 16, 8 */ 265 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET 0U /*!< The number of RTCCLK pulses subbstited 266 during a 32-second window = CALM[8:0] */ 267 /** 268 * @} 269 */ 270 271 /** @defgroup RTCEx_Smooth_calib_low_power_Definitions RTCEx Smooth calib Low Power Definitions 272 * @{ 273 */ 274 #define RTC_LPCAL_SET RTC_CALR_LPCAL /*!< Calibration window is 2exp20 ck_apre, which is the required configuration for ultra-low consumption mode. */ 275 #define RTC_LPCAL_RESET 0U /*!< Calibration window is 2exp20 RTCCLK, which is a high-consumption mode. 276 This mode should be set only when less 277 than 32s calibration window is required. */ 278 /** 279 * @} 280 */ 281 282 #if defined(RTC_CR_COSEL) 283 /** @defgroup RTCEx_Calib_Output_selection_Definitions RTCEx Calib Output selection Definitions 284 * @{ 285 */ 286 #define RTC_CALIBOUTPUT_512HZ 0U 287 #define RTC_CALIBOUTPUT_1HZ RTC_CR_COSEL 288 /** 289 * @} 290 */ 291 #endif /* RTC_CR_COSEL */ 292 293 /** @defgroup RTCEx_Add_1_Second_Parameter_Definition RTCEx Add 1 Second Parameter Definitions 294 * @{ 295 */ 296 #define RTC_SHIFTADD1S_RESET 0U 297 #define RTC_SHIFTADD1S_SET RTC_SHIFTR_ADD1S 298 /** 299 * @} 300 */ 301 302 /** @defgroup RTCEx_Tamper_Pins RTCEx Tamper Pins Definition 303 * @{ 304 */ 305 #define RTC_TAMPER_1 TAMP_CR1_TAMP1E 306 #define RTC_TAMPER_2 TAMP_CR1_TAMP2E 307 #if (RTC_TAMP_NB == 3U) 308 #define RTC_TAMPER_3 TAMP_CR1_TAMP3E 309 #define RTC_TAMPER_ALL (RTC_TAMPER_1 | RTC_TAMPER_2 | RTC_TAMPER_3 ) 310 #elif (RTC_TAMP_NB == 8U) 311 #define RTC_TAMPER_3 TAMP_CR1_TAMP3E 312 #define RTC_TAMPER_4 TAMP_CR1_TAMP4E 313 #define RTC_TAMPER_5 TAMP_CR1_TAMP5E 314 #define RTC_TAMPER_6 TAMP_CR1_TAMP6E 315 #define RTC_TAMPER_7 TAMP_CR1_TAMP7E 316 #define RTC_TAMPER_8 TAMP_CR1_TAMP8E 317 #define RTC_TAMPER_ALL (RTC_TAMPER_1 | RTC_TAMPER_2 |\ 318 RTC_TAMPER_3 | RTC_TAMPER_4 |\ 319 RTC_TAMPER_5 | RTC_TAMPER_6 |\ 320 RTC_TAMPER_7 | RTC_TAMPER_8 ) 321 #else 322 #define RTC_TAMPER_ALL (RTC_TAMPER_1 | RTC_TAMPER_2) 323 #endif /* RTC_TAMP_NB */ 324 /** 325 * @} 326 */ 327 328 /** @defgroup RTCEx_Internal_Tamper_Pins RTCEx Internal Tamper Pins Definition 329 * @{ 330 */ 331 #define RTC_INT_TAMPER_1 TAMP_CR1_ITAMP1E 332 #define RTC_INT_TAMPER_2 TAMP_CR1_ITAMP2E 333 #define RTC_INT_TAMPER_3 TAMP_CR1_ITAMP3E 334 #define RTC_INT_TAMPER_4 TAMP_CR1_ITAMP4E 335 #define RTC_INT_TAMPER_5 TAMP_CR1_ITAMP5E 336 #define RTC_INT_TAMPER_6 TAMP_CR1_ITAMP6E 337 #define RTC_INT_TAMPER_7 TAMP_CR1_ITAMP7E 338 #define RTC_INT_TAMPER_8 TAMP_CR1_ITAMP8E 339 #define RTC_INT_TAMPER_9 TAMP_CR1_ITAMP9E 340 #define RTC_INT_TAMPER_11 TAMP_CR1_ITAMP11E 341 #define RTC_INT_TAMPER_15 TAMP_CR1_ITAMP15E 342 #define RTC_INT_TAMPER_ALL (RTC_INT_TAMPER_1 | RTC_INT_TAMPER_2 |\ 343 RTC_INT_TAMPER_3 | RTC_INT_TAMPER_4 |\ 344 RTC_INT_TAMPER_5 | RTC_INT_TAMPER_6 |\ 345 RTC_INT_TAMPER_7 | RTC_INT_TAMPER_8 |\ 346 RTC_INT_TAMPER_9 | RTC_INT_TAMPER_11 |\ 347 RTC_INT_TAMPER_15) 348 /** 349 * @} 350 */ 351 352 /** @defgroup RTCEx_Tamper_Trigger RTCEx Tamper Trigger 353 * @{ 354 */ 355 #define RTC_TAMPERTRIGGER_RISINGEDGE 0U /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */ 356 #define RTC_TAMPERTRIGGER_FALLINGEDGE 1U /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */ 357 #define RTC_TAMPERTRIGGER_LOWLEVEL 2U /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */ 358 #define RTC_TAMPERTRIGGER_HIGHLEVEL 3U /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */ 359 /** 360 * @} 361 */ 362 363 /** @defgroup RTCEx_Tamper_MaskFlag RTCEx Tamper MaskFlag 364 * @{ 365 */ 366 #define RTC_TAMPERMASK_FLAG_DISABLE 0U 367 #define RTC_TAMPERMASK_FLAG_ENABLE 1U 368 /** 369 * @} 370 */ 371 372 /** @defgroup RTCEx_Tamper_Maskable_nb RTCEx Tampers maskable number 373 * @{ 374 */ 375 #if (RTC_TAMP_NB == 2U) 376 #define RTC_TAMPER_MASKABLE_NB 2U 377 #else 378 #define RTC_TAMPER_MASKABLE_NB 3U 379 #endif /* (RTC_TAMP_NB == 2U) */ 380 381 /** 382 * @} 383 */ 384 385 /** @defgroup RTCEx_Tamper_EraseBackUp RTCEx Tamper EraseBackUp 386 * @{ 387 */ 388 #define RTC_TAMPER_ERASE_BACKUP_ENABLE 0U 389 #define RTC_TAMPER_ERASE_BACKUP_DISABLE 1U 390 /** 391 * @} 392 */ 393 394 /** @defgroup RTCEx_Tamper_Filter RTCEx Tamper Filter 395 * @{ 396 */ 397 #define RTC_TAMPERFILTER_DISABLE 0U /*!< Tamper filter is disabled */ 398 #define RTC_TAMPERFILTER_2SAMPLE TAMP_FLTCR_TAMPFLT_0 /*!< Tamper is activated after 2 consecutive samples at the active level */ 399 #define RTC_TAMPERFILTER_4SAMPLE TAMP_FLTCR_TAMPFLT_1 /*!< Tamper is activated after 4 consecutive samples at the active level */ 400 #define RTC_TAMPERFILTER_8SAMPLE TAMP_FLTCR_TAMPFLT /*!< Tamper is activated after 8 consecutive samples at the active level */ 401 /** 402 * @} 403 */ 404 405 /** @defgroup RTCEx_Tamper_Sampling_Frequencies RTCEx Tamper Sampling Frequencies 406 * @{ 407 */ 408 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 0U /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 32768 */ 409 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 TAMP_FLTCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 16384 */ 410 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 TAMP_FLTCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 8192 */ 411 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 4096 */ 412 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 TAMP_FLTCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 2048 */ 413 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 1024 */ 414 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 (TAMP_FLTCR_TAMPFREQ_1 | TAMP_FLTCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 512 */ 415 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_1 | \ 416 TAMP_FLTCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 256 */ 417 /** 418 * @} 419 */ 420 421 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration RTCEx Tamper Pin Precharge Duration 422 * @{ 423 */ 424 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK 0U /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle */ 425 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK TAMP_FLTCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */ 426 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK TAMP_FLTCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */ 427 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK (TAMP_FLTCR_TAMPPRCH_0 | TAMP_FLTCR_TAMPPRCH_1) /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */ 428 /** 429 * @} 430 */ 431 432 /** @defgroup RTCEx_Tamper_Pull_UP RTCEx Tamper Pull UP 433 * @{ 434 */ 435 #define RTC_TAMPER_PULLUP_ENABLE 0U /*!< Tamper pins are pre-charged before sampling */ 436 #define RTC_TAMPER_PULLUP_DISABLE TAMP_FLTCR_TAMPPUDIS /*!< Tamper pins pre-charge is disabled */ 437 /** 438 * @} 439 */ 440 441 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection RTCEx Tamper TimeStamp On Tamper Detection Definitions 442 * @{ 443 */ 444 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE 0U /*!< TimeStamp on Tamper Detection event is not saved */ 445 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE RTC_CR_TAMPTS /*!< TimeStamp on Tamper Detection event saved */ 446 /** 447 * @} 448 */ 449 450 /** @defgroup RTCEx_Tamper_Detection_Output RTCEx Tamper detection output Definitions 451 * @{ 452 */ 453 #if defined(RTC_CR_TAMPOE) 454 #define RTC_TAMPERDETECTIONOUTPUT_DISABLE 0U /*!< Tamper detection output disable on TAMPALRM */ 455 #define RTC_TAMPERDETECTIONOUTPUT_ENABLE RTC_CR_TAMPOE /*!< Tamper detection output enable on TAMPALRM */ 456 #endif /* RTC_CR_TAMPOE */ 457 /** 458 * @} 459 */ 460 461 462 /** @defgroup RTCEx_Tamper_Interrupt RTCEx Tamper Interrupt 463 * @{ 464 */ 465 #define RTC_IT_TAMP_1 TAMP_IER_TAMP1IE /*!< Tamper 1 Interrupt */ 466 #define RTC_IT_TAMP_2 TAMP_IER_TAMP2IE /*!< Tamper 2 Interrupt */ 467 #if (RTC_TAMP_NB == 3U) 468 #define RTC_IT_TAMP_3 TAMP_IER_TAMP3IE /*!< Tamper 3 Interrupt */ 469 #define RTC_IT_TAMP_ALL (RTC_IT_TAMP_1 | RTC_IT_TAMP_2 | RTC_IT_TAMP_3) 470 #elif (RTC_TAMP_NB == 8U) 471 #define RTC_IT_TAMP_3 TAMP_IER_TAMP3IE /*!< Tamper 3 Interrupt */ 472 #define RTC_IT_TAMP_4 TAMP_IER_TAMP4IE /*!< Tamper 4 Interrupt */ 473 #define RTC_IT_TAMP_5 TAMP_IER_TAMP5IE /*!< Tamper 5 Interrupt */ 474 #define RTC_IT_TAMP_6 TAMP_IER_TAMP6IE /*!< Tamper 6 Interrupt */ 475 #define RTC_IT_TAMP_7 TAMP_IER_TAMP7IE /*!< Tamper 7 Interrupt */ 476 #define RTC_IT_TAMP_8 TAMP_IER_TAMP8IE /*!< Tamper 8 Interrupt */ 477 #define RTC_IT_TAMP_ALL (RTC_IT_TAMP_1 | RTC_IT_TAMP_2 |\ 478 RTC_IT_TAMP_3 | RTC_IT_TAMP_4 |\ 479 RTC_IT_TAMP_5 | RTC_IT_TAMP_6 |\ 480 RTC_IT_TAMP_7 | RTC_IT_TAMP_8 ) 481 #else 482 #define RTC_IT_TAMP_ALL (RTC_IT_TAMP_1 | RTC_IT_TAMP_2) 483 #endif /* RTC_TAMP_NB */ 484 /** 485 * @} 486 */ 487 488 /** @defgroup RTCEx_Internal_Tamper_Interrupt RTCEx Internal Tamper Interrupt 489 * @{ 490 */ 491 #define RTC_IT_INT_TAMP_1 TAMP_IER_ITAMP1IE /*!< Tamper 1 internal Interrupt */ 492 #define RTC_IT_INT_TAMP_2 TAMP_IER_ITAMP2IE /*!< Tamper 2 internal Interrupt */ 493 #define RTC_IT_INT_TAMP_3 TAMP_IER_ITAMP3IE /*!< Tamper 3 internal Interrupt */ 494 #define RTC_IT_INT_TAMP_4 TAMP_IER_ITAMP4IE /*!< Tamper 4 internal Interrupt */ 495 #define RTC_IT_INT_TAMP_5 TAMP_IER_ITAMP5IE /*!< Tamper 5 internal Interrupt */ 496 #define RTC_IT_INT_TAMP_6 TAMP_IER_ITAMP6IE /*!< Tamper 6 internal Interrupt */ 497 #define RTC_IT_INT_TAMP_7 TAMP_IER_ITAMP7IE /*!< Tamper 7 internal Interrupt */ 498 #define RTC_IT_INT_TAMP_8 TAMP_IER_ITAMP8IE /*!< Tamper 8 internal Interrupt */ 499 #define RTC_IT_INT_TAMP_9 TAMP_IER_ITAMP9IE /*!< Tamper 9 internal Interrupt */ 500 #define RTC_IT_INT_TAMP_11 TAMP_IER_ITAMP11IE /*!< Tamper 11 internal Interrupt */ 501 #define RTC_IT_INT_TAMP_15 TAMP_IER_ITAMP15IE /*!< Tamper 15 internal Interrupt */ 502 503 #define RTC_IT_INT_TAMP_ALL (RTC_IT_INT_TAMP_1 | RTC_IT_INT_TAMP_2 |\ 504 RTC_IT_INT_TAMP_3 | RTC_IT_INT_TAMP_4 |\ 505 RTC_IT_INT_TAMP_5 | RTC_IT_INT_TAMP_6 |\ 506 RTC_IT_INT_TAMP_7 | RTC_IT_INT_TAMP_8 |\ 507 RTC_IT_INT_TAMP_9 | RTC_IT_INT_TAMP_11 |\ 508 RTC_IT_INT_TAMP_15) 509 /** 510 * @} 511 */ 512 513 /** @defgroup RTCEx_Flags RTCEx Flags 514 * @{ 515 */ 516 #define RTC_FLAG_TAMP_1 TAMP_SR_TAMP1F 517 #define RTC_FLAG_TAMP_2 TAMP_SR_TAMP2F 518 #if (RTC_TAMP_NB == 3U) 519 #define RTC_FLAG_TAMP_3 TAMP_SR_TAMP3F 520 #define RTC_FLAG_TAMP_ALL (RTC_FLAG_TAMP_1 | RTC_FLAG_TAMP_2 | RTC_FLAG_TAMP_3 ) 521 #elif (RTC_TAMP_NB == 8U) 522 #define RTC_FLAG_TAMP_3 TAMP_SR_TAMP3F 523 #define RTC_FLAG_TAMP_4 TAMP_SR_TAMP4F 524 #define RTC_FLAG_TAMP_5 TAMP_SR_TAMP5F 525 #define RTC_FLAG_TAMP_6 TAMP_SR_TAMP6F 526 #define RTC_FLAG_TAMP_7 TAMP_SR_TAMP7F 527 #define RTC_FLAG_TAMP_8 TAMP_SR_TAMP8F 528 #define RTC_FLAG_TAMP_ALL (RTC_FLAG_TAMP_1 | RTC_FLAG_TAMP_2 | RTC_FLAG_TAMP_3 |\ 529 RTC_FLAG_TAMP_4 | RTC_FLAG_TAMP_5 | RTC_FLAG_TAMP_6 |\ 530 RTC_FLAG_TAMP_7 | RTC_FLAG_TAMP_8) 531 #else 532 #define RTC_FLAG_TAMP_ALL (TAMP_SR_TAMP1F | TAMP_SR_TAMP2F) 533 #endif /* RTC_TAMP_NB */ 534 535 #define RTC_FLAG_INT_TAMP_1 TAMP_SR_ITAMP1F 536 #define RTC_FLAG_INT_TAMP_2 TAMP_SR_ITAMP2F 537 #define RTC_FLAG_INT_TAMP_3 TAMP_SR_ITAMP3F 538 #define RTC_FLAG_INT_TAMP_4 TAMP_SR_ITAMP4F 539 #define RTC_FLAG_INT_TAMP_5 TAMP_SR_ITAMP5F 540 #define RTC_FLAG_INT_TAMP_6 TAMP_SR_ITAMP6F 541 #define RTC_FLAG_INT_TAMP_7 TAMP_SR_ITAMP7F 542 #define RTC_FLAG_INT_TAMP_8 TAMP_SR_ITAMP8F 543 #define RTC_FLAG_INT_TAMP_9 TAMP_SR_ITAMP9F 544 #define RTC_FLAG_INT_TAMP_11 TAMP_SR_ITAMP11F 545 #define RTC_FLAG_INT_TAMP_15 TAMP_SR_ITAMP15F 546 #define RTC_FLAG_INT_TAMP_ALL (RTC_FLAG_INT_TAMP_1 | RTC_FLAG_INT_TAMP_2 |\ 547 RTC_FLAG_INT_TAMP_3 | RTC_FLAG_INT_TAMP_4 |\ 548 RTC_FLAG_INT_TAMP_5 | RTC_FLAG_INT_TAMP_6 |\ 549 RTC_FLAG_INT_TAMP_7 | RTC_FLAG_INT_TAMP_8 |\ 550 RTC_FLAG_INT_TAMP_9 | RTC_FLAG_INT_TAMP_11 |\ 551 RTC_FLAG_INT_TAMP_15) 552 /** 553 * @} 554 */ 555 556 557 /** @defgroup RTCEx_ActiveTamper_Enable RTCEx_ActiveTamper_Enable Definitions 558 * @{ 559 */ 560 #define RTC_ATAMP_ENABLE 1U 561 #define RTC_ATAMP_DISABLE 0U 562 /** 563 * @} 564 */ 565 566 /** @defgroup RTCEx_ActiveTamper_Interrupt RTCEx_ActiveTamper_Interrupt Definitions 567 * @{ 568 */ 569 #define RTC_ATAMP_INTERRUPT_ENABLE 1U 570 #define RTC_ATAMP_INTERRUPT_DISABLE 0U 571 /** 572 * @} 573 */ 574 575 /** @defgroup RTCEx_ActiveTamper_Filter RTCEx_ActiveTamper_Filter Definitions 576 * @{ 577 */ 578 #define RTC_ATAMP_FILTER_ENABLE TAMP_ATCR1_FLTEN 579 #define RTC_ATAMP_FILTER_DISABLE 0U 580 /** 581 * @} 582 */ 583 584 /** @defgroup RTCEx_ActiveTamper_Async_prescaler RTCEx Active_Tamper_Asynchronous_Prescaler clock Definitions 585 * @{ 586 */ 587 #define RTC_ATAMP_ASYNCPRES_RTCCLK 0U /*!< RTCCLK */ 588 #define RTC_ATAMP_ASYNCPRES_RTCCLK_2 TAMP_ATCR1_ATCKSEL_0 /*!< RTCCLK/2 */ 589 #define RTC_ATAMP_ASYNCPRES_RTCCLK_4 TAMP_ATCR1_ATCKSEL_1 /*!< RTCCLK/4 */ 590 #define RTC_ATAMP_ASYNCPRES_RTCCLK_8 (TAMP_ATCR1_ATCKSEL_1 | TAMP_ATCR1_ATCKSEL_0) /*!< RTCCLK/8 */ 591 #define RTC_ATAMP_ASYNCPRES_RTCCLK_16 TAMP_ATCR1_ATCKSEL_2 /*!< RTCCLK/16 */ 592 #define RTC_ATAMP_ASYNCPRES_RTCCLK_32 (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_0) /*!< RTCCLK/32 */ 593 #define RTC_ATAMP_ASYNCPRES_RTCCLK_64 (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_1) /*!< RTCCLK/64 */ 594 #define RTC_ATAMP_ASYNCPRES_RTCCLK_128 (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_1 | TAMP_ATCR1_ATCKSEL_0) /*!< RTCCLK/128 */ 595 #define RTC_ATAMP_ASYNCPRES_RTCCLK_2048 (TAMP_ATCR1_ATCKSEL_3 | TAMP_ATCR1_ATCKSEL_1 | TAMP_ATCR1_ATCKSEL_0) /*!< RTCCLK/2048 */ 596 /** 597 * @} 598 */ 599 600 /** @defgroup RTCEx_ActiveTamper_Sel RTCEx Active Tamper selection Definition 601 * @{ 602 */ 603 #define RTC_ATAMP_1 0U /*!< Tamper 1 */ 604 #define RTC_ATAMP_2 1U /*!< Tamper 2 */ 605 #define RTC_ATAMP_3 2U /*!< Tamper 3 */ 606 #define RTC_ATAMP_4 3U /*!< Tamper 4 */ 607 #define RTC_ATAMP_5 4U /*!< Tamper 5 */ 608 #define RTC_ATAMP_6 5U /*!< Tamper 6 */ 609 #define RTC_ATAMP_7 6U /*!< Tamper 7 */ 610 #define RTC_ATAMP_8 7U /*!< Tamper 8 */ 611 /** 612 * @} 613 */ 614 615 /** @defgroup RTCEx_MonotonicCounter_Instance RTCEx Monotonic Counter Instance Definition 616 * @{ 617 */ 618 #define RTC_MONOTONIC_COUNTER_1 0U /*!< Monotonic counter 1 */ 619 /** 620 * @} 621 */ 622 623 /** @defgroup RTCEx_Backup_Registers RTCEx Backup Registers Definition 624 * @{ 625 */ 626 #define RTC_BKP_NUMBER RTC_BKP_NB 627 #define RTC_BKP_DR0 0x00U 628 #define RTC_BKP_DR1 0x01U 629 #define RTC_BKP_DR2 0x02U 630 #define RTC_BKP_DR3 0x03U 631 #define RTC_BKP_DR4 0x04U 632 #define RTC_BKP_DR5 0x05U 633 #define RTC_BKP_DR6 0x06U 634 #define RTC_BKP_DR7 0x07U 635 #define RTC_BKP_DR8 0x08U 636 #define RTC_BKP_DR9 0x09U 637 #define RTC_BKP_DR10 0x0AU 638 #define RTC_BKP_DR11 0x0BU 639 #define RTC_BKP_DR12 0x0CU 640 #define RTC_BKP_DR13 0x0DU 641 #define RTC_BKP_DR14 0x0EU 642 #define RTC_BKP_DR15 0x0FU 643 #define RTC_BKP_DR16 0x10U 644 #define RTC_BKP_DR17 0x11U 645 #define RTC_BKP_DR18 0x12U 646 #define RTC_BKP_DR19 0x13U 647 #define RTC_BKP_DR20 0x14U 648 #define RTC_BKP_DR21 0x15U 649 #define RTC_BKP_DR22 0x16U 650 #define RTC_BKP_DR23 0x17U 651 #define RTC_BKP_DR24 0x18U 652 #define RTC_BKP_DR25 0x19U 653 #define RTC_BKP_DR26 0x1AU 654 #define RTC_BKP_DR27 0x1BU 655 #define RTC_BKP_DR28 0x1CU 656 #define RTC_BKP_DR29 0x1DU 657 #define RTC_BKP_DR30 0x1EU 658 #define RTC_BKP_DR31 0x1FU 659 /** 660 * @} 661 */ 662 663 /** @defgroup RTCEx_Binary_Mode RTC Binary Mode (32-bit free-running counter configuration). 664 * Warning : It Should not be confused with the Binary format @ref RTC_Input_parameter_format_definitions. 665 * @{ 666 */ 667 #define RTC_BINARY_NONE 0U /*!< Free running BCD calendar mode (Binary mode disabled) */ 668 #define RTC_BINARY_ONLY RTC_ICSR_BIN_0 /*!< Free running Binary mode (BCD mode disabled) */ 669 #define RTC_BINARY_MIX RTC_ICSR_BIN_1 /*!< Free running BCD calendar and Binary modes */ 670 /** 671 * @} 672 */ 673 674 /** @defgroup RTCEx_Binary_mix_BCDU If Binary mode is RTC_BINARY_MIX, the BCD calendar second is incremented 675 * using the SSR Least Significant Bits. 676 * @{ 677 */ 678 #define RTC_BINARY_MIX_BCDU_0 0U /*!< The 1s BCD calendar increment is generated each time SS[7:0] = 0 */ 679 #define RTC_BINARY_MIX_BCDU_1 (0x1UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[8:0] = 0 */ 680 #define RTC_BINARY_MIX_BCDU_2 (0x2UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[9:0] = 0 */ 681 #define RTC_BINARY_MIX_BCDU_3 (0x3UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[10:0] = 0 */ 682 #define RTC_BINARY_MIX_BCDU_4 (0x4UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[11:0] = 0 */ 683 #define RTC_BINARY_MIX_BCDU_5 (0x5UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[12:0] = 0 */ 684 #define RTC_BINARY_MIX_BCDU_6 (0x6UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[13:0] = 0 */ 685 #define RTC_BINARY_MIX_BCDU_7 (0x7UL << RTC_ICSR_BCDU_Pos) /*!< The 1s BCD calendar increment is generated each time SS[14:0] = 0 */ 686 /** 687 * @} 688 */ 689 690 /** @defgroup RTCEx_Alarm_Sub_Seconds_binary_Masks_Definitions RTC Alarm Sub Seconds with binary or mix mode 691 * Masks Definitions. 692 * @{ 693 */ 694 #define RTC_ALARMSUBSECONDBINMASK_ALL 0U /*!< All Alarm SS fields are masked.There is no comparison on sub seconds for Alarm */ 695 #define RTC_ALARMSUBSECONDBINMASK_SS31_1 (1UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:1] are don't care in Alarm comparison. Only SS[0] is compared */ 696 #define RTC_ALARMSUBSECONDBINMASK_SS31_2 (2UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:2] are don't care in Alarm comparison. Only SS[1:0] are compared */ 697 #define RTC_ALARMSUBSECONDBINMASK_SS31_3 (3UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:3] are don't care in Alarm comparison. Only SS[2:0] are compared */ 698 #define RTC_ALARMSUBSECONDBINMASK_SS31_4 (4UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:4] are don't care in Alarm comparison. Only SS[3:0] are compared */ 699 #define RTC_ALARMSUBSECONDBINMASK_SS31_5 (5UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:5] are don't care in Alarm comparison. Only SS[4:0] are compared */ 700 #define RTC_ALARMSUBSECONDBINMASK_SS31_6 (6UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:6] are don't care in Alarm comparison. Only SS[5:0] are compared */ 701 #define RTC_ALARMSUBSECONDBINMASK_SS31_7 (7UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:7] are don't care in Alarm comparison. Only SS[6:0] are compared */ 702 #define RTC_ALARMSUBSECONDBINMASK_SS31_8 (8UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:8] are don't care in Alarm comparison. Only SS[7:0] are compared */ 703 #define RTC_ALARMSUBSECONDBINMASK_SS31_9 (9UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:9] are don't care in Alarm comparison. Only SS[8:0] are compared */ 704 #define RTC_ALARMSUBSECONDBINMASK_SS31_10 (10UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:10] are don't care in Alarm comparison. Only SS[9:0] are compared */ 705 #define RTC_ALARMSUBSECONDBINMASK_SS31_11 (11UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:11] are don't care in Alarm comparison. Only SS[10:0] are compared */ 706 #define RTC_ALARMSUBSECONDBINMASK_SS31_12 (12UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:12] are don't care in Alarm comparison.Only SS[11:0] are compared */ 707 #define RTC_ALARMSUBSECONDBINMASK_SS31_13 (13UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:13] are don't care in Alarm comparison. Only SS[12:0] are compared */ 708 #define RTC_ALARMSUBSECONDBINMASK_SS31_14 (14UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:14] are don't care in Alarm comparison. Only SS[13:0] are compared */ 709 #define RTC_ALARMSUBSECONDBINMASK_SS31_15 (15UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:15] are don't care in Alarm comparison. Only SS[14:0] are compared */ 710 #define RTC_ALARMSUBSECONDBINMASK_SS31_16 (16UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:16] are don't care in Alarm comparison. Only SS[15:0] are compared */ 711 #define RTC_ALARMSUBSECONDBINMASK_SS31_17 (17UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:17] are don't care in Alarm comparison. Only SS[16:0] are compared */ 712 #define RTC_ALARMSUBSECONDBINMASK_SS31_18 (18UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:18] are don't care in Alarm comparison. Only SS[17:0] are compared */ 713 #define RTC_ALARMSUBSECONDBINMASK_SS31_19 (19UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:19] are don't care in Alarm comparison. Only SS[18:0] are compared */ 714 #define RTC_ALARMSUBSECONDBINMASK_SS31_20 (20UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:20] are don't care in Alarm comparison. Only SS[19:0] are compared */ 715 #define RTC_ALARMSUBSECONDBINMASK_SS31_21 (21UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:21] are don't care in Alarm comparison. Only SS[20:0] are compared */ 716 #define RTC_ALARMSUBSECONDBINMASK_SS31_22 (22UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:22] are don't care in Alarm comparison. Only SS[21:0] are compared */ 717 #define RTC_ALARMSUBSECONDBINMASK_SS31_23 (23UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:23] are don't care in Alarm comparison. Only SS[22:0] are compared */ 718 #define RTC_ALARMSUBSECONDBINMASK_SS31_24 (24UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:24] are don't care in Alarm comparison. Only SS[23:0] are compared */ 719 #define RTC_ALARMSUBSECONDBINMASK_SS31_25 (25UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:25] are don't care in Alarm comparison. Only SS[24:0] are compared */ 720 #define RTC_ALARMSUBSECONDBINMASK_SS31_26 (26UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:26] are don't care in Alarm comparison. Only SS[25:0] are compared */ 721 #define RTC_ALARMSUBSECONDBINMASK_SS31_27 (27UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:27] are don't care in Alarm comparison. Only SS[26:0] are compared */ 722 #define RTC_ALARMSUBSECONDBINMASK_SS31_28 (28UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:28] are don't care in Alarm comparison. Only SS[27:0] are compared */ 723 #define RTC_ALARMSUBSECONDBINMASK_SS31_29 (29UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:29] are don't care in Alarm comparison. Only SS[28:0] are compared */ 724 #define RTC_ALARMSUBSECONDBINMASK_SS31_30 (30UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:30] are don't care in Alarm comparison. Only SS[29:0] are compared */ 725 #define RTC_ALARMSUBSECONDBINMASK_SS31 (31UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31] is don't care in Alarm comparison. Only SS[30:0] are compared */ 726 #define RTC_ALARMSUBSECONDBINMASK_NONE RTC_ALRMASSR_MASKSS /*!< SS[31:0] are compared and must match to activate alarm */ 727 /** 728 * @} 729 */ 730 731 /** @defgroup RTCEx_Alarm_Sub_Seconds_binary_Clear_Definitions RTC Alarm Sub Seconds 732 * with binary mode auto clear Definitions 733 * @{ 734 */ 735 #define RTC_ALARMSUBSECONDBIN_AUTOCLR_NO 0UL /*!< The synchronous Binary counter(SS[31:0] in RTC_SSR) is free-running */ 736 #define RTC_ALARMSUBSECONDBIN_AUTOCLR_YES RTC_ALRMASSR_SSCLR 737 /*!< The synchronous Binary counter (SS[31:0] in RTC_SSR) is running from 0xFFFF FFFF to RTC_ALRMABINR -> SS[31:0] 738 value and is automatically reloaded with 0xFFFF FFFF whenreaching RTC_ALRMABINR -> SS[31:0]. */ 739 /** 740 * @} 741 */ 742 743 /** @defgroup RTCEx_RTC_Privilege_Full RTCEx Privilege Full Definition 744 * @{ 745 */ 746 #define RTC_PRIVILEGE_FULL_YES RTC_PRIVCFGR_PRIV 747 #define RTC_PRIVILEGE_FULL_NO 0U 748 /** 749 * @} 750 */ 751 752 /** @defgroup RTCEx_RTC_Privilege_Features RTCEx Privilege Features Definition 753 * @{ 754 */ 755 #define RTC_PRIVILEGE_FEATURE_NONE 0U 756 #define RTC_PRIVILEGE_FEATURE_INIT RTC_PRIVCFGR_INITPRIV /*!< Initialization */ 757 #define RTC_PRIVILEGE_FEATURE_CAL RTC_PRIVCFGR_CALPRIV /*!< Calibration */ 758 #define RTC_PRIVILEGE_FEATURE_TS RTC_PRIVCFGR_TSPRIV /*!< Time stamp */ 759 #define RTC_PRIVILEGE_FEATURE_WUT RTC_PRIVCFGR_WUTPRIV /*!< Wake up timer */ 760 #define RTC_PRIVILEGE_FEATURE_ALRA RTC_PRIVCFGR_ALRAPRIV /*!< Alarm A */ 761 #define RTC_PRIVILEGE_FEATURE_ALRB RTC_PRIVCFGR_ALRBPRIV /*!< Alarm B */ 762 763 #define RTC_PRIVILEGE_FEATURE_ALL (RTC_PRIVCFGR_INITPRIV | RTC_PRIVCFGR_CALPRIV | \ 764 RTC_PRIVCFGR_TSPRIV | RTC_PRIVCFGR_WUTPRIV | \ 765 RTC_PRIVCFGR_ALRAPRIV | RTC_PRIVCFGR_ALRBPRIV) 766 /** 767 * @} 768 */ 769 770 /** @defgroup RTCEx_TAMP_Privilege_Full RTCEx TAMP security Definition 771 * @{ 772 */ 773 #define TAMP_PRIVILEGE_FULL_YES TAMP_PRIVCFGR_TAMPPRIV 774 #define TAMP_PRIVILEGE_FULL_NO 0U 775 /** 776 * @} 777 */ 778 779 /** @defgroup RTCEx_TAMP_Device_Secrets_Erase_Conf RTCEx TAMP Device Secrets Erase Configuration Definition 780 * @{ 781 */ 782 #define TAMP_DEVICESECRETS_ERASE_NONE 0U /*!< No Erase */ 783 #define TAMP_DEVICESECRETS_ERASE_BKPSRAM TAMP_RPCFGR_RPCFG0 /*!< Backup SRAM */ 784 /** 785 * @} 786 */ 787 788 /** @defgroup RTCEx_TAMP_Monotonic_Counter_Privilege RTCEx TAMP Monotonic Counter Privilege Definition 789 * @{ 790 */ 791 #define TAMP_MONOTONIC_CNT_PRIVILEGE_YES TAMP_PRIVCFGR_CNT1PRIV 792 #define TAMP_MONOTONIC_CNT_PRIVILEGE_NO 0U 793 /** 794 * @} 795 */ 796 797 /** @defgroup RTCEx_Backup_Reg_Privilege_zone RTCEx Privilege Backup register privilege zone Definition 798 * @{ 799 */ 800 #define RTC_PRIVILEGE_BKUP_ZONE_NONE 0U 801 #define RTC_PRIVILEGE_BKUP_ZONE_1 TAMP_PRIVCFGR_BKPRWPRIV 802 #define RTC_PRIVILEGE_BKUP_ZONE_2 TAMP_PRIVCFGR_BKPWPRIV 803 #define RTC_PRIVILEGE_BKUP_ZONE_ALL (RTC_PRIVILEGE_BKUP_ZONE_1 | RTC_PRIVILEGE_BKUP_ZONE_2) 804 /** 805 * @} 806 */ 807 808 /** 809 * @} 810 */ 811 812 /* Exported macros -----------------------------------------------------------*/ 813 /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros 814 * @{ 815 */ 816 817 /** @brief Clear the specified RTC pending flag. 818 * @param __HANDLE__ specifies the RTC Handle. 819 * @param __FLAG__ specifies the flag to check. 820 * This parameter can be any combination of the following values: 821 * @arg @ref RTC_CLEAR_SSRUF Clear SSR underflow flag 822 * @arg @ref RTC_CLEAR_ITSF Clear Internal Time-stamp flag 823 * @arg @ref RTC_CLEAR_TSOVF Clear Time-stamp overflow flag 824 * @arg @ref RTC_CLEAR_TSF Clear Time-stamp flag 825 * @arg @ref RTC_CLEAR_WUTF Clear Wakeup timer flag 826 * @arg @ref RTC_CLEAR_ALRBF Clear Alarm B flag 827 * @arg @ref RTC_CLEAR_ALRAF Clear Alarm A flag 828 * @retval None 829 */ 830 #define __HAL_RTC_CLEAR_FLAG(__HANDLE__, __FLAG__) (RTC->SCR = (__FLAG__)) 831 832 /** @brief Check whether the specified RTC flag is set or not. 833 * @param __HANDLE__ specifies the RTC Handle. 834 * @param __FLAG__ specifies the flag to check. 835 * This parameter can be any combination of the following values: 836 * @arg @ref RTC_FLAG_RECALPF Recalibration pending Flag 837 * @arg @ref RTC_FLAG_INITF Initialization flag 838 * @arg @ref RTC_FLAG_RSF Registers synchronization flag 839 * @arg @ref RTC_FLAG_INITS Initialization status flag 840 * @arg @ref RTC_FLAG_SHPF Shift operation pending flag 841 * @arg @ref RTC_FLAG_WUTWF Wakeup timer write flag 842 * @arg @ref RTC_FLAG_ITSF Internal Time-stamp flag 843 * @arg @ref RTC_FLAG_TSOVF Time-stamp overflow flag 844 * @arg @ref RTC_FLAG_TSF Time-stamp flag 845 * @arg @ref RTC_FLAG_WUTF Wakeup timer flag 846 * @arg @ref RTC_FLAG_ALRBF Alarm B flag 847 * @arg @ref RTC_FLAG_ALRAF Alarm A flag 848 * @retval The state of __FLAG__ (TRUE or FALSE). 849 */ 850 #define __HAL_RTC_GET_FLAG(__HANDLE__, __FLAG__)( \ 851 ((__FLAG__) == RTC_FLAG_RECALPF) ? (READ_BIT(RTC->ICSR, RTC_ICSR_RECALPF) == \ 852 RTC_ICSR_RECALPF) : \ 853 ((__FLAG__) == RTC_FLAG_INITF) ? (READ_BIT(RTC->ICSR, RTC_ICSR_INITF) == \ 854 RTC_ICSR_INITF) : \ 855 ((__FLAG__) == RTC_FLAG_RSF) ? (READ_BIT(RTC->ICSR, RTC_ICSR_RSF) == \ 856 RTC_ICSR_RSF) : \ 857 ((__FLAG__) == RTC_FLAG_INITS) ? (READ_BIT(RTC->ICSR, RTC_ICSR_INITS) == \ 858 RTC_ICSR_INITS) : \ 859 ((__FLAG__) == RTC_FLAG_SHPF) ? (READ_BIT(RTC->ICSR, RTC_ICSR_SHPF) == \ 860 RTC_ICSR_SHPF) : \ 861 ((__FLAG__) == RTC_FLAG_WUTWF) ? (READ_BIT(RTC->ICSR, RTC_ICSR_WUTWF) == \ 862 RTC_ICSR_WUTWF) : \ 863 ((__FLAG__) == RTC_FLAG_SSRUF) ? (READ_BIT(RTC->SR, RTC_SR_SSRUF) == \ 864 RTC_SR_SSRUF) : \ 865 ((__FLAG__) == RTC_FLAG_ITSF) ? (READ_BIT(RTC->SR, RTC_SR_ITSF) == \ 866 RTC_SR_ITSF) : \ 867 ((__FLAG__) == RTC_FLAG_TSOVF) ? (READ_BIT(RTC->SR, RTC_SR_TSOVF) == \ 868 RTC_SR_TSOVF) : \ 869 ((__FLAG__) == RTC_FLAG_TSF) ? (READ_BIT(RTC->SR, RTC_SR_TSF) == \ 870 RTC_SR_TSF): \ 871 ((__FLAG__) == RTC_FLAG_WUTF) ? (READ_BIT(RTC->SR, RTC_SR_WUTF) == \ 872 RTC_SR_WUTF): \ 873 ((__FLAG__) == RTC_FLAG_ALRBF) ? (READ_BIT(RTC->SR, RTC_SR_ALRBF) == \ 874 RTC_SR_ALRBF) : \ 875 ((__FLAG__) == RTC_FLAG_ALRAF) ? (READ_BIT(RTC->SR, RTC_SR_ALRAF) == \ 876 RTC_SR_ALRAF) : \ 877 (0U)) /* Return 0 because it is an invalid parameter value */ 878 879 /* ---------------------------------WAKEUPTIMER---------------------------------*/ 880 /** @defgroup RTCEx_WakeUp_Timer RTC WakeUp Timer 881 * @{ 882 */ 883 884 /** 885 * @brief Enable the RTC WakeUp Timer peripheral. 886 * @param __HANDLE__ specifies the RTC handle. 887 * @retval None 888 */ 889 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_WUTE)) 890 891 /** 892 * @brief Disable the RTC WakeUp Timer peripheral. 893 * @param __HANDLE__ specifies the RTC handle. 894 * @retval None 895 */ 896 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_WUTE)) 897 898 /** 899 * @brief Enable the RTC WakeUpTimer interrupt. 900 * @param __HANDLE__ specifies the RTC handle. 901 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled. 902 * This parameter can be: 903 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt 904 * @retval None 905 */ 906 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR |= (RTC_CR_WUTIE)) 907 908 /** 909 * @brief Disable the RTC WakeUpTimer interrupt. 910 * @param __HANDLE__ specifies the RTC handle. 911 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be disabled. 912 * This parameter can be: 913 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt 914 * @retval None 915 */ 916 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR &= ~(RTC_CR_WUTIE)) 917 918 /** 919 * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not. 920 * @param __HANDLE__ specifies the RTC handle. 921 * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt to check. 922 * This parameter can be: 923 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt 924 * @retval The state of __INTERRUPT__ (TRUE or FALSE). 925 */ 926 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((RTC->MISR) & (RTC_MISR_WUTMF)) != 0U) 927 928 /** 929 * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not. 930 * @param __HANDLE__ specifies the RTC handle. 931 * @param __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check. 932 * This parameter can be: 933 * @arg @ref RTC_IT_WUT WakeUpTimer interrupt 934 * @retval The state of __INTERRUPT__ (TRUE or FALSE). 935 */ 936 #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((RTC->CR) & (RTC_CR_WUTIE)) != 0U) 937 938 /** 939 * @brief Get the selected RTC WakeUpTimers flag status. 940 * @param __HANDLE__ specifies the RTC handle. 941 * @param __FLAG__ specifies the RTC WakeUpTimer Flag is pending or not. 942 * This parameter can be: 943 * @arg @ref RTC_FLAG_WUTF 944 * @arg @ref RTC_FLAG_WUTWF 945 * @retval The state of __FLAG__ (TRUE or FALSE). 946 */ 947 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__)( \ 948 ((__FLAG__) == RTC_FLAG_WUTF) ? (READ_BIT(RTC->SR, RTC_SR_WUTF) == RTC_SR_WUTF):\ 949 ((__FLAG__) == RTC_FLAG_WUTWF) ? (READ_BIT(RTC->ICSR, RTC_ICSR_WUTWF) == RTC_ICSR_WUTWF):\ 950 (0U)) /* Return 0 because it is an invalid parameter value */ 951 952 /** 953 * @brief Clear the RTC Wake Up timers pending flags. 954 * @param __HANDLE__ specifies the RTC handle. 955 * @param __FLAG__ specifies the RTC WakeUpTimer Flag to clear. 956 * This parameter can be: 957 * @arg @ref RTC_FLAG_WUTF 958 * @retval None 959 */ 960 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) (WRITE_REG(RTC->SCR, RTC_SCR_CWUTF)) 961 962 /** 963 * @} 964 */ 965 966 /* ---------------------------------TIMESTAMP---------------------------------*/ 967 /** @defgroup RTCEx_Timestamp RTC Timestamp 968 * @{ 969 */ 970 971 /** 972 * @brief Enable the RTC TimeStamp peripheral. 973 * @param __HANDLE__ specifies the RTC handle. 974 * @retval None 975 */ 976 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_TSE)) 977 978 /** 979 * @brief Disable the RTC TimeStamp peripheral. 980 * @param __HANDLE__ specifies the RTC handle. 981 * @retval None 982 */ 983 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_TSE)) 984 985 /** 986 * @brief Enable the RTC TimeStamp interrupt. 987 * @param __HANDLE__ specifies the RTC handle. 988 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be enabled. 989 * This parameter can be: 990 * @arg @ref RTC_IT_TS TimeStamp interrupt 991 * @retval None 992 */ 993 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR |= (RTC_CR_TSIE)) 994 995 /** 996 * @brief Disable the RTC TimeStamp interrupt. 997 * @param __HANDLE__ specifies the RTC handle. 998 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be disabled. 999 * This parameter can be: 1000 * @arg @ref RTC_IT_TS TimeStamp interrupt 1001 * @retval None 1002 */ 1003 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR &= ~(RTC_CR_TSIE)) 1004 1005 /** 1006 * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not. 1007 * @param __HANDLE__ specifies the RTC handle. 1008 * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt to check. 1009 * This parameter can be: 1010 * @arg @ref RTC_IT_TS TimeStamp interrupt 1011 * @retval The state of __INTERRUPT__ (TRUE or FALSE). 1012 */ 1013 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((RTC->MISR) & (RTC_MISR_TSMF)) != 0U) 1014 1015 /** 1016 * @brief Check whether the specified RTC Time Stamp interrupt has been enabled or not. 1017 * @param __HANDLE__ specifies the RTC handle. 1018 * @param __INTERRUPT__ specifies the RTC Time Stamp interrupt source to check. 1019 * This parameter can be: 1020 * @arg @ref RTC_IT_TS TimeStamp interrupt 1021 * @retval The state of __INTERRUPT__ (TRUE or FALSE). 1022 */ 1023 #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((RTC->CR) & (RTC_CR_TSIE)) != 0U) 1024 1025 /** 1026 * @brief Get the selected RTC TimeStamps flag status. 1027 * @param __HANDLE__ specifies the RTC handle. 1028 * @param __FLAG__ specifies the RTC TimeStamp Flag is pending or not. 1029 * This parameter can be: 1030 * @arg @ref RTC_FLAG_TSF 1031 * @arg @ref RTC_FLAG_TSOVF 1032 * @retval The state of __FLAG__ (TRUE or FALSE) or 255 if invalid parameter. 1033 */ 1034 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__)( \ 1035 ((__FLAG__) == RTC_FLAG_TSF) ? (READ_BIT(RTC->SR, RTC_SR_TSF) == RTC_SR_TSF):\ 1036 ((__FLAG__) == RTC_FLAG_TSOVF) ? (READ_BIT(RTC->SR, RTC_SR_TSOVF) == RTC_SR_TSOVF):\ 1037 (0U)) /* Return 0 because it is an invalid parameter value */ 1038 1039 /** 1040 * @brief Clear the RTC Time Stamps pending flags. 1041 * @param __HANDLE__ specifies the RTC handle. 1042 * @param __FLAG__ specifies the RTC TimeStamp Flag to clear. 1043 * This parameter can be: 1044 * @arg @ref RTC_FLAG_TSF 1045 * @arg @ref RTC_FLAG_TSOVF 1046 * @retval None 1047 */ 1048 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__)( \ 1049 ((__FLAG__) == RTC_FLAG_TSF) ? (WRITE_REG(RTC->SCR, RTC_SCR_CTSF)):\ 1050 ((__FLAG__) == RTC_FLAG_TSOVF) ? (WRITE_REG(RTC->SCR, RTC_SCR_CTSOVF)):\ 1051 (0U)) /* Dummy action because is an invalid parameter value */ 1052 1053 /** 1054 * @brief Enable the RTC internal TimeStamp peripheral. 1055 * @param __HANDLE__ specifies the RTC handle. 1056 * @retval None 1057 */ 1058 #define __HAL_RTC_INTERNAL_TIMESTAMP_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_ITSE)) 1059 1060 /** 1061 * @brief Disable the RTC internal TimeStamp peripheral. 1062 * @param __HANDLE__ specifies the RTC handle. 1063 * @retval None 1064 */ 1065 #define __HAL_RTC_INTERNAL_TIMESTAMP_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_ITSE)) 1066 1067 /** 1068 * @brief Get the selected RTC Internal Time Stamps flag status. 1069 * @param __HANDLE__ specifies the RTC handle. 1070 * @param __FLAG__ specifies the RTC Internal Time Stamp Flag is pending or not. 1071 * This parameter can be: 1072 * @arg @ref RTC_FLAG_ITSF 1073 * @retval None 1074 */ 1075 #define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BIT(RTC->SR, RTC_SR_ITSF) == RTC_SR_ITSF)) 1076 1077 /** 1078 * @brief Clear the RTC Internal Time Stamps pending flags. 1079 * @param __HANDLE__ specifies the RTC handle. 1080 * @param __FLAG__ specifies the RTC Internal Time Stamp Flag source to clear. 1081 * This parameter can be: 1082 * @arg @ref RTC_FLAG_ITSF 1083 * @retval None 1084 */ 1085 #define __HAL_RTC_INTERNAL_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) (WRITE_REG(RTC->SCR, RTC_SCR_CITSF)) 1086 1087 /** 1088 * @brief Enable the RTC TimeStamp on Tamper detection. 1089 * @param __HANDLE__ specifies the RTC handle. 1090 * @retval None 1091 */ 1092 #define __HAL_RTC_TAMPTS_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_TAMPTS)) 1093 1094 /** 1095 * @brief Disable the RTC TimeStamp on Tamper detection. 1096 * @param __HANDLE__ specifies the RTC handle. 1097 * @retval None 1098 */ 1099 #define __HAL_RTC_TAMPTS_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_TAMPTS)) 1100 1101 #if defined(RTC_CR_TAMPOE) 1102 /** 1103 * @brief Enable the RTC Tamper detection output. 1104 * @param __HANDLE__ specifies the RTC handle. 1105 * @retval None 1106 */ 1107 #define __HAL_RTC_TAMPOE_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_TAMPOE)) 1108 1109 /** 1110 * @brief Disable the RTC Tamper detection output. 1111 * @param __HANDLE__ specifies the RTC handle. 1112 * @retval None 1113 */ 1114 #define __HAL_RTC_TAMPOE_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_TAMPOE)) 1115 1116 #endif /* RTC_CR_TAMPOE */ 1117 /** 1118 * @} 1119 */ 1120 1121 1122 /* ------------------------------Calibration----------------------------------*/ 1123 /** @defgroup RTCEx_Calibration RTC Calibration 1124 * @{ 1125 */ 1126 1127 /** 1128 * @brief Enable the RTC calibration output. 1129 * @param __HANDLE__ specifies the RTC handle. 1130 * @retval None 1131 */ 1132 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_COE)) 1133 1134 /** 1135 * @brief Disable the calibration output. 1136 * @param __HANDLE__ specifies the RTC handle. 1137 * @retval None 1138 */ 1139 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_COE)) 1140 1141 /** 1142 * @brief Enable the clock reference detection. 1143 * @param __HANDLE__ specifies the RTC handle. 1144 * @retval None 1145 */ 1146 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) (RTC->CR |= (RTC_CR_REFCKON)) 1147 1148 /** 1149 * @brief Disable the clock reference detection. 1150 * @param __HANDLE__ specifies the RTC handle. 1151 * @retval None 1152 */ 1153 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) (RTC->CR &= ~(RTC_CR_REFCKON)) 1154 1155 /** 1156 * @brief Get the selected RTC shift operations flag status. 1157 * @param __HANDLE__ specifies the RTC handle. 1158 * @param __FLAG__ specifies the RTC shift operation Flag is pending or not. 1159 * This parameter can be: 1160 * @arg @ref RTC_FLAG_SHPF 1161 * @retval The state of __FLAG__ (TRUE or FALSE) 1162 */ 1163 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BIT(RTC->ICSR, RTC_ICSR_SHPF) == RTC_ICSR_SHPF)) 1164 /** 1165 * @} 1166 */ 1167 1168 /* ------------------------------Tamper----------------------------------*/ 1169 /** @defgroup RTCEx_Tamper RTCEx tamper 1170 * @{ 1171 */ 1172 1173 /** 1174 * @brief Enable the TAMP Tamper input detection. 1175 * @param __HANDLE__ specifies the RTC handle. 1176 * @param __TAMPER__ specifies the RTC Tamper source to be enabled. 1177 * This parameter can be any combination of the following values: 1178 * @arg RTC_TAMPER_ALL: All tampers 1179 * @arg RTC_TAMPER_1: Tamper1 1180 * @arg RTC_TAMPER_2: Tamper2 1181 * @arg RTC_TAMPER_3: Tamper3 1182 * @arg RTC_TAMPER_4: Tamper4 1183 * @arg RTC_TAMPER_5: Tamper5 1184 * @arg RTC_TAMPER_6: Tamper6 1185 * @arg RTC_TAMPER_7: Tamper7 1186 * @arg RTC_TAMPER_8: Tamper8 1187 * @retval None 1188 */ 1189 #define __HAL_RTC_TAMPER_ENABLE(__HANDLE__, __TAMPER__) (TAMP->CR1 |= (__TAMPER__)) 1190 1191 /** 1192 * @brief Disable the TAMP Tamper input detection. 1193 * @param __HANDLE__ specifies the RTC handle. 1194 * @param __TAMPER__ specifies the RTC Tamper sources to be enabled. 1195 * This parameter can be any combination of the following values: 1196 * @arg RTC_TAMPER_ALL: All tampers 1197 * @arg RTC_TAMPER_1: Tamper1 1198 * @arg RTC_TAMPER_2: Tamper2 1199 * @arg RTC_TAMPER_3: Tamper3 1200 * @arg RTC_TAMPER_4: Tamper4 1201 * @arg RTC_TAMPER_5: Tamper5 1202 * @arg RTC_TAMPER_6: Tamper6 1203 * @arg RTC_TAMPER_7: Tamper7 1204 * @arg RTC_TAMPER_8: Tamper8 1205 */ 1206 #define __HAL_RTC_TAMPER_DISABLE(__HANDLE__, __TAMPER__) (TAMP->CR1 &= ~(__TAMPER__)) 1207 1208 1209 /**************************************************************************************************/ 1210 /** 1211 * @brief Enable the TAMP Tamper interrupt. 1212 * @param __HANDLE__ specifies the RTC handle. 1213 * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be enabled. 1214 * This parameter can be any combination of the following values: 1215 * @arg RTC_IT_TAMP_ALL: All tampers interrupts 1216 * @arg RTC_IT_TAMP_1: Tamper1 interrupt 1217 * @arg RTC_IT_TAMP_2: Tamper2 interrupt 1218 * @arg RTC_IT_TAMP_3: Tamper3 interrupt 1219 * @arg RTC_IT_TAMP_4: Tamper4 interrupt 1220 * @arg RTC_IT_TAMP_5: Tamper5 interrupt 1221 * @arg RTC_IT_TAMP_6: Tamper6 interrupt 1222 * @arg RTC_IT_TAMP_7: Tamper7 interrupt 1223 * @arg RTC_IT_TAMP_8: Tamper8 interrupt 1224 * @retval None 1225 */ 1226 #define __HAL_RTC_TAMPER_ENABLE_IT(__HANDLE__, __INTERRUPT__) (TAMP->IER |= (__INTERRUPT__)) 1227 1228 /** 1229 * @brief Disable the TAMP Tamper interrupt. 1230 * @param __HANDLE__ specifies the RTC handle. 1231 * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be disabled. 1232 * This parameter can be any combination of the following values: 1233 * @arg RTC_IT_TAMP_ALL: All tampers interrupts 1234 * @arg RTC_IT_TAMP_1: Tamper1 interrupt 1235 * @arg RTC_IT_TAMP_2: Tamper2 interrupt 1236 * @arg RTC_IT_TAMP_3: Tamper3 interrupt 1237 * @arg RTC_IT_TAMP_4: Tamper4 interrupt 1238 * @arg RTC_IT_TAMP_5: Tamper5 interrupt 1239 * @arg RTC_IT_TAMP_6: Tamper6 interrupt 1240 * @arg RTC_IT_TAMP_7: Tamper7 interrupt 1241 * @arg RTC_IT_TAMP_8: Tamper8 interrupt 1242 * @retval None 1243 */ 1244 #define __HAL_RTC_TAMPER_DISABLE_IT(__HANDLE__, __INTERRUPT__) (TAMP->IER &= ~(__INTERRUPT__)) 1245 1246 1247 /**************************************************************************************************/ 1248 /** 1249 * @brief Check whether the specified RTC Tamper interrupt has occurred or not. 1250 * @param __HANDLE__ specifies the RTC handle. 1251 * @param __INTERRUPT__ specifies the RTC Tamper interrupt to check. 1252 * This parameter can be: 1253 * @arg RTC_IT_TAMP_ALL: All tampers interrupts 1254 * @arg RTC_IT_TAMP_1: Tamper1 interrupt 1255 * @arg RTC_IT_TAMP_2: Tamper2 interrupt 1256 * @arg RTC_IT_TAMP_3: Tamper3 interrupt 1257 * @arg RTC_IT_TAMP_4: Tamper4 interrupt 1258 * @arg RTC_IT_TAMP_5: Tamper5 interrupt 1259 * @arg RTC_IT_TAMP_6: Tamper6 interrupt 1260 * @arg RTC_IT_TAMP_7: Tamper7 interrupt 1261 * @arg RTC_IT_TAMP_8: Tamper8 interrupt 1262 * @arg RTC_IT_INT_TAMP_ALL: All Internal Tamper interrupts 1263 * @arg RTC_IT_INT_TAMP_1: Internal Tamper1 interrupt 1264 * @arg RTC_IT_INT_TAMP_2: Internal Tamper2 interrupt 1265 * @arg RTC_IT_INT_TAMP_3: Internal Tamper3 interrupt 1266 * @arg RTC_IT_INT_TAMP_4: Internal Tamper4 interrupt 1267 * @arg RTC_IT_INT_TAMP_5: Internal Tamper5 interrupt 1268 * @arg RTC_IT_INT_TAMP_6: Internal Tamper6 interrupt 1269 * @arg RTC_IT_INT_TAMP_7: Internal Tamper7 interrupt 1270 * @arg RTC_IT_INT_TAMP_8: Internal Tamper8 interrupt 1271 * @arg RTC_IT_INT_TAMP_9: Internal Tamper9 interrupt 1272 * @arg RTC_IT_INT_TAMP_11: Internal Tamper11 interrupt 1273 * @arg RTC_IT_INT_TAMP_15: Internal Tamper15 interrupt 1274 * @retval The state of __INTERRUPT__ (TRUE or FALSE) 1275 */ 1276 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) ((((TAMP->MISR) & (__INTERRUPT__)) != 0U) ? 1UL : 0UL) 1277 1278 /** 1279 * @brief Check whether the specified RTC Tamper interrupt has been enabled or not. 1280 * @param __HANDLE__ specifies the RTC handle. 1281 * @param __INTERRUPT__ specifies the RTC Tamper interrupt source to check. 1282 * This parameter can be: 1283 * @arg RTC_IT_TAMP_ALL: All tampers interrupts 1284 * @arg RTC_IT_TAMP_1: Tamper1 interrupt 1285 * @arg RTC_IT_TAMP_2: Tamper2 interrupt 1286 * @arg RTC_IT_TAMP_3: Tamper3 interrupt 1287 * @arg RTC_IT_TAMP_4: Tamper4 interrupt 1288 * @arg RTC_IT_TAMP_5: Tamper5 interrupt 1289 * @arg RTC_IT_TAMP_6: Tamper6 interrupt 1290 * @arg RTC_IT_TAMP_7: Tamper7 interrupt 1291 * @arg RTC_IT_TAMP_8: Tamper8 interrupt 1292 * @arg RTC_IT_INT_TAMP_ALL: All internal tampers interrupts 1293 * @arg RTC_IT_INT_TAMP_1: Internal Tamper1 interrupt 1294 * @arg RTC_IT_INT_TAMP_2: Internal Tamper2 interrupt 1295 * @arg RTC_IT_INT_TAMP_3: Internal Tamper3 interrupt 1296 * @arg RTC_IT_INT_TAMP_4: Internal Tamper4 interrupt 1297 * @arg RTC_IT_INT_TAMP_5: Internal Tamper5 interrupt 1298 * @arg RTC_IT_INT_TAMP_6: Internal Tamper6 interrupt 1299 * @arg RTC_IT_INT_TAMP_7: Internal Tamper7 interrupt 1300 * @arg RTC_IT_INT_TAMP_8: Internal Tamper8 interrupt 1301 * @arg RTC_IT_INT_TAMP_9: Internal Tamper9 interrupt 1302 * @arg RTC_IT_INT_TAMP_11: Internal Tamper11 interrupt 1303 * @arg RTC_IT_INT_TAMP_15: Internal Tamper15 interrupt 1304 * @retval The state of __INTERRUPT__ (TRUE or FALSE) 1305 */ 1306 #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((TAMP->IER) & (__INTERRUPT__)) != \ 1307 0U) ? 1UL : 0UL) 1308 1309 /** 1310 * @brief Get the selected RTC Tampers flag status. 1311 * @param __HANDLE__ specifies the RTC handle. 1312 * @param __FLAG__ specifies the RTC Tamper Flag is pending or not. 1313 * This parameter can be: 1314 * @arg RTC_FLAG_TAMP_ALL: All tampers flag 1315 * @arg RTC_FLAG_TAMP_1: Tamper1 flag 1316 * @arg RTC_FLAG_TAMP_2: Tamper2 flag 1317 * @arg RTC_FLAG_TAMP_3: Tamper3 flag 1318 * @arg RTC_FLAG_TAMP_4: Tamper4 flag 1319 * @arg RTC_FLAG_TAMP_5: Tamper5 flag 1320 * @arg RTC_FLAG_TAMP_6: Tamper6 flag 1321 * @arg RTC_FLAG_TAMP_7: Tamper7 flag 1322 * @arg RTC_FLAG_TAMP_8: Tamper8 flag 1323 * @arg RTC_FLAG_INT_TAMP_1: Internal Tamper1 flag 1324 * @arg RTC_FLAG_INT_TAMP_2: Internal Tamper2 flag 1325 * @arg RTC_FLAG_INT_TAMP_3: Internal Tamper3 flag 1326 * @arg RTC_FLAG_INT_TAMP_4: Internal Tamper4 flag 1327 * @arg RTC_FLAG_INT_TAMP_5: Internal Tamper5 flag 1328 * @arg RTC_FLAG_INT_TAMP_6: Internal Tamper6 flag 1329 * @arg RTC_FLAG_INT_TAMP_7: Internal Tamper7 flag 1330 * @arg RTC_FLAG_INT_TAMP_8: Internal Tamper8 flag 1331 * @arg RTC_FLAG_INT_TAMP_9: Internal Tamper9 flag 1332 * @arg RTC_FLAG_INT_TAMP_11: Internal Tamper11 flag 1333 * @arg RTC_FLAG_INT_TAMP_15: Internal Tamper15 flag 1334 * @retval The state of __FLAG__ (TRUE or FALSE) 1335 */ 1336 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((TAMP->SR) & (__FLAG__)) != 0U) 1337 1338 /** 1339 * @brief Clear the RTC Tamper's pending flags. 1340 * @param __HANDLE__ specifies the RTC handle. 1341 * @param __FLAG__ specifies the RTC Tamper Flag to clear. 1342 * This parameter can be: 1343 * @arg RTC_FLAG_TAMP_ALL: All tampers flag 1344 * @arg RTC_FLAG_TAMP_1: Tamper1 flag 1345 * @arg RTC_FLAG_TAMP_2: Tamper2 flag 1346 * @arg RTC_FLAG_TAMP_3: Tamper3 flag 1347 * @arg RTC_FLAG_TAMP_4: Tamper4 flag 1348 * @arg RTC_FLAG_TAMP_5: Tamper5 flag 1349 * @arg RTC_FLAG_TAMP_6: Tamper6 flag 1350 * @arg RTC_FLAG_TAMP_7: Tamper7 flag 1351 * @arg RTC_FLAG_TAMP_8: Tamper8 flag 1352 * @arg RTC_FLAG_INT_TAMP_ALL: All Internal Tamper flags 1353 * @arg RTC_FLAG_INT_TAMP_1: Internal Tamper1 flag 1354 * @arg RTC_FLAG_INT_TAMP_2: Internal Tamper2 flag 1355 * @arg RTC_FLAG_INT_TAMP_3: Internal Tamper3 flag 1356 * @arg RTC_FLAG_INT_TAMP_4: Internal Tamper4 flag 1357 * @arg RTC_FLAG_INT_TAMP_5: Internal Tamper5 flag 1358 * @arg RTC_FLAG_INT_TAMP_6: Internal Tamper6 flag 1359 * @arg RTC_FLAG_INT_TAMP_7: Internal Tamper7 flag 1360 * @arg RTC_FLAG_INT_TAMP_8: Internal Tamper8 flag 1361 * @arg RTC_FLAG_INT_TAMP_9: Internal Tamper9 flag 1362 * @arg RTC_FLAG_INT_TAMP_11: Internal Tamper11 flag 1363 * @arg RTC_FLAG_INT_TAMP_15: Internal Tamper15 flag 1364 * @retval None 1365 */ 1366 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((TAMP->SCR) = (__FLAG__)) 1367 /** 1368 * @} 1369 */ 1370 1371 /* --------------------------------- SSR Underflow ---------------------------------*/ 1372 /** @defgroup RTCEx_SSR_Underflow RTC SSR Underflow 1373 * @{ 1374 */ 1375 1376 /** 1377 * @brief Enable the RTC SSRU interrupt. 1378 * @param __HANDLE__ specifies the RTC handle. 1379 * @param __INTERRUPT__ specifies the RTC SSRU interrupt sources to be enabled. 1380 * This parameter can be: 1381 * @arg @ref RTC_IT_SSRU SSRU interrupt 1382 * @retval None 1383 */ 1384 #define __HAL_RTC_SSRU_ENABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR |= (RTC_CR_SSRUIE)) 1385 1386 /** 1387 * @brief Disable the RTC SSRU interrupt. 1388 * @param __HANDLE__ specifies the RTC handle. 1389 * @param __INTERRUPT__ specifies the RTC SSRU interrupt sources to be disabled. 1390 * This parameter can be: 1391 * @arg @ref RTC_IT_SSRU SSRU interrupt 1392 * @retval None 1393 */ 1394 #define __HAL_RTC_SSRU_DISABLE_IT(__HANDLE__, __INTERRUPT__) (RTC->CR &= ~(RTC_CR_SSRUIE)) 1395 1396 1397 /** 1398 * @brief Check whether the specified RTC SSRU interrupt has occurred or not. 1399 * @param __HANDLE__ specifies the RTC handle. 1400 * @param __INTERRUPT__ specifies the RTC SSRU interrupt to check. 1401 * This parameter can be: 1402 * @arg @ref RTC_IT_SSRU SSRU interrupt 1403 * @retval The state of __INTERRUPT__ (TRUE or FALSE) 1404 */ 1405 #define __HAL_RTC_SSRU_GET_IT(__HANDLE__, __INTERRUPT__) ((((RTC->MISR) & (RTC_MISR_SSRUMF)) != 0U) ? 1U : 0U) 1406 /** 1407 * @brief Check whether the specified RTC SSRU interrupt has been enabled or not. 1408 * @param __HANDLE__ specifies the RTC handle. 1409 * @param __INTERRUPT__ specifies the RTC SSRU interrupt sources to check. 1410 * This parameter can be: 1411 * @arg @ref RTC_IT_SSRU SSRU interrupt 1412 * @retval The state of __INTERRUPT__ (TRUE or FALSE) 1413 */ 1414 #define __HAL_RTC_SSRU_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((RTC->CR) & (RTC_CR_SSRUIE)) != 0U) ? 1U : 0U) 1415 1416 /** 1417 * @brief Get the selected RTC SSRU's flag status. 1418 * @param __HANDLE__ specifies the RTC handle. 1419 * @param __FLAG__ specifies the RTC SSRU Flag is pending or not. 1420 * This parameter can be: 1421 * @arg @ref RTC_FLAG_SSRUF 1422 * @retval The state of __FLAG__ (TRUE or FALSE) 1423 */ 1424 #define __HAL_RTC_SSRU_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BIT(RTC->SR, RTC_SR_SSRUF) == RTC_SR_SSRUF)) 1425 1426 /** 1427 * @brief Clear the RTC SSRU's pending flags. 1428 * @param __HANDLE__ specifies the RTC handle. 1429 * @param __FLAG__ specifies the RTC SSRU Flag to clear. 1430 * This parameter can be: 1431 * @arg @ref RTC_FLAG_SSRUF 1432 * @retval None 1433 */ 1434 #define __HAL_RTC_SSRU_CLEAR_FLAG(__HANDLE__, __FLAG__) (WRITE_REG(RTC->SCR, RTC_SCR_CSSRUF)) 1435 /** 1436 * @} 1437 */ 1438 1439 /** 1440 * @} 1441 */ 1442 1443 /* Exported functions --------------------------------------------------------*/ 1444 /** @defgroup RTCEx_Exported_Functions RTCEx Exported Functions 1445 * @{ 1446 */ 1447 1448 /* RTC TimeStamp functions *****************************************/ 1449 /** @defgroup RTCEx_Exported_Functions_Group1 Extended RTC TimeStamp functions 1450 * @{ 1451 */ 1452 1453 #ifdef RTC_CR_TSE 1454 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin); 1455 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin); 1456 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc); 1457 #endif /* RTC_CR_TSE */ 1458 HAL_StatusTypeDef HAL_RTCEx_SetInternalTimeStamp(RTC_HandleTypeDef *hrtc); 1459 HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTimeStamp(RTC_HandleTypeDef *hrtc); 1460 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(const RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, 1461 RTC_DateTypeDef *sTimeStampDate, uint32_t Format); 1462 void HAL_RTCEx_TimeStampIRQHandler(RTC_HandleTypeDef *hrtc); 1463 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(const RTC_HandleTypeDef *hrtc, uint32_t Timeout); 1464 void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc); 1465 /** 1466 * @} 1467 */ 1468 1469 1470 /* RTC Wake-up functions ******************************************************/ 1471 /** @defgroup RTCEx_Exported_Functions_Group2 Extended RTC Wake-up functions 1472 * @{ 1473 */ 1474 1475 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); 1476 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock, 1477 uint32_t WakeUpAutoClr); 1478 HAL_StatusTypeDef HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc); 1479 uint32_t HAL_RTCEx_GetWakeUpTimer(const RTC_HandleTypeDef *hrtc); 1480 void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc); 1481 void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc); 1482 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(const RTC_HandleTypeDef *hrtc, uint32_t Timeout); 1483 /** 1484 * @} 1485 */ 1486 1487 /* Extended Control functions ************************************************/ 1488 /** @defgroup RTCEx_Exported_Functions_Group3 Extended Peripheral Control functions 1489 * @{ 1490 */ 1491 1492 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, 1493 uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue); 1494 HAL_StatusTypeDef HAL_RTCEx_SetLowPowerCalib(RTC_HandleTypeDef *hrtc, uint32_t LowPowerCalib); 1495 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS); 1496 #if defined(RTC_CR_COSEL) 1497 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput); 1498 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc); 1499 #endif /* RTC_CR_COSEL */ 1500 #if defined(RTC_CR_REFCKON) 1501 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc); 1502 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc); 1503 #endif /* RTC_CR_REFCKON */ 1504 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc); 1505 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc); 1506 HAL_StatusTypeDef HAL_RTCEx_MonotonicCounterIncrement(const RTC_HandleTypeDef *hrtc, uint32_t Instance); 1507 HAL_StatusTypeDef HAL_RTCEx_MonotonicCounterGet(const RTC_HandleTypeDef *hrtc, uint32_t Instance, uint32_t *pValue); 1508 HAL_StatusTypeDef HAL_RTCEx_SetSSRU_IT(RTC_HandleTypeDef *hrtc); 1509 HAL_StatusTypeDef HAL_RTCEx_DeactivateSSRU(RTC_HandleTypeDef *hrtc); 1510 void HAL_RTCEx_SSRUIRQHandler(RTC_HandleTypeDef *hrtc); 1511 void HAL_RTCEx_SSRUEventCallback(RTC_HandleTypeDef *hrtc); 1512 1513 /** 1514 * @} 1515 */ 1516 1517 /* Extended RTC features functions *******************************************/ 1518 /** @defgroup RTCEx_Exported_Functions_Group4 Extended features functions 1519 * @{ 1520 */ 1521 1522 void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc); 1523 HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(const RTC_HandleTypeDef *hrtc, uint32_t Timeout); 1524 /** 1525 * @} 1526 */ 1527 1528 /** @defgroup RTCEx_Exported_Functions_Group5 Extended RTC Tamper functions 1529 * @{ 1530 */ 1531 HAL_StatusTypeDef HAL_RTCEx_SetTamper(const RTC_HandleTypeDef *hrtc, const RTC_TamperTypeDef *sTamper); 1532 HAL_StatusTypeDef HAL_RTCEx_SetActiveTampers(RTC_HandleTypeDef *hrtc, const RTC_ActiveTampersTypeDef *sAllTamper); 1533 HAL_StatusTypeDef HAL_RTCEx_SetActiveSeed(RTC_HandleTypeDef *hrtc, const uint32_t *pSeed); 1534 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(const RTC_HandleTypeDef *hrtc, const RTC_TamperTypeDef *sTamper); 1535 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(const RTC_HandleTypeDef *hrtc, uint32_t Tamper); 1536 HAL_StatusTypeDef HAL_RTCEx_DeactivateActiveTampers(const RTC_HandleTypeDef *hrtc); 1537 HAL_StatusTypeDef HAL_RTCEx_PollForTamperEvent(const RTC_HandleTypeDef *hrtc, uint32_t Tamper, uint32_t Timeout); 1538 HAL_StatusTypeDef HAL_RTCEx_SetInternalTamper(const RTC_HandleTypeDef *hrtc, 1539 const RTC_InternalTamperTypeDef *sIntTamper); 1540 HAL_StatusTypeDef HAL_RTCEx_SetInternalTamper_IT(const RTC_HandleTypeDef *hrtc, 1541 const RTC_InternalTamperTypeDef *sIntTamper); 1542 HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTamper(const RTC_HandleTypeDef *hrtc, uint32_t IntTamper); 1543 HAL_StatusTypeDef HAL_RTCEx_PollForInternalTamperEvent(const RTC_HandleTypeDef *hrtc, uint32_t IntTamper, 1544 uint32_t Timeout); 1545 #if defined(TAMP_CFGR_BHKLOCK) 1546 HAL_StatusTypeDef HAL_RTCEx_LockBootHardwareKey(const RTC_HandleTypeDef *hrtc); 1547 #endif /* TAMP_CFGR_BHKLOCK */ 1548 void HAL_RTCEx_TamperIRQHandler(RTC_HandleTypeDef *hrtc); 1549 void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc); 1550 void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc); 1551 void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc); 1552 void HAL_RTCEx_Tamper4EventCallback(RTC_HandleTypeDef *hrtc); 1553 void HAL_RTCEx_Tamper5EventCallback(RTC_HandleTypeDef *hrtc); 1554 void HAL_RTCEx_Tamper6EventCallback(RTC_HandleTypeDef *hrtc); 1555 void HAL_RTCEx_Tamper7EventCallback(RTC_HandleTypeDef *hrtc); 1556 void HAL_RTCEx_Tamper8EventCallback(RTC_HandleTypeDef *hrtc); 1557 void HAL_RTCEx_InternalTamper1EventCallback(RTC_HandleTypeDef *hrtc); 1558 void HAL_RTCEx_InternalTamper2EventCallback(RTC_HandleTypeDef *hrtc); 1559 void HAL_RTCEx_InternalTamper3EventCallback(RTC_HandleTypeDef *hrtc); 1560 void HAL_RTCEx_InternalTamper4EventCallback(RTC_HandleTypeDef *hrtc); 1561 void HAL_RTCEx_InternalTamper5EventCallback(RTC_HandleTypeDef *hrtc); 1562 void HAL_RTCEx_InternalTamper6EventCallback(RTC_HandleTypeDef *hrtc); 1563 void HAL_RTCEx_InternalTamper7EventCallback(RTC_HandleTypeDef *hrtc); 1564 void HAL_RTCEx_InternalTamper8EventCallback(RTC_HandleTypeDef *hrtc); 1565 void HAL_RTCEx_InternalTamper9EventCallback(RTC_HandleTypeDef *hrtc); 1566 void HAL_RTCEx_InternalTamper11EventCallback(RTC_HandleTypeDef *hrtc); 1567 void HAL_RTCEx_InternalTamper15EventCallback(RTC_HandleTypeDef *hrtc); 1568 /** 1569 * @} 1570 */ 1571 1572 /** @defgroup RTCEx_Exported_Functions_Group6 Extended RTC Backup register functions 1573 * @{ 1574 */ 1575 void HAL_RTCEx_BKUPWrite(const RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data); 1576 uint32_t HAL_RTCEx_BKUPRead(const RTC_HandleTypeDef *hrtc, uint32_t BackupRegister); 1577 void HAL_RTCEx_BKUPErase(const RTC_HandleTypeDef *hrtc); 1578 void HAL_RTCEx_BKUPBlock(const RTC_HandleTypeDef *hrtc); 1579 void HAL_RTCEx_BKUPUnblock(const RTC_HandleTypeDef *hrtc); 1580 #ifdef TAMP_RPCFGR_RPCFG0 1581 void HAL_RTCEx_ConfigEraseDeviceSecrets(const RTC_HandleTypeDef *hrtc, uint32_t DeviceSecretConf); 1582 #endif /* TAMP_RPCFGR_RPCFG0 */ 1583 /** 1584 * @} 1585 */ 1586 1587 #if defined(TAMP_PRIVCFGR_TAMPPRIV) 1588 /** @defgroup RTCEx_Exported_Functions_Group8 Extended RTC privilege functions 1589 * @{ 1590 */ 1591 HAL_StatusTypeDef HAL_RTCEx_PrivilegeModeSet(const RTC_HandleTypeDef *hrtc, 1592 const RTC_PrivilegeStateTypeDef *privilegeState); 1593 HAL_StatusTypeDef HAL_RTCEx_PrivilegeModeGet(const RTC_HandleTypeDef *hrtc, RTC_PrivilegeStateTypeDef *privilegeState); 1594 /** 1595 * @} 1596 */ 1597 #endif /* TAMP_PRIVCFGR_TAMPPRIV */ 1598 1599 /** 1600 * @} 1601 */ 1602 1603 /* Private types -------------------------------------------------------------*/ 1604 /* Private variables ---------------------------------------------------------*/ 1605 /* Private constants ---------------------------------------------------------*/ 1606 /* Private macros ------------------------------------------------------------*/ 1607 /** @defgroup RTCEx_Private_Macros RTCEx Private Macros 1608 * @{ 1609 */ 1610 1611 /** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters 1612 * @{ 1613 */ 1614 #if defined(RTC_CR_TSEDGE) 1615 #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \ 1616 ((EDGE) == RTC_TIMESTAMPEDGE_FALLING)) 1617 #endif /* RTC_CR_TSEDGE */ 1618 1619 #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_DEFAULT)) 1620 1621 #define IS_RTC_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \ 1622 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE)) 1623 1624 #if defined(RTC_CR_TAMPOE) 1625 #define IS_RTC_TAMPER_TAMPERDETECTIONOUTPUT(MODE) (((MODE) == RTC_TAMPERDETECTIONOUTPUT_ENABLE) || \ 1626 ((MODE) == RTC_TAMPERDETECTIONOUTPUT_DISABLE)) 1627 #endif /* RTC_CR_TAMPOE */ 1628 1629 #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \ 1630 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \ 1631 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \ 1632 ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \ 1633 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \ 1634 ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS)) 1635 1636 #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= RTC_WUTR_WUT) 1637 1638 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \ 1639 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \ 1640 ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC)) 1641 1642 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \ 1643 ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET)) 1644 1645 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= RTC_CALR_CALM) 1646 1647 #define IS_RTC_LOW_POWER_CALIB(LPCAL) (((LPCAL) == RTC_LPCAL_SET) || \ 1648 ((LPCAL) == RTC_LPCAL_RESET)) 1649 1650 1651 #define IS_RTC_TAMPER(__TAMPER__) ((((__TAMPER__) & RTC_TAMPER_ALL) != 0U) && \ 1652 (((__TAMPER__) & ~RTC_TAMPER_ALL) == 0U)) 1653 1654 #define IS_RTC_INTERNAL_TAMPER(__INT_TAMPER__) ((((__INT_TAMPER__) & RTC_INT_TAMPER_ALL) != 0U) && \ 1655 (((__INT_TAMPER__) & ~RTC_INT_TAMPER_ALL) == 0U)) 1656 1657 #define IS_RTC_TAMPER_TRIGGER(__TRIGGER__) (((__TRIGGER__) == RTC_TAMPERTRIGGER_RISINGEDGE) || \ 1658 ((__TRIGGER__) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \ 1659 ((__TRIGGER__) == RTC_TAMPERTRIGGER_LOWLEVEL) || \ 1660 ((__TRIGGER__) == RTC_TAMPERTRIGGER_HIGHLEVEL)) 1661 1662 #define IS_RTC_TAMPER_ERASE_MODE(__MODE__) (((__MODE__) == RTC_TAMPER_ERASE_BACKUP_ENABLE) || \ 1663 ((__MODE__) == RTC_TAMPER_ERASE_BACKUP_DISABLE)) 1664 1665 #define IS_RTC_TAMPER_MASKFLAG_STATE(__STATE__) (((__STATE__) == RTC_TAMPERMASK_FLAG_ENABLE) || \ 1666 ((__STATE__) == RTC_TAMPERMASK_FLAG_DISABLE)) 1667 1668 #define IS_RTC_TAMPER_FILTER(__FILTER__) (((__FILTER__) == RTC_TAMPERFILTER_DISABLE) || \ 1669 ((__FILTER__) == RTC_TAMPERFILTER_2SAMPLE) || \ 1670 ((__FILTER__) == RTC_TAMPERFILTER_4SAMPLE) || \ 1671 ((__FILTER__) == RTC_TAMPERFILTER_8SAMPLE)) 1672 1673 #define IS_RTC_TAMPER_SAMPLING_FREQ(__FREQ__) (((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \ 1674 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \ 1675 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \ 1676 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \ 1677 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \ 1678 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \ 1679 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \ 1680 ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256)) 1681 1682 #define IS_RTC_TAMPER_PRECHARGE_DURATION(__DURATION__) (((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \ 1683 ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \ 1684 ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \ 1685 ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK)) 1686 1687 #define IS_RTC_TAMPER_PULLUP_STATE(__STATE__) (((__STATE__) == RTC_TAMPER_PULLUP_ENABLE) || \ 1688 ((__STATE__) == RTC_TAMPER_PULLUP_DISABLE)) 1689 1690 #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) \ 1691 (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \ 1692 ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE)) 1693 1694 #define IS_RTC_ATAMPER_FILTER(__FILTER__) (((__FILTER__) == RTC_ATAMP_FILTER_ENABLE) || \ 1695 ((__FILTER__) == RTC_ATAMP_FILTER_DISABLE)) 1696 1697 #define IS_RTC_ATAMPER_OUTPUT_CHANGE_PERIOD(__PERIOD__) ((__PERIOD__) <= 7U) 1698 1699 #define IS_RTC_ATAMPER_ASYNCPRES_RTCCLK(__PRESCALER__) (((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK) || \ 1700 ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_2) || \ 1701 ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_4) || \ 1702 ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_8) || \ 1703 ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_16) || \ 1704 ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_32) || \ 1705 ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_64) || \ 1706 ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_128) || \ 1707 ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_2048)) 1708 1709 1710 #define IS_RTC_BKP(__BKP__) ((__BKP__) < RTC_BKP_NUMBER) 1711 1712 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \ 1713 ((SEL) == RTC_SHIFTADD1S_SET)) 1714 1715 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= RTC_SHIFTR_SUBFS) 1716 1717 #if defined(RTC_CR_COSEL) 1718 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \ 1719 ((OUTPUT) == RTC_CALIBOUTPUT_1HZ)) 1720 #endif /* RTC_CR_COSEL */ 1721 1722 #define IS_RTC_PRIVILEGE_FULL(__STATE__) (((__STATE__) == RTC_PRIVILEGE_FULL_YES) || \ 1723 ((__STATE__) == RTC_PRIVILEGE_FULL_NO)) 1724 1725 #define IS_RTC_PRIVILEGE_FEATURES(__FEATURES__) (((__FEATURES__) & ~RTC_PRIVILEGE_FEATURE_ALL) == 0U) 1726 1727 #define IS_TAMP_PRIVILEGE_FULL(__STATE__) (((__STATE__) == TAMP_PRIVILEGE_FULL_YES) || \ 1728 ((__STATE__) == TAMP_PRIVILEGE_FULL_NO)) 1729 1730 #define IS_TAMP_MONOTONIC_CNT_PRIVILEGE(__STATE__) (((__STATE__) == TAMP_MONOTONIC_CNT_PRIVILEGE_YES) || \ 1731 ((__STATE__) == TAMP_MONOTONIC_CNT_PRIVILEGE_NO)) 1732 1733 #define IS_RTC_PRIVILEGE_BKUP_ZONE(__ZONES__) (((__ZONES__) & ~RTC_PRIVILEGE_BKUP_ZONE_ALL) == 0U) 1734 1735 #define IS_RTC_BINARY_MODE(MODE) (((MODE) == RTC_BINARY_NONE) || \ 1736 ((MODE) == RTC_BINARY_ONLY) || \ 1737 ((MODE) == RTC_BINARY_MIX )) 1738 1739 #define IS_RTC_BINARY_MIX_BCDU(BDCU) (((BDCU) == RTC_BINARY_MIX_BCDU_0) || \ 1740 ((BDCU) == RTC_BINARY_MIX_BCDU_1) || \ 1741 ((BDCU) == RTC_BINARY_MIX_BCDU_2) || \ 1742 ((BDCU) == RTC_BINARY_MIX_BCDU_3) || \ 1743 ((BDCU) == RTC_BINARY_MIX_BCDU_4) || \ 1744 ((BDCU) == RTC_BINARY_MIX_BCDU_5) || \ 1745 ((BDCU) == RTC_BINARY_MIX_BCDU_6) || \ 1746 ((BDCU) == RTC_BINARY_MIX_BCDU_7)) 1747 1748 #define IS_RTC_ALARM_SUB_SECOND_BINARY_MASK(MASK) (((MASK) == 0U) || \ 1749 (((MASK) >= RTC_ALARMSUBSECONDBINMASK_SS31_1) &&\ 1750 ((MASK) <= RTC_ALARMSUBSECONDBINMASK_NONE))) 1751 1752 #define IS_RTC_ALARMSUBSECONDBIN_AUTOCLR(SEL) (((SEL) == RTC_ALARMSUBSECONDBIN_AUTOCLR_NO) || \ 1753 ((SEL) == RTC_ALARMSUBSECONDBIN_AUTOCLR_YES)) 1754 /** 1755 * @} 1756 */ 1757 1758 /** 1759 * @} 1760 */ 1761 1762 /** 1763 * @} 1764 */ 1765 1766 /** 1767 * @} 1768 */ 1769 1770 /** 1771 * @} 1772 */ 1773 1774 /** 1775 * @} 1776 */ 1777 1778 #ifdef __cplusplus 1779 } 1780 #endif 1781 1782 #endif /* STM32H7RSxx_HAL_RTC_EX_H */ 1783