stm32f411/stm32f411e-disco/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __STM32F4xx_HAL_PWR_EX_H
22 #define __STM32F4xx_HAL_PWR_EX_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f4xx_hal_def.h"
30 
39 /* Exported types ------------------------------------------------------------*/
40 /* Exported constants --------------------------------------------------------*/
44 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
45  defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
46 
50 #define PWR_MAINREGULATOR_UNDERDRIVE_ON PWR_CR_MRUDS
51 #define PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON ((uint32_t)(PWR_CR_LPDS | PWR_CR_LPUDS))
52 
59 #define PWR_FLAG_ODRDY PWR_CSR_ODRDY
60 #define PWR_FLAG_ODSWRDY PWR_CSR_ODSWRDY
61 #define PWR_FLAG_UDRDY PWR_CSR_UDSWRDY
62 
65 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
66 
70 #if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
71 #define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR_VOS /* Scale 1 mode(default value at reset): the maximum value of fHCLK = 168 MHz. */
72 #define PWR_REGULATOR_VOLTAGE_SCALE2 0x00000000U /* Scale 2 mode: the maximum value of fHCLK = 144 MHz. */
73 #else
74 #define PWR_REGULATOR_VOLTAGE_SCALE1 PWR_CR_VOS /* Scale 1 mode(default value at reset): the maximum value of fHCLK is 168 MHz. It can be extended to
75  180 MHz by activating the over-drive mode. */
76 #define PWR_REGULATOR_VOLTAGE_SCALE2 PWR_CR_VOS_1 /* Scale 2 mode: the maximum value of fHCLK is 144 MHz. It can be extended to
77  168 MHz by activating the over-drive mode. */
78 #define PWR_REGULATOR_VOLTAGE_SCALE3 PWR_CR_VOS_0 /* Scale 3 mode: the maximum value of fHCLK is 120 MHz. */
79 #endif /* STM32F405xx || STM32F407xx || STM32F415xx || STM32F417xx */
80 
83 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
84  defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
85 
88 #define PWR_WAKEUP_PIN2 0x00000080U
89 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
90  defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
91 #define PWR_WAKEUP_PIN3 0x00000040U
92 #endif /* STM32F410xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Zx || STM32F412Vx || \
93  STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
94 
97 #endif /* STM32F410xx || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx ||
98  STM32F413xx || STM32F423xx */
99 
104 /* Exported macro ------------------------------------------------------------*/
109 #if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
110 
119 #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \
120  __IO uint32_t tmpreg = 0x00U; \
121  MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \
122  /* Delay after an RCC peripheral clock enabling */ \
123  tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \
124  UNUSED(tmpreg); \
125  } while(0U)
126 #else
127 
137 #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) do { \
138  __IO uint32_t tmpreg = 0x00U; \
139  MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)); \
140  /* Delay after an RCC peripheral clock enabling */ \
141  tmpreg = READ_BIT(PWR->CR, PWR_CR_VOS); \
142  UNUSED(tmpreg); \
143  } while(0U)
144 #endif /* STM32F405xx || STM32F407xx || STM32F415xx || STM32F417xx */
145 
146 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
147  defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
148 
151 #define __HAL_PWR_OVERDRIVE_ENABLE() (*(__IO uint32_t *) CR_ODEN_BB = ENABLE)
152 #define __HAL_PWR_OVERDRIVE_DISABLE() (*(__IO uint32_t *) CR_ODEN_BB = DISABLE)
153 
157 #define __HAL_PWR_OVERDRIVESWITCHING_ENABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = ENABLE)
158 #define __HAL_PWR_OVERDRIVESWITCHING_DISABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = DISABLE)
159 
170 #define __HAL_PWR_UNDERDRIVE_ENABLE() (PWR->CR |= (uint32_t)PWR_CR_UDEN)
171 #define __HAL_PWR_UNDERDRIVE_DISABLE() (PWR->CR &= (uint32_t)(~PWR_CR_UDEN))
172 
185 #define __HAL_PWR_GET_ODRUDR_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
186 
190 #define __HAL_PWR_CLEAR_ODRUDR_FLAG() (PWR->CSR |= PWR_FLAG_UDRDY)
191 
192 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
193 
197 /* Exported functions --------------------------------------------------------*/
209 uint32_t HAL_PWREx_GetVoltageRange(void);
210 HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling);
211 
212 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F401xC) ||\
213  defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\
214  defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
219 #endif /* STM32F410xx || STM32F401xC || STM32F401xE || STM32F411xE || STM32F412Zx || STM32F412Vx ||\
220  STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
221 
222 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) ||\
223  defined(STM32F469xx) || defined(STM32F479xx)
226 HAL_StatusTypeDef HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
227 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
228 
236 /* Private types -------------------------------------------------------------*/
237 /* Private variables ---------------------------------------------------------*/
238 /* Private constants ---------------------------------------------------------*/
246 /* ------------- PWR registers bit address in the alias region ---------------*/
247 /* --- CR Register ---*/
248 /* Alias word address of FPDS bit */
249 #define FPDS_BIT_NUMBER PWR_CR_FPDS_Pos
250 #define CR_FPDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (FPDS_BIT_NUMBER * 4U))
251 
252 /* Alias word address of ODEN bit */
253 #define ODEN_BIT_NUMBER PWR_CR_ODEN_Pos
254 #define CR_ODEN_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (ODEN_BIT_NUMBER * 4U))
255 
256 /* Alias word address of ODSWEN bit */
257 #define ODSWEN_BIT_NUMBER PWR_CR_ODSWEN_Pos
258 #define CR_ODSWEN_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (ODSWEN_BIT_NUMBER * 4U))
259 
260 /* Alias word address of MRLVDS bit */
261 #define MRLVDS_BIT_NUMBER PWR_CR_MRLVDS_Pos
262 #define CR_MRLVDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (MRLVDS_BIT_NUMBER * 4U))
263 
264 /* Alias word address of LPLVDS bit */
265 #define LPLVDS_BIT_NUMBER PWR_CR_LPLVDS_Pos
266 #define CR_LPLVDS_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CR_OFFSET_BB * 32U) + (LPLVDS_BIT_NUMBER * 4U))
267 
275 /* --- CSR Register ---*/
276 /* Alias word address of BRE bit */
277 #define BRE_BIT_NUMBER PWR_CSR_BRE_Pos
278 #define CSR_BRE_BB (uint32_t)(PERIPH_BB_BASE + (PWR_CSR_OFFSET_BB * 32U) + (BRE_BIT_NUMBER * 4U))
279 
288 /* Private macros ------------------------------------------------------------*/
296 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
297  defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
298 #define IS_PWR_REGULATOR_UNDERDRIVE(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_UNDERDRIVE_ON) || \
299  ((REGULATOR) == PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON))
300 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
301 
302 #if defined(STM32F405xx) || defined(STM32F407xx) || defined(STM32F415xx) || defined(STM32F417xx)
303 #define IS_PWR_VOLTAGE_SCALING_RANGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
304  ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2))
305 #else
306 #define IS_PWR_VOLTAGE_SCALING_RANGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
307  ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2) || \
308  ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE3))
309 #endif /* STM32F405xx || STM32F407xx || STM32F415xx || STM32F417xx */
310 
311 #if defined(STM32F446xx)
312 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2))
313 #elif defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) ||\
314  defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\
315  defined(STM32F423xx)
316 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2) || \
317  ((PIN) == PWR_WAKEUP_PIN3))
318 #else
319 #define IS_PWR_WAKEUP_PIN(PIN) ((PIN) == PWR_WAKEUP_PIN1)
320 #endif /* STM32F446xx */
321 
337 #ifdef __cplusplus
338 }
339 #endif
340 
341 
342 #endif /* __STM32F4xx_HAL_PWR_EX_H */
343 
344 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
HAL_PWREx_EnableBkUpReg
HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void)
HAL_PWREx_EnableOverDrive
HAL_StatusTypeDef HAL_PWREx_EnableOverDrive(void)
HAL_PWREx_EnableLowRegulatorLowVoltage
void HAL_PWREx_EnableLowRegulatorLowVoltage(void)
stm32f4xx_hal_def.h
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_PWREx_DisableBkUpReg
HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void)
HAL_PWREx_DisableOverDrive
HAL_StatusTypeDef HAL_PWREx_DisableOverDrive(void)
HAL_PWREx_EnterUnderDriveSTOPMode
HAL_StatusTypeDef HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry)
HAL_PWREx_EnableFlashPowerDown
void HAL_PWREx_EnableFlashPowerDown(void)
HAL_PWREx_DisableFlashPowerDown
void HAL_PWREx_DisableFlashPowerDown(void)
HAL_PWREx_DisableMainRegulatorLowVoltage
void HAL_PWREx_DisableMainRegulatorLowVoltage(void)
HAL_PWREx_GetVoltageRange
uint32_t HAL_PWREx_GetVoltageRange(void)
HAL_PWREx_DisableLowRegulatorLowVoltage
void HAL_PWREx_DisableLowRegulatorLowVoltage(void)
HAL_PWREx_EnableMainRegulatorLowVoltage
void HAL_PWREx_EnableMainRegulatorLowVoltage(void)
HAL_PWREx_ControlVoltageScaling
HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling)


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:52