1 /* Define to prevent recursive inclusion -------------------------------------*/
2 #ifndef __AIR32F10x_PWR_H
3 #define __AIR32F10x_PWR_H
4 
5 #ifdef __cplusplus
6  extern "C" {
7 #endif
8 
9 /* Includes ------------------------------------------------------------------*/
10 #include "air32f10x.h"
11 
12 /** @addtogroup air32f10x_StdPeriph_Driver
13   * @{
14   */
15 
16 /** @addtogroup PWR
17   * @{
18   */
19 
20 /** @defgroup PWR_Exported_Types
21   * @{
22   */
23 
24 /**
25   * @}
26   */
27 
28 /** @defgroup PWR_Exported_Constants
29   * @{
30   */
31 
32 /** @defgroup PVD_detection_level
33   * @{
34   */
35 
36 #define PWR_PVDLevel_2V2          ((uint32_t)0x00000000)
37 #define PWR_PVDLevel_2V3          ((uint32_t)0x00000020)
38 #define PWR_PVDLevel_2V4          ((uint32_t)0x00000040)
39 #define PWR_PVDLevel_2V5          ((uint32_t)0x00000060)
40 #define PWR_PVDLevel_2V6          ((uint32_t)0x00000080)
41 #define PWR_PVDLevel_2V7          ((uint32_t)0x000000A0)
42 #define PWR_PVDLevel_2V8          ((uint32_t)0x000000C0)
43 #define PWR_PVDLevel_2V9          ((uint32_t)0x000000E0)
44 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_2V2) || ((LEVEL) == PWR_PVDLevel_2V3)|| \
45                                  ((LEVEL) == PWR_PVDLevel_2V4) || ((LEVEL) == PWR_PVDLevel_2V5)|| \
46                                  ((LEVEL) == PWR_PVDLevel_2V6) || ((LEVEL) == PWR_PVDLevel_2V7)|| \
47                                  ((LEVEL) == PWR_PVDLevel_2V8) || ((LEVEL) == PWR_PVDLevel_2V9))
48 /**
49   * @}
50   */
51 
52 /** @defgroup Regulator_state_is_STOP_mode
53   * @{
54   */
55 
56 #define PWR_Regulator_ON          ((uint32_t)0x00000000)
57 #define PWR_Regulator_LowPower    ((uint32_t)0x00000001)
58 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
59                                      ((REGULATOR) == PWR_Regulator_LowPower))
60 /**
61   * @}
62   */
63 
64 /** @defgroup STOP_mode_entry
65   * @{
66   */
67 
68 #define PWR_STOPEntry_WFI         ((uint8_t)0x01)
69 #define PWR_STOPEntry_WFE         ((uint8_t)0x02)
70 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
71 
72 /**
73   * @}
74   */
75 
76 /** @defgroup PWR_Flag
77   * @{
78   */
79 
80 #define PWR_FLAG_WU               ((uint32_t)0x00000001)
81 #define PWR_FLAG_SB               ((uint32_t)0x00000002)
82 #define PWR_FLAG_PVDO             ((uint32_t)0x00000004)
83 #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
84                                ((FLAG) == PWR_FLAG_PVDO))
85 
86 #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
87 /**
88   * @}
89   */
90 
91 /**
92   * @}
93   */
94 
95 /** @defgroup PWR_Exported_Macros
96   * @{
97   */
98 
99 /**
100   * @}
101   */
102 
103 /** @defgroup PWR_Exported_Functions
104   * @{
105   */
106 
107 void PWR_DeInit(void);
108 void PWR_BackupAccessCmd(FunctionalState NewState);
109 void PWR_PVDCmd(FunctionalState NewState);
110 void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
111 void PWR_WakeUpPinCmd(FunctionalState NewState);
112 void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
113 void PWR_EnterSTANDBYMode(void);
114 FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
115 void PWR_ClearFlag(uint32_t PWR_FLAG);
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif /* __AIR32F10x_PWR_H */
122 /**
123   * @}
124   */
125 
126 /**
127   * @}
128   */
129 
130 /**
131   * @}
132   */
133 
134