]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F0/stm32f0xx_hal_pwr.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F0 / stm32f0xx_hal_pwr.h
1 /**
2   ******************************************************************************
3   * @file    stm32f0xx_hal_pwr.h
4   * @author  MCD Application Team
5   * @version V1.2.0
6   * @date    11-December-2014
7   * @brief   Header file of PWR HAL module.
8   ******************************************************************************
9   * @attention
10   *
11   * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
12   *
13   * Redistribution and use in source and binary forms, with or without modification,
14   * are permitted provided that the following conditions are met:
15   *   1. Redistributions of source code must retain the above copyright notice,
16   *      this list of conditions and the following disclaimer.
17   *   2. Redistributions in binary form must reproduce the above copyright notice,
18   *      this list of conditions and the following disclaimer in the documentation
19   *      and/or other materials provided with the distribution.
20   *   3. Neither the name of STMicroelectronics nor the names of its contributors
21   *      may be used to endorse or promote products derived from this software
22   *      without specific prior written permission.
23   *
24   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34   *
35   ******************************************************************************  
36   */
37
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F0xx_HAL_PWR_H
40 #define __STM32F0xx_HAL_PWR_H
41
42 #ifdef __cplusplus
43  extern "C" {
44 #endif
45
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f0xx_hal_def.h"
48
49 /** @addtogroup STM32F0xx_HAL_Driver
50   * @{
51   */
52
53 /** @addtogroup PWR PWR HAL module Driver 
54   * @{
55   */
56
57 /* Exported types ------------------------------------------------------------*/
58 /* Exported constants --------------------------------------------------------*/
59
60 /** @defgroup PWR_Exported_Constants PWR Exported Constants
61   * @{
62   */ 
63
64 /** @defgroup PWR_Regulator_state_in_STOP_mode PWR Regulator state in STOP mode
65   * @{
66   */
67 #define PWR_MAINREGULATOR_ON                        ((uint32_t)0x00000000)
68 #define PWR_LOWPOWERREGULATOR_ON                    PWR_CR_LPDS
69
70 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \
71                                      ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON))
72 /**
73   * @}
74   */
75
76 /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry
77   * @{
78   */
79 #define PWR_SLEEPENTRY_WFI              ((uint8_t)0x01)
80 #define PWR_SLEEPENTRY_WFE              ((uint8_t)0x02)
81 #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE))
82 /**
83   * @}
84   */
85
86 /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry
87   * @{
88   */
89 #define PWR_STOPENTRY_WFI               ((uint8_t)0x01)
90 #define PWR_STOPENTRY_WFE               ((uint8_t)0x02)
91 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE))
92 /**
93   * @}
94   */
95
96
97 /**
98   * @}
99   */
100
101 /* Exported macro ------------------------------------------------------------*/
102 /** @defgroup PWR_Exported_Macro PWR Exported Macro
103   * @{
104   */
105
106 /** @brief  Check PWR flag is set or not.
107   * @param  __FLAG__: specifies the flag to check.
108   *           This parameter can be one of the following values:
109   *            @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event
110   *                  was received from the WKUP pin or from the RTC alarm (Alarm A),
111   *                  RTC Tamper event, RTC TimeStamp event or RTC Wakeup.
112   *                  An additional wakeup event is detected if the WKUP pin is enabled
113   *                  (by setting the EWUP bit) when the WKUP pin level is already high.
114   *            @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was
115   *                  resumed from StandBy mode.
116   *            @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled
117   *                  by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode
118   *                  For this reason, this bit is equal to 0 after Standby or reset
119   *                  until the PVDE bit is set. 
120   *                  Warning: this Flag is not available on STM32F030x8 products
121   *            @arg PWR_FLAG_VREFINTRDY: This flag indicates that the internal reference
122   *                  voltage VREFINT is ready.
123   *                  Warning: this Flag is not available on STM32F030x8 products
124   * @retval The new state of __FLAG__ (TRUE or FALSE).
125   */
126 #define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__))
127
128 /** @brief  Clear the PWR's pending flags.
129   * @param  __FLAG__: specifies the flag to clear.
130   *          This parameter can be one of the following values:
131   *            @arg PWR_FLAG_WU: Wake Up flag
132   *            @arg PWR_FLAG_SB: StandBy flag
133   */
134 #define __HAL_PWR_CLEAR_FLAG(__FLAG__) (PWR->CR |=  (__FLAG__) << 2)
135
136
137 /**
138   * @}
139   */
140
141 /* Include PWR HAL Extension module */
142 #include "stm32f0xx_hal_pwr_ex.h"
143
144 /* Exported functions --------------------------------------------------------*/
145
146 /** @addtogroup PWR_Exported_Functions PWR Exported Functions
147   * @{
148   */
149   
150 /** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions 
151   * @{
152   */
153
154 /* Initialization and de-initialization functions *****************************/
155 void HAL_PWR_DeInit(void);
156
157 /**
158   * @}
159   */
160
161 /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions 
162   * @{
163   */
164
165 /* Peripheral Control functions  **********************************************/
166 void HAL_PWR_EnableBkUpAccess(void);
167 void HAL_PWR_DisableBkUpAccess(void);
168
169 /* WakeUp pins configuration functions ****************************************/
170 void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx);
171 void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx);
172
173 /* Low Power modes configuration functions ************************************/
174 void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
175 void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry);
176 void HAL_PWR_EnterSTANDBYMode(void);
177
178 void HAL_PWR_EnableSleepOnExit(void);
179 void HAL_PWR_DisableSleepOnExit(void);
180 void HAL_PWR_EnableSEVOnPend(void);
181 void HAL_PWR_DisableSEVOnPend(void);
182
183 /**
184   * @}
185   */
186
187 /**
188   * @}
189   */
190
191 /**
192   * @}
193   */
194
195 /**
196   * @}
197   */
198
199 #ifdef __cplusplus
200 }
201 #endif
202
203
204 #endif /* __STM32F0xx_HAL_PWR_H */
205
206 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
207