]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F3XX/stm32f30x_pwr.h
Merge commit '4d116a04e94cf0d19317d5b44e4fa9f34a3e5594'
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F3XX / stm32f30x_pwr.h
1 /**
2 ******************************************************************************
3 * @file stm32f30x_pwr.h
4 * @author MCD Application Team
5 * @version V1.1.0
6 * @date 27-February-2014
7 * @brief This file contains all the functions prototypes for the PWR firmware
8 * library.
9 ******************************************************************************
10 * @attention
11 *
12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
13 *
14 * Redistribution and use in source and binary forms, with or without modification,
15 * are permitted provided that the following conditions are met:
16 * 1. Redistributions of source code must retain the above copyright notice,
17 * this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright notice,
19 * this list of conditions and the following disclaimer in the documentation
20 * and/or other materials provided with the distribution.
21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 *
36 ******************************************************************************
37 */
38
39 /* Define to prevent recursive inclusion -------------------------------------*/
40 #ifndef __STM32F30x_PWR_H
41 #define __STM32F30x_PWR_H
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 /* Includes ------------------------------------------------------------------*/
48 #include "stm32f30x.h"
49
50 /** @addtogroup STM32F30x_StdPeriph_Driver
51 * @{
52 */
53
54 /** @addtogroup PWR
55 * @{
56 */
57
58 /* Exported types ------------------------------------------------------------*/
59 /* Exported constants --------------------------------------------------------*/
60
61 /** @defgroup PWR_Exported_Constants
62 * @{
63 */
64
65 /** @defgroup PWR_PVD_detection_level
66 * @{
67 */
68
69 #define PWR_PVDLevel_0 PWR_CR_PLS_LEV0
70 #define PWR_PVDLevel_1 PWR_CR_PLS_LEV1
71 #define PWR_PVDLevel_2 PWR_CR_PLS_LEV2
72 #define PWR_PVDLevel_3 PWR_CR_PLS_LEV3
73 #define PWR_PVDLevel_4 PWR_CR_PLS_LEV4
74 #define PWR_PVDLevel_5 PWR_CR_PLS_LEV5
75 #define PWR_PVDLevel_6 PWR_CR_PLS_LEV6
76 #define PWR_PVDLevel_7 PWR_CR_PLS_LEV7
77
78 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \
79 ((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \
80 ((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \
81 ((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7))
82 /**
83 * @}
84 */
85
86 /** @defgroup PWR_WakeUp_Pins
87 * @{
88 */
89
90 #define PWR_WakeUpPin_1 PWR_CSR_EWUP1
91 #define PWR_WakeUpPin_2 PWR_CSR_EWUP2
92 #define PWR_WakeUpPin_3 PWR_CSR_EWUP3
93 #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WakeUpPin_1) || \
94 ((PIN) == PWR_WakeUpPin_2) || \
95 ((PIN) == PWR_WakeUpPin_3))
96 /**
97 * @}
98 */
99
100
101 /** @defgroup PWR_Regulator_state_is_Sleep_STOP_mode
102 * @{
103 */
104
105 #define PWR_Regulator_ON ((uint32_t)0x00000000)
106 #define PWR_Regulator_LowPower PWR_CR_LPSDSR
107 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
108 ((REGULATOR) == PWR_Regulator_LowPower))
109 /**
110 * @}
111 */
112
113 /** @defgroup PWR_SLEEP_mode_entry
114 * @{
115 */
116
117 #define PWR_SLEEPEntry_WFI ((uint8_t)0x01)
118 #define PWR_SLEEPEntry_WFE ((uint8_t)0x02)
119 #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPEntry_WFI) || ((ENTRY) == PWR_SLEEPEntry_WFE))
120
121 /**
122 * @}
123 */
124
125 /** @defgroup PWR_STOP_mode_entry
126 * @{
127 */
128
129 #define PWR_STOPEntry_WFI ((uint8_t)0x01)
130 #define PWR_STOPEntry_WFE ((uint8_t)0x02)
131 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
132
133 /**
134 * @}
135 */
136
137 /** @defgroup PWR_Flag
138 * @{
139 */
140
141 #define PWR_FLAG_WU PWR_CSR_WUF
142 #define PWR_FLAG_SB PWR_CSR_SBF
143 #define PWR_FLAG_PVDO PWR_CSR_PVDO
144 #define PWR_FLAG_VREFINTRDY PWR_CSR_VREFINTRDYF
145
146 #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
147 ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_VREFINTRDY))
148
149 #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
150 /**
151 * @}
152 */
153
154 /**
155 * @}
156 */
157
158 /* Exported macro ------------------------------------------------------------*/
159 /* Exported functions ------------------------------------------------------- */
160
161 /* Function used to set the PWR configuration to the default reset state ******/
162 void PWR_DeInit(void);
163
164 /* Backup Domain Access function **********************************************/
165 void PWR_BackupAccessCmd(FunctionalState NewState);
166
167 /* PVD configuration functions ************************************************/
168 void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
169 void PWR_PVDCmd(FunctionalState NewState);
170
171 /* WakeUp pins configuration functions ****************************************/
172 void PWR_WakeUpPinCmd(uint32_t PWR_WakeUpPin, FunctionalState NewState);
173
174 /* Low Power modes configuration functions ************************************/
175 void PWR_EnterSleepMode(uint8_t PWR_SLEEPEntry);
176 void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
177 void PWR_EnterSTANDBYMode(void);
178
179 /* Flags management functions *************************************************/
180 FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
181 void PWR_ClearFlag(uint32_t PWR_FLAG);
182
183 #ifdef __cplusplus
184 }
185 #endif
186
187 #endif /* __STM32F30x_PWR_H */
188
189 /**
190 * @}
191 */
192
193 /**
194 * @}
195 */
196
197 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Imprint / Impressum