00001
00029
00030 #ifndef __STM32F4xx_PWR_H
00031 #define __STM32F4xx_PWR_H
00032
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036
00037
00038 #include "stm32f4xx.h"
00039
00048
00049
00050
00059 #define PWR_PVDLevel_0 PWR_CR_PLS_LEV0
00060 #define PWR_PVDLevel_1 PWR_CR_PLS_LEV1
00061 #define PWR_PVDLevel_2 PWR_CR_PLS_LEV2
00062 #define PWR_PVDLevel_3 PWR_CR_PLS_LEV3
00063 #define PWR_PVDLevel_4 PWR_CR_PLS_LEV4
00064 #define PWR_PVDLevel_5 PWR_CR_PLS_LEV5
00065 #define PWR_PVDLevel_6 PWR_CR_PLS_LEV6
00066 #define PWR_PVDLevel_7 PWR_CR_PLS_LEV7
00067
00068 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \
00069 ((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \
00070 ((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \
00071 ((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7))
00072
00081 #define PWR_Regulator_ON ((uint32_t)0x00000000)
00082 #define PWR_Regulator_LowPower PWR_CR_LPDS
00083 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
00084 ((REGULATOR) == PWR_Regulator_LowPower))
00085
00093 #define PWR_STOPEntry_WFI ((uint8_t)0x01)
00094 #define PWR_STOPEntry_WFE ((uint8_t)0x02)
00095 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
00096
00101 #define PWR_Regulator_Voltage_Scale1 ((uint32_t)0x00004000)
00102 #define PWR_Regulator_Voltage_Scale2 ((uint32_t)0x00000000)
00103 #define IS_PWR_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_Regulator_Voltage_Scale1) || ((VOLTAGE) == PWR_Regulator_Voltage_Scale2))
00104
00113 #define PWR_FLAG_WU PWR_CSR_WUF
00114 #define PWR_FLAG_SB PWR_CSR_SBF
00115 #define PWR_FLAG_PVDO PWR_CSR_PVDO
00116 #define PWR_FLAG_BRR PWR_CSR_BRR
00117 #define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY
00118
00122 #define PWR_FLAG_REGRDY PWR_FLAG_VOSRDY
00123
00127 #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
00128 ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_BRR) || \
00129 ((FLAG) == PWR_FLAG_VOSRDY))
00130
00131 #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
00132
00140
00141
00142
00143
00144 void PWR_DeInit(void);
00145
00146
00147 void PWR_BackupAccessCmd(FunctionalState NewState);
00148
00149
00150 void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
00151 void PWR_PVDCmd(FunctionalState NewState);
00152
00153
00154 void PWR_WakeUpPinCmd(FunctionalState NewState);
00155
00156
00157 void PWR_BackupRegulatorCmd(FunctionalState NewState);
00158 void PWR_MainRegulatorModeConfig(uint32_t PWR_Regulator_Voltage);
00159
00160
00161 void PWR_FlashPowerDownCmd(FunctionalState NewState);
00162
00163
00164 void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
00165 void PWR_EnterSTANDBYMode(void);
00166
00167
00168 FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
00169 void PWR_ClearFlag(uint32_t PWR_FLAG);
00170
00171 #ifdef __cplusplus
00172 }
00173 #endif
00174
00175 #endif
00176
00185