1 /**
2 ******************************************************************************
3 * @file    HAL_pwr.h
4 * @author  AE Team
5 * @version V1.0.0
6 * @date    28/7/2017
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, MindMotion 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 2017 MindMotion</center></h2>
20 */
21 
22 /* Define to prevent recursive inclusion -------------------------------------*/
23 #ifndef __HAL_PWR_H
24 #define __HAL_PWR_H
25 
26 /* Includes ------------------------------------------------------------------*/
27 #include "HAL_device.h"
28 
29 /** @addtogroup StdPeriph_Driver
30 * @{
31 */
32 
33 /** @addtogroup PWR
34 * @{
35 */
36 
37 /** @defgroup PWR_Exported_Types
38 * @{
39 */
40 
41 /**
42 * @}
43 */
44 
45 /** @defgroup PWR_Exported_Constants
46 * @{
47 */
48 
49 
50 /** @defgroup PVD_detection_level
51 * @{
52 */
53 
54 #define PWR_PVDLevel_1V8          ((uint32_t)0x00000000)
55 #define PWR_PVDLevel_2V1          ((uint32_t)0x00000200)
56 #define PWR_PVDLevel_2V4          ((uint32_t)0x00000400)
57 #define PWR_PVDLevel_2V7          ((uint32_t)0x00000600)
58 #define PWR_PVDLevel_3V0          ((uint32_t)0x00000800)
59 #define PWR_PVDLevel_3V3          ((uint32_t)0x00000A00)
60 #define PWR_PVDLevel_3V6          ((uint32_t)0x00000C00)
61 #define PWR_PVDLevel_3V9          ((uint32_t)0x00000E00)
62 #define PWR_PVDLevel_4V2          ((uint32_t)0x00001000)
63 #define PWR_PVDLevel_4V5          ((uint32_t)0x00001200)
64 #define PWR_PVDLevel_4V8          ((uint32_t)0x00001400)
65 #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_1V8) || ((LEVEL) == PWR_PVDLevel_2V1)|| \
66 ((LEVEL) == PWR_PVDLevel_2V4) || ((LEVEL) == PWR_PVDLevel_2V7)|| \
67   ((LEVEL) == PWR_PVDLevel_3V0) || ((LEVEL) == PWR_PVDLevel_3V3)|| \
68     ((LEVEL) == PWR_PVDLevel_3V6) || ((LEVEL) == PWR_PVDLevel_3V9)|| \
69       ((LEVEL) == PWR_PVDLevel_4V2) || ((LEVEL) == PWR_PVDLevel_4V5)|| \
70         ((LEVEL) == PWR_PVDLevel_4V8))
71 
72 
73 /**
74 * @}
75 */
76 
77 /** @defgroup Regulator_state_is_STOP_mode
78 * @{
79 */
80 
81 #define PWR_Regulator_ON          ((uint32_t)0x00000000)
82 #define PWR_Regulator_LowPower    ((uint32_t)0x00000002)
83 #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
84 ((REGULATOR) == PWR_Regulator_LowPower))
85 /**
86 * @}
87 */
88 
89 /** @defgroup STOP_mode_entry
90 * @{
91 */
92 
93 #define PWR_STOPEntry_WFI         ((uint8_t)0x01)
94 #define PWR_STOPEntry_WFE         ((uint8_t)0x02)
95 #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
96 
97 /**
98 * @}
99 */
100 
101 /** @defgroup PWR_Flag
102 * @{
103 */
104 
105 #define PWR_FLAG_WU               ((uint32_t)0x00000001)
106 #define PWR_FLAG_SB               ((uint32_t)0x00000002)
107 #define PWR_FLAG_PVDO             ((uint32_t)0x00000004)
108 #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
109 ((FLAG) == PWR_FLAG_PVDO))
110 
111 #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
112 /**
113 * @}
114 */
115 
116 /**
117 * @}
118 */
119 
120 /** @defgroup PWR_Exported_Macros
121 * @{
122 */
123 
124 /**
125 * @}
126 */
127 
128 /** @defgroup PWR_Exported_Functions
129 * @{
130 */
131 
132 void PWR_DeInit(void);
133 void PWR_BackupAccessCmd(FunctionalState NewState);
134 void PWR_PVDCmd(FunctionalState NewState);
135 void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
136 void PWR_WakeUpPinCmd(FunctionalState NewState);
137 void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
138 void PWR_EnterSTANDBYMode(void);
139 FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
140 void PWR_ClearFlag(uint32_t PWR_FLAG);
141 
142 #endif /* __HAL_PWR_H */
143 /**
144 * @}
145 */
146 
147 /**
148 * @}
149 */
150 
151 /**
152 * @}
153 */
154 
155 /*-------------------------(C) COPYRIGHT 2017 MindMotion ----------------------*/
156