SY883x_For_Client_JLAB_JS07/UsrSrc/hall/hall.c
Alex xu a29b5cb50b 更改内容:1、将全局变量在定义时不赋初值,需要赋初值的变量在系统初始化函数中赋值,节省ROM占用月100Bytes;
2、删除按键短按显示电量功能;
3、增加开盖Vox输出5V给耳机充电功能,有耳机入盒灯效,无出盒灯效,Vox检测到轻载后延迟10分钟后关闭Vox输出5V,转入ADT模式;
4、增加Vox充电过程中电池电压触发3.6V低电报警阈值后,Vox发送电量码pattern功能。
2025-02-10 11:37:49 +08:00

102 lines
2.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
******************************************************************************
*
* @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"
#include "vox_module.h"
#ifdef HALL_ENABLE
/******************************************************************************\
Macro definitions
\******************************************************************************/
/******************************************************************************\
Variables definitions
\******************************************************************************/
uint8_t Hall_Sta_bk;
CoverStatus_E CoverStatus;
bit CoverEvent_Flg; //Hall开关触发事件标志位
bit CoverEvent_Flg_led;
/******************************************************************************\
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;
// Get_Vox_Num_Flag = 1;
#if LED_DISPLAY
LED_On_Flag = 1;
#endif
Hall_Sta_bk = Hall_Sta;
// Enter_Sleep_Cnt_Restart_Flag = 1;
}
}
#endif