Set blackbox file handler to NULL after closing file
[inav.git] / lib / main / STM32F4 / Drivers / STM32F4xx_StdPeriph_Driver / inc / stm32f4xx_pwr.h
blob323649bd2e67317b61ef57040379bc4719f31565
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_pwr.h
4 * @author MCD Application Team
5 * @version V1.7.1
6 * @date 20-May-2016
7 * @brief This file contains all the functions prototypes for the PWR firmware
8 * library.
9 ******************************************************************************
10 * @attention
12 * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 * You may not use this file except in compliance with the License.
16 * You may obtain a copy of the License at:
18 * http://www.st.com/software_license_agreement_liberty_v2
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
26 ******************************************************************************
27 */
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __STM32F4xx_PWR_H
31 #define __STM32F4xx_PWR_H
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f4xx.h"
40 /** @addtogroup STM32F4xx_StdPeriph_Driver
41 * @{
44 /** @addtogroup PWR
45 * @{
46 */
48 /* Exported types ------------------------------------------------------------*/
49 /* Exported constants --------------------------------------------------------*/
51 /** @defgroup PWR_Exported_Constants
52 * @{
53 */
55 /** @defgroup PWR_PVD_detection_level
56 * @{
57 */
58 #define PWR_PVDLevel_0 PWR_CR_PLS_LEV0
59 #define PWR_PVDLevel_1 PWR_CR_PLS_LEV1
60 #define PWR_PVDLevel_2 PWR_CR_PLS_LEV2
61 #define PWR_PVDLevel_3 PWR_CR_PLS_LEV3
62 #define PWR_PVDLevel_4 PWR_CR_PLS_LEV4
63 #define PWR_PVDLevel_5 PWR_CR_PLS_LEV5
64 #define PWR_PVDLevel_6 PWR_CR_PLS_LEV6
65 #define PWR_PVDLevel_7 PWR_CR_PLS_LEV7
67 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \
68 ((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \
69 ((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \
70 ((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7))
71 /**
72 * @}
76 /** @defgroup PWR_Regulator_state_in_STOP_mode
77 * @{
79 #define PWR_MainRegulator_ON ((uint32_t)0x00000000)
80 #define PWR_LowPowerRegulator_ON PWR_CR_LPDS
82 /* --- PWR_Legacy ---*/
83 #define PWR_Regulator_ON PWR_MainRegulator_ON
84 #define PWR_Regulator_LowPower PWR_LowPowerRegulator_ON
86 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MainRegulator_ON) || \
87 ((REGULATOR) == PWR_LowPowerRegulator_ON))
89 /**
90 * @}
93 /** @defgroup PWR_Regulator_state_in_UnderDrive_mode
94 * @{
96 #define PWR_MainRegulator_UnderDrive_ON PWR_CR_MRUDS
97 #define PWR_LowPowerRegulator_UnderDrive_ON ((uint32_t)(PWR_CR_LPDS | PWR_CR_LPUDS))
99 #define IS_PWR_REGULATOR_UNDERDRIVE(REGULATOR) (((REGULATOR) == PWR_MainRegulator_UnderDrive_ON) || \
100 ((REGULATOR) == PWR_LowPowerRegulator_UnderDrive_ON))
103 * @}
105 #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F446xx)
106 /** @defgroup PWR_Wake_Up_Pin
107 * @{
109 #define PWR_WakeUp_Pin1 ((uint32_t)0x00)
110 #define PWR_WakeUp_Pin2 ((uint32_t)0x01)
111 #if defined(STM32F410xx) || defined(STM32F412xG)
112 #define PWR_WakeUp_Pin3 ((uint32_t)0x02)
113 #endif /* STM32F410xx || STM32F412xG */
115 #if defined(STM32F446xx)
116 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WakeUp_Pin1) || \
117 ((PIN) == PWR_WakeUp_Pin2))
118 #else /* STM32F410xx || STM32F412xG */
119 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WakeUp_Pin1) || ((PIN) == PWR_WakeUp_Pin2) || \
120 ((PIN) == PWR_WakeUp_Pin3))
121 #endif /* STM32F446xx */
123 * @}
125 #endif /* STM32F410xx || STM32F412xG || STM32F446xx */
127 /** @defgroup PWR_STOP_mode_entry
128 * @{
130 #define PWR_STOPEntry_WFI ((uint8_t)0x01)
131 #define PWR_STOPEntry_WFE ((uint8_t)0x02)
132 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
134 * @}
137 /** @defgroup PWR_Regulator_Voltage_Scale
138 * @{
140 #define PWR_Regulator_Voltage_Scale1 ((uint32_t)0x0000C000)
141 #define PWR_Regulator_Voltage_Scale2 ((uint32_t)0x00008000)
142 #define PWR_Regulator_Voltage_Scale3 ((uint32_t)0x00004000)
143 #define IS_PWR_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_Regulator_Voltage_Scale1) || \
144 ((VOLTAGE) == PWR_Regulator_Voltage_Scale2) || \
145 ((VOLTAGE) == PWR_Regulator_Voltage_Scale3))
147 * @}
150 /** @defgroup PWR_Flag
151 * @{
153 #define PWR_FLAG_WU PWR_CSR_WUF
154 #define PWR_FLAG_SB PWR_CSR_SBF
155 #define PWR_FLAG_PVDO PWR_CSR_PVDO
156 #define PWR_FLAG_BRR PWR_CSR_BRR
157 #define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY
158 #define PWR_FLAG_ODRDY PWR_CSR_ODRDY
159 #define PWR_FLAG_ODSWRDY PWR_CSR_ODSWRDY
160 #define PWR_FLAG_UDRDY PWR_CSR_UDSWRDY
162 /* --- FLAG Legacy ---*/
163 #define PWR_FLAG_REGRDY PWR_FLAG_VOSRDY
165 #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
166 ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_BRR) || \
167 ((FLAG) == PWR_FLAG_VOSRDY) || ((FLAG) == PWR_FLAG_ODRDY) || \
168 ((FLAG) == PWR_FLAG_ODSWRDY) || ((FLAG) == PWR_FLAG_UDRDY))
171 #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
172 ((FLAG) == PWR_FLAG_UDRDY))
175 * @}
179 * @}
182 /* Exported macro ------------------------------------------------------------*/
183 /* Exported functions --------------------------------------------------------*/
185 /* Function used to set the PWR configuration to the default reset state ******/
186 void PWR_DeInit(void);
188 /* Backup Domain Access function **********************************************/
189 void PWR_BackupAccessCmd(FunctionalState NewState);
191 /* PVD configuration functions ************************************************/
192 void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
193 void PWR_PVDCmd(FunctionalState NewState);
195 /* WakeUp pins configuration functions ****************************************/
196 #if defined(STM32F40_41xxx) || defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F401xx) || defined(STM32F411xE)
197 void PWR_WakeUpPinCmd(FunctionalState NewState);
198 #endif /* STM32F40_41xxx || STM32F427_437xx || STM32F429_439xx || STM32F401xx || STM32F411xE */
199 #if defined(STM32F410xx) || defined(STM32F412xG) ||defined(STM32F446xx)
200 void PWR_WakeUpPinCmd(uint32_t PWR_WakeUpPinx, FunctionalState NewState);
201 #endif /* STM32F410xx || STM32F412xG || STM32F446xx */
202 /* Main and Backup Regulators configuration functions *************************/
203 void PWR_BackupRegulatorCmd(FunctionalState NewState);
204 void PWR_MainRegulatorModeConfig(uint32_t PWR_Regulator_Voltage);
205 void PWR_OverDriveCmd(FunctionalState NewState);
206 void PWR_OverDriveSWCmd(FunctionalState NewState);
207 void PWR_UnderDriveCmd(FunctionalState NewState);
209 #if defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F446xx)
210 void PWR_MainRegulatorUnderDriveCmd(FunctionalState NewState);
211 void PWR_LowRegulatorUnderDriveCmd(FunctionalState NewState);
212 #endif /* STM32F427_437xx || STM32F429_439xx || STM32F446xx */
214 #if defined(STM32F401xx) || defined(STM32F410xx) || defined(STM32F411xE) || defined(STM32F412xG)
215 void PWR_MainRegulatorLowVoltageCmd(FunctionalState NewState);
216 void PWR_LowRegulatorLowVoltageCmd(FunctionalState NewState);
217 #endif /* STM32F401xx || STM32F410xx || STM32F411xE || STM32F412xG */
219 /* FLASH Power Down configuration functions ***********************************/
220 void PWR_FlashPowerDownCmd(FunctionalState NewState);
222 /* Low Power modes configuration functions ************************************/
223 void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
224 void PWR_EnterUnderDriveSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
225 void PWR_EnterSTANDBYMode(void);
227 /* Flags management functions *************************************************/
228 FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
229 void PWR_ClearFlag(uint32_t PWR_FLAG);
231 #ifdef __cplusplus
233 #endif
235 #endif /* __STM32F4xx_PWR_H */
238 * @}
242 * @}
245 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/