19#ifndef __STM32F4xx_HAL_PWR_EX_H
20#define __STM32F4xx_HAL_PWR_EX_H
42#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
43 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
48#define PWR_MAINREGULATOR_UNDERDRIVE_ON PWR_CR_MRUDS
49#define PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON ((uint32_t)(PWR_CR_LPDS | PWR_CR_LPUDS))
57#define PWR_FLAG_ODRDY PWR_CSR_ODRDY
58#define PWR_FLAG_ODSWRDY PWR_CSR_ODSWRDY
59#define PWR_FLAG_UDRDY PWR_CSR_UDSWRDY
68#if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
69#define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR_VOS
70#define PWR_REGULATOR_VOLTAGE_SCALE2 0x00000000U
72#define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR_VOS
74#define PWR_REGULATOR_VOLTAGE_SCALE2 PWR_CR_VOS_1
76#define PWR_REGULATOR_VOLTAGE_SCALE3 PWR_CR_VOS_0
81#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
82 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
86#define PWR_WAKEUP_PIN2 0x00000080U
87#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
88 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
89#define PWR_WAKEUP_PIN3 0x00000040U
107#if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
117#define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \
118 __IO uint32_t tmpreg = 0x00U; \
119 MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \
121 tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \
135#define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \
136 __IO uint32_t tmpreg = 0x00U; \
137 MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \
139 tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \
144#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
145 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
149#define __HAL_PWR_OVERDRIVE_ENABLE() (*(__IO uint32_t *) CR_ODEN_BB = ENABLE)
150#define __HAL_PWR_OVERDRIVE_DISABLE() (*(__IO uint32_t *) CR_ODEN_BB = DISABLE)
155#define __HAL_PWR_OVERDRIVESWITCHING_ENABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = ENABLE)
156#define __HAL_PWR_OVERDRIVESWITCHING_DISABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = DISABLE)
168#define __HAL_PWR_UNDERDRIVE_ENABLE() (PWR->CR |= (uint32_t)PWR_CR_UDEN)
169#define __HAL_PWR_UNDERDRIVE_DISABLE() (PWR->CR &= (uint32_t)(~PWR_CR_UDEN))
183#define __HAL_PWR_GET_ODRUDR_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
188#define __HAL_PWR_CLEAR_ODRUDR_FLAG() (PWR->CSR |= PWR_FLAG_UDRDY)
210#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F401xC) ||\
211 defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\
212 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
213void HAL_PWREx_EnableMainRegulatorLowVoltage(
void);
214void HAL_PWREx_DisableMainRegulatorLowVoltage(
void);
215void HAL_PWREx_EnableLowRegulatorLowVoltage(
void);
216void HAL_PWREx_DisableLowRegulatorLowVoltage(
void);
220#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) ||\
221 defined(STM32F469xx) || defined(STM32F479xx)
247#define FPDS_BIT_NUMBER PWR_CR_FPDS_Pos
248#define CR_FPDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (FPDS_BIT_NUMBER * 4U))
251#define ODEN_BIT_NUMBER PWR_CR_ODEN_Pos
252#define CR_ODEN_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (ODEN_BIT_NUMBER * 4U))
255#define ODSWEN_BIT_NUMBER PWR_CR_ODSWEN_Pos
256#define CR_ODSWEN_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (ODSWEN_BIT_NUMBER * 4U))
259#define MRLVDS_BIT_NUMBER PWR_CR_MRLVDS_Pos
260#define CR_MRLVDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (MRLVDS_BIT_NUMBER * 4U))
263#define LPLVDS_BIT_NUMBER PWR_CR_LPLVDS_Pos
264#define CR_LPLVDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (LPLVDS_BIT_NUMBER * 4U))
275#define BRE_BIT_NUMBER PWR_CSR_BRE_Pos
276#define CSR_BRE_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32U) + (BRE_BIT_NUMBER * 4U))
294#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
295 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
296#define IS_PWR_REGULATOR_UNDERDRIVE(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_UNDERDRIVE_ON) || \
297 ((REGULATOR) == PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON))
300#if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
301#define IS_PWR_VOLTAGE_SCALING_RANGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
302 ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2))
304#define IS_PWR_VOLTAGE_SCALING_RANGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
305 ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2) || \
306 ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE3))
309#if defined(STM32F446xx)
310#define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2))
311#elif defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) ||\
312 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
314#define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2) || \
315 ((PIN) == PWR_WAKEUP_PIN3))
317#define IS_PWR_WAKEUP_PIN(PIN) ((PIN) == PWR_WAKEUP_PIN1)
void HAL_PWREx_DisableFlashPowerDown(void)
Disables the Flash Power Down in Stop mode.
HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling)
Configures the main internal regulator output voltage.
HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void)
Enables the Backup Regulator.
uint32_t HAL_PWREx_GetVoltageRange(void)
Return Voltage Scaling Range.
HAL_StatusTypeDef HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry)
Enters in Under-Drive STOP mode.
HAL_StatusTypeDef HAL_PWREx_DisableOverDrive(void)
Deactivates the Over-Drive mode.
void HAL_PWREx_EnableFlashPowerDown(void)
Enables the Flash Power Down in Stop mode.
HAL_StatusTypeDef HAL_PWREx_EnableOverDrive(void)
Activates the Over-Drive mode.
HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void)
Disables the Backup Regulator.
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition