106 lines
2.4 KiB
C
106 lines
2.4 KiB
C
/*
|
||
******************************************************************************
|
||
*
|
||
* @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;
|
||
#else
|
||
CoverStatus = CLOSE;
|
||
#endif
|
||
}
|
||
else
|
||
{
|
||
#if HALL_OPEN_LEV_SET
|
||
CoverStatus = CLOSE;
|
||
#else
|
||
CoverStatus = OPEN;
|
||
#endif
|
||
}
|
||
|
||
CoverEvent_Flg = 1;
|
||
|
||
CoverEvent_Flg_led = 1;
|
||
|
||
#ifdef LED_DISPLAY
|
||
LED_On_Flag = 1;
|
||
#endif
|
||
|
||
Hall_Sta_bk = Hall_Sta;
|
||
}
|
||
}
|
||
|
||
#endif
|
||
|