/* ****************************************************************************** * * @file sleep.c * @brief sleep module * * * @version 1.0 * @date 2023/03/22 17:35:40 * @author Alex Xu * * Copyright (c) 2013-2099,Tkplusemi Technology Co.,Ltd. * All Rights Reserved * * History: * Revision Date Author Desc * 1.0.0 2023/03/22 Alex build this file ****************************************************************************** */ #include "sleep.h" #include "led.h" #include "system.h" #include "vox_module.h" #include "discharge_module.h" #include "charger_module.h" #include "bat.h" #include "hall.h" #include "gpio.h" #include "sys_tim.h" #if SLEEP_ENABLE /******************************************************************************\ Macro definitions \******************************************************************************/ /******************************************************************************\ Variables definitions \******************************************************************************/ uint8_t Decnt_SleepDelay = 0; bit Enter_Sleep_Cnt_Restart_Flag = 0; /******************************************************************************\ Functions definitions \******************************************************************************/ /* ******************************************************************************* * bool Check_Require_Sleep(void ) * * Description : 查询休眠唤醒源标志位函数。 * * Arguments : None * Returns : None * Notes : bool Flag * ******************************************************************************* */ bool Check_Require_Sleep(void ) { // if( ( CHIP_STA4 & 0x80 ) || Vol_LiPro_Flag || Vor_LiPro_Flag || Enter_Sleep_Cnt_Restart_Flag ) /* Power Good存在、有中断、耳机处于锂保状态情况下,系统不进休眠模式。 */ if( ( CHIP_STA4 & 0x80 ) || Enter_Sleep_Cnt_Restart_Flag ) { #ifdef _DEBUG_SLEEP printf("Protect\r\n"); #endif Enter_Sleep_Cnt_Restart_Flag = 0; /*处理对应的保护和中断唤醒事件。*/ return false; } return true; } #endif