1 /**
2   ******************************************************************************
3   * @file    stm32f10x_pwr.h
4   * @author  MCD Application Team
5   * @version V3.4.0
6   * @date    10/15/2010
7   * @brief   This file contains all the functions prototypes for the PWR firmware
8   *          library.
9   ******************************************************************************
10   * @copy
11   *
12   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18   *
19   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
20   */
21 
22 /* Define to prevent recursive inclusion -------------------------------------*/
23 #ifndef __STM32F10x_PWR_H
24 #define __STM32F10x_PWR_H
25 
26 #ifdef __cplusplus
27  extern "C" {
28 #endif
29 
30 /* Includes ------------------------------------------------------------------*/
31 #include "stm32f10x.h"
32 
33 /** @addtogroup STM32F10x_StdPeriph_Driver
34   * @{
35   */
36 
37 /** @addtogroup PWR
38   * @{
39   */
40 
41 /** @defgroup PWR_Exported_Types
42   * @{
43   */
44 
45 /**
46   * @}
47   */
48 
49 /** @defgroup PWR_Exported_Constants
50   * @{
51   */
52 
53 /** @defgroup PVD_detection_level
54   * @{
55   */
56 
57 #define PWR_PVDLevel_2V2          ((uint32_t)0x00000000)
58 #define PWR_PVDLevel_2V3          ((uint32_t)0x00000020)
59 #define PWR_PVDLevel_2V4          ((uint32_t)0x00000040)
60 #define PWR_PVDLevel_2V5          ((uint32_t)0x00000060)
61 #define PWR_PVDLevel_2V6          ((uint32_t)0x00000080)
62 #define PWR_PVDLevel_2V7          ((uint32_t)0x000000A0)
63 #define PWR_PVDLevel_2V8          ((uint32_t)0x000000C0)
64 #define PWR_PVDLevel_2V9          ((uint32_t)0x000000E0)
65 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_2V2) || ((LEVEL) == PWR_PVDLevel_2V3)|| \
66                                  ((LEVEL) == PWR_PVDLevel_2V4) || ((LEVEL) == PWR_PVDLevel_2V5)|| \
67                                  ((LEVEL) == PWR_PVDLevel_2V6) || ((LEVEL) == PWR_PVDLevel_2V7)|| \
68                                  ((LEVEL) == PWR_PVDLevel_2V8) || ((LEVEL) == PWR_PVDLevel_2V9))
69 /**
70   * @}
71   */
72 
73 /** @defgroup Regulator_state_is_STOP_mode
74   * @{
75   */
76 
77 #define PWR_Regulator_ON          ((uint32_t)0x00000000)
78 #define PWR_Regulator_LowPower    ((uint32_t)0x00000001)
79 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
80                                      ((REGULATOR) == PWR_Regulator_LowPower))
81 /**
82   * @}
83   */
84 
85 /** @defgroup STOP_mode_entry
86   * @{
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 /** @defgroup PWR_Flag
98   * @{
99   */
100 
101 #define PWR_FLAG_WU               ((uint32_t)0x00000001)
102 #define PWR_FLAG_SB               ((uint32_t)0x00000002)
103 #define PWR_FLAG_PVDO             ((uint32_t)0x00000004)
104 #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
105                                ((FLAG) == PWR_FLAG_PVDO))
106 
107 #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
108 /**
109   * @}
110   */
111 
112 /**
113   * @}
114   */
115 
116 /** @defgroup PWR_Exported_Macros
117   * @{
118   */
119 
120 /**
121   * @}
122   */
123 
124 /** @defgroup PWR_Exported_Functions
125   * @{
126   */
127 
128 void PWR_DeInit(void);
129 void PWR_BackupAccessCmd(FunctionalState NewState);
130 void PWR_PVDCmd(FunctionalState NewState);
131 void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
132 void PWR_WakeUpPinCmd(FunctionalState NewState);
133 void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
134 void PWR_EnterSTANDBYMode(void);
135 FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
136 void PWR_ClearFlag(uint32_t PWR_FLAG);
137 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif /* __STM32F10x_PWR_H */
143 /**
144   * @}
145   */
146 
147 /**
148   * @}
149   */
150 
151 /**
152   * @}
153   */
154 
155 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
156