1 /***************COPYRIGHT(C)  2019 WCH. A11 rights reserved*********************
2  * File Name          : ch32f10x_pwr.h
3  * Author             : WCH
4  * Version            : V1.0.0
5  * Date               : 2019/10/15
6  * Description        : This file contains all the functions prototypes for the PWR
7  *                      firmware library.
8  *******************************************************************************/
9 #ifndef __CH32F10x_PWR_H
10 #define __CH32F10x_PWR_H
11 
12 #ifdef __cplusplus
13  extern "C" {
14 #endif
15 
16 #include "ch32f10x.h"
17 
18 /* PVD_detection_level  */
19 #define PWR_PVDLevel_2V2          ((uint32_t)0x00000000)
20 #define PWR_PVDLevel_2V3          ((uint32_t)0x00000020)
21 #define PWR_PVDLevel_2V4          ((uint32_t)0x00000040)
22 #define PWR_PVDLevel_2V5          ((uint32_t)0x00000060)
23 #define PWR_PVDLevel_2V6          ((uint32_t)0x00000080)
24 #define PWR_PVDLevel_2V7          ((uint32_t)0x000000A0)
25 #define PWR_PVDLevel_2V8          ((uint32_t)0x000000C0)
26 #define PWR_PVDLevel_2V9          ((uint32_t)0x000000E0)
27 
28 /* Regulator_state_is_STOP_mode */
29 #define PWR_Regulator_ON          ((uint32_t)0x00000000)
30 #define PWR_Regulator_LowPower    ((uint32_t)0x00000001)
31 
32 /* STOP_mode_entry */
33 #define PWR_STOPEntry_WFI         ((uint8_t)0x01)
34 #define PWR_STOPEntry_WFE         ((uint8_t)0x02)
35 
36 /* PWR_Flag */
37 #define PWR_FLAG_WU               ((uint32_t)0x00000001)
38 #define PWR_FLAG_SB               ((uint32_t)0x00000002)
39 #define PWR_FLAG_PVDO             ((uint32_t)0x00000004)
40 
41 
42 void PWR_DeInit(void);
43 void PWR_BackupAccessCmd(FunctionalState NewState);
44 void PWR_PVDCmd(FunctionalState NewState);
45 void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
46 void PWR_WakeUpPinCmd(FunctionalState NewState);
47 void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
48 void PWR_EnterSTANDBYMode(void);
49 FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
50 void PWR_ClearFlag(uint32_t PWR_FLAG);
51 
52 #ifdef __cplusplus
53 }
54 #endif
55 
56 #endif /* __CH32F10x_PWR_H */
57 
58