53 #define PWR_OFFSET (PWR_BASE - PERIPH_BASE)
58 #define CR_OFFSET (PWR_OFFSET + 0x00)
59 #define DBP_BitNumber 0x08
60 #define CR_DBP_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (DBP_BitNumber * 4))
63 #define PVDE_BitNumber 0x04
64 #define CR_PVDE_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (PVDE_BitNumber * 4))
67 #define FPDS_BitNumber 0x09
68 #define CR_FPDS_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (FPDS_BitNumber * 4))
71 #define PMODE_BitNumber 0x0E
72 #define CR_PMODE_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (PMODE_BitNumber * 4))
75 #define ODEN_BitNumber 0x10
76 #define CR_ODEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (ODEN_BitNumber * 4))
79 #define ODSWEN_BitNumber 0x11
80 #define CR_ODSWEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (ODSWEN_BitNumber * 4))
85 #define CSR_OFFSET (PWR_OFFSET + 0x04)
86 #define EWUP_BitNumber 0x08
87 #define CSR_EWUP_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (EWUP_BitNumber * 4))
90 #define BRE_BitNumber 0x09
91 #define CSR_BRE_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (BRE_BitNumber * 4))
96 #define CR_DS_MASK ((uint32_t)0xFFFFF3FC)
97 #define CR_PLS_MASK ((uint32_t)0xFFFFFF1F)
98 #define CR_VOS_MASK ((uint32_t)0xFFFF3FFF)
152 assert_param(IS_FUNCTIONAL_STATE(NewState));
154 *(__IO uint32_t *) CR_DBP_BB = (uint32_t)NewState;
202 assert_param(IS_PWR_PVD_LEVEL(PWR_PVDLevel));
207 tmpreg &= CR_PLS_MASK;
210 tmpreg |= PWR_PVDLevel;
225 assert_param(IS_FUNCTIONAL_STATE(NewState));
227 *(__IO uint32_t *) CR_PVDE_BB = (uint32_t)NewState;
259 assert_param(IS_FUNCTIONAL_STATE(NewState));
261 *(__IO uint32_t *) CSR_EWUP_BB = (uint32_t)NewState;
356 assert_param(IS_FUNCTIONAL_STATE(NewState));
358 *(__IO uint32_t *) CSR_BRE_BB = (uint32_t)NewState;
380 assert_param(IS_PWR_REGULATOR_VOLTAGE(PWR_Regulator_Voltage));
385 tmpreg &= CR_VOS_MASK;
388 tmpreg |= PWR_Regulator_Voltage;
413 assert_param(IS_FUNCTIONAL_STATE(NewState));
416 *(__IO uint32_t *) CR_ODEN_BB = (uint32_t)NewState;
431 assert_param(IS_FUNCTIONAL_STATE(NewState));
434 *(__IO uint32_t *) CR_ODSWEN_BB = (uint32_t)NewState;
458 assert_param(IS_FUNCTIONAL_STATE(NewState));
460 if (NewState != DISABLE)
463 PWR->CR |= (uint32_t)PWR_CR_UDEN;
468 PWR->CR &= (uint32_t)(~PWR_CR_UDEN);
502 assert_param(IS_FUNCTIONAL_STATE(NewState));
504 *(__IO uint32_t *) CR_FPDS_BB = (uint32_t)NewState;
650 assert_param(IS_PWR_REGULATOR(PWR_Regulator));
651 assert_param(IS_PWR_STOP_ENTRY(PWR_STOPEntry));
656 tmpreg &= CR_DS_MASK;
659 tmpreg |= PWR_Regulator;
665 SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
668 if(PWR_STOPEntry == PWR_STOPEntry_WFI)
679 SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP_Msk);
714 assert_param(IS_PWR_REGULATOR_UNDERDRIVE(PWR_Regulator));
715 assert_param(IS_PWR_STOP_ENTRY(PWR_STOPEntry));
720 tmpreg &= CR_DS_MASK;
723 tmpreg |= PWR_Regulator;
729 SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
732 if(PWR_STOPEntry == PWR_STOPEntry_WFI)
743 SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP_Msk);
760 PWR->CR |= PWR_CR_CWUF;
763 PWR->CR |= PWR_CR_PDDS;
766 SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
769 #if defined ( __CC_ARM )
822 FlagStatus bitstatus = RESET;
825 assert_param(IS_PWR_GET_FLAG(PWR_FLAG));
827 if ((PWR->CSR & PWR_FLAG) != (uint32_t)RESET)
851 assert_param(IS_PWR_CLEAR_FLAG(PWR_FLAG));
853 #if defined (STM32F427_437xx) || defined (STM32F429_439xx)
854 if (PWR_FLAG != PWR_FLAG_UDRDY)
856 PWR->CR |= PWR_FLAG << 2;
860 PWR->CSR |= PWR_FLAG_UDRDY;
864 #if defined (STM32F40_41xxx) || defined (STM32F401xx)
865 PWR->CR |= PWR_FLAG << 2;
This file contains all the functions prototypes for the RCC firmware library.
void PWR_EnterSTANDBYMode(void)
Enters STANDBY mode.
void PWR_FlashPowerDownCmd(FunctionalState NewState)
Enables or disables the Flash Power Down in STOP mode.
void PWR_PVDCmd(FunctionalState NewState)
Enables or disables the Power Voltage Detector(PVD).
This file contains all the functions prototypes for the PWR firmware library.
void PWR_OverDriveSWCmd(FunctionalState NewState)
Enables or disables the Over-Drive switching.
void PWR_BackupAccessCmd(FunctionalState NewState)
Enables or disables access to the backup domain (RTC registers, RTC backup data registers and backup ...
void PWR_OverDriveCmd(FunctionalState NewState)
Enables or disables the Over-Drive.
void PWR_UnderDriveCmd(FunctionalState NewState)
Enables or disables the Under-Drive mode.
FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG)
Checks whether the specified PWR flag is set or not.
void PWR_ClearFlag(uint32_t PWR_FLAG)
Clears the PWR's pending flags.
void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel)
Configures the voltage threshold detected by the Power Voltage Detector(PVD).
void PWR_BackupRegulatorCmd(FunctionalState NewState)
Enables or disables the Backup Regulator.
void PWR_EnterUnderDriveSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry)
Enters in Under-Drive STOP mode.
void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
Forces or releases Low Speed APB (APB1) peripheral reset.
void PWR_WakeUpPinCmd(FunctionalState NewState)
Enables or disables the WakeUp Pin functionality.
void PWR_MainRegulatorModeConfig(uint32_t PWR_Regulator_Voltage)
Configures the main internal regulator output voltage.
void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry)
Enters STOP mode.
void PWR_DeInit(void)
Deinitializes the PWR peripheral registers to their default reset values.