Subversion Repositories FuelGauge

Rev

Blame | Last modification | View Log | Download | RSS feed

  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.  
  20. /* Define to prevent recursive inclusion -------------------------------------*/
  21. #ifndef __STM32F0xx_HAL_PWR_H
  22. #define __STM32F0xx_HAL_PWR_H
  23.  
  24. #ifdef __cplusplus
  25.  extern "C" {
  26. #endif
  27.  
  28. /* Includes ------------------------------------------------------------------*/
  29. #include "stm32f0xx_hal_def.h"
  30.  
  31. /** @addtogroup STM32F0xx_HAL_Driver
  32.   * @{
  33.   */
  34.  
  35. /** @addtogroup PWR PWR
  36.   * @{
  37.   */
  38.  
  39. /* Exported types ------------------------------------------------------------*/
  40. /* Exported constants --------------------------------------------------------*/
  41.  
  42. /** @defgroup PWR_Exported_Constants PWR Exported Constants
  43.   * @{
  44.   */
  45.  
  46. /** @defgroup PWR_Regulator_state_in_STOP_mode PWR Regulator state in STOP mode
  47.   * @{
  48.   */
  49. #define PWR_MAINREGULATOR_ON                        (0x00000000U)
  50. #define PWR_LOWPOWERREGULATOR_ON                    PWR_CR_LPDS
  51.  
  52. #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \
  53.                                      ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON))
  54. /**
  55.   * @}
  56.   */
  57.  
  58. /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry
  59.   * @{
  60.   */
  61. #define PWR_SLEEPENTRY_WFI              ((uint8_t)0x01U)
  62. #define PWR_SLEEPENTRY_WFE              ((uint8_t)0x02U)
  63. #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE))
  64. /**
  65.   * @}
  66.   */
  67.  
  68. /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry
  69.   * @{
  70.   */
  71. #define PWR_STOPENTRY_WFI               ((uint8_t)0x01U)
  72. #define PWR_STOPENTRY_WFE               ((uint8_t)0x02U)
  73. #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE))
  74. /**
  75.   * @}
  76.   */
  77.  
  78.  
  79. /**
  80.   * @}
  81.   */
  82.  
  83. /* Exported macro ------------------------------------------------------------*/
  84. /** @defgroup PWR_Exported_Macro PWR Exported Macro
  85.   * @{
  86.   */
  87.  
  88. /** @brief  Check PWR flag is set or not.
  89.   * @param  __FLAG__ specifies the flag to check.
  90.   *           This parameter can be one of the following values:
  91.   *            @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event
  92.   *                  was received from the WKUP pin or from the RTC alarm (Alarm A),
  93.   *                  RTC Tamper event, RTC TimeStamp event or RTC Wakeup.
  94.   *                  An additional wakeup event is detected if the WKUP pin is enabled
  95.   *                  (by setting the EWUP bit) when the WKUP pin level is already high.
  96.   *            @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was
  97.   *                  resumed from StandBy mode.
  98.   *            @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled
  99.   *                  by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode
  100.   *                  For this reason, this bit is equal to 0 after Standby or reset
  101.   *                  until the PVDE bit is set.
  102.   *                  Warning: this Flag is not available on STM32F030x8 products
  103.   *            @arg PWR_FLAG_VREFINTRDY: This flag indicates that the internal reference
  104.   *                  voltage VREFINT is ready.
  105.   *                  Warning: this Flag is not available on STM32F030x8 products
  106.   * @retval The new state of __FLAG__ (TRUE or FALSE).
  107.   */
  108. #define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
  109.  
  110. /** @brief  Clear the PWR's pending flags.
  111.   * @param  __FLAG__ specifies the flag to clear.
  112.   *          This parameter can be one of the following values:
  113.   *            @arg PWR_FLAG_WU: Wake Up flag
  114.   *            @arg PWR_FLAG_SB: StandBy flag
  115.   */
  116. #define __HAL_PWR_CLEAR_FLAG(__FLAG__) (PWR->CR |=  (__FLAG__) << 2U)
  117.  
  118.  
  119. /**
  120.   * @}
  121.   */
  122.  
  123. /* Include PWR HAL Extension module */
  124. #include "stm32f0xx_hal_pwr_ex.h"
  125.  
  126. /* Exported functions --------------------------------------------------------*/
  127.  
  128. /** @addtogroup PWR_Exported_Functions PWR Exported Functions
  129.   * @{
  130.   */
  131.  
  132. /** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions
  133.   * @{
  134.   */
  135.  
  136. /* Initialization and de-initialization functions *****************************/
  137. void HAL_PWR_DeInit(void);
  138.  
  139. /**
  140.   * @}
  141.   */
  142.  
  143. /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions
  144.   * @{
  145.   */
  146.  
  147. /* Peripheral Control functions  **********************************************/
  148. void HAL_PWR_EnableBkUpAccess(void);
  149. void HAL_PWR_DisableBkUpAccess(void);
  150.  
  151. /* WakeUp pins configuration functions ****************************************/
  152. void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx);
  153. void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx);
  154.  
  155. /* Low Power modes configuration functions ************************************/
  156. void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
  157. void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry);
  158. void HAL_PWR_EnterSTANDBYMode(void);
  159.  
  160. void HAL_PWR_EnableSleepOnExit(void);
  161. void HAL_PWR_DisableSleepOnExit(void);
  162. void HAL_PWR_EnableSEVOnPend(void);
  163. void HAL_PWR_DisableSEVOnPend(void);
  164.  
  165. /**
  166.   * @}
  167.   */
  168.  
  169. /**
  170.   * @}
  171.   */
  172.  
  173. /**
  174.   * @}
  175.   */
  176.  
  177. /**
  178.   * @}
  179.   */
  180.  
  181. #ifdef __cplusplus
  182. }
  183. #endif
  184.  
  185.  
  186. #endif /* __STM32F0xx_HAL_PWR_H */
  187.  
  188. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
  189.  
  190.