Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

189 righe
6.0 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_pwr.h
  4. * @author MCD Application Team
  5. * @version V1.1.0
  6. * @date 11-January-2013
  7. * @brief This file contains all the functions prototypes for the PWR firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
  13. *
  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:
  17. *
  18. * http://www.st.com/software_license_agreement_liberty_v2
  19. *
  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.
  25. *
  26. ******************************************************************************
  27. */
  28. /* Define to prevent recursive inclusion -------------------------------------*/
  29. #ifndef __STM32F4xx_PWR_H
  30. #define __STM32F4xx_PWR_H
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /* Includes ------------------------------------------------------------------*/
  35. #include "stm32f4xx.h"
  36. /** @addtogroup STM32F4xx_StdPeriph_Driver
  37. * @{
  38. */
  39. /** @addtogroup PWR
  40. * @{
  41. */
  42. /* Exported types ------------------------------------------------------------*/
  43. /* Exported constants --------------------------------------------------------*/
  44. /** @defgroup PWR_Exported_Constants
  45. * @{
  46. */
  47. /** @defgroup PWR_PVD_detection_level
  48. * @{
  49. */
  50. #define PWR_PVDLevel_0 PWR_CR_PLS_LEV0
  51. #define PWR_PVDLevel_1 PWR_CR_PLS_LEV1
  52. #define PWR_PVDLevel_2 PWR_CR_PLS_LEV2
  53. #define PWR_PVDLevel_3 PWR_CR_PLS_LEV3
  54. #define PWR_PVDLevel_4 PWR_CR_PLS_LEV4
  55. #define PWR_PVDLevel_5 PWR_CR_PLS_LEV5
  56. #define PWR_PVDLevel_6 PWR_CR_PLS_LEV6
  57. #define PWR_PVDLevel_7 PWR_CR_PLS_LEV7
  58. #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \
  59. ((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \
  60. ((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \
  61. ((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7))
  62. /**
  63. * @}
  64. */
  65. /** @defgroup PWR_Regulator_state_in_STOP_mode
  66. * @{
  67. */
  68. #define PWR_Regulator_ON ((uint32_t)0x00000000)
  69. #define PWR_Regulator_LowPower PWR_CR_LPDS
  70. #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
  71. ((REGULATOR) == PWR_Regulator_LowPower))
  72. /**
  73. * @}
  74. */
  75. /** @defgroup PWR_STOP_mode_entry
  76. * @{
  77. */
  78. #define PWR_STOPEntry_WFI ((uint8_t)0x01)
  79. #define PWR_STOPEntry_WFE ((uint8_t)0x02)
  80. #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
  81. /** @defgroup PWR_Regulator_Voltage_Scale
  82. * @{
  83. */
  84. #define PWR_Regulator_Voltage_Scale1 ((uint32_t)0x0000C000)
  85. #define PWR_Regulator_Voltage_Scale2 ((uint32_t)0x00008000)
  86. #define PWR_Regulator_Voltage_Scale3 ((uint32_t)0x00004000)
  87. #define IS_PWR_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_Regulator_Voltage_Scale1) || \
  88. ((VOLTAGE) == PWR_Regulator_Voltage_Scale2) || \
  89. ((VOLTAGE) == PWR_Regulator_Voltage_Scale3))
  90. /**
  91. * @}
  92. */
  93. /** @defgroup PWR_Flag
  94. * @{
  95. */
  96. #define PWR_FLAG_WU PWR_CSR_WUF
  97. #define PWR_FLAG_SB PWR_CSR_SBF
  98. #define PWR_FLAG_PVDO PWR_CSR_PVDO
  99. #define PWR_FLAG_BRR PWR_CSR_BRR
  100. #define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY
  101. /** @defgroup PWR_Flag_Legacy
  102. * @{
  103. */
  104. #define PWR_FLAG_REGRDY PWR_FLAG_VOSRDY
  105. /**
  106. * @}
  107. */
  108. #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
  109. ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_BRR) || \
  110. ((FLAG) == PWR_FLAG_VOSRDY))
  111. #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
  112. /**
  113. * @}
  114. */
  115. /**
  116. * @}
  117. */
  118. /* Exported macro ------------------------------------------------------------*/
  119. /* Exported functions --------------------------------------------------------*/
  120. /* Function used to set the PWR configuration to the default reset state ******/
  121. void PWR_DeInit(void);
  122. /* Backup Domain Access function **********************************************/
  123. void PWR_BackupAccessCmd(FunctionalState NewState);
  124. /* PVD configuration functions ************************************************/
  125. void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
  126. void PWR_PVDCmd(FunctionalState NewState);
  127. /* WakeUp pins configuration functions ****************************************/
  128. void PWR_WakeUpPinCmd(FunctionalState NewState);
  129. /* Main and Backup Regulators configuration functions *************************/
  130. void PWR_BackupRegulatorCmd(FunctionalState NewState);
  131. void PWR_MainRegulatorModeConfig(uint32_t PWR_Regulator_Voltage);
  132. /* FLASH Power Down configuration functions ***********************************/
  133. void PWR_FlashPowerDownCmd(FunctionalState NewState);
  134. /* Low Power modes configuration functions ************************************/
  135. void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
  136. void PWR_EnterSTANDBYMode(void);
  137. /* Flags management functions *************************************************/
  138. FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
  139. void PWR_ClearFlag(uint32_t PWR_FLAG);
  140. #ifdef __cplusplus
  141. }
  142. #endif
  143. #endif /* __STM32F4xx_PWR_H */
  144. /**
  145. * @}
  146. */
  147. /**
  148. * @}
  149. */
  150. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/