/* ****************************************************************************** * * @file hall.c * @brief hall module * * * @version 1.0 * @date 2022/08/04 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 2022/08/04 Alex build this file ******************************************************************************/ /*_____ I N C L U D E S ____________________________________________________*/ #include "hall.h" #include "key.h" #include "led.h" #include "userapp.h" #include "sleep.h" #ifdef HALL_ENABLE /******************************************************************************\ Macro definitions \******************************************************************************/ /******************************************************************************\ Variables definitions \******************************************************************************/ uint8_t Hall_Sta_bk = 0xff; CoverStatus_E CoverStatus; bit CoverEvent_Flg = 0; //Hall开关触发事件标志位 bit CoverEvent_Flg_led = 0; /******************************************************************************\ 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 = CHIP_STA0 & 0x08; if( Hall_Sta != Hall_Sta_bk) { if(CHIP_STA0 & 0x08) //Hall 高电平 { #if HALL_OPEN_LEV_SET CoverStatus = OPEN; #else CoverStatus = CLOSE; #endif } else { #if HALL_OPEN_LEV_SET CoverStatus = CLOSE; #else CoverStatus = OPEN; #endif } CoverEvent_Flg = 1; CoverEvent_Flg_led = 1; #if LED_DISPLAY LED_On_Flag = 1; #endif Hall_Sta_bk = Hall_Sta; // Enter_Sleep_Cnt_Restart_Flag = 1; } } #endif