已裁剪掉逗猫棒的业务程序,原有的蓝牙转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)
|
||||
|
||||
Reference in New Issue
Block a user