已裁剪掉逗猫棒的业务程序,原有的蓝牙转USB功能不受影响
This commit is contained in:
+26
-328
@@ -45,9 +45,6 @@ u8 user_at_cmd_send_support = 1;
|
||||
#endif
|
||||
|
||||
|
||||
extern void usr_le_notify_data();
|
||||
|
||||
|
||||
/*任务列表 */
|
||||
const struct task_info task_info_table[] = {
|
||||
{"app_core", 1, 0, 768+768, 256 },
|
||||
@@ -149,39 +146,15 @@ const struct task_info task_info_table[] = {
|
||||
APP_VAR app_var;
|
||||
USR_VAR usr_var;
|
||||
void clr_wdt(void);
|
||||
u8 usr_get_ldoin();
|
||||
void app_earphone_play_voice_file(const char *name);
|
||||
extern void usr_clear_battery_cache();
|
||||
extern int cpu_reset_by_soft();
|
||||
extern int audio_dec_init();
|
||||
extern int audio_enc_init();
|
||||
extern u32 timer_get_ms(void);
|
||||
extern void uart_dev_test_main();
|
||||
extern int utc_test_main();
|
||||
extern void timer_pwm_test(void);
|
||||
extern int ana_demo();
|
||||
extern void uart_dev_main_init();
|
||||
extern void usr_check_mcu_all_sta();
|
||||
extern int utc_dec_test_main();
|
||||
extern int plan_test_main();
|
||||
extern void usr_clear_moto();
|
||||
extern void usr_rtc_get_time();
|
||||
extern void usr_read_device_sta();
|
||||
extern void usr_rcsp_process_timer();
|
||||
extern void usr_clear_pair_info_noreset();
|
||||
extern void usr_disable_intterupt();
|
||||
extern void usr_disable_charge_intterupt();
|
||||
extern void app_rtc_task();
|
||||
extern void usr_plan_init();
|
||||
u8 power_reset_flag=0;///不定义的话RTC编译报错
|
||||
/*
|
||||
* 2ms timer中断回调函数
|
||||
*/
|
||||
|
||||
void timer_2ms_handler()
|
||||
{
|
||||
|
||||
}
|
||||
u8 power_reset_flag = 0;
|
||||
|
||||
void app_var_init(void)
|
||||
{
|
||||
@@ -190,52 +163,6 @@ void app_var_init(void)
|
||||
|
||||
}
|
||||
|
||||
void check_power_on_key(void)
|
||||
{
|
||||
u32 delay_10ms_cnt = 0;
|
||||
usr_var.usr_power_charge_flag=2;
|
||||
|
||||
os_time_dly(10);
|
||||
while (1) {
|
||||
clr_wdt();
|
||||
os_time_dly(1);
|
||||
|
||||
extern u8 get_power_on_status(void);
|
||||
if (get_power_on_status()) {
|
||||
log_info("+");
|
||||
delay_10ms_cnt++;
|
||||
if (delay_10ms_cnt > 60) {
|
||||
/* extern void set_key_poweron_flag(u8 flag); */
|
||||
/* set_key_poweron_flag(1); */
|
||||
_usr_module_cfg.local_moto_mode=1;
|
||||
usr_var.usr_power_charge_flag=2;
|
||||
app_var.play_poweron_tone=1;
|
||||
//wdt_init(WDT_256MS);
|
||||
//while(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if((usr_get_ldoin())||(gpio_read(IO_PORTC_05)==0))
|
||||
{
|
||||
putchar('*');
|
||||
delay_10ms_cnt++;
|
||||
if (delay_10ms_cnt > 10) {
|
||||
usr_var.usr_power_charge_flag=1;
|
||||
//wdt_init(WDT_256MS);
|
||||
//while(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
log_info("-");
|
||||
delay_10ms_cnt = 0;
|
||||
log_info("enter softpoweroff\n");
|
||||
usr_clear_battery_cache();
|
||||
power_set_soft_poweroff();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
u8 get_charge_online_flag(void)
|
||||
{
|
||||
@@ -257,312 +184,83 @@ static void app_poweron_check(int update)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
//#ifdef CONFIG_RELEASE_ENABLE
|
||||
#if TCFG_POWER_ON_NEED_KEY
|
||||
check_power_on_key();
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void usr_led_w_out(u8 flag)
|
||||
{
|
||||
gpio_set_direction(IO_PORTA_07, !flag);
|
||||
gpio_set_pull_up(IO_PORTA_07, 0);
|
||||
gpio_set_pull_down(IO_PORTA_07,0);
|
||||
gpio_set_output_value(IO_PORTA_07,!flag);
|
||||
}
|
||||
void usr_led_b_out(u8 flag)
|
||||
{
|
||||
gpio_set_direction(IO_PORTA_08,!flag);
|
||||
gpio_set_pull_down(IO_PORTA_08,0);
|
||||
gpio_set_pull_up (IO_PORTA_08,0);
|
||||
gpio_set_output_value(IO_PORTA_08,!flag);
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern void usr_moto_timer_init();
|
||||
|
||||
|
||||
u8 usr_get_ldoin()
|
||||
{
|
||||
if(gpio_read(IO_PORTG_08)==0)return 1;
|
||||
return 0;
|
||||
}
|
||||
u8 usr_get_full()
|
||||
{
|
||||
if(gpio_read(IO_PORTC_05)==0)return 1;
|
||||
return 0;
|
||||
}
|
||||
u8 usr_get_ldoin_all()
|
||||
{
|
||||
if(usr_get_ldoin()||usr_get_full())return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void usr_charge_deal()
|
||||
{
|
||||
static u8 rled_flag=0;
|
||||
u8 usr_chg_in=0;
|
||||
usr_chg_in=usr_get_ldoin();
|
||||
//printf("usr_chg_in = %d\n",usr_chg_in);
|
||||
if(usr_chg_in)
|
||||
{
|
||||
// charge_check_and_set_pinr(0);
|
||||
usr_clear_moto();
|
||||
if(usr_get_full())
|
||||
{
|
||||
rled_flag=1;
|
||||
if(usr_var.usr_power_charge_flag==2)
|
||||
{
|
||||
usr_var.usr_power_charge_flag=1;
|
||||
usr_le_notify_data();
|
||||
}
|
||||
printf("charge full power off00\n");
|
||||
//power_set_soft_poweroff();
|
||||
}
|
||||
else
|
||||
{
|
||||
rled_flag=!rled_flag;
|
||||
printf("charging \n");
|
||||
if(usr_var.usr_power_charge_flag==2)
|
||||
{
|
||||
usr_var.usr_power_charge_flag=1;
|
||||
usr_le_notify_data();
|
||||
}
|
||||
}
|
||||
usr_led_b_out(0);
|
||||
usr_led_w_out(rled_flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
// charge_check_and_set_pinr(1);
|
||||
if(usr_get_full())
|
||||
{
|
||||
if(usr_var.usr_power_charge_flag==2)
|
||||
{
|
||||
usr_var.usr_power_charge_flag=1;
|
||||
usr_le_notify_data();
|
||||
}
|
||||
usr_clear_moto();
|
||||
usr_led_b_out(0);
|
||||
rled_flag=1;
|
||||
usr_led_w_out(rled_flag);
|
||||
printf("charge full power off11\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(usr_var.usr_power_charge_flag==1)
|
||||
{
|
||||
usr_var.usr_power_charge_flag=2;
|
||||
usr_var.usr_allow_to_sleep_cnt=8;
|
||||
//power_set_soft_poweroff();
|
||||
printf("charge plug power off\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
usr_rtc_get_time();
|
||||
//read_sys_time(&usr_current_time1);
|
||||
//printf("#### usr_current_time1 %d-%d-%d %d:%d:%d \n",usr_current_time1.year,usr_current_time1.month,usr_current_time1.day,usr_current_time1.hour,usr_current_time1.min,usr_current_time1.sec);
|
||||
usr_rcsp_process_timer();
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
const struct sys_time def_sys_time = { //初始一下当前时间
|
||||
.year = 2020,
|
||||
.month = 1,
|
||||
.day = 1,
|
||||
.hour = 0,
|
||||
.min = 0,
|
||||
.sec = 0,
|
||||
};
|
||||
|
||||
|
||||
const struct rtc_dev_platform_data rtc_init_data=
|
||||
{
|
||||
.default_sys_time = &def_sys_time,
|
||||
.default_alarm = NULL,
|
||||
.clk_sel = CLK_SEL_32K,//CLK_SEL_LRC,//CLK_SEL_32K,
|
||||
.cbfun = NULL, //闹钟中断的回调函数,用户自行定义
|
||||
/* .cbfun = alarm_isr_user_cbfun, */
|
||||
};
|
||||
#endif // 0
|
||||
extern void bt_osc_offset_ext_updata(s32 offset);
|
||||
extern void usr_test_protocol(void);
|
||||
void app_main()
|
||||
{
|
||||
int update = 0;
|
||||
u32 addr = 0, size = 0;
|
||||
struct intent it;
|
||||
|
||||
u16 pair_cnt=0;
|
||||
log_info("app_main........4444444444444.......#####\n");
|
||||
log_info("app_main usb-ble bridge\n");
|
||||
bt_osc_offset_ext_updata(11);
|
||||
//usr_disable_charge_intterupt();
|
||||
app_rtc_task();
|
||||
//alarm_init();
|
||||
usr_var.usr_ota_succ_flag=0;
|
||||
//rtc_init(&rtc_init_data);
|
||||
//read_sys_time(&usr_current_time1);
|
||||
//printf("#### usr_current_time1 %d %d %d %d %d %d \n",usr_current_time1.year,usr_current_time1.month,usr_current_time1.day,usr_current_time1.hour,usr_current_time1.min,usr_current_time1.sec);
|
||||
|
||||
// usb_iomode(1);
|
||||
usr_var.usr_ota_succ_flag = 0;
|
||||
|
||||
gpio_set_die(IO_PORTB_01, 1);
|
||||
gpio_set_direction(IO_PORTB_01, 1);
|
||||
gpio_set_pull_up(IO_PORTB_01, 1);
|
||||
gpio_set_pull_down(IO_PORTB_01,0);
|
||||
|
||||
// gpio_set_die(IO_PORTG_08, 1);///充电插入检测
|
||||
// gpio_set_direction(IO_PORTG_08, 1);
|
||||
// gpio_set_pull_up(IO_PORTG_08, 1);
|
||||
// gpio_set_pull_down(IO_PORTG_08,0);
|
||||
|
||||
// gpio_set_die (IO_PORTC_05,1);///充满检测
|
||||
// gpio_set_direction(IO_PORTC_05,1);
|
||||
// gpio_set_pull_down(IO_PORTC_05,0);
|
||||
// gpio_set_pull_up (IO_PORTC_05,1);
|
||||
|
||||
|
||||
//usr_disable_intterupt();
|
||||
gpio_set_pull_down(IO_PORTB_01, 0);
|
||||
|
||||
#ifndef CONFIG_DEBUG_ENABLE
|
||||
uart_dev_test_main();
|
||||
#endif // CONFIG_DEBUG_ENABLE
|
||||
#endif
|
||||
app_var.start_time = timer_get_ms();
|
||||
|
||||
#if (defined(CONFIG_MEDIA_NEW_ENABLE) || (defined(CONFIG_MEDIA_DEVELOP_ENABLE)))
|
||||
/*解码器*/
|
||||
audio_enc_init();
|
||||
audio_dec_init();
|
||||
#endif
|
||||
|
||||
//rtc_init(&rtc_init_data);
|
||||
#ifdef BT_DUT_INTERFERE
|
||||
void audio_demo(void);
|
||||
audio_demo();
|
||||
#endif/*BT_DUT_INTERFERE*/
|
||||
#endif
|
||||
#ifdef BT_DUT_ADC_INTERFERE
|
||||
void audio_adc_mic_dut_open(void);
|
||||
audio_adc_mic_dut_open();
|
||||
#endif/*BT_DUT_ADC_INTERFERE*/
|
||||
#endif
|
||||
|
||||
if (!UPDATE_SUPPORT_DEV_IS_NULL()) {
|
||||
update = 0;//update_result_deal();
|
||||
update = 0;
|
||||
}
|
||||
|
||||
app_var_init();
|
||||
|
||||
#if TCFG_MC_BIAS_AUTO_ADJUST
|
||||
mc_trim_init(update);
|
||||
#endif/*TCFG_MC_BIAS_AUTO_ADJUST*/
|
||||
|
||||
//if (get_charge_online_flag())
|
||||
if(0){
|
||||
|
||||
#if(TCFG_SYS_LVD_EN == 1)
|
||||
vbat_check_init();
|
||||
#endif
|
||||
|
||||
init_intent(&it);
|
||||
it.name = "idle";
|
||||
it.action = ACTION_IDLE_MAIN;
|
||||
start_app(&it);
|
||||
} else {
|
||||
_usr_module_cfg.local_moto_mode=0;
|
||||
check_power_on_voltage();
|
||||
check_power_on_voltage();
|
||||
app_poweron_check(update);
|
||||
|
||||
app_poweron_check(update);
|
||||
//uart_dev_main_init();
|
||||
//sys_timeout_add(NULL,usr_check_mcu_all_sta,1000);
|
||||
if(usr_get_ldoin()||usr_get_full())
|
||||
{
|
||||
usr_var.usr_power_charge_flag=1;
|
||||
_usr_module_cfg.local_moto_mode=3;
|
||||
}
|
||||
else
|
||||
{
|
||||
usr_var.usr_power_charge_flag=2;
|
||||
}
|
||||
//utc_dec_test_main();
|
||||
//utc_test_main();
|
||||
//usr_check_mcu_all_sta();
|
||||
//ana_demo();
|
||||
usr_read_device_sta();
|
||||
usr_var.usr_goto_pair = 1;
|
||||
usr_clear_pair_info_noreset();
|
||||
|
||||
pair_cnt=0;
|
||||
timer_pwm_test();
|
||||
usr_moto_timer_init();
|
||||
|
||||
// sys_timer_add(NULL,usr_charge_deal,1000);
|
||||
//plan_test_main();
|
||||
usr_led_w_out(1);
|
||||
|
||||
usr_read_device_sta();
|
||||
usr_var.usr_goto_pair=1;
|
||||
// if(app_var.play_poweron_tone==0)
|
||||
// {
|
||||
// _usr_module_cfg.local_moto_mode=3;
|
||||
// _usr_module_cfg.usr_dizhuo_mode=0;
|
||||
// _usr_module_cfg.usr_douban_mode=0;
|
||||
// }
|
||||
// if(usr_var.usr_power_charge_flag==2)
|
||||
// {
|
||||
// while(1)
|
||||
// {
|
||||
// delay_2ms(30);
|
||||
// if(gpio_read(IO_PORTB_01)==0)
|
||||
// {
|
||||
// pair_cnt++;
|
||||
// printf("pair_cnt = %d\n",pair_cnt);
|
||||
// if(pair_cnt>=30)
|
||||
// {
|
||||
// pair_cnt=0;
|
||||
// usr_var.usr_goto_pair=1;
|
||||
// _usr_module_cfg.local_moto_mode=3;
|
||||
// usr_clear_pair_info_noreset();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// pair_cnt=0;
|
||||
// usr_var.usr_goto_pair=0;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
usr_plan_init();
|
||||
|
||||
|
||||
ui_manage_init();
|
||||
ui_update_status(STATUS_POWERON);
|
||||
ui_manage_init();
|
||||
ui_update_status(STATUS_POWERON);
|
||||
|
||||
#if TCFG_WIRELESS_MIC_ENABLE
|
||||
extern void wireless_mic_main_run(void);
|
||||
wireless_mic_main_run();
|
||||
extern void wireless_mic_main_run(void);
|
||||
wireless_mic_main_run();
|
||||
#endif
|
||||
|
||||
#if TCFG_ENTER_PC_MODE
|
||||
init_intent(&it);
|
||||
it.name = "pc";
|
||||
it.action = ACTION_PC_MAIN;
|
||||
start_app(&it);
|
||||
#if TCFG_ENTER_PC_MODE
|
||||
init_intent(&it);
|
||||
it.name = "pc";
|
||||
it.action = ACTION_PC_MAIN;
|
||||
start_app(&it);
|
||||
#else
|
||||
init_intent(&it);
|
||||
it.name = "earphone";
|
||||
it.action = ACTION_EARPHONE_MAIN;
|
||||
start_app(&it);
|
||||
init_intent(&it);
|
||||
it.name = "earphone";
|
||||
it.action = ACTION_EARPHONE_MAIN;
|
||||
start_app(&it);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if TCFG_CHARGE_ENABLE
|
||||
set_charge_event_flag(1);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
int __attribute__((weak)) eSystemConfirmStopStatus(void)
|
||||
|
||||
@@ -720,80 +720,8 @@ const struct low_power_param power_param = {
|
||||
};
|
||||
|
||||
/************************** wk_param ****************************/
|
||||
struct port_wakeup port0 = {
|
||||
.iomap = IO_PORTB_01, //唤醒口选择
|
||||
.pullup_down_enable = ENABLE, //配置I/O 内部上下拉是否使能
|
||||
.edge = FALLING_EDGE, //唤醒方式选择,可选:上升沿\下降沿
|
||||
.filter = PORT_FLT_4ms,
|
||||
|
||||
};
|
||||
struct port_wakeup port2_1 = {
|
||||
.iomap = IO_PORTA_03, //唤醒口选择
|
||||
.pullup_down_enable = 0, //配置I/O 内部上下拉是否使能
|
||||
.edge = FALLING_EDGE, //唤醒方式选择,可选:上升沿\下降沿
|
||||
.filter = PORT_FLT_16ms,
|
||||
|
||||
};
|
||||
struct port_wakeup port_1 = {
|
||||
.iomap = IO_PORTG_08, //唤醒口选择
|
||||
.pullup_down_enable = ENABLE, //配置I/O 内部上下拉是否使能
|
||||
.edge = FALLING_EDGE, //唤醒方式选择,可选:上升沿\下降沿
|
||||
.filter = PORT_FLT_4ms,
|
||||
};
|
||||
struct port_wakeup port_2 = {
|
||||
.iomap = IO_PORTC_04, //唤醒口选择
|
||||
.pullup_down_enable = ENABLE, //配置I/O 内部上下拉是否使能
|
||||
.edge = FALLING_EDGE, //唤醒方式选择,可选:上升沿\下降沿
|
||||
.filter = PORT_FLT_4ms,
|
||||
};
|
||||
#if (TCFG_TEST_BOX_ENABLE || TCFG_CHARGESTORE_ENABLE || TCFG_ANC_BOX_ENABLE || TCFG_UMIDIGI_BOX_ENABLE)
|
||||
struct port_wakeup port1 = {
|
||||
.pullup_down_enable = DISABLE, //配置I/O 内部上下拉是否使能
|
||||
#if (TCFG_TEST_BOX_ANY_IO_UPDATE)
|
||||
.edge = RISING_EDGE, //唤醒方式选择,可选:上升沿\下降沿
|
||||
#else
|
||||
.edge = FALLING_EDGE, //唤醒方式选择,可选:上升沿\下降沿
|
||||
#endif
|
||||
.filter = PORT_FLT_1ms,
|
||||
.iomap = TCFG_CHARGESTORE_PORT, //唤醒口选择
|
||||
};
|
||||
#endif
|
||||
|
||||
#if TCFG_CHARGE_ENABLE
|
||||
struct port_wakeup charge_port = {
|
||||
.edge = RISING_EDGE, //唤醒方式选择,可选:上升沿\下降沿\双边沿
|
||||
.filter = PORT_FLT_16ms,
|
||||
.iomap = IO_CHGFL_DET, //唤醒口选择
|
||||
};
|
||||
|
||||
struct port_wakeup vbat_port = {
|
||||
.edge = BOTH_EDGE, //唤醒方式选择,可选:上升沿\下降沿\双边沿
|
||||
.filter = PORT_FLT_4ms,
|
||||
.iomap = IO_VBTCH_DET, //唤醒口选择
|
||||
};
|
||||
|
||||
struct port_wakeup ldoin_port = {
|
||||
.edge = BOTH_EDGE, //唤醒方式选择,可选:上升沿\下降沿\双边沿
|
||||
.filter = PORT_FLT_4ms,
|
||||
.iomap = IO_LDOIN_DET, //唤醒口选择
|
||||
};
|
||||
#endif
|
||||
|
||||
/* 桥接板:无休眠、无充电唤醒源 */
|
||||
const struct wakeup_param wk_param = {
|
||||
#if 1//(!(TCFG_LP_TOUCH_KEY_ENABLE && TCFG_LP_TOUCH_KEY1_EN))
|
||||
.port[1] = &port0,
|
||||
.port[2] = &port2_1,
|
||||
.port[3] = &port_1,
|
||||
.port[4] = &port_2,
|
||||
#endif
|
||||
#if 0//(TCFG_TEST_BOX_ENABLE || TCFG_CHARGESTORE_ENABLE || TCFG_ANC_BOX_ENABLE || TCFG_UMIDIGI_BOX_ENABLE)
|
||||
.port[3] = &port1,
|
||||
#endif
|
||||
#if TCFG_CHARGE_ENABLE
|
||||
.aport[0] = &charge_port,
|
||||
.aport[1] = &vbat_port,
|
||||
.aport[2] = &ldoin_port,
|
||||
#endif
|
||||
};
|
||||
|
||||
void gSensor_wkupup_disable(void)
|
||||
@@ -1034,107 +962,35 @@ void board_set_soft_poweroff(void)
|
||||
|
||||
#define APP_IO_DEBUG_0(i,x) {JL_PORT##i->DIR &= ~BIT(x), JL_PORT##i->OUT &= ~BIT(x);}
|
||||
#define APP_IO_DEBUG_1(i,x) {JL_PORT##i->DIR &= ~BIT(x), JL_PORT##i->OUT |= BIT(x);}
|
||||
extern void usr_intterupt_close();
|
||||
extern void usr_intterupt_reinit();
|
||||
extern void usr_pwm_close();
|
||||
extern void key_active_set(u8 port);
|
||||
|
||||
/* 休眠已关闭,回调仅保留 SDK 注册接口;不做 PWM/唤醒口业务 */
|
||||
void sleep_exit_callback(u32 usec)
|
||||
{
|
||||
(void)usec;
|
||||
sleep_exit_callback_common(NULL);
|
||||
power_wakeup_index_enable(2, 0);
|
||||
power_wakeup_index_enable(3, 0);
|
||||
putchar('>');
|
||||
}
|
||||
void usr_disable_intterupt()
|
||||
{
|
||||
power_wakeup_index_enable(2, 0);
|
||||
}
|
||||
|
||||
|
||||
void usr_disable_charge_intterupt()
|
||||
{
|
||||
power_wakeup_index_enable(3, 0);
|
||||
}
|
||||
void usr_disable_all_intterupt()
|
||||
{
|
||||
usr_disable_intterupt();
|
||||
usr_disable_charge_intterupt();
|
||||
}
|
||||
|
||||
void sleep_enter_callback(u8 step)
|
||||
void sleep_enter_callback(u8 step)
|
||||
{
|
||||
/* 此函数禁止添加打印 */
|
||||
if (step == 1) {
|
||||
usr_pwm_close();
|
||||
usr_var.usr_interrupt_cnt=0;
|
||||
putchar('<');
|
||||
} else {
|
||||
gpio_set_pull_up(TCFG_CHARGESTORE_PORT, 0);
|
||||
gpio_set_pull_down(TCFG_CHARGESTORE_PORT, 0);
|
||||
gpio_set_die(TCFG_CHARGESTORE_PORT, 1);
|
||||
gpio_set_dieh(TCFG_CHARGESTORE_PORT, 1);
|
||||
gpio_set_direction(TCFG_CHARGESTORE_PORT, 1);
|
||||
|
||||
sleep_enter_callback_common(NULL);
|
||||
//if(_usr_module_cfg.power_on_flag==0)
|
||||
{
|
||||
if(_usr_module_cfg.zhengdong_kaiji)
|
||||
{
|
||||
if(usr_var.usr_disable_zjhendong==0)power_wakeup_index_enable(2, 1);
|
||||
}
|
||||
}
|
||||
power_wakeup_index_enable(3, 1);
|
||||
usr_intterupt_close();
|
||||
}
|
||||
return;
|
||||
}
|
||||
sleep_enter_callback_common(NULL);
|
||||
}
|
||||
|
||||
|
||||
static void port_wakeup_callback(u8 index, u8 gpio)
|
||||
{
|
||||
log_info("%s:%d,%d",__FUNCTION__,index,gpio);
|
||||
if(index==2)
|
||||
{
|
||||
//if(_usr_module_cfg.power_on_flag==0)
|
||||
{
|
||||
usr_var.usr_interrupt_cnt=0;
|
||||
usr_var.usr_intterupt_reinit_falg=0;
|
||||
if(_usr_module_cfg.zhengdong_kaiji)
|
||||
{
|
||||
if(usr_var.usr_disable_zjhendong==0)usr_intterupt_reinit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if TCFG_UMIDIGI_BOX_ENABLE
|
||||
if (index == 2) {
|
||||
ldo_port_wakeup_to_cmessage();
|
||||
}
|
||||
#endif
|
||||
switch (index) {
|
||||
#if (TCFG_TEST_BOX_ENABLE || TCFG_CHARGESTORE_ENABLE || TCFG_ANC_BOX_ENABLE)
|
||||
case 2:
|
||||
extern void chargestore_ldo5v_fall_deal(void);
|
||||
chargestore_ldo5v_fall_deal();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
(void)index;
|
||||
(void)gpio;
|
||||
}
|
||||
|
||||
static void aport_wakeup_callback(u8 index, u8 gpio, u8 edge)
|
||||
{
|
||||
/* log_info("%s:%d,%d",__FUNCTION__,index,gpio); */
|
||||
#if TCFG_CHARGE_ENABLE
|
||||
switch (gpio) {
|
||||
case IO_CHGFL_DET://charge port
|
||||
charge_wakeup_isr();
|
||||
break;
|
||||
case IO_VBTCH_DET://vbat port
|
||||
case IO_LDOIN_DET://ldoin port
|
||||
ldoin_wakeup_isr();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
(void)index;
|
||||
(void)gpio;
|
||||
(void)edge;
|
||||
}
|
||||
|
||||
void board_power_init(void)
|
||||
@@ -1145,19 +1001,12 @@ void board_power_init(void)
|
||||
|
||||
power_set_callback(TCFG_LOWPOWER_LOWPOWER_SEL, sleep_enter_callback, sleep_exit_callback, board_set_soft_poweroff);
|
||||
|
||||
#if TCFG_UMIDIGI_BOX_ENABLE
|
||||
gpio_set_die(TCFG_CHARGESTORE_PORT, 1);
|
||||
umidigi_chargestore_message_callback(app_umidigi_chargetore_message_deal);
|
||||
#endif
|
||||
|
||||
power_keep_dacvdd_en(0);
|
||||
|
||||
power_wakeup_init(&wk_param);
|
||||
power_wakeup_init(&wk_param);
|
||||
|
||||
power_awakeup_set_callback(aport_wakeup_callback);
|
||||
power_wakeup_set_callback(port_wakeup_callback);
|
||||
|
||||
usr_disable_all_intterupt();
|
||||
|
||||
}
|
||||
#endif /* #ifdef CONFIG_BOARD_JL701N_DEMO */
|
||||
|
||||
@@ -747,19 +747,13 @@ DAC硬件上的连接方式,可选的配置:
|
||||
//*********************************************************************************//
|
||||
// 充电参数配置 //
|
||||
//*********************************************************************************//
|
||||
//是否支持芯片内置充电
|
||||
//桥接板不使用内置充电 / 充电舱
|
||||
#define TCFG_CHARGE_ENABLE 0
|
||||
//是否支持开机充电
|
||||
#define TCFG_CHARGE_POWERON_ENABLE DISABLE
|
||||
//是否支持拔出充电自动开机功能
|
||||
#define TCFG_CHARGE_OFF_POWERON_NE ENABLE
|
||||
/*充电截止电压可选配置*/
|
||||
#define TCFG_CHARGE_OFF_POWERON_NE DISABLE
|
||||
#define TCFG_CHARGE_FULL_V CHARGE_FULL_V_4199
|
||||
/*充电截止电流可选配置*/
|
||||
#define TCFG_CHARGE_FULL_MA CHARGE_FULL_mA_10
|
||||
/*恒流充电电流可选配置*/
|
||||
#define TCFG_CHARGE_MA CHARGE_mA_50
|
||||
/*涓流充电电流配置*/
|
||||
#define TCFG_CHARGE_TRICKLE_MA CHARGE_mA_10
|
||||
|
||||
//*********************************************************************************//
|
||||
@@ -787,7 +781,7 @@ DAC硬件上的连接方式,可选的配置:
|
||||
//*********************************************************************************//
|
||||
#define TCFG_LOWPOWER_POWER_SEL PWR_LDO15//PWR_LDO15 //电源模式设置,可选DCDC和LDO
|
||||
#define TCFG_LOWPOWER_BTOSC_DISABLE 0 //低功耗模式下BTOSC是否保持
|
||||
#define TCFG_LOWPOWER_LOWPOWER_SEL SLEEP_EN//DEEP_SLEEP_EN//SLEEP_EN//DEEP_SLEEP_EN //低功耗使能,蓝牙&&系统空闲可进入低功耗
|
||||
#define TCFG_LOWPOWER_LOWPOWER_SEL 0 // 桥接板常供电,不进系统休眠//SLEEP_EN//DEEP_SLEEP_EN //低功耗使能,蓝牙&&系统空闲可进入低功耗
|
||||
#define TCFG_LOWPOWER_VDDIOM_LEVEL VDDIOM_VOL_28V //vddiom等级
|
||||
#define TCFG_LOWPOWER_OSC_TYPE OSC_TYPE_LRC //低功耗晶振类型,btosc/lrc
|
||||
///#if (TCFG_AUDIO_ASR_DEVELOP && TCFG_CVP_DEVELOP_ENABLE)
|
||||
|
||||
@@ -49,18 +49,13 @@ extern int bt_get_low_latency_mode();
|
||||
extern void bt_set_low_latency_mode(int enable);
|
||||
|
||||
extern void usr_goto_pair_mode();
|
||||
extern void usr_write_device_sta();
|
||||
extern u16 usr_get_conn_service();
|
||||
extern void usr_ble_adv_init();
|
||||
|
||||
extern void usr_le_notify_data();
|
||||
extern void usr_clear_up();
|
||||
void audio_aec_pitch_change_ctrl();
|
||||
void audio_surround_voice_ctrl();
|
||||
extern void start_streamer_test(void);
|
||||
extern int jl_kws_voice_event_handle(struct key_event *key);
|
||||
extern void usr_app_ota_init();
|
||||
extern void usr_intterupt_close();
|
||||
|
||||
|
||||
u8 poweroff_sametime_flag = 0;
|
||||
@@ -377,109 +372,54 @@ int app_earphone_key_event_handler(struct sys_event *event)
|
||||
|
||||
switch (key_event) {
|
||||
case KEY_MUSIC_PP:
|
||||
|
||||
//extern void usr_le_low_power_notify();
|
||||
//usr_le_low_power_notify();
|
||||
|
||||
if(_usr_module_cfg.power_on_flag==0)break;
|
||||
if(usr_var.usr_goto_pair)break;
|
||||
if(usr_var.usr_power_charge_flag==1)break;
|
||||
|
||||
usr_var.usr_auto_off_cnt=0;
|
||||
usr_var.usr_allow_to_sleep_cnt=8;
|
||||
|
||||
if(_usr_module_cfg.local_moto_mode==2)_usr_module_cfg.local_moto_mode=1;
|
||||
else _usr_module_cfg.local_moto_mode=2;
|
||||
usr_clear_up();
|
||||
usr_write_device_sta();
|
||||
printf("_usr_module_cfg.local_moto_mode = %d\n",_usr_module_cfg.local_moto_mode);
|
||||
/* cat-toy moto mode switch removed */
|
||||
break;
|
||||
case KEY_IR_NUM_0:
|
||||
// tone_play_by_path(TONE_POWER_ON, 0);
|
||||
break;
|
||||
case KEY_IR_NUM_1:
|
||||
// tone_play_by_path(TONE_RING, 0);
|
||||
break;
|
||||
case KEY_IR_NUM_2:
|
||||
// tone_play_by_path(TONE_RING, 0);
|
||||
if(_usr_module_cfg.power_on_flag==0)break;
|
||||
if(usr_var.usr_goto_pair)break;
|
||||
if(usr_var.usr_power_charge_flag==1)break;
|
||||
usr_var.usr_allow_to_sleep_cnt=8;
|
||||
if (usr_var.usr_goto_pair) {
|
||||
break;
|
||||
}
|
||||
usr_app_ota_init();
|
||||
break;
|
||||
case KEY_POWEROFF:
|
||||
if(usr_var.usr_power_charge_flag==1)break;
|
||||
goto_poweroff_cnt = 0;
|
||||
poweroff_sametime_flag = 0;
|
||||
goto_poweroff_flag = 1;
|
||||
usr_var.usr_allow_to_sleep_cnt=8;
|
||||
user_send_cmd_prepare(USER_CTRL_ALL_SNIFF_EXIT, 0, NULL);
|
||||
break;
|
||||
case KEY_POWEROFF_HOLD:
|
||||
if(usr_var.usr_power_charge_flag==1)break;
|
||||
#if (TCFG_USER_TWS_ENABLE && CONFIG_TWS_POWEROFF_SAME_TIME == 0)
|
||||
if ((u32)event->arg == KEY_EVENT_FROM_TWS) {
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
log_info("power flag cnt:%d cnt:%d\n", goto_poweroff_flag, goto_poweroff_cnt);
|
||||
usr_var.usr_allow_to_sleep_cnt=12;
|
||||
if (goto_poweroff_flag) {
|
||||
if(goto_poweroff_cnt<(POWER_OFF_CNT*3))goto_poweroff_cnt++;
|
||||
if (goto_poweroff_cnt < (POWER_OFF_CNT * 3)) {
|
||||
goto_poweroff_cnt++;
|
||||
}
|
||||
if (goto_poweroff_cnt == POWER_OFF_CNT) {
|
||||
//goto_poweroff_cnt = 0;
|
||||
//sys_enter_soft_poweroff(NULL);
|
||||
if(_usr_module_cfg.power_on_flag==0)
|
||||
{
|
||||
_usr_module_cfg.power_on_flag=1;
|
||||
usr_var.usr_can_pair=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
usr_var.usr_intterupt_reinit_falg=1;
|
||||
usr_intterupt_close();
|
||||
if((usr_auth_data.paired_flag==0)&&(_usr_module_cfg.zhengdong_kaiji==0))
|
||||
{
|
||||
sys_enter_soft_poweroff(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
_usr_module_cfg.power_on_flag=0;
|
||||
_usr_module_cfg.local_moto_mode=0;
|
||||
usr_clear_up();
|
||||
usr_le_notify_data();
|
||||
}
|
||||
if (_usr_module_cfg.power_on_flag == 0) {
|
||||
_usr_module_cfg.power_on_flag = 1;
|
||||
usr_var.usr_can_pair = 1;
|
||||
} else {
|
||||
usr_var.usr_can_pair = 1;
|
||||
}
|
||||
}
|
||||
if(usr_var.usr_can_pair)
|
||||
{
|
||||
if(goto_poweroff_cnt==(POWER_OFF_CNT*3))
|
||||
{
|
||||
usr_var.usr_can_pair=0;
|
||||
//goto_poweroff_cnt=0;
|
||||
if (usr_var.usr_can_pair) {
|
||||
if (goto_poweroff_cnt == (POWER_OFF_CNT * 3)) {
|
||||
usr_var.usr_can_pair = 0;
|
||||
usr_goto_pair_mode();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KEY_POWEROFF_HOLD_UP:
|
||||
if((usr_var.usr_can_pair)&&(goto_poweroff_cnt<(POWER_OFF_CNT*3)))
|
||||
{
|
||||
usr_clear_up();
|
||||
_usr_module_cfg.local_moto_mode=2;
|
||||
if(usr_get_conn_service()==0)
|
||||
{
|
||||
usr_ble_adv_init();
|
||||
}
|
||||
else
|
||||
{
|
||||
usr_le_notify_data();
|
||||
}
|
||||
}
|
||||
usr_var.usr_can_pair=0;
|
||||
goto_poweroff_cnt=0;
|
||||
usr_var.usr_allow_to_sleep_cnt=12;
|
||||
usr_var.usr_can_pair = 0;
|
||||
goto_poweroff_cnt = 0;
|
||||
break;
|
||||
case KEY_MUSIC_PREV:
|
||||
//user_send_cmd_prepare(USER_CTRL_AVCTP_OPID_PREV, 0, NULL);
|
||||
|
||||
Reference in New Issue
Block a user