1 /** 2 ****************************************************************************** 3 * @file stm32h7rsxx_hal_pwr_ex.h 4 * @author MCD Application Team 5 * @brief Header file of PWR HAL Extension 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_PWR_EX_H 21 #define STM32H7RSxx_HAL_PWR_EX_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif /* __cplusplus */ 26 27 /* Includes ------------------------------------------------------------------*/ 28 #include "stm32h7rsxx_hal_def.h" 29 30 /** @addtogroup STM32H7RSxx_HAL_Driver 31 * @{ 32 */ 33 34 /** @addtogroup PWREx 35 * @{ 36 */ 37 38 /* Exported types ------------------------------------------------------------*/ 39 /** @defgroup PWREx_Exported_Types PWREx Exported Types 40 * @{ 41 */ 42 /** 43 * @brief PWREx AVD configuration structure definition 44 */ 45 typedef struct 46 { 47 uint32_t AVDLevel; /*!< Specifies the AVD detection level. 48 This parameter can be a value of @ref PWREx_AVD_detection_level */ 49 50 uint32_t Mode; /*!< Specifies the EXTI operating mode for the AVD event. 51 This parameter can be a value of @ref PWREx_AVD_Mode. */ 52 } PWREx_AVDTypeDef; 53 54 /** 55 * @brief PWREx Wakeup pin configuration structure definition 56 */ 57 typedef struct 58 { 59 uint32_t WakeUpPin; /*!< Specifies the Wake-Up pin to be enabled. 60 This parameter can be a value of @ref PWR_WakeUp_Pins */ 61 62 uint32_t PinPolarity; /*!< Specifies the Wake-Up pin polarity. 63 This parameter can be a value of @ref PWREx_PIN_Polarity */ 64 65 uint32_t PinPull; /*!< Specifies the Wake-Up pin pull. 66 This parameter can be a value of @ref PWREx_PIN_Pull */ 67 } PWREx_WakeupPinTypeDef; 68 69 /** 70 * @} 71 */ 72 73 /* Exported constants --------------------------------------------------------*/ 74 75 /** @defgroup PWREx_Exported_Constants PWREx Exported Constants 76 * @{ 77 */ 78 79 /** @defgroup PWREx_PIN_Polarity PWREx Pin Polarity configuration 80 * @{ 81 */ 82 #define PWR_PIN_POLARITY_HIGH (0x0U) 83 #define PWR_PIN_POLARITY_LOW (0x1U) 84 /** 85 * @} 86 */ 87 88 /** @defgroup PWREx_PIN_Pull PWREx Pin Pull configuration 89 * @{ 90 */ 91 #define PWR_PIN_NO_PULL (0x0U) 92 #define PWR_PIN_PULL_UP (0x1U) 93 #define PWR_PIN_PULL_DOWN (0x2U) 94 /** 95 * @} 96 */ 97 98 /** @defgroup PWREx_Wakeup_Pins_Flags PWREx Wakeup Pins Flags. 99 * @{ 100 */ 101 #define PWR_WAKEUP_FLAG1 PWR_WKUPFR_WKUPF1 /*!< Wakeup flag on PA0 */ 102 #define PWR_WAKEUP_FLAG2 PWR_WKUPFR_WKUPF2 /*!< Wakeup flag on PA2 */ 103 #define PWR_WAKEUP_FLAG3 PWR_WKUPFR_WKUPF3 /*!< Wakeup flag on PC13 */ 104 #define PWR_WAKEUP_FLAG4 PWR_WKUPFR_WKUPF4 /*!< Wakeup flag on PC1 */ 105 106 #define PWR_WAKEUP_FLAG_ALL (PWR_WKUPFR_WKUPF1 | PWR_WKUPFR_WKUPF2 |\ 107 PWR_WKUPFR_WKUPF3 | PWR_WKUPFR_WKUPF4) 108 /** 109 * @} 110 */ 111 112 /** @defgroup PWREx_Supply_configuration PWREx Supply configuration 113 * @{ 114 */ 115 #define PWR_LDO_SUPPLY PWR_CSR2_LDOEN /*!< Core domains are supplied from the LDO */ 116 #define PWR_EXTERNAL_SOURCE_SUPPLY PWR_CSR2_BYPASS /*!< The SMPS disabled and the LDO Bypass. The Core domains are supplied from an external source */ 117 #define PWR_DIRECT_SMPS_SUPPLY PWR_CSR2_SDEN /*!< Core domains are supplied from the SMPS only */ 118 119 #define PWR_SMPS_1V8_SUPPLIES_LDO (PWR_CSR2_SDHILEVEL | PWR_CSR2_SDEN | PWR_CSR2_LDOEN) /*!< The SMPS 1.8V output supplies the LDO which supplies the Core domains */ 120 #define PWR_SMPS_1V8_SUPPLIES_EXT_AND_LDO (PWR_CSR2_SDHILEVEL | PWR_CSR2_SMPSEXTHP | PWR_CSR2_SDEN | PWR_CSR2_LDOEN) /*!< The SMPS 1.8V output supplies external circuits and the LDO. The Core domains are supplied from the LDO */ 121 #define PWR_SMPS_1V8_SUPPLIES_EXT (PWR_CSR2_SDHILEVEL | PWR_CSR2_SMPSEXTHP | PWR_CSR2_SDEN | PWR_CSR2_BYPASS) /*!< The SMPS 1.8V output supplies external source which supplies the Core domains */ 122 123 #define PWR_SUPPLY_CONFIG_MASK (PWR_CSR2_SDHILEVEL | PWR_CSR2_SMPSEXTHP | \ 124 PWR_CSR2_SDEN | PWR_CSR2_LDOEN | PWR_CSR2_BYPASS) 125 126 /** 127 * @} 128 */ 129 130 131 /** @defgroup PWREx_AVD_detection_level PWREx AVD detection level 132 * @{ 133 */ 134 #define PWR_AVDLEVEL_1 (0x0U) /*!< Analog voltage detector level 1 : 1V7 */ 135 #define PWR_AVDLEVEL_2 PWR_CR1_ALS_0 /*!< Analog voltage detector level 2 : 2V1 */ 136 #define PWR_AVDLEVEL_3 PWR_CR1_ALS_1 /*!< Analog voltage detector level 3 : 2V5 */ 137 #define PWR_AVDLEVEL_4 (PWR_CR1_ALS_1 | PWR_CR1_ALS_0) /*!< Analog voltage detector level 4 : 2V8 */ 138 139 /** 140 * @} 141 */ 142 143 /** @defgroup PWREx_AVD_Mode PWREx AVD Mode 144 * @{ 145 */ 146 #define PWR_AVD_MODE_NORMAL (0x00000000U) /*!< Basic mode is used */ 147 #define PWR_AVD_MODE_IT_RISING (0x00010001U) /*!< External Interrupt Mode with Rising edge trigger detection */ 148 #define PWR_AVD_MODE_IT_FALLING (0x00010002U) /*!< External Interrupt Mode with Falling edge trigger detection */ 149 #define PWR_AVD_MODE_IT_RISING_FALLING (0x00010003U) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ 150 #define PWR_AVD_MODE_EVENT_RISING (0x00020001U) /*!< Event Mode with Rising edge trigger detection */ 151 #define PWR_AVD_MODE_EVENT_FALLING (0x00020002U) /*!< Event Mode with Falling edge trigger detection */ 152 #define PWR_AVD_MODE_EVENT_RISING_FALLING (0x00020003U) /*!< Event Mode with Rising/Falling edge trigger detection */ 153 /** 154 * @} 155 */ 156 157 /** @defgroup PWREx_Regulator_Voltage_Scale PWREx Regulator Voltage Scale 158 * @{ 159 */ 160 #define PWR_REGULATOR_STOP_VOLTAGE_SCALE3 PWR_CR1_SVOS /*!< System Stop mode voltage scaling range 3 (highest frequency) */ 161 #define PWR_REGULATOR_STOP_VOLTAGE_SCALE5 (0x0U) /*!< System Stop mode voltage scaling range 5 (lowest power) */ 162 163 /** 164 * @} 165 */ 166 167 /** @defgroup PWREx_VBAT_Battery_Charging_Resistor PWR battery charging resistor selection 168 * @{ 169 */ 170 #define PWR_BATTERY_CHARGING_RESISTOR_5 (0x0U) /*!< VBAT charging through a 5 kOhms resistor */ 171 #define PWR_BATTERY_CHARGING_RESISTOR_1_5 PWR_CSR2_VBRS /*!< VBAT charging through a 1.5 kOhms resistor */ 172 /** 173 * @} 174 */ 175 176 /** @defgroup PWREx_VBAT_Thresholds PWREx VBAT Thresholds 177 * @{ 178 */ 179 #define PWR_VBAT_BETWEEN_HIGH_LOW_THRESHOLD (0x0U) 180 #define PWR_VBAT_BELOW_LOW_THRESHOLD PWR_CSR1_VBATL 181 #define PWR_VBAT_ABOVE_HIGH_THRESHOLD PWR_CSR1_VBATH 182 /** 183 * @} 184 */ 185 186 /** @defgroup PWREx_TEMP_Thresholds PWREx Temperature Thresholds 187 * @{ 188 */ 189 #define PWR_TEMP_BETWEEN_HIGH_LOW_THRESHOLD (0x00000000U) 190 #define PWR_TEMP_BELOW_LOW_THRESHOLD PWR_CSR1_TEMPL 191 #define PWR_TEMP_ABOVE_HIGH_THRESHOLD PWR_CSR1_TEMPH 192 /** 193 * @} 194 */ 195 196 /** @defgroup PWREx_CAPACITOR_Port PWREx Capacitor Port 197 * @{ 198 */ 199 #define PWR_CAPACITOR_PORT1 PWR_CSR2_XSPICAP1 200 #define PWR_CAPACITOR_PORT2 PWR_CSR2_XSPICAP2 201 /** 202 * @} 203 */ 204 205 /** @defgroup PWREx_CAPACITOR_Value PWREx Capacitor Value 206 * @{ 207 */ 208 #define PWR_CAPACITOR_OFF (0x0U) 209 #define PWR_CAPACITOR_ONE_THIRD_CAPACITANCE PWR_CSR2_XSPICAP1_0 210 #define PWR_CAPACITOR_TWO_THIRD_CAPACITANCE PWR_CSR2_XSPICAP1_1 211 #define PWR_CAPACITOR_FULL_CAPACITANCE PWR_CSR2_XSPICAP1 212 /** 213 * @} 214 */ 215 216 /** @defgroup PWREx_AVD_EXTI_Line PWREx AVD EXTI Line 16 217 * @{ 218 */ 219 #define PWR_EXTI_LINE_AVD EXTI_IMR1_IM16 /*!< External interrupt line 16 connected to the AVD EXTI Line */ 220 /** 221 * @} 222 */ 223 224 /** @defgroup PWREx_GPIO_PullUp_Port PWR Extended GPIO Pull-Up Port 225 * @{ 226 */ 227 #define PWR_GPIO_PULLUP_PORT_N (0x00U) /*!< GPIO port N */ 228 #define PWR_GPIO_PULLUP_PORT_O (0x01U) /*!< GPIO port O */ 229 /** 230 * @} 231 */ 232 233 /** @defgroup PWREx_GPIO_PullDown_Port PWR Extended GPIO Pull-Down Port 234 * @{ 235 */ 236 #define PWR_GPIO_PULLDOWN_PORT_N (0x00U) /*!< GPIO port N */ 237 #define PWR_GPIO_PULLDOWN_PORT_O (0x01U) /*!< GPIO port O */ 238 #define PWR_GPIO_PULLDOWN_PORT_P (0x02U) /*!< GPIO port P */ 239 /** 240 * @} 241 */ 242 243 /** @defgroup PWREx_GPIO_PullUp_Pin_Mask PWR Extended GPIO Pull-Up Pin Mask 244 * @{ 245 */ 246 #define PWR_GPIO_N_PULLUP_PIN_1 (0x0002U) /*!< GPIO N pin 1 */ 247 #define PWR_GPIO_N_PULLUP_PIN_6 (0x0040U) /*!< GPIO N pin 6 */ 248 #define PWR_GPIO_N_PULLUP_PIN_12 (0x1000U) /*!< GPIO N pin 12 */ 249 250 #define PWR_GPIO_O_PULLUP_PIN_0 (0x0001U) /*!< GPIO O pin 0 */ 251 #define PWR_GPIO_O_PULLUP_PIN_1 (0x0002U) /*!< GPIO O pin 1 */ 252 #define PWR_GPIO_O_PULLUP_PIN_4 (0x0010U) /*!< GPIO O pin 4 */ 253 /** 254 * @} 255 */ 256 257 /** @defgroup PWREx_GPIO_PullDown_Pin_Mask PWR Extended GPIO Pull-Down Pin Mask 258 * @{ 259 */ 260 #define PWR_GPIO_N_PULLDOWN_PIN_0 (0x0001U) /*!< GPIO N pin 0 */ 261 #define PWR_GPIO_N_PULLDOWN_PIN_1 (0x0002U) /*!< GPIO N pin 1 */ 262 #define PWR_GPIO_N_PULLDOWN_PIN_2_5 (0x0004U) /*!< GPIO N pin 2 to 5 */ 263 #define PWR_GPIO_N_PULLDOWN_PIN_6 (0x0040U) /*!< GPIO N pin 6 */ 264 #define PWR_GPIO_N_PULLDOWN_PIN_8_11 (0x0100U) /*!< GPIO N pin 8 to 11 */ 265 #define PWR_GPIO_N_PULLDOWN_PIN_12 (0x1000U) /*!< GPIO N pin 12 */ 266 267 #define PWR_GPIO_O_PULLDOWN_PIN_0 (0x0001U) /*!< GPIO O pin 0 */ 268 #define PWR_GPIO_O_PULLDOWN_PIN_1 (0x0002U) /*!< GPIO O pin 1 */ 269 #define PWR_GPIO_O_PULLDOWN_PIN_2 (0x0004U) /*!< GPIO O pin 2 */ 270 #define PWR_GPIO_O_PULLDOWN_PIN_3 (0x0008U) /*!< GPIO O pin 3 */ 271 #define PWR_GPIO_O_PULLDOWN_PIN_4 (0x0010U) /*!< GPIO O pin 4 */ 272 273 #define PWR_GPIO_P_PULLDOWN_PIN_0_3 (0x0001U) /*!< GPIO P pin 0 to 3 */ 274 #define PWR_GPIO_P_PULLDOWN_PIN_4_7 (0x0010U) /*!< GPIO P pin 4 to 7 */ 275 #define PWR_GPIO_P_PULLDOWN_PIN_8_11 (0x0100U) /*!< GPIO P pin 8 to 11 */ 276 #define PWR_GPIO_P_PULLDOWN_PIN_12_15 (0x1000U) /*!< GPIO P pin 12 to 15 */ 277 /** 278 * @} 279 */ 280 281 /** 282 * @} 283 */ 284 285 /* Exported macro ------------------------------------------------------------*/ 286 287 /** @defgroup PWREx_Exported_Macro PWREx Exported Macro 288 * @{ 289 */ 290 291 /** 292 * @brief Enable the AVD EXTI Line 16. 293 * @retval None. 294 */ 295 #define __HAL_PWR_AVD_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, PWR_EXTI_LINE_AVD) 296 297 /** 298 * @brief Disable the AVD EXTI Line 16 299 * @retval None. 300 */ 301 #define __HAL_PWR_AVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, PWR_EXTI_LINE_AVD) 302 303 /** 304 * @brief Enable event on AVD EXTI Line 16. 305 * @retval None. 306 */ 307 #define __HAL_PWR_AVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, PWR_EXTI_LINE_AVD) 308 309 /** 310 * @brief Disable event on AVD EXTI Line 16. 311 * @retval None. 312 */ 313 #define __HAL_PWR_AVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, PWR_EXTI_LINE_AVD) 314 315 /** 316 * @brief Enable the AVD Extended Interrupt Rising Trigger. 317 * @retval None. 318 */ 319 #define __HAL_PWR_AVD_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR1, PWR_EXTI_LINE_AVD) 320 321 /** 322 * @brief Disable the AVD Extended Interrupt Rising Trigger. 323 * @retval None. 324 */ 325 #define __HAL_PWR_AVD_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR1, PWR_EXTI_LINE_AVD) 326 327 /** 328 * @brief Enable the AVD Extended Interrupt Falling Trigger. 329 * @retval None. 330 */ 331 #define __HAL_PWR_AVD_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR1, PWR_EXTI_LINE_AVD) 332 333 /** 334 * @brief Disable the AVD Extended Interrupt Falling Trigger. 335 * @retval None. 336 */ 337 #define __HAL_PWR_AVD_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR1, PWR_EXTI_LINE_AVD) 338 339 /** 340 * @brief Enable the AVD Extended Interrupt Rising and Falling Trigger. 341 * @retval None. 342 */ 343 #define __HAL_PWR_AVD_EXTI_ENABLE_RISING_FALLING_EDGE() \ 344 do { \ 345 __HAL_PWR_AVD_EXTI_ENABLE_RISING_EDGE(); \ 346 __HAL_PWR_AVD_EXTI_ENABLE_FALLING_EDGE(); \ 347 } while(0); 348 349 /** 350 * @brief Disable the AVD Extended Interrupt Rising & Falling Trigger. 351 * @retval None. 352 */ 353 #define __HAL_PWR_AVD_EXTI_DISABLE_RISING_FALLING_EDGE() \ 354 do { \ 355 __HAL_PWR_AVD_EXTI_DISABLE_RISING_EDGE(); \ 356 __HAL_PWR_AVD_EXTI_DISABLE_FALLING_EDGE(); \ 357 } while(0); 358 359 /** 360 * @brief Check whether the specified AVD EXTI interrupt flag is set or not. 361 * @retval EXTI AVD Line Status. 362 */ 363 #define __HAL_PWR_AVD_EXTI_GET_FLAG() ((READ_BIT(EXTI->PR1, PWR_EXTI_LINE_AVD) == PWR_EXTI_LINE_AVD) ? 1UL : 0UL) 364 365 /** 366 * @brief Clear the AVD EXTI flag. 367 * @retval None. 368 */ 369 #define __HAL_PWR_AVD_EXTI_CLEAR_FLAG() WRITE_REG(EXTI->PR1, PWR_EXTI_LINE_AVD) 370 371 /** 372 * @brief Generates a Software interrupt on AVD EXTI line. 373 * @retval None. 374 */ 375 #define __HAL_PWR_AVD_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER1, PWR_EXTI_LINE_AVD) 376 /** 377 * @} 378 */ 379 380 /* Exported functions --------------------------------------------------------*/ 381 382 /** @addtogroup PWREx_Exported_Functions PWREx Exported Functions 383 * @{ 384 */ 385 386 /** @addtogroup PWREx_Exported_Functions_Group1 Power Supply Control Functions 387 * @{ 388 */ 389 /* Power supply control functions */ 390 HAL_StatusTypeDef HAL_PWREx_ConfigSupply(uint32_t SupplySource); 391 uint32_t HAL_PWREx_GetSupplyConfig(void); 392 393 /* Power voltage scaling functions */ 394 HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling); 395 uint32_t HAL_PWREx_GetVoltageRange(void); 396 HAL_StatusTypeDef HAL_PWREx_ControlStopModeVoltageScaling(uint32_t VoltageScaling); 397 uint32_t HAL_PWREx_GetStopModeVoltageRange(void); 398 /** 399 * @} 400 */ 401 402 /** @addtogroup PWREx_Exported_Functions_Group2 Low Power Control Functions 403 * @{ 404 */ 405 /* Flash low power control functions */ 406 void HAL_PWREx_EnableFlashPowerDown(void); 407 void HAL_PWREx_DisableFlashPowerDown(void); 408 409 /* Wakeup Pins control functions */ 410 void HAL_PWREx_EnableWakeUpPin(const PWREx_WakeupPinTypeDef *sPinParams); 411 void HAL_PWREx_DisableWakeUpPin(uint32_t WakeUpPin); 412 uint32_t HAL_PWREx_GetWakeupFlag(uint32_t WakeUpFlag); 413 HAL_StatusTypeDef HAL_PWREx_ClearWakeupFlag(uint32_t WakeUpFlag); 414 415 /* Power Wakeup PIN IRQ Handler */ 416 void HAL_PWREx_WAKEUP_PIN_IRQHandler(void); 417 void HAL_PWREx_WKUP1_Callback(void); 418 void HAL_PWREx_WKUP2_Callback(void); 419 void HAL_PWREx_WKUP3_Callback(void); 420 void HAL_PWREx_WKUP4_Callback(void); 421 /** 422 * @} 423 */ 424 425 /** @addtogroup PWREx_Exported_Functions_Group3 Peripherals Control Functions 426 * @{ 427 */ 428 /* Backup regulator control functions */ 429 HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void); 430 HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void); 431 432 /* USB regulator control functions */ 433 void HAL_PWREx_EnableUSBReg(void); 434 void HAL_PWREx_DisableUSBReg(void); 435 HAL_StatusTypeDef HAL_PWREx_EnableUSBVoltageDetector(void); 436 HAL_StatusTypeDef HAL_PWREx_DisableUSBVoltageDetector(void); 437 void HAL_PWREx_EnableUSBHSregulator(void); 438 void HAL_PWREx_DisableUSBHSregulator(void); 439 440 /* USB regulator control functions */ 441 void HAL_PWREx_EnableUCPDStandbyMode(void); 442 void HAL_PWREx_DisableUCPDStandbyMode(void); 443 void HAL_PWREx_EnableUCPDDeadBattery(void); 444 void HAL_PWREx_DisableUCPDDeadBattery(void); 445 446 /* Battery control functions */ 447 void HAL_PWREx_EnableBatteryCharging(uint32_t ResistorValue); 448 void HAL_PWREx_DisableBatteryCharging(void); 449 450 /* Analog Booster functions */ 451 void HAL_PWREx_EnableAnalogBooster(void); 452 void HAL_PWREx_DisableAnalogBooster(void); 453 454 /* XSPIM_P1 functions */ 455 void HAL_PWREx_EnableXSPIM1(void); 456 void HAL_PWREx_DisableXSPIM1(void); 457 458 /* XSPIM_P2 functions */ 459 void HAL_PWREx_EnableXSPIM2(void); 460 void HAL_PWREx_DisableXSPIM2(void); 461 462 /* PORT capacitor control functions */ 463 void HAL_PWREx_ConfigXSPIPortCap(uint32_t PortCapacitor, uint32_t PortCapacitorSetting); 464 uint32_t HAL_PWREx_GetConfigXSPIPortCap(uint32_t PortCapacitor); 465 466 /** 467 * @} 468 */ 469 470 /** @addtogroup PWREx_Exported_Functions_Group4 Power Monitoring functions 471 * @{ 472 */ 473 /* Power VBAT/Temperature monitoring functions */ 474 void HAL_PWREx_EnableMonitoring(void); 475 void HAL_PWREx_DisableMonitoring(void); 476 uint32_t HAL_PWREx_GetTemperatureLevel(void); 477 uint32_t HAL_PWREx_GetVBATLevel(void); 478 479 /* Power AVD configuration functions */ 480 void HAL_PWREx_ConfigAVD(const PWREx_AVDTypeDef *sConfigAVD); 481 void HAL_PWREx_EnableAVD(void); 482 void HAL_PWREx_DisableAVD(void); 483 484 /* Power PVD/AVD IRQ Handler */ 485 void HAL_PWREx_PVD_AVD_IRQHandler(void); 486 void HAL_PWREx_PVD_AVD_Callback(void); 487 /** 488 * @} 489 */ 490 491 /** @addtogroup PWREx_Exported_Functions_Group5 I/O Pull-Up Pull-Down Configuration Functions 492 * @{ 493 */ 494 /* GPIO Pull-up Pull-down configuration functions */ 495 void HAL_PWREx_EnablePullUpPullDownConfig(void); 496 void HAL_PWREx_DisablePullUpPullDownConfig(void); 497 498 /* GPIO Pull control functions */ 499 HAL_StatusTypeDef HAL_PWREx_EnableGPIOPullUp(uint32_t GPIO_Port, uint32_t GPIO_Pin); 500 HAL_StatusTypeDef HAL_PWREx_DisableGPIOPullUp(uint32_t GPIO_Port, uint32_t GPIO_Pin); 501 HAL_StatusTypeDef HAL_PWREx_EnableGPIOPullDown(uint32_t GPIO_Port, uint32_t GPIO_Pin); 502 HAL_StatusTypeDef HAL_PWREx_DisableGPIOPullDown(uint32_t GPIO_Port, uint32_t GPIO_Pin); 503 /** 504 * @} 505 */ 506 507 /** 508 * @} 509 */ 510 /* Private types -------------------------------------------------------------*/ 511 /* Private variables ---------------------------------------------------------*/ 512 /* Private constants ---------------------------------------------------------*/ 513 /* Private macros ------------------------------------------------------------*/ 514 /** @defgroup PWREx_Private_Macros PWREx Private Macros 515 * @{ 516 */ 517 518 /** @defgroup PWREx_IS_PWR_Definitions PWREx Private macros to check input parameters 519 * @{ 520 */ 521 /* Check PWR regulator configuration parameter */ 522 #define IS_PWR_SUPPLY(PWR_SOURCE) (((PWR_SOURCE) == PWR_LDO_SUPPLY) ||\ 523 ((PWR_SOURCE) == PWR_DIRECT_SMPS_SUPPLY) ||\ 524 ((PWR_SOURCE) == PWR_SMPS_1V8_SUPPLIES_LDO) ||\ 525 ((PWR_SOURCE) == PWR_SMPS_1V8_SUPPLIES_EXT_AND_LDO) ||\ 526 ((PWR_SOURCE) == PWR_SMPS_1V8_SUPPLIES_EXT) ||\ 527 ((PWR_SOURCE) == PWR_EXTERNAL_SOURCE_SUPPLY)) 528 529 /* Check PWR regulator configuration in STOP mode parameter */ 530 #define IS_PWR_STOP_MODE_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_STOP_VOLTAGE_SCALE3) ||\ 531 ((VOLTAGE) == PWR_REGULATOR_STOP_VOLTAGE_SCALE5)) 532 533 /* Check wake up pin polarity parameter */ 534 #define IS_PWR_WAKEUP_PIN_POLARITY(POLARITY) (((POLARITY) == PWR_PIN_POLARITY_HIGH) ||\ 535 ((POLARITY) == PWR_PIN_POLARITY_LOW)) 536 537 /* Check wake up pin pull configuration parameter */ 538 #define IS_PWR_WAKEUP_PIN_PULL(PULL) (((PULL) == PWR_PIN_NO_PULL) ||\ 539 ((PULL) == PWR_PIN_PULL_UP) ||\ 540 ((PULL) == PWR_PIN_PULL_DOWN)) 541 542 /* Check wake up flag parameter */ 543 #define IS_PWR_WAKEUP_FLAG(FLAG) (((FLAG) == PWR_WAKEUP_FLAG1) ||\ 544 ((FLAG) == PWR_WAKEUP_FLAG2) ||\ 545 ((FLAG) == PWR_WAKEUP_FLAG3) ||\ 546 ((FLAG) == PWR_WAKEUP_FLAG4) ||\ 547 ((FLAG) == PWR_WAKEUP_FLAG_ALL)) 548 549 /* Check wake up flag parameter */ 550 #define IS_PWR_AVD_LEVEL(LEVEL) (((LEVEL) == PWR_AVDLEVEL_1) ||\ 551 ((LEVEL) == PWR_AVDLEVEL_2) ||\ 552 ((LEVEL) == PWR_AVDLEVEL_3) ||\ 553 ((LEVEL) == PWR_AVDLEVEL_4)) 554 555 /* Check AVD mode parameter */ 556 #define IS_PWR_AVD_MODE(MODE) (((MODE) == PWR_AVD_MODE_IT_RISING) ||\ 557 ((MODE) == PWR_AVD_MODE_IT_FALLING) ||\ 558 ((MODE) == PWR_AVD_MODE_IT_RISING_FALLING) ||\ 559 ((MODE) == PWR_AVD_MODE_EVENT_RISING) ||\ 560 ((MODE) == PWR_AVD_MODE_EVENT_FALLING) ||\ 561 ((MODE) == PWR_AVD_MODE_NORMAL) ||\ 562 ((MODE) == PWR_AVD_MODE_EVENT_RISING_FALLING)) 563 564 /* Check resistor battery parameter */ 565 #define IS_PWR_BATTERY_RESISTOR_SELECT(RESISTOR) (((RESISTOR) == PWR_BATTERY_CHARGING_RESISTOR_5) ||\ 566 ((RESISTOR) == PWR_BATTERY_CHARGING_RESISTOR_1_5)) 567 568 /* Check the capacitor port parameter */ 569 #define IS_PWR_CAPACITOR(PORT) (((PORT) == PWR_CAPACITOR_PORT1) || \ 570 ((PORT) == PWR_CAPACITOR_PORT2)) 571 572 /* Check the capacitor port setting parameter */ 573 #define IS_PWR_CAPACITOR_SETTING(SETTING) (((SETTING) == PWR_CAPACITOR_OFF) || \ 574 ((SETTING) == PWR_CAPACITOR_ONE_THIRD_CAPACITANCE) || \ 575 ((SETTING) == PWR_CAPACITOR_TWO_THIRD_CAPACITANCE) || \ 576 ((SETTING) == PWR_CAPACITOR_FULL_CAPACITANCE)) 577 578 /* Check GPIO Pull-Up Port parameter */ 579 #define IS_PWR_GPIO_PULLPUP_PORT(GPIO_PORT) (((GPIO_PORT) == PWR_GPIO_PULLUP_PORT_N) ||\ 580 ((GPIO_PORT) == PWR_GPIO_PULLUP_PORT_O)) 581 582 /* Check GPIO Pull-Down Port parameter */ 583 #define IS_PWR_GPIO_PULLDOWN_PORT(GPIO_PORT) (((GPIO_PORT) == PWR_GPIO_PULLDOWN_PORT_N) ||\ 584 ((GPIO_PORT) == PWR_GPIO_PULLDOWN_PORT_O) ||\ 585 ((GPIO_PORT) == PWR_GPIO_PULLDOWN_PORT_P)) 586 587 /* GPIO pin mask check macro */ 588 #define IS_PWR_GPIO_PIN_MASK(BIT_MASK) ((((BIT_MASK) & GPIO_PIN_MASK) != 0U) && ((BIT_MASK) <= GPIO_PIN_MASK)) 589 /** 590 * @} 591 */ 592 593 /** 594 * @} 595 */ 596 597 /** 598 * @} 599 */ 600 601 /** 602 * @} 603 */ 604 #ifdef __cplusplus 605 } 606 #endif /* __cplusplus */ 607 608 609 #endif /* STM32H7RSxx_HAL_PWR_EX_H */ 610