2、增加VOX持续输出0V以唤醒耳机的情况; 3、解决超长按后,双向通讯一直发码的问题;(松开按键后Key_Press_ll_irq设为FALSE) 4、解决关盖上电时,不亮灯和不发码的问题(即把Hall_Sta_bk初始化); 5、长按发配对码时,主副耳的选择提取到config.h中;
140 lines
2.8 KiB
C
140 lines
2.8 KiB
C
/*
|
||
******************************************************************************
|
||
*
|
||
* @file hall.c
|
||
* @brief hall module
|
||
* @ic sy8837/8
|
||
*
|
||
* @version 1.0
|
||
* @date 2024/12/02 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/12/02 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"
|
||
#include "system.h"
|
||
#include "display_ui.h"
|
||
#include "vox_comm.h"
|
||
|
||
|
||
/******************************************************************************\
|
||
Macro definitions
|
||
\******************************************************************************/
|
||
|
||
/******************************************************************************\
|
||
Variables definitions
|
||
\******************************************************************************/
|
||
|
||
CoverStatus_E CoverStatus;
|
||
|
||
bit CoverEvent_Flg; //Hall开关触发事件标志位,用于VOX充电。
|
||
|
||
#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 = CHIP_STA0 & HALL_STAT;
|
||
|
||
if( Hall_Sta != Hall_Sta_bk )
|
||
{
|
||
if( CHIP_STA0 & HALL_STAT ) //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
|
||
}
|
||
|
||
Vox_Comm_Cfg_Clear();
|
||
|
||
CoverEvent_Flg = TRUE;
|
||
|
||
Boost_Open_Flag = FALSE;
|
||
|
||
CoverEvent_Flg_led = TRUE;
|
||
|
||
#ifdef LED_DISPLAY
|
||
LED_On_Flag = TRUE;
|
||
#endif
|
||
|
||
Hall_Sta_bk = Hall_Sta;
|
||
|
||
#if SLEEP_ENABLE
|
||
|
||
Enter_Sleep_Cnt_Restart_Flag = TRUE;
|
||
|
||
#endif
|
||
|
||
}
|
||
}
|
||
|
||
#endif
|
||
|