stm32f0xx_hal_pwr.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /**
  2. ******************************************************************************
  3. * @file stm32f0xx_hal_pwr.h
  4. * @author MCD Application Team
  5. * @brief Header file of PWR HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef __STM32F0xx_HAL_PWR_H
  21. #define __STM32F0xx_HAL_PWR_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32f0xx_hal_def.h"
  27. /** @addtogroup STM32F0xx_HAL_Driver
  28. * @{
  29. */
  30. /** @addtogroup PWR PWR
  31. * @{
  32. */
  33. /* Exported types ------------------------------------------------------------*/
  34. /* Exported constants --------------------------------------------------------*/
  35. /** @defgroup PWR_Exported_Constants PWR Exported Constants
  36. * @{
  37. */
  38. /** @defgroup PWR_Regulator_state_in_STOP_mode PWR Regulator state in STOP mode
  39. * @{
  40. */
  41. #define PWR_MAINREGULATOR_ON (0x00000000U)
  42. #define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPDS
  43. #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \
  44. ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON))
  45. /**
  46. * @}
  47. */
  48. /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry
  49. * @{
  50. */
  51. #define PWR_SLEEPENTRY_WFI ((uint8_t)0x01U)
  52. #define PWR_SLEEPENTRY_WFE ((uint8_t)0x02U)
  53. #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE))
  54. /**
  55. * @}
  56. */
  57. /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry
  58. * @{
  59. */
  60. #define PWR_STOPENTRY_WFI ((uint8_t)0x01U)
  61. #define PWR_STOPENTRY_WFE ((uint8_t)0x02U)
  62. #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE))
  63. /**
  64. * @}
  65. */
  66. /**
  67. * @}
  68. */
  69. /* Exported macro ------------------------------------------------------------*/
  70. /** @defgroup PWR_Exported_Macro PWR Exported Macro
  71. * @{
  72. */
  73. /** @brief Check PWR flag is set or not.
  74. * @param __FLAG__ specifies the flag to check.
  75. * This parameter can be one of the following values:
  76. * @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event
  77. * was received from the WKUP pin or from the RTC alarm (Alarm A),
  78. * RTC Tamper event, RTC TimeStamp event or RTC Wakeup.
  79. * An additional wakeup event is detected if the WKUP pin is enabled
  80. * (by setting the EWUP bit) when the WKUP pin level is already high.
  81. * @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was
  82. * resumed from StandBy mode.
  83. * @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled
  84. * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode
  85. * For this reason, this bit is equal to 0 after Standby or reset
  86. * until the PVDE bit is set.
  87. * Warning: this Flag is not available on STM32F030x8 products
  88. * @arg PWR_FLAG_VREFINTRDY: This flag indicates that the internal reference
  89. * voltage VREFINT is ready.
  90. * Warning: this Flag is not available on STM32F030x8 products
  91. * @retval The new state of __FLAG__ (TRUE or FALSE).
  92. */
  93. #define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
  94. /** @brief Clear the PWR's pending flags.
  95. * @param __FLAG__ specifies the flag to clear.
  96. * This parameter can be one of the following values:
  97. * @arg PWR_FLAG_WU: Wake Up flag
  98. * @arg PWR_FLAG_SB: StandBy flag
  99. */
  100. #define __HAL_PWR_CLEAR_FLAG(__FLAG__) (PWR->CR |= (__FLAG__) << 2U)
  101. /**
  102. * @}
  103. */
  104. /* Include PWR HAL Extension module */
  105. #include "stm32f0xx_hal_pwr_ex.h"
  106. /* Exported functions --------------------------------------------------------*/
  107. /** @addtogroup PWR_Exported_Functions PWR Exported Functions
  108. * @{
  109. */
  110. /** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions
  111. * @{
  112. */
  113. /* Initialization and de-initialization functions *****************************/
  114. void HAL_PWR_DeInit(void);
  115. /**
  116. * @}
  117. */
  118. /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions
  119. * @{
  120. */
  121. /* Peripheral Control functions **********************************************/
  122. void HAL_PWR_EnableBkUpAccess(void);
  123. void HAL_PWR_DisableBkUpAccess(void);
  124. /* WakeUp pins configuration functions ****************************************/
  125. void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx);
  126. void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx);
  127. /* Low Power modes configuration functions ************************************/
  128. void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
  129. void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry);
  130. void HAL_PWR_EnterSTANDBYMode(void);
  131. void HAL_PWR_EnableSleepOnExit(void);
  132. void HAL_PWR_DisableSleepOnExit(void);
  133. void HAL_PWR_EnableSEVOnPend(void);
  134. void HAL_PWR_DisableSEVOnPend(void);
  135. /**
  136. * @}
  137. */
  138. /**
  139. * @}
  140. */
  141. /**
  142. * @}
  143. */
  144. /**
  145. * @}
  146. */
  147. #ifdef __cplusplus
  148. }
  149. #endif
  150. #endif /* __STM32F0xx_HAL_PWR_H */
  151. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/