#include "hal_pwr.h" void Peripheral_UnInit(void) { unsigned int err_code; UART0_UnInit(); //to do twi_UnInit(); //to do spi_UnInit(); //to do saadc_UnInit(); TIME_UnInit(); err_code = ESB_UnInit(); #if DEBUG_PWR_Process if(err_code==0) SEGGER_RTT_printf(0,"Peripheral_UnInit ok!!\n"); else SEGGER_RTT_printf(0,"Peripheral_UnInit fail!!\n"); #endif } void WakeUp_Process(void* p) { unsigned int err_code; SEGGER_RTT_printf(0,"WakeUp_Process start!!\n"); WakeUpDisable(); UART0_Init(115200); //初始化串口 TIME_Init(); //滴答 err_code = ESB_Init(); #if DEBUG_PWR_Process if(err_code==0) SEGGER_RTT_printf(0,"WakeUp_Process ok!!\n"); else SEGGER_RTT_printf(0,"WakeUp_Process fail!!\n"); #endif } void PWR_Process(void) { if(GetWakeUpTime() != 0) //如果设置了唤醒时间 { #if DEBUG_PWR_Process SEGGER_RTT_printf(0,"PWR_Process call time : %d\r\n",TIME_GetTicks()); #endif Peripheral_UnInit(); //关闭外设 if(IsWakeUpEnable() == 0){ lfclk_config(); //开启低频时钟 } WakeUpTask_Regist(WakeUp_Process); //唤醒任务注册 WakeUpEnable(); //使能唤醒中断 PWR_EnterSleep(); //进入睡眠 } }