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