stm32f4xx_pwr.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_pwr.h
  4. * @author MCD Application Team
  5. * @version V1.0.0
  6. * @date 30-September-2011
  7. * @brief This file contains all the functions prototypes for the PWR firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  13. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  14. * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  15. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  16. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  17. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  18. *
  19. * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  20. ******************************************************************************
  21. */
  22. /* Define to prevent recursive inclusion -------------------------------------*/
  23. #ifndef __STM32F4xx_PWR_H
  24. #define __STM32F4xx_PWR_H
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /* Includes ------------------------------------------------------------------*/
  29. #include "stm32f4xx.h"
  30. /** @addtogroup STM32F4xx_StdPeriph_Driver
  31. * @{
  32. */
  33. /** @addtogroup PWR
  34. * @{
  35. */
  36. /* Exported types ------------------------------------------------------------*/
  37. /* Exported constants --------------------------------------------------------*/
  38. /** @defgroup PWR_Exported_Constants
  39. * @{
  40. */
  41. /** @defgroup PWR_PVD_detection_level
  42. * @{
  43. */
  44. #define PWR_PVDLevel_0 PWR_CR_PLS_LEV0
  45. #define PWR_PVDLevel_1 PWR_CR_PLS_LEV1
  46. #define PWR_PVDLevel_2 PWR_CR_PLS_LEV2
  47. #define PWR_PVDLevel_3 PWR_CR_PLS_LEV3
  48. #define PWR_PVDLevel_4 PWR_CR_PLS_LEV4
  49. #define PWR_PVDLevel_5 PWR_CR_PLS_LEV5
  50. #define PWR_PVDLevel_6 PWR_CR_PLS_LEV6
  51. #define PWR_PVDLevel_7 PWR_CR_PLS_LEV7
  52. #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \
  53. ((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \
  54. ((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \
  55. ((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7))
  56. /**
  57. * @}
  58. */
  59. /** @defgroup PWR_Regulator_state_in_STOP_mode
  60. * @{
  61. */
  62. #define PWR_Regulator_ON ((uint32_t)0x00000000)
  63. #define PWR_Regulator_LowPower PWR_CR_LPDS
  64. #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
  65. ((REGULATOR) == PWR_Regulator_LowPower))
  66. /**
  67. * @}
  68. */
  69. /** @defgroup PWR_STOP_mode_entry
  70. * @{
  71. */
  72. #define PWR_STOPEntry_WFI ((uint8_t)0x01)
  73. #define PWR_STOPEntry_WFE ((uint8_t)0x02)
  74. #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
  75. /** @defgroup PWR_Regulator_Voltage_Scale
  76. * @{
  77. */
  78. #define PWR_Regulator_Voltage_Scale1 ((uint32_t)0x00004000)
  79. #define PWR_Regulator_Voltage_Scale2 ((uint32_t)0x00000000)
  80. #define IS_PWR_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_Regulator_Voltage_Scale1) || ((VOLTAGE) == PWR_Regulator_Voltage_Scale2))
  81. /**
  82. * @}
  83. */
  84. /** @defgroup PWR_Flag
  85. * @{
  86. */
  87. #define PWR_FLAG_WU PWR_CSR_WUF
  88. #define PWR_FLAG_SB PWR_CSR_SBF
  89. #define PWR_FLAG_PVDO PWR_CSR_PVDO
  90. #define PWR_FLAG_BRR PWR_CSR_BRR
  91. #define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY
  92. /** @defgroup PWR_Flag_Legacy
  93. * @{
  94. */
  95. #define PWR_FLAG_REGRDY PWR_FLAG_VOSRDY
  96. /**
  97. * @}
  98. */
  99. #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
  100. ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_BRR) || \
  101. ((FLAG) == PWR_FLAG_VOSRDY))
  102. #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
  103. /**
  104. * @}
  105. */
  106. /**
  107. * @}
  108. */
  109. /* Exported macro ------------------------------------------------------------*/
  110. /* Exported functions --------------------------------------------------------*/
  111. /* Function used to set the PWR configuration to the default reset state ******/
  112. void PWR_DeInit(void);
  113. /* Backup Domain Access function **********************************************/
  114. void PWR_BackupAccessCmd(FunctionalState NewState);
  115. /* PVD configuration functions ************************************************/
  116. void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
  117. void PWR_PVDCmd(FunctionalState NewState);
  118. /* WakeUp pins configuration functions ****************************************/
  119. void PWR_WakeUpPinCmd(FunctionalState NewState);
  120. /* Main and Backup Regulators configuration functions *************************/
  121. void PWR_BackupRegulatorCmd(FunctionalState NewState);
  122. void PWR_MainRegulatorModeConfig(uint32_t PWR_Regulator_Voltage);
  123. /* FLASH Power Down configuration functions ***********************************/
  124. void PWR_FlashPowerDownCmd(FunctionalState NewState);
  125. /* Low Power modes configuration functions ************************************/
  126. void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
  127. void PWR_EnterSTANDBYMode(void);
  128. /* Flags management functions *************************************************/
  129. FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
  130. void PWR_ClearFlag(uint32_t PWR_FLAG);
  131. #ifdef __cplusplus
  132. }
  133. #endif
  134. #endif /* __STM32F4xx_PWR_H */
  135. /**
  136. * @}
  137. */
  138. /**
  139. * @}
  140. */
  141. /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/