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