Go to the documentation of this file.
21 #ifndef __STM32F4xx_HAL_PWR_EX_H
22 #define __STM32F4xx_HAL_PWR_EX_H
44 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
45 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
50 #define PWR_MAINREGULATOR_UNDERDRIVE_ON PWR_CR_MRUDS
51 #define PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON ((uint32_t)(PWR_CR_LPDS | PWR_CR_LPUDS))
59 #define PWR_FLAG_ODRDY PWR_CSR_ODRDY
60 #define PWR_FLAG_ODSWRDY PWR_CSR_ODSWRDY
61 #define PWR_FLAG_UDRDY PWR_CSR_UDSWRDY
70 #if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
71 #define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR_VOS
72 #define PWR_REGULATOR_VOLTAGE_SCALE2 0x00000000U
74 #define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR_VOS
76 #define PWR_REGULATOR_VOLTAGE_SCALE2 PWR_CR_VOS_1
78 #define PWR_REGULATOR_VOLTAGE_SCALE3 PWR_CR_VOS_0
83 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
84 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
88 #define PWR_WAKEUP_PIN2 0x00000080U
89 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
90 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
91 #define PWR_WAKEUP_PIN3 0x00000040U
109 #if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
119 #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \
120 __IO uint32_t tmpreg = 0x00U; \
121 MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \
123 tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \
137 #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \
138 __IO uint32_t tmpreg = 0x00U; \
139 MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \
141 tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \
146 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
147 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
151 #define __HAL_PWR_OVERDRIVE_ENABLE() (*(__IO uint32_t *) CR_ODEN_BB = ENABLE)
152 #define __HAL_PWR_OVERDRIVE_DISABLE() (*(__IO uint32_t *) CR_ODEN_BB = DISABLE)
157 #define __HAL_PWR_OVERDRIVESWITCHING_ENABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = ENABLE)
158 #define __HAL_PWR_OVERDRIVESWITCHING_DISABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = DISABLE)
170 #define __HAL_PWR_UNDERDRIVE_ENABLE() (PWR->CR |= (uint32_t)PWR_CR_UDEN)
171 #define __HAL_PWR_UNDERDRIVE_DISABLE() (PWR->CR &= (uint32_t)(~PWR_CR_UDEN))
185 #define __HAL_PWR_GET_ODRUDR_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
190 #define __HAL_PWR_CLEAR_ODRUDR_FLAG() (PWR->CSR |= PWR_FLAG_UDRDY)
212 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F401xC) ||\
213 defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\
214 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
222 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) ||\
223 defined(STM32F469xx) || defined(STM32F479xx)
249 #define FPDS_BIT_NUMBER PWR_CR_FPDS_Pos
250 #define CR_FPDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (FPDS_BIT_NUMBER * 4U))
253 #define ODEN_BIT_NUMBER PWR_CR_ODEN_Pos
254 #define CR_ODEN_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (ODEN_BIT_NUMBER * 4U))
257 #define ODSWEN_BIT_NUMBER PWR_CR_ODSWEN_Pos
258 #define CR_ODSWEN_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (ODSWEN_BIT_NUMBER * 4U))
261 #define MRLVDS_BIT_NUMBER PWR_CR_MRLVDS_Pos
262 #define CR_MRLVDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (MRLVDS_BIT_NUMBER * 4U))
265 #define LPLVDS_BIT_NUMBER PWR_CR_LPLVDS_Pos
266 #define CR_LPLVDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (LPLVDS_BIT_NUMBER * 4U))
277 #define BRE_BIT_NUMBER PWR_CSR_BRE_Pos
278 #define CSR_BRE_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32U) + (BRE_BIT_NUMBER * 4U))
296 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
297 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
298 #define IS_PWR_REGULATOR_UNDERDRIVE(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_UNDERDRIVE_ON) || \
299 ((REGULATOR) == PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON))
302 #if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
303 #define IS_PWR_VOLTAGE_SCALING_RANGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
304 ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2))
306 #define IS_PWR_VOLTAGE_SCALING_RANGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
307 ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2) || \
308 ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE3))
311 #if defined(STM32F446xx)
312 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2))
313 #elif defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) ||\
314 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
316 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2) || \
317 ((PIN) == PWR_WAKEUP_PIN3))
319 #define IS_PWR_WAKEUP_PIN(PIN) ((PIN) == PWR_WAKEUP_PIN1)
HAL_StatusTypeDef
HAL Status structures definition
HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void)
HAL_StatusTypeDef HAL_PWREx_EnableOverDrive(void)
void HAL_PWREx_EnableLowRegulatorLowVoltage(void)
HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void)
HAL_StatusTypeDef HAL_PWREx_DisableOverDrive(void)
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry)
void HAL_PWREx_EnableFlashPowerDown(void)
void HAL_PWREx_DisableFlashPowerDown(void)
void HAL_PWREx_DisableMainRegulatorLowVoltage(void)
uint32_t HAL_PWREx_GetVoltageRange(void)
void HAL_PWREx_DisableLowRegulatorLowVoltage(void)
void HAL_PWREx_EnableMainRegulatorLowVoltage(void)
HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling)