1 2 3 4 #ifndef __CH57x_PWR_H__ 5 #define __CH57x_PWR_H__ 6 7 #ifdef __cplusplus 8 extern "C" { 9 #endif 10 11 #include "CH579SFR.h" 12 #include "core_cm0.h" 13 14 /** 15 * @brief Peripher CLK control bit define 16 */ 17 #define BIT_SLP_CLK_TMR0 (0x00000001) /*!< TMR0 peripher clk bit */ 18 #define BIT_SLP_CLK_TMR1 (0x00000002) /*!< TMR1 peripher clk bit */ 19 #define BIT_SLP_CLK_TMR2 (0x00000004) /*!< TMR2 peripher clk bit */ 20 #define BIT_SLP_CLK_TMR3 (0x00000008) /*!< TMR3 peripher clk bit */ 21 #define BIT_SLP_CLK_UART0 (0x00000010) /*!< UART0 peripher clk bit */ 22 #define BIT_SLP_CLK_UART1 (0x00000020) /*!< UART1 peripher clk bit */ 23 #define BIT_SLP_CLK_UART2 (0x00000040) /*!< UART2 peripher clk bit */ 24 #define BIT_SLP_CLK_UART3 (0x00000080) /*!< UART3 peripher clk bit */ 25 #define BIT_SLP_CLK_SPI0 (0x00000100) /*!< SPI0 peripher clk bit */ 26 #define BIT_SLP_CLK_SPI1 (0x00000200) /*!< SPI1 peripher clk bit */ 27 #define BIT_SLP_CLK_PWMX (0x00000400) /*!< PWMX peripher clk bit */ 28 #define BIT_SLP_CLK_LCD (0x00000800) /*!< LCD peripher clk bit */ 29 #define BIT_SLP_CLK_USB (0x00001000) /*!< USB peripher clk bit */ 30 #define BIT_SLP_CLK_ETH (0x00002000) /*!< ETH peripher clk bit */ 31 #define BIT_SLP_CLK_LED (0x00004000) /*!< LED peripher clk bit */ 32 #define BIT_SLP_CLK_BLE (0x00008000) /*!< BLE peripher clk bit */ 33 #define BIT_SLP_CLK_RAMX (0x10000000) /*!< RAM14K peripher clk bit */ 34 #define BIT_SLP_CLK_RAM2K (0x20000000) /*!< RAM2K peripher clk bit */ 35 #define BIT_SLP_CLK_ALL (0x3000FFFF) /*!< All peripher clk bit */ 36 37 /** 38 * @brief unit of controllable power supply 39 */ 40 #define UNIT_SYS_LSE RB_CLK_XT32K_PON // 外部32K 时钟振荡 41 #define UNIT_SYS_LSI RB_CLK_INT32K_PON // 内部32K 时钟振荡 42 #define UNIT_SYS_HSE RB_CLK_XT32M_PON // 外部32M 时钟振荡 43 #define UNIT_SYS_HSI RB_CLK_INT32M_PON // 内部32M 时钟振荡 44 #define UNIT_SYS_PLL RB_CLK_PLL_PON // PLL 时钟振荡 45 #define UNIT_ETH_PHY (0x80) // 以太网收发器 ETH-PHY 46 47 48 void PWR_DCDCCfg( UINT8 s ); /* 内部DC/DC电源控制 */ 49 void PWR_UnitModCfg( UINT8 s, UINT8 unit ); /* 可控单元模块的电源控制 */ 50 void PWR_PeriphClkCfg( UINT8 s, UINT16 perph ); /* 外设时钟控制位 */ 51 52 void PowerMonitor( UINT8 s ); /* 电源电压监控功能控制 */ 53 54 void PWR_PeriphWakeUpCfg( UINT8 s, UINT16 perph ); /* 睡眠唤醒源配置 */ 55 void LowPower_Idle( void ); /* 低功耗-IDLE模式 */ 56 void LowPower_Halt_1( void ); /* 低功耗-Halt_1模式 */ 57 void LowPower_Halt_2( void ); /* 低功耗-Halt_2模式 */ 58 void LowPower_Sleep( UINT8 rm ); /* 低功耗-Sleep模式 */ 59 void LowPower_Shutdown( UINT8 rm ); /* 低功耗-Shutdown模式 */ 60 void EnterCodeUpgrade( void ); /* 跳入BOOT程序,准备代码升级 */ 61 62 63 64 #ifdef __cplusplus 65 } 66 #endif 67 68 #endif // __CH57x_PWR_H__ 69 70