/* ****************************************************************************** * * @file hall.c * @brief hall module * @ic sy8835 * * @version 1.0 * @date 2024/11/01 15:00:40 * @author Alex Xu * * Copyright (c) 2013-2099,Tkplusemi Technology Co.,Ltd. * All Rights Reserved * * History: * Revision Date Author Desc * 1.0.0 2024/11/01 Alex build this file ******************************************************************************/ /*_____ I N C L U D E S ____________________________________________________*/ #include "hall.h" #include "key.h" #include "led.h" #include "vox_module.h" #include "userapp.h" #include "charger_module.h" #include "sleep.h" /******************************************************************************\ Macro definitions \******************************************************************************/ /******************************************************************************\ Variables definitions \******************************************************************************/ CoverStatus_E CoverStatus; bit CoverEvent_Flg = 0; //Hall开关触发事件标志位 bit CoverEvent_Flg_led = 0; #if HALL_ENABLE uint8_t Hall_Sta_bk = 0xff; /******************************************************************************\ Functions definitions \******************************************************************************/ /* ******************************************************************************* * void Hall_Handle(void) * * Description : Hall Handle --- 主循环中调用,调用周期10ms。CoverStatus --- 充电仓盖子状态。 * * Arguments : NONE * Returns : NONE * Notes : NONE * ******************************************************************************* */ void Hall_Handler(void) { uint8_t Hall_Sta = 0; Hall_Sta = pmu_Info.pmu_Chip_STA & HALL_STA; if( Hall_Sta != Hall_Sta_bk) { if( pmu_Info.pmu_Chip_STA & HALL_STA ) //Hall 高电平 { #if HALL_OPEN_LEV_SET CoverStatus = OPEN; #ifdef _DEBUG_HALL printf("Box Open.\r\n"); #endif #else CoverStatus = CLOSE; #ifdef _DEBUG_HALL printf("Box Close.\r\n"); #endif #endif } else { #if HALL_OPEN_LEV_SET CoverStatus = CLOSE; #ifdef _DEBUG_HALL printf("Box Close.\r\n"); #endif #else CoverStatus = OPEN; #ifdef _DEBUG_HALL printf("Box Open.\r\n"); #endif #endif } CoverEvent_Flg = 1; Boost_Open_Flag = 0; CoverEvent_Flg_led = 1; #ifdef LED_DISPLAY LED_On_Flag = 1; #endif Hall_Sta_bk = Hall_Sta; #if SLEEP_ENABLE Enter_Sleep_Cnt_Restart_Flag = 1; #endif } } #endif