2 ******************************************************************************
\r
3 * @file stm32f7xx_hal_pwr_ex.h
\r
4 * @author MCD Application Team
\r
5 * @brief Header file of PWR HAL Extension module.
\r
6 ******************************************************************************
\r
9 * <h2><center>© Copyright (c) 2017 STMicroelectronics.
\r
10 * All rights reserved.</center></h2>
\r
12 * This software component is licensed by ST under BSD 3-Clause license,
\r
13 * the "License"; You may not use this file except in compliance with the
\r
14 * License. You may obtain a copy of the License at:
\r
15 * opensource.org/licenses/BSD-3-Clause
\r
17 ******************************************************************************
\r
20 /* Define to prevent recursive inclusion -------------------------------------*/
\r
21 #ifndef __STM32F7xx_HAL_PWR_EX_H
\r
22 #define __STM32F7xx_HAL_PWR_EX_H
\r
28 /* Includes ------------------------------------------------------------------*/
\r
29 #include "stm32f7xx_hal_def.h"
\r
31 /** @addtogroup STM32F7xx_HAL_Driver
\r
35 /** @addtogroup PWREx
\r
39 /* Exported types ------------------------------------------------------------*/
\r
40 /* Exported constants --------------------------------------------------------*/
\r
41 /** @defgroup PWREx_Exported_Constants PWREx Exported Constants
\r
44 /** @defgroup PWREx_WakeUp_Pins PWREx Wake Up Pins
\r
47 #define PWR_WAKEUP_PIN1 PWR_CSR2_EWUP1
\r
48 #define PWR_WAKEUP_PIN2 PWR_CSR2_EWUP2
\r
49 #define PWR_WAKEUP_PIN3 PWR_CSR2_EWUP3
\r
50 #define PWR_WAKEUP_PIN4 PWR_CSR2_EWUP4
\r
51 #define PWR_WAKEUP_PIN5 PWR_CSR2_EWUP5
\r
52 #define PWR_WAKEUP_PIN6 PWR_CSR2_EWUP6
\r
53 #define PWR_WAKEUP_PIN1_HIGH PWR_CSR2_EWUP1
\r
54 #define PWR_WAKEUP_PIN2_HIGH PWR_CSR2_EWUP2
\r
55 #define PWR_WAKEUP_PIN3_HIGH PWR_CSR2_EWUP3
\r
56 #define PWR_WAKEUP_PIN4_HIGH PWR_CSR2_EWUP4
\r
57 #define PWR_WAKEUP_PIN5_HIGH PWR_CSR2_EWUP5
\r
58 #define PWR_WAKEUP_PIN6_HIGH PWR_CSR2_EWUP6
\r
59 #define PWR_WAKEUP_PIN1_LOW (uint32_t)((PWR_CR2_WUPP1<<6) | PWR_CSR2_EWUP1)
\r
60 #define PWR_WAKEUP_PIN2_LOW (uint32_t)((PWR_CR2_WUPP2<<6) | PWR_CSR2_EWUP2)
\r
61 #define PWR_WAKEUP_PIN3_LOW (uint32_t)((PWR_CR2_WUPP3<<6) | PWR_CSR2_EWUP3)
\r
62 #define PWR_WAKEUP_PIN4_LOW (uint32_t)((PWR_CR2_WUPP4<<6) | PWR_CSR2_EWUP4)
\r
63 #define PWR_WAKEUP_PIN5_LOW (uint32_t)((PWR_CR2_WUPP5<<6) | PWR_CSR2_EWUP5)
\r
64 #define PWR_WAKEUP_PIN6_LOW (uint32_t)((PWR_CR2_WUPP6<<6) | PWR_CSR2_EWUP6)
\r
70 /** @defgroup PWREx_Regulator_state_in_UnderDrive_mode PWREx Regulator state in UnderDrive mode
\r
73 #define PWR_MAINREGULATOR_UNDERDRIVE_ON PWR_CR1_MRUDS
\r
74 #define PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON ((uint32_t)(PWR_CR1_LPDS | PWR_CR1_LPUDS))
\r
79 /** @defgroup PWREx_Over_Under_Drive_Flag PWREx Over Under Drive Flag
\r
82 #define PWR_FLAG_ODRDY PWR_CSR1_ODRDY
\r
83 #define PWR_FLAG_ODSWRDY PWR_CSR1_ODSWRDY
\r
84 #define PWR_FLAG_UDRDY PWR_CSR1_UDRDY
\r
89 /** @defgroup PWREx_Wakeup_Pins_Flag PWREx Wake Up Pin Flags
\r
92 #define PWR_WAKEUP_PIN_FLAG1 PWR_CSR2_WUPF1
\r
93 #define PWR_WAKEUP_PIN_FLAG2 PWR_CSR2_WUPF2
\r
94 #define PWR_WAKEUP_PIN_FLAG3 PWR_CSR2_WUPF3
\r
95 #define PWR_WAKEUP_PIN_FLAG4 PWR_CSR2_WUPF4
\r
96 #define PWR_WAKEUP_PIN_FLAG5 PWR_CSR2_WUPF5
\r
97 #define PWR_WAKEUP_PIN_FLAG6 PWR_CSR2_WUPF6
\r
106 /* Exported macro ------------------------------------------------------------*/
\r
107 /** @defgroup PWREx_Exported_Macro PWREx Exported Macro
\r
110 /** @brief Macros to enable or disable the Over drive mode.
\r
112 #define __HAL_PWR_OVERDRIVE_ENABLE() (PWR->CR1 |= (uint32_t)PWR_CR1_ODEN)
\r
113 #define __HAL_PWR_OVERDRIVE_DISABLE() (PWR->CR1 &= (uint32_t)(~PWR_CR1_ODEN))
\r
115 /** @brief Macros to enable or disable the Over drive switching.
\r
117 #define __HAL_PWR_OVERDRIVESWITCHING_ENABLE() (PWR->CR1 |= (uint32_t)PWR_CR1_ODSWEN)
\r
118 #define __HAL_PWR_OVERDRIVESWITCHING_DISABLE() (PWR->CR1 &= (uint32_t)(~PWR_CR1_ODSWEN))
\r
120 /** @brief Macros to enable or disable the Under drive mode.
\r
121 * @note This mode is enabled only with STOP low power mode.
\r
122 * In this mode, the 1.2V domain is preserved in reduced leakage mode. This
\r
123 * mode is only available when the main regulator or the low power regulator
\r
124 * is in low voltage mode.
\r
125 * @note If the Under-drive mode was enabled, it is automatically disabled after
\r
126 * exiting Stop mode.
\r
127 * When the voltage regulator operates in Under-drive mode, an additional
\r
128 * startup delay is induced when waking up from Stop mode.
\r
130 #define __HAL_PWR_UNDERDRIVE_ENABLE() (PWR->CR1 |= (uint32_t)PWR_CR1_UDEN)
\r
131 #define __HAL_PWR_UNDERDRIVE_DISABLE() (PWR->CR1 &= (uint32_t)(~PWR_CR1_UDEN))
\r
133 /** @brief Check PWR flag is set or not.
\r
134 * @param __FLAG__ specifies the flag to check.
\r
135 * This parameter can be one of the following values:
\r
136 * @arg PWR_FLAG_ODRDY: This flag indicates that the Over-drive mode
\r
138 * @arg PWR_FLAG_ODSWRDY: This flag indicates that the Over-drive mode
\r
139 * switching is ready
\r
140 * @arg PWR_FLAG_UDRDY: This flag indicates that the Under-drive mode
\r
141 * is enabled in Stop mode
\r
142 * @retval The new state of __FLAG__ (TRUE or FALSE).
\r
144 #define __HAL_PWR_GET_ODRUDR_FLAG(__FLAG__) ((PWR->CSR1 & (__FLAG__)) == (__FLAG__))
\r
146 /** @brief Clear the Under-Drive Ready flag.
\r
148 #define __HAL_PWR_CLEAR_ODRUDR_FLAG() (PWR->CSR1 |= PWR_FLAG_UDRDY)
\r
150 /** @brief Check Wake Up flag is set or not.
\r
151 * @param __WUFLAG__ specifies the Wake Up flag to check.
\r
152 * This parameter can be one of the following values:
\r
153 * @arg PWR_WAKEUP_PIN_FLAG1: Wakeup Pin Flag for PA0
\r
154 * @arg PWR_WAKEUP_PIN_FLAG2: Wakeup Pin Flag for PA2
\r
155 * @arg PWR_WAKEUP_PIN_FLAG3: Wakeup Pin Flag for PC1
\r
156 * @arg PWR_WAKEUP_PIN_FLAG4: Wakeup Pin Flag for PC13
\r
157 * @arg PWR_WAKEUP_PIN_FLAG5: Wakeup Pin Flag for PI8
\r
158 * @arg PWR_WAKEUP_PIN_FLAG6: Wakeup Pin Flag for PI11
\r
160 #define __HAL_PWR_GET_WAKEUP_FLAG(__WUFLAG__) (PWR->CSR2 & (__WUFLAG__))
\r
162 /** @brief Clear the WakeUp pins flags.
\r
163 * @param __WUFLAG__ specifies the Wake Up pin flag to clear.
\r
164 * This parameter can be one of the following values:
\r
165 * @arg PWR_WAKEUP_PIN_FLAG1: Wakeup Pin Flag for PA0
\r
166 * @arg PWR_WAKEUP_PIN_FLAG2: Wakeup Pin Flag for PA2
\r
167 * @arg PWR_WAKEUP_PIN_FLAG3: Wakeup Pin Flag for PC1
\r
168 * @arg PWR_WAKEUP_PIN_FLAG4: Wakeup Pin Flag for PC13
\r
169 * @arg PWR_WAKEUP_PIN_FLAG5: Wakeup Pin Flag for PI8
\r
170 * @arg PWR_WAKEUP_PIN_FLAG6: Wakeup Pin Flag for PI11
\r
172 #define __HAL_PWR_CLEAR_WAKEUP_FLAG(__WUFLAG__) (PWR->CR2 |= (__WUFLAG__))
\r
176 /* Exported functions --------------------------------------------------------*/
\r
177 /** @addtogroup PWREx_Exported_Functions PWREx Exported Functions
\r
181 /** @addtogroup PWREx_Exported_Functions_Group1
\r
184 uint32_t HAL_PWREx_GetVoltageRange(void);
\r
185 HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling);
\r
187 void HAL_PWREx_EnableFlashPowerDown(void);
\r
188 void HAL_PWREx_DisableFlashPowerDown(void);
\r
189 HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void);
\r
190 HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void);
\r
192 void HAL_PWREx_EnableMainRegulatorLowVoltage(void);
\r
193 void HAL_PWREx_DisableMainRegulatorLowVoltage(void);
\r
194 void HAL_PWREx_EnableLowRegulatorLowVoltage(void);
\r
195 void HAL_PWREx_DisableLowRegulatorLowVoltage(void);
\r
197 HAL_StatusTypeDef HAL_PWREx_EnableOverDrive(void);
\r
198 HAL_StatusTypeDef HAL_PWREx_DisableOverDrive(void);
\r
199 HAL_StatusTypeDef HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
\r
208 /* Private types -------------------------------------------------------------*/
\r
209 /* Private variables ---------------------------------------------------------*/
\r
210 /* Private constants ---------------------------------------------------------*/
\r
211 /* Private macros ------------------------------------------------------------*/
\r
212 /** @defgroup PWREx_Private_Macros PWREx Private Macros
\r
216 /** @defgroup PWREx_IS_PWR_Definitions PWREx Private macros to check input parameters
\r
219 #define IS_PWR_REGULATOR_UNDERDRIVE(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_UNDERDRIVE_ON) || \
\r
220 ((REGULATOR) == PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON))
\r
221 #define IS_PWR_WAKEUP_PIN(__PIN__) (((__PIN__) == PWR_WAKEUP_PIN1) || \
\r
222 ((__PIN__) == PWR_WAKEUP_PIN2) || \
\r
223 ((__PIN__) == PWR_WAKEUP_PIN3) || \
\r
224 ((__PIN__) == PWR_WAKEUP_PIN4) || \
\r
225 ((__PIN__) == PWR_WAKEUP_PIN5) || \
\r
226 ((__PIN__) == PWR_WAKEUP_PIN6) || \
\r
227 ((__PIN__) == PWR_WAKEUP_PIN1_HIGH) || \
\r
228 ((__PIN__) == PWR_WAKEUP_PIN2_HIGH) || \
\r
229 ((__PIN__) == PWR_WAKEUP_PIN3_HIGH) || \
\r
230 ((__PIN__) == PWR_WAKEUP_PIN4_HIGH) || \
\r
231 ((__PIN__) == PWR_WAKEUP_PIN5_HIGH) || \
\r
232 ((__PIN__) == PWR_WAKEUP_PIN6_HIGH) || \
\r
233 ((__PIN__) == PWR_WAKEUP_PIN1_LOW) || \
\r
234 ((__PIN__) == PWR_WAKEUP_PIN2_LOW) || \
\r
235 ((__PIN__) == PWR_WAKEUP_PIN3_LOW) || \
\r
236 ((__PIN__) == PWR_WAKEUP_PIN4_LOW) || \
\r
237 ((__PIN__) == PWR_WAKEUP_PIN5_LOW) || \
\r
238 ((__PIN__) == PWR_WAKEUP_PIN6_LOW))
\r
260 #endif /* __STM32F7xx_HAL_PWR_EX_H */
\r
262 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r