2 ******************************************************************************
\r
3 * @file stm32f4xx_pwr.h
\r
4 * @author MCD Application Team
\r
6 * @date 30-September-2011
\r
7 * @brief This file contains all the functions prototypes for the PWR firmware
\r
9 ******************************************************************************
\r
12 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
\r
13 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
\r
14 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
\r
15 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
\r
16 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
\r
17 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
\r
19 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
\r
20 ******************************************************************************
\r
23 /* Define to prevent recursive inclusion -------------------------------------*/
\r
24 #ifndef __STM32F4xx_PWR_H
\r
25 #define __STM32F4xx_PWR_H
\r
31 /* Includes ------------------------------------------------------------------*/
\r
32 #include "stm32f4xx.h"
\r
34 /** @addtogroup STM32F4xx_StdPeriph_Driver
\r
42 /* Exported types ------------------------------------------------------------*/
\r
43 /* Exported constants --------------------------------------------------------*/
\r
45 /** @defgroup PWR_Exported_Constants
\r
49 /** @defgroup PWR_PVD_detection_level
\r
53 #define PWR_PVDLevel_0 PWR_CR_PLS_LEV0
\r
54 #define PWR_PVDLevel_1 PWR_CR_PLS_LEV1
\r
55 #define PWR_PVDLevel_2 PWR_CR_PLS_LEV2
\r
56 #define PWR_PVDLevel_3 PWR_CR_PLS_LEV3
\r
57 #define PWR_PVDLevel_4 PWR_CR_PLS_LEV4
\r
58 #define PWR_PVDLevel_5 PWR_CR_PLS_LEV5
\r
59 #define PWR_PVDLevel_6 PWR_CR_PLS_LEV6
\r
60 #define PWR_PVDLevel_7 PWR_CR_PLS_LEV7
\r
62 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \
\r
63 ((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \
\r
64 ((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \
\r
65 ((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7))
\r
71 /** @defgroup PWR_Regulator_state_in_STOP_mode
\r
75 #define PWR_Regulator_ON ((uint32_t)0x00000000)
\r
76 #define PWR_Regulator_LowPower PWR_CR_LPDS
\r
77 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
\r
78 ((REGULATOR) == PWR_Regulator_LowPower))
\r
83 /** @defgroup PWR_STOP_mode_entry
\r
87 #define PWR_STOPEntry_WFI ((uint8_t)0x01)
\r
88 #define PWR_STOPEntry_WFE ((uint8_t)0x02)
\r
89 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
\r
91 /** @defgroup PWR_Regulator_Voltage_Scale
\r
95 #define PWR_Regulator_Voltage_Scale1 ((uint32_t)0x00004000)
\r
96 #define PWR_Regulator_Voltage_Scale2 ((uint32_t)0x00000000)
\r
97 #define IS_PWR_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_Regulator_Voltage_Scale1) || ((VOLTAGE) == PWR_Regulator_Voltage_Scale2))
\r
103 /** @defgroup PWR_Flag
\r
107 #define PWR_FLAG_WU PWR_CSR_WUF
\r
108 #define PWR_FLAG_SB PWR_CSR_SBF
\r
109 #define PWR_FLAG_PVDO PWR_CSR_PVDO
\r
110 #define PWR_FLAG_BRR PWR_CSR_BRR
\r
111 #define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY
\r
113 /** @defgroup PWR_Flag_Legacy
\r
116 #define PWR_FLAG_REGRDY PWR_FLAG_VOSRDY
\r
121 #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
\r
122 ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_BRR) || \
\r
123 ((FLAG) == PWR_FLAG_VOSRDY))
\r
125 #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
\r
134 /* Exported macro ------------------------------------------------------------*/
\r
135 /* Exported functions --------------------------------------------------------*/
\r
137 /* Function used to set the PWR configuration to the default reset state ******/
\r
138 void PWR_DeInit(void);
\r
140 /* Backup Domain Access function **********************************************/
\r
141 void PWR_BackupAccessCmd(FunctionalState NewState);
\r
143 /* PVD configuration functions ************************************************/
\r
144 void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
\r
145 void PWR_PVDCmd(FunctionalState NewState);
\r
147 /* WakeUp pins configuration functions ****************************************/
\r
148 void PWR_WakeUpPinCmd(FunctionalState NewState);
\r
150 /* Main and Backup Regulators configuration functions *************************/
\r
151 void PWR_BackupRegulatorCmd(FunctionalState NewState);
\r
152 void PWR_MainRegulatorModeConfig(uint32_t PWR_Regulator_Voltage);
\r
154 /* FLASH Power Down configuration functions ***********************************/
\r
155 void PWR_FlashPowerDownCmd(FunctionalState NewState);
\r
157 /* Low Power modes configuration functions ************************************/
\r
158 void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
\r
159 void PWR_EnterSTANDBYMode(void);
\r
161 /* Flags management functions *************************************************/
\r
162 FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
\r
163 void PWR_ClearFlag(uint32_t PWR_FLAG);
\r
169 #endif /* __STM32F4xx_PWR_H */
\r
179 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
\r