/* * 获取p/f epg信息 */ GxEpgInfo * app_epg_get_pf_event(uint32_t pos) { GxBusPmDataProg prog; GxMsgProperty_EpgGet epg_params ; GxMsgProperty_EpgNumGet epg_num_get; app_msg* msg_temp; app_msg* msg1_temp; app_epg_free(); GxBus_PmProgGetByPos(pos,1,&prog); epg_num_get.service_id = prog.service_id; epg_num_get.ts_id = prog.ts_id; epg_num_get.orig_network_id = prog.original_id; if(epg_para.gApp_epg_enable == 0) { return NULL; } epg_para.msg_get_epg_num_id = app_send_msg(GXMSG_EPG_NUM_GET,(void*)&epg_num_get); if(epg_para.msg_get_epg_num_id<=0) { return NULL; } msg1_temp = app_get_msg(epg_para.msg_get_epg_num_id); if(((GxMsgProperty_EpgNumGet*)msg1_temp->param)->event_per_day[0] == 0) { app_free_msg(GXMSG_EPG_NUM_GET,epg_para.msg_get_epg_num_id); epg_para.msg_get_epg_num_id = 0; return NULL; } // epg_params.orig_network_id = prog.original_id; epg_params.service_id = prog.service_id; epg_params.ts_id = prog.ts_id; epg_params.get_event_pos = 0; epg_params.want_event_count = 2; epg_params.epg_info_size = 15*1024; epg_params.epg_info = (GxEpgInfo*)s_event_info; //等待消息被执行结束 epg_para.msg_get_epg_id = app_send_msg(GXMSG_EPG_GET,(void*)&epg_params); if(epg_para.msg_get_epg_id<=0) { app_free_msg(GXMSG_EPG_GET,epg_para.msg_get_epg_num_id); epg_para.msg_get_epg_num_id = 0; return NULL; } msg_temp = app_get_msg(epg_para.msg_get_epg_id); if(((GxMsgProperty_EpgGet*)msg_temp->param)->get_event_count == 0) { app_free_msg(GXMSG_EPG_GET,epg_para.msg_get_epg_id); epg_para.msg_get_epg_id = 0; return NULL; } return &(((GxMsgProperty_EpgGet*)msg_temp->param)->epg_info[0]); }
/* * 获取某天对应索引的EPG信息 */ GxEpgInfo * app_epg_get_event_info_by_sel(uint32_t nListSel) { app_msg* msg0_temp; app_msg* msg1_temp; GxEpgInfo *epg_info = NULL; uint32_t event_count ; if(epg_para.msg_get_epg_id<=0) { return NULL; } msg0_temp = app_get_msg(epg_para.msg_get_epg_id); msg1_temp = app_get_msg(epg_para.msg_get_epg_num_id); event_count = ((GxMsgProperty_EpgNumGet*)msg1_temp->param)->event_per_day[epg_para.sEpg_day+1]; if(event_count == 0) { return NULL; } if(epg_para.sEpg_day == 0) { event_count -= epg_para.sOffSetSel; if (nListSel >= event_count) { return NULL; } epg_info = &(((GxMsgProperty_EpgGet*)msg0_temp->param)->epg_info[nListSel+epg_para.sOffSetSel]); } else { if (nListSel >= event_count) { return NULL; } epg_info = &(((GxMsgProperty_EpgGet*)msg0_temp->param)->epg_info[nListSel]); } return epg_info; }
void idle_mode(void) { u8 key; //deg_str("idle_mode \n"); //dac_out_select(DAC_MUSIC, 0); //clear_all_event(); dac_mute_control(1,1); #ifdef PLAY_STATUS_LED_FUNC set_play_status_led_spark(PLED_OFF); #endif KT_AMFMStandby(); usb_suspend(); flush_all_msg(); disp_port(MENU_POWER_OFF); input_number_en=0; vol_change_en=0; #ifdef DEFAULT_VOL sys_main_vol=DEFAULT_VOL; #endif delay_10ms(20); #ifdef SYS_SOFT_WARE_GOIN_STANDBY if(sys_pwr_flag==0){ put_msg_fifo(MSG_SYS_CORE_SLEEP); } #endif while (1) { key = app_get_msg(); switch (key) { #ifdef SYS_SOFT_WARE_GOIN_STANDBY case MSG_SYS_CORE_SLEEP: core_power_off(); break; #endif case MSG_CHANGE_WORK_MODE: clear_all_event(); flush_all_msg(); return; case MSG_MUSIC_NEW_DEVICE_IN: //有新设备接入 break; default: ap_handle_hotkey(key); break; } } }
uint32_t app_epg_get_event_count(void) { app_msg* msg_temp; if(epg_para.msg_get_epg_id<=0 || epg_para.msg_get_epg_num_id<=0) { epg_para.cur_event_count = 0; return epg_para.cur_event_count; } msg_temp = app_get_msg(epg_para.msg_get_epg_num_id); printf("epg_para.sEpg_day=%d\n",epg_para.sEpg_day); epg_para.cur_event_count = ((GxMsgProperty_EpgNumGet*)msg_temp->param)->event_per_day[epg_para.sEpg_day+1]; if(epg_para.sEpg_day == 0) { epg_para.cur_event_count -=epg_para.sOffSetSel; } return epg_para.cur_event_count; }
void idle_mode(void) { u8 key; //deg_str("idle_mode \n"); //dac_out_select(DAC_MUSIC, 0); //clear_all_event(); KT_AMFMStandby(); usb_suspend(); flush_all_msg(); disp_port(MENU_POWER_OFF); input_number_en=0; vol_change_en=0; SYS_POWER_OFF(); LCD_BACKLIGHT_OFF(); //core_power_off(); while (1) { key = app_get_msg(); switch (key) { case MSG_POWER: work_mode = MUSIC_MODE; case MSG_CHANGE_WORK_MODE: clear_all_event(); flush_all_msg(); irkey_activated =0; sys_pwr_flag =1; return; case MSG_MUSIC_NEW_DEVICE_IN: //有新设备接入 //put_msg_lifo(MSG_CHANGE_WORK_MODE); break; default: //ap_handle_hotkey(key); break; } } }
void sys_power_on_wait_for_powerkey(void) { u8 msg_key=0; u8 pwr_keyhold_timer=2,pwr_keyhold_sec=0; SYS_POWER_OFF(); LCD_BACKLIGHT_OFF(); while(1) { msg_key = app_get_msg(); switch(msg_key) { case MSG_POWER_HOLD: pwr_keyhold_timer=8; break; case MSG_HALF_SECOND: if(pwr_keyhold_timer>6){ pwr_keyhold_sec++; if(pwr_keyhold_sec==0){ SYS_POWER_ON(); return ; } } else{ pwr_keyhold_sec--; pwr_keyhold_timer--; if(pwr_keyhold_timer==0){ SYS_POWER_OFF(); disp_port(MENU_POWER_OFF); delay_10ms(12); //core_power_off(); while(1); } } break; default: break; } } }
//检测当前预约节目是否存在 int8_t app_book_check_exist(GxBookGet* pEpgBookGet,GxBookType type,int32_t book_id) { int32_t book_get_msg_id; app_msg* pmsg; int i; memset(pEpgBookGet,0,sizeof(GxBookGet)); book_get_msg_id = app_send_msg(GXMSG_BOOK_GET,&type);//获取预约消息 if(book_get_msg_id) { pmsg = app_get_msg(book_get_msg_id);//获取数据 memcpy(pEpgBookGet , (GxBookGet*)(pmsg->param),sizeof(GxBookGet)); app_free_msg(GXMSG_BOOK_GET,book_get_msg_id);//释放数据空间 } for(i=0;i<pEpgBookGet->book_number;i++) { if(book_id == pEpgBookGet->book[i].id) { return 0; } } return -1; }
/*----------------------------------------------------------------------------*/ void aux_main(void) { u8 key; while (1) { #if defined(EXCHANGE_AUX_CHANNEL) dac_out_select(DAC_AMUX0, 0); #else dac_out_select(DAC_AMUX1, 0); #endif key = app_get_msg(); switch (key) { case MSG_CHANGE_WORK_MODE: return; case MSG_MUSIC_NEW_DEVICE_IN: //有新设备接入 work_mode = MUSIC_MODE; return; case MSG_HALF_SECOND: //////////////////////////////////////////////////////////// //显示界面的切换 #if 1 // if(RECODE_WORKING == encode_status) // { // main_menu = MENU_RECWORKING; // } // else if(RECODE_PAUSE == encode_status) // { // main_menu = MENU_REC_PAUSE; // } // else // { // main_menu = MENU_AUX; // } if(cur_menu == main_menu) { disp_port(main_menu); } set_brightness_fade_out(); #endif set_brightness_fade_out(); if (main_menu_conter < SUB_MENU_TIME) { main_menu_conter++; } else if (cur_menu != main_menu) { cur_menu = main_menu; disp_port(cur_menu); } // if(MENU_RECWORKING == cur_menu) // { // // disp_rec_working(); // disp_port(MENU_RECWORKING); // } break; #if 0//RTC_ENABLE case MSG_ALM_ON: write_next_alm_sec(); work_mode = RTC_MODE; put_msg_lifo(MSG_CHANGE_WORK_MODE); break; #endif default: ap_handle_hotkey(key); break; } } }
/*----------------------------------------------------------------------------*/ void music_play(void) { u8 key; u8 res; while (1) { #if (FF_FR_MUSIC == 0) if (play_status == MAD_PLAY) { dac_out_select(DAC_MUSIC, 0); } #else if ((play_status == MAD_PLAY) || (play_status == MAD_FF) || (play_status == MAD_FR)) { dac_out_select(DAC_MUSIC, 0); } #endif //suspend_sdmmc(); //可减少SDMMC功耗,但会增加电源波动 key = app_get_msg(); switch (key) { case MSG_CHANGE_WORK_MODE: //backup_music_point(); break; // return; case MSG_DEVICE_REMOVED: device_check(); disk_remove_deal_for_music(); stop_decode(); dev_remov_timer=8; break; case MSG_MUSIC_NEW_DEVICE_IN: //有新设备接入 //backup_music_point(); flush_all_msg(); given_file_method = PLAY_FIRST_FILE; case MSG_MUSIC_SELECT_NEW_DEVICE: //重新选择设备 res = find_device(given_device); if ((res == DEV_INIT_ERR) || (res == NO_DEFINE_DEV)) //指定的设备不在线,或初始化失败 { disk_toc_ok=0; dev_invalid=1; //Set_Curr_Func(SYS_IDLE); //put_msg_lifo(MSG_CHANGE_WORK_MODE); break; //given_device = DEVICE_AUTO_NEXT; //自动选择下一个设备 //put_msg_lifo(MSG_MUSIC_SELECT_NEW_DEVICE); //break; } else if ((res == NO_EFFECTIVE_DEV) || (res == NO_DEV_ONLINE)) //无可播放的设备 { #if defined(NO_DEV_DEFAULT_GO_TO_AUX) //Set_Curr_Func(SYS_AUX); #elif defined(NO_DEV_DEFAULT_GO_TO_IDLE) // Set_Curr_Func(SYS_IDLE); //put_msg_fifo(MSG_NO_DEVICE); #else //Set_Curr_Func(SYS_FMREV); #endif disk_toc_ok=0; dev_invalid=1; //Set_Curr_Func(SYS_IDLE); //put_msg_lifo(MSG_CHANGE_WORK_MODE); break; } else put_msg_lifo(MSG_MUSIC_SELECT_NEW_FILE); //找到可用设备 first_init_dev =1; break; case MSG_MUSIC_SELECT_NEW_FILE: #if 0 if (device_check() == 0) //当前播放设备已经不在线,则自动选取下一个设备 { #if 1 disk_toc_ok=0; //Set_Curr_Func(SYS_IDLE); //put_msg_lifo(MSG_CHANGE_WORK_MODE); #else given_device = DEVICE_AUTO_NEXT; put_msg_lifo(MSG_MUSIC_SELECT_NEW_DEVICE); #endif break; } #endif res = fs_get_filenum(play_mode, given_file_method); #if 0 if (res == GET_DEVICE_END) //下一曲到设备的结束,查找下一个设备的第一首 { given_file_method = PLAY_FIRST_FILE; given_device = DEVICE_AUTO_NEXT; put_msg_lifo(MSG_MUSIC_SELECT_NEW_DEVICE); break; } else if (res == GET_DEVICE_HEAD) //上一曲到设备的结束,查找下一个设备的最后一首 { given_file_method = PLAY_LAST_FILE; given_device = DEVICE_AUTO_PREV; put_msg_lifo(MSG_MUSIC_SELECT_NEW_DEVICE); break; } #endif if(res == GET_DEVICE_END){ given_file_method = PLAY_FIRST_FILE; put_msg_lifo(MSG_MUSIC_STOP); break; } put_msg_lifo(MSG_MUSIC_PLAY_NEW_FILE); break; case MSG_MUSIC_PLAY_NEW_FILE: //按文件序号选择文件进行播放 flush_all_msg(); stop_decode(); cipher_ctl(0); res = fs_getfile_bynumber(0, &fat_ptr1, given_file_number); disp_port(MENU_FILENUM); if (res == 0) { if (given_file_method == PLAY_BREAK_POINT) res = start_decode(); else res = start_decode(); } if (res != 0) //播放不成功 { play_status = MAD_STOP_WAIT; play_delay_time = 0; if (given_file_method <= PLAY_BREAK_POINT) //重新找下一首 { given_file_method = PLAY_NEXT_FILE; break; } else //重新找上一首 { given_file_method = PLAY_PREV_FILE; break; } } main_menu = MENU_MUSIC_MAIN; write_file_info(); break; case MSG_DECODE_FILE_END: if ((dec_msg->play_time >= 5) || (play_status == MAD_FF) || (play_status == MAD_FR)) //当前歌曲的播放时间大于5S时,直接播放下一首 { given_file_method = PLAY_AUTO_NEXT; put_msg_lifo(MSG_MUSIC_SELECT_NEW_FILE); } else //当前歌曲播放时间小于5S,有可能是不坏歌曲,等待一段时间 { play_delay_time = 0; given_file_method = PLAY_AUTO_NEXT; play_status = MAD_STOP_WAIT; } if(play_mode == REPEAT_OFF){ if(given_file_number == fs_msg.fileTotal){ flush_all_msg(); stop_decode(); } } break; case MSG_MUSIC_PREV_FILE: //选择上一个文件进行播放 given_file_method = PLAY_PREV_FILE; put_msg_lifo(MSG_MUSIC_SELECT_NEW_FILE); break; case MSG_MUSIC_NEXT_FILE: //选择下一个文件进行播放 //delay_10ms(30); given_file_method = PLAY_NEXT_FILE; put_msg_lifo(MSG_MUSIC_SELECT_NEW_FILE); break; #if defined(DECODE_STOP_MODE_ENABLE ) case MSG_MUSIC_STOP: if(play_status !=MAD_STOP){ flush_all_msg(); stop_decode(); } break; #endif case MSG_MUSIC_PP: //暂停和播放 if (cur_menu == MENU_INPUT_NUMBER) //数字输入模式 { put_msg_lifo(MSG_PICH_SONG); break; } #if defined(DECODE_STOP_MODE_ENABLE ) if(play_status ==MAD_STOP){ device_check(); if(DSA_SEL_DEV == DEVICE_SDMMC0){ if((device_online&BIT(0))==0){ break; } } else if (DSA_SEL_DEV == DEVICE_UDISK){ if((device_online&BIT(1))==0){ break; } } given_file_method = PLAY_FIRST_FILE; put_msg_lifo(MSG_MUSIC_SELECT_NEW_FILE); play_status = MAD_PLAY; break; } #endif if (play_status == MAD_PLAY) { disp_port(MENU_PAUSE); main_menu = MENU_PAUSE; mad_control(MAD_PAUSE, 0); play_status = MAD_PAUSE; // set_play_flash(LED_FLASH_ON); } else if (play_status == MAD_PAUSE) { main_menu = MENU_MUSIC_MAIN; disp_port(MENU_MUSIC_MAIN); mad_control(MAD_PLAY, 0); play_status = MAD_PLAY; // set_play_flash(LED_FLASH_NOR); } flush_all_msg(); break; case MSG_MUSIC_NEXT_EQ: if (play_status == MAD_PAUSE) break; eq_mode++; if (eq_mode > CLASSIC) { eq_mode = NORMAL; } set_eq(eq_mode); disp_port(MENU_SET_EQ); break; case MSG_NEXT_PLAYMODE: if (play_status == MAD_PAUSE) break; play_mode++; if (play_mode > REPEAT_END) { play_mode = REPEAT_INIT; } //disp_port(MENU_SET_PLAY_MODE); break; case MSG_MUTE: //静音 break; #if (FF_FR_EN == 1) case MSG_MUSIC_FR: //启动快退 if (find_break_point_file_flag) //如果是记忆播放的歌曲,不能快退 { break; } if (play_status == MAD_PLAY) { play_status = MAD_FR; } break; case MSG_MUSIC_FF: //启动快进 if (play_status == MAD_PLAY) { play_status = MAD_FF; } break; case MSG_KEY_CHANGE: case MSG_MUSIC_FFR_DONE: //快进快退结束,恢复播放 if (play_status == MAD_FR) { set_eq(eq_mode); flush_all_msg(); #if (FF_FR_MUSIC == 0) dac_mute_control(0); #endif play_status = MAD_PLAY; } else if (play_status == MAD_FF) { set_eq(eq_mode); flush_all_msg(); #if (FF_FR_MUSIC == 0) dac_mute_control(0); #endif play_status = MAD_PLAY; } break; #endif case MSG_PICH_SONG: if (cur_menu == MENU_INPUT_NUMBER) //数字输入模式 { if ((input_number <= fs_msg.fileTotal) && (input_number != 0)) //输入数字是否有效 { given_file_number = input_number; given_file_method = PLAY_FIRST_FILE; given_device = DEVICE_AUTO_NEXT; put_msg_lifo(MSG_MUSIC_PLAY_NEW_FILE); } else disp_port(main_menu); } break; #if (MUSIC_SPECTRUM_EN == 1) case MSG_100MS: if (cur_menu == MENU_MUSIC_MAIN) { music_spec_cul(1); disp_port(MENU_100MS_REFRESH); } break; #endif case MSG_200MS: //////////////////////////////////////////////////////////// //快进快退实际的操作在这里完成 #if (FF_FR_EN == 1) if (play_status == MAD_FF) { #if (FF_FR_MUSIC == 0) //如果需要在快进快退过程中听到声音,可以不加此行 dac_mute_control(1); #endif mad_control(MAD_FF, FF_FR_STEP); mad_control(MAD_FAST_FORWARD, 0); #if (FF_FR_MUSIC == 1) dac_mute_control(0,1); #endif mad_control(MAD_PLAY, 0); } else if (play_status == MAD_FR) { #if (FF_FR_MUSIC == 0) dac_mute_control(1); //如果需要在快进快退过程中听到声音,可以不加此行 #endif mad_control(MAD_FR, FF_FR_STEP); mad_control(MAD_FAST_REVERASE, 0); #if (FF_FR_MUSIC == 1) dac_mute_control(0,1); #endif mad_control(MAD_PLAY, 0); } disp_port(MENU_HALF_SEC_REFRESH); #endif #if (DISP_DOT_LCD == 1) disp_port(MENU_200MS_REFRESH); //播放时的滚动显示 #endif break; case MSG_HALF_SECOND: ///////////////////////////////////////////////////////////// //短歌曲或损坏的歌曲在这里跳到下一首 if (play_status == MAD_STOP_WAIT) //等待一段时间再自动选择下一首 { if (play_delay_time < 4) play_delay_time++; else { put_msg_lifo(MSG_MUSIC_SELECT_NEW_FILE); } } if(dev_remov_timer>0){ dev_remov_timer--; if(dev_remov_timer==0){ Set_Curr_Func(SYS_IDLE); put_msg_lifo(MSG_CHANGE_WORK_MODE); } } //////////////////////////////////////////////////////////// //显示界面的切换 if (main_menu_conter < SUB_MENU_TIME) { main_menu_conter++; } else if (cur_menu != main_menu) { if (cur_menu == MENU_INPUT_NUMBER) //数字输入模式 { put_msg_lifo(MSG_PICH_SONG); break; } else { cur_menu = main_menu; } disp_port(cur_menu); } ///////////////////////////////////////////////////////////// //调整显示亮度 set_brightness_fade_out(); ///////////////////////////////////////////////////////////// //更新实时界面 disp_port(MENU_HALF_SEC_REFRESH); break; case MSG_NEXT_FOLDER: select_folder_file(FIND_NEXT_DIR); break; case MSG_PREV_FOLDER: select_folder_file(FIND_PREV_DIR); break; #if 0//RTC_ENABLE case MSG_ALM_ON: write_next_alm_sec(); Set_Curr_Func(SYS_RTC); put_msg_lifo(MSG_CHANGE_WORK_MODE); break; #endif default : ap_handle_hotkey(key); break; } } }
/* * 更新选中节目某天的EPG信息(返回当前选中行EPG) */ GxEpgInfo * app_epg_update_event_by_day(uint32_t value,int32_t nListSel,uint32_t checkflag) { uint32_t offset ,i; GxBusPmDataProg prog; GxMsgProperty_EpgNumGet epg_num_get; GxMsgProperty_EpgGet epg_params ; app_msg* msg_temp; app_msg* msg1_temp; GxEpgInfo *epg_info = NULL; app_epg_free(); GxBus_PmProgGetByPos(value,1,&prog); epg_num_get.service_id = prog.service_id; epg_num_get.ts_id = prog.ts_id; epg_num_get.orig_network_id = prog.original_id; if(epg_para.gApp_epg_enable == 0) { return NULL; } epg_para.msg_get_epg_num_id = app_send_msg(GXMSG_EPG_NUM_GET,(void*)&epg_num_get); if(epg_para.msg_get_epg_num_id>0) { msg_temp = app_get_msg(epg_para.msg_get_epg_num_id); if(((GxMsgProperty_EpgNumGet*)msg_temp->param)->event_per_day[epg_para.sEpg_day+1]) { offset = 0; for(i=0;i<epg_para.sEpg_day+1;i++) { offset += ((GxMsgProperty_EpgNumGet*)msg_temp->param)->event_per_day[i]; } epg_params.want_event_count =((GxMsgProperty_EpgNumGet*)msg_temp->param)->event_per_day[epg_para.sEpg_day+1]; // epg_params.orig_network_id = prog.original_id; epg_para.get_event_count = epg_params.want_event_count; epg_params.service_id = prog.service_id; epg_params.ts_id = prog.ts_id; epg_params.get_event_pos =offset; epg_params.epg_info_size = 60*1024; epg_params.epg_info = (GxEpgInfo*)s_event_info; epg_para.msg_get_epg_id = app_send_msg(GXMSG_EPG_GET,(void*)&epg_params); if(epg_para.msg_get_epg_id>0) { msg1_temp = app_get_msg(epg_para.msg_get_epg_id); #if 0 for(i=0; i<((GxMsgProperty_EpgGet*)msg1_temp->param)->get_event_count; i++) { //No. hour:min:sec - hour:min:sec event_name printf(" %s\n", ((GxMsgProperty_EpgGet*)msg1_temp->param)->epg_info[i].event_name); //printf(" %s\n\n", ((GxMsgProperty_EpgGet*)msg1_temp->param)->epg_info[i].event_detail); } #endif if(epg_para.sEpg_day == 0) { app_epg_rebuild_valid_event(checkflag); } if(-1 != nListSel) { /* * EPG列表选中,获取当前选中EPG */ if(epg_para.sEpg_day == 0) { epg_info = &(((GxMsgProperty_EpgGet*)msg1_temp->param)->epg_info[nListSel+epg_para.sOffSetSel]); } else { epg_info = &(((GxMsgProperty_EpgGet*)msg1_temp->param)->epg_info[nListSel]); } } else { /* * EPG列表未选中,默认取第一条 */ if(epg_para.sEpg_day == 0) { epg_info = &(((GxMsgProperty_EpgGet*)msg1_temp->param)->epg_info[epg_para.sOffSetSel]); } else { epg_info = &(((GxMsgProperty_EpgGet*)msg1_temp->param)->epg_info[0]); } } } } } return epg_info; }
/* * 根据当前时间查找第一条有效EPG信息 * 可配置是否保留当前时间之前的EPG信息 * 如当前时间13:43,保留08:00EPG信息 */ static void app_epg_rebuild_valid_event(uint32_t checkflag) { uint32_t i = 0, event_num = 0; app_msg* msg0_temp; app_msg* msg1_temp; GxEpgInfo *epg_info_temp = NULL; GxTime time; if(epg_para.sEpg_day!=0) { epg_para.sOffSetSel = 0; return; } if (FALSE == checkflag) { /* * 显示读取到的所有EPG信息,不删除过期EPG */ epg_para.sOffSetSel = 0; return ; } msg0_temp = app_get_msg(epg_para.msg_get_epg_id); msg1_temp = app_get_msg(epg_para.msg_get_epg_num_id); if(((GxMsgProperty_EpgNumGet*)msg1_temp->param)->event_per_day[epg_para.sEpg_day+1] == 0) { return ; } event_num = ((GxMsgProperty_EpgNumGet*)msg1_temp->param)->event_per_day[epg_para.sEpg_day+1]; GxCore_GetLocalTime(&time); for(i = 0; i<event_num; i++) { epg_info_temp = &(((GxMsgProperty_EpgGet*)msg0_temp->param)->epg_info[i]); if((epg_info_temp->start_time<time.seconds)&&(epg_info_temp->start_time + epg_info_temp->duration>=time.seconds)) { /* * 开始时间小于当前时间,结束时间大于当前时间 * 找到的第一个有效EPG */ epg_para.sOffSetSel = i; break; } else if(epg_info_temp->start_time>time.seconds) { /* * 开始时间大于当前时间 * 找到的第一个有效EPG */ epg_para.sOffSetSel = (i>0)?(i-1):0; printf("time.seconds i=%d\n",epg_para.sOffSetSel); break; } } if(i == event_num) { /* * 所有EPG无效,EPG个数为0 */ epg_para.sOffSetSel = event_num; printf("time.seconds i=%d\n",epg_para.sOffSetSel); } }
/*----------------------------------------------------------------------------*/ u8 fm_scan(u8 mode) { u8 i; u8 key; u8 result = 0; vol_change_en=0; input_number_en = 0; amp_mute(1); if (mode == 0) { write_info(MEM_CHAN,0); write_info(MEM_FRE,0); clear_all_fm_point(); total_channel = 0; fre_channel = 0; frequency = MIN_FRE - 1; //自动搜索从最低的频点开始 } fm_set_ch(4); for (i = 0;i <= (MAX_FRE-MIN_FRE);i++) { while (1) { key = app_get_msg(); if (key == NO_MSG) break; switch (key) { case MSG_MUSIC_NEW_DEVICE_IN: //有新设备接入 work_mode = MUSIC_MODE; result = 2; goto _fm_scan_ret; case MSG_AUX_IN : work_mode = AUX_MODE; result = 2; goto _fm_scan_ret; #if USB_DEVICE_ENABLE case MSG_USB_PC_IN: work_mode = USB_DEVICE_MODE; result = 2; goto _fm_scan_ret; #endif case MSG_FM_NEXT_STATION: case MSG_FM_SCAN_STOP: case MSG_FM_SCAN_ALL: result = 0; goto _fm_scan_ret; case MSG_ALM_ON: result = 3; goto _fm_scan_ret; default: ap_handle_hotkey(key); break; } } if (mode ==1) { frequency--; } else { frequency++; } fm_module_mute(1); disp_port(MENU_FM_DISP_FRE); if (set_fre(FM_CUR_FRE)) //找到一个台 { fm_module_mute(0); if (mode == 0) //搜索所有电台 { save_fm_point(frequency - MIN_FRE); fre_channel = get_channel_via_fre(frequency - MIN_FRE); total_channel = get_total_mem_channel(); disp_port(MENU_FM_FIND_STATION); delay_10ms(100); } else { save_fm_point(frequency - MIN_FRE); fre_channel = get_channel_via_fre(frequency - MIN_FRE); total_channel = get_total_mem_channel(); disp_port(MENU_FM_DISP_FRE); result = 1; goto _fm_scan_ret; } } } _fm_scan_ret: fm_module_mute(0); input_number_en = 1; vol_change_en = 1; amp_mute(0); return result; }
void power_key_hdlr(SYS_PWR_HDLR pwr_cmd) { u8 key_msg=0; if(pwr_cmd == SYS_PWR_ON){ #ifdef USE_POWER_KEY u8 key_hold_timer=4,pwr_key_valid_sec=0; sys_gpio_ctrl_pwr(SYS_PWR_ON); while(1){ key_msg = app_get_msg(); #if 0 if(key_msg!= NO_MSG) my_printf(" --->power_key_hdlr key_msg : %x \r\n",(u16)key_msg); #endif switch(key_msg){ case MSG_HALF_SECOND: //my_printf(" --->power_key_hdlr %x \r\n",(u16)key_hold_timer); if(key_hold_timer>3){ pwr_key_valid_sec++; if(pwr_key_valid_sec == (POWER_KEY_HOLD_VALID_TIME_SEC*2)){ goto __POWER_ON; } } key_hold_timer--; if(key_hold_timer==0){ goto __POWER_OFF; } break; case MSG_POWER_KEY_HOLD: // my_printf(" --->power_key_hdlr key_msg %x \r\n",(u16)key_msg); key_hold_timer=5; break; default: break; } } __POWER_ON: UI_menu(MENU_POWER_UP); sys_gpio_ctrl_pwr(SYS_PWR_ON); #endif } else if(pwr_cmd == SYS_PWR_OFF){ #ifdef USE_POWER_KEY __POWER_OFF: my_puts("__POWER_OFF \r\n"); UI_menu(MENU_POWER_DOWN); sys_gpio_ctrl_pwr(SYS_PWR_OFF); ext_pa_mute(PA_MUTE); delay_n10ms(20); EA = 0; #ifdef WDT_EN config_wdt(0x40); //关掉看门狗 #endif while(1); #endif } else if(pwr_cmd == SYS_PWR_IDLE){ #ifdef USE_POWER_IDLE_MODE UI_menu(MENU_POWER_DOWN); ext_pa_mute(PA_MUTE); set_play_status_led(LED_SPARK_STOP); while(1){ key_msg = app_get_msg(); switch(key_msg){ case MSG_POWER_DOWN: set_play_status_led(LED_SPARK_ON); func_msg_hdlr(S_FUNC,SYS_USB_MODE); return; default: break; } } #endif } }
/*----------------------------------------------------------------------------*/ void aux_main_handlr(void) { u8 key; #ifdef FORCE_AUX_GPIO_TO_GROUND_IMPROVE_CROSSTALK #ifndef UART_ENABLE #if defined(EXCHANGE_AUX_CHANNEL) P2IE_REG &=~((BIT(4)|BIT(5))); P2IE_REG |= ((BIT(6)|BIT(7))); P2IE_reg_OverWrite(); P2PD &=~((BIT(4)|BIT(5))); P2PD |= ((BIT(6)|BIT(7))); P2 &=~((BIT(6)|BIT(7))); #else P2IE_REG &=~((BIT(6)|BIT(7))); P2IE_REG |= ((BIT(4)|BIT(5))); P2IE_reg_OverWrite(); P2PD &=~((BIT(6)|BIT(7))); P2PD |= ((BIT(4)|BIT(5))); P2 &=~((BIT(4)|BIT(5))); #endif #endif #endif sys_main_vol_setting(sys_main_vol); SYS_AMP_POWER_ON(); dac_mute_control(0,1); while (1) { #if defined(EXCHANGE_AUX_CHANNEL) dac_out_select(DAC_AMUX0, 0); #else dac_out_select(DAC_AMUX1, 0); #endif key = app_get_msg(); switch (key) { case MSG_CHANGE_WORK_MODE: return; case MSG_MUSIC_NEW_DEVICE_IN: //有新设备接入 work_mode = MUSIC_MODE; return; case MSG_MUSIC_PP: case MSG_MUTE_UNMUTE: sys_mute_flag=~sys_mute_flag; dac_mute_control(sys_mute_flag,1); //调节音量时,自动UNMUTE break; case MSG_HALF_SECOND: ext_pa_delay_mute_hdlr(); //////////////////////////////////////////////////////////// //显示界面的切换 #if 1 // if(RECODE_WORKING == encode_status) // { // main_menu = MENU_RECWORKING; // } // else if(RECODE_PAUSE == encode_status) // { // main_menu = MENU_REC_PAUSE; // } // else // { // main_menu = MENU_AUX; // } if(cur_menu == main_menu) { disp_port(main_menu); } set_brightness_fade_out(); #endif set_brightness_fade_out(); if (main_menu_conter < SUB_MENU_TIME) { main_menu_conter++; } else if (cur_menu != main_menu) { cur_menu = main_menu; disp_port(cur_menu); } if(RECODE_WORKING == encode_status) { disp_port(MENU_AUX_MAIN); } break; default: ap_handle_hotkey(key); break; } } }
void idle_mode(void) { u8 key; input_number_en = 0; if(mic_plugged){ mic_counter=0; set_max_vol(MAX_ANOLOG_VOL,MAX_DIGITAL_VOL);///设置最大音量 dac_out_select(DAC_MUSIC | DAC_KALAOK, 0); kala_dac(); set_rec_vol(7); P3HD |=(1<<6); dsp_kalaok_channel(); vol_change_en=1; } else{ vol_change_en=0; } disp_port(MENU_NODEVICE); while (1) { key = app_get_msg(); switch (key) { case MSG_NO_DEVICE: clear_all_event(); flush_low_msg(); disp_port(MENU_NODEVICE); break; case MSG_MIC_OUT: if(mic_plugged){ work_mode = last_work_mode; mic_plugged = 0; return; //put_msg_lifo(MSG_CHANGE_WORK_MODE); } break; case MSG_MUSIC_NEW_DEVICE_IN: //有新设备接入 case MSG_CHANGE_WORK_MODE: break; work_mode = MUSIC_MODE; return; case MSG_HALF_SECOND: //////////////////////////////////////////////////////////// //显示界面的切换 #if 0 set_brightness_fade_out(); if (main_menu_conter < SUB_MENU_TIME) { main_menu_conter++; } else if (cur_menu != main_menu) { cur_menu = main_menu; disp_port(cur_menu); } #endif break; #if RTC_ENABLE case MSG_ALM_ON: write_next_alm_sec(); work_mode = RTC_MODE; put_msg_lifo(MSG_CHANGE_WORK_MODE); break; #endif default: ap_handle_hotkey(key); break; } } }
/*----------------------------------------------------------------------------*/ void rec_mic_main(void) { u8 key; while (1) { dac_out_select(DAC_MUSIC, 0); key = app_get_msg(); switch (key) { case MSG_CHANGE_WORK_MODE: return; case MSG_MUSIC_NEW_DEVICE_IN: //有新设备接入 work_mode = MUSIC_MODE; return; case MSG_HALF_SECOND: //////////////////////////////////////////////////////////// //显示界面的切换 #if 1 // if(RECODE_WORKING == encode_status) // { // main_menu = MENU_RECWORKING; // } // else if(RECODE_PAUSE == encode_status) // { // main_menu = MENU_REC_PAUSE; // } // else // { // main_menu = MENU_REC; // } if(cur_menu == main_menu) { disp_port(main_menu); } set_brightness_fade_out(); #endif if (main_menu_conter < SUB_MENU_TIME) { main_menu_conter++; } else if (cur_menu != main_menu) { cur_menu = main_menu; disp_port(cur_menu); } // if(MENU_RECWORKING == cur_menu) // { // // disp_rec_working(); // disp_port(MENU_RECWORKING); // } break; default: ap_handle_hotkey(key); break; } } }
/*----------------------------------------------------------------------------*/ void deal_rtc(void) { u8 key; u8 rtc_set_cnt; close_alarm(); while (1) { key = app_get_msg(); #if 0 if (alm_on_flag) { key = alm_msg_convert(key); } #endif switch (key) { case MSG_NEXT_WORKMODE: case MSG_REC_KEY: case MSG_REC_PLAY: break; case MSG_CHANGE_WORK_MODE: return; case MSG_MUSIC_NEW_DEVICE_IN: //有新设备接入 break; case MSG_ALM_SOURCE: //if(rtc_mode_setting == ALARM_SETTING) { #if 1 if(alarm.sw==0)break; if(rtc_mode_setting != ALARM_SETTING){ alarm.bSource =0; alm_coordinate=3; rtc_mode_setting = ALARM_SETTING; disp_port(MENU_ALM_SET); } else{ rtc_mode_setting = RTC_DISPLAY; disp_port(MENU_RTC); break; } #if 0 if(alm_coordinate==3){ rtc_mode_setting = RTC_DISPLAY; disp_port(MENU_RTC); break; } else{ alarm.bSource =0; alm_coordinate=3;; } #endif #else alarm.bSource++; if(alarm.bSource>3){ alarm.bSource =0; } #endif } rtc_set_cnt=0; break; case MSG_ALM_SETUP: if(rtc_mode_setting == ALARM_SETTING){ alm_coordinate++; if(alm_coordinate>2){ rtc_mode_setting = RTC_DISPLAY; } } else{ snooze_init(); alm_coordinate = 1; alarm.sw=1; alarm.bSource =0; rtc_mode_setting = ALARM_SETTING; write_next_alm_sec(); save_alarm_info(); } rtc_set_cnt=0; disp_port(MENU_RTC); break; case MSG_RTC_SETTING: if (rtc_mode_setting == RTC_SETTING) { rtc_mode_setting = RTC_DISPLAY; } else{ rtc_coordinate = 3; rtc_mode_setting = RTC_SETTING; } rtc_set_cnt=0; disp_port(MENU_RTC); break; case MSG_RTC_NEXT: if (rtc_mode_setting == RTC_SETTING) { rtc_coordinate++; if (rtc_coordinate > 4) { rtc_mode_setting = RTC_DISPLAY; } rtc_set_cnt=0; disp_port(MENU_RTC); } break; #if 0 case MSG_RTC_PREV: if (rtc_mode_setting == RTC_SETTING) { rtc_coordinate--; if (rtc_coordinate == 255) { rtc_coordinate = 5; } rtc_set_cnt=0; disp_port(MENU_RTC); } if (rtc_mode_setting == ALARM_SETTING) { alm_coordinate--; if (alm_coordinate == 255) { //if(alarm[0].sw) //{ // alm_coordinate = 9; //} //else //{ alm_coordinate = 2; //} } disp_port(MENU_ALM_SET); } break; #endif case MSG_RTC_PLUS: case MSG_RTC_PLUS_HOLD: if (rtc_mode_setting == RTC_SETTING) { rtc_set_cnt=0; curr_time_plus(); write_rtc(&curr_time); write_next_alm_sec(); disp_port(MENU_RTC); } if (rtc_mode_setting == ALARM_SETTING) { rtc_set_cnt=0; alm_time_plus(); save_alarm_info(); write_next_alm_sec(); if(alm_coordinate==3){ disp_port(MENU_ALM_SET); } else{ disp_port(MENU_RTC); } } break; case MSG_RTC_MINUS: case MSG_RTC_MINUS_HOLD: if (rtc_mode_setting == RTC_SETTING) { rtc_set_cnt=0; curr_time_minus(); write_rtc(&curr_time); write_next_alm_sec(); disp_port(MENU_RTC); } if (rtc_mode_setting == ALARM_SETTING) { rtc_set_cnt=0; alm_time_minus(); save_alarm_info(); write_next_alm_sec(); if(alm_coordinate==3){ disp_port(MENU_ALM_SET); } else{ disp_port(MENU_RTC); } } break; case MSG_HALF_SECOND: snooze_hdlr(); if (main_menu_conter < SUB_MENU_TIME*4) { main_menu_conter++; } else if (cur_menu != main_menu) { rtc_mode_setting = RTC_DISPLAY; read_rtc(&curr_time); chk_date_err(); disp_port(MENU_RTC); } if ((rtc_mode_setting == RTC_SETTING)||(rtc_mode_setting == ALARM_SETTING)) rtc_set_cnt++; if ((rtc_set_cnt==8)&&((rtc_mode_setting == RTC_SETTING)||(rtc_mode_setting == ALARM_SETTING))) { rtc_set_cnt=0; rtc_mode_setting = RTC_DISPLAY; read_rtc(&curr_time); chk_date_err(); disp_port(MENU_RTC); } if (cur_menu == MENU_RTC) { read_rtc(&curr_time); chk_date_err(); disp_port(MENU_RTC); } break; case MSG_ALM_ON: write_next_alm_sec(); alm_on_flag = 1; alrm_vol_bakup=sys_main_vol; sys_main_vol = 10; alm_recover_vol_enable=1; if(alarm.bSource== 0){ work_mode = MUSIC_MODE; } else if(alarm.bSource== 1){ work_mode = MUSIC_MODE; } else if(alarm.bSource== 2){ work_mode = FM_RADIO_MODE; } else{ work_mode = AUX_MODE; } disp_port(MENU_RTC); return; break; default: ap_handle_hotkey(key); break; } } }
//预约同步 int8_t app_book_sync(GxBookGet* pEpgBookGet,GxBookType type) { uint32_t i,j; int8_t ret=0; int32_t book_get_msg_id; app_msg* pmsg; GxBook pBookTemp; book_play bookPlay1={0}; book_play bookPlay2={0}; if (NULL == pEpgBookGet) return -1; memset(pEpgBookGet,0,sizeof(GxBookGet)); book_get_msg_id = app_send_msg(GXMSG_BOOK_GET,&type);//获取预约消息 if(book_get_msg_id) { pmsg = app_get_msg(book_get_msg_id);//获取数据 memcpy(pEpgBookGet , (GxBookGet*)(pmsg->param),sizeof(GxBookGet)); app_free_msg(GXMSG_BOOK_GET,book_get_msg_id);//释放数据空间 for(i = 0; i<pEpgBookGet->book_number; i++) { if(BOOK_TRIG_OFF == pEpgBookGet->book[i].trigger_mode) { app_book_delete(&(pEpgBookGet->book[i])); ret = -1; } if((BOOK_TRIG_ING == pEpgBookGet->book[i].trigger_mode ) &&(pEpgBookGet->book[i].book_type == BOOK_POWER_ON||pEpgBookGet->book[i].book_type == BOOK_POWER_OFF ||BOOK_PROGRAM_PLAY == pEpgBookGet->book[i].book_type)) { app_book_delete(&(pEpgBookGet->book[i])); ret = -1; } } //重新获取数据 if(ret == -1) { book_get_msg_id = app_send_msg(GXMSG_BOOK_GET,&type); if(book_get_msg_id) { pmsg = app_get_msg(book_get_msg_id); memcpy(pEpgBookGet , (GxBookGet*)(pmsg->param),sizeof(GxBookGet)); app_free_msg(GXMSG_BOOK_GET,book_get_msg_id); } else { return -1; } } /* * 预约排序(选择排序) ,根据时间先后顺序 */ if (pEpgBookGet->book_number > 1) { for (i =0; i< pEpgBookGet->book_number-1;i++) { for (j=i+1; j<pEpgBookGet->book_number;j++) { memcpy(&bookPlay1,pEpgBookGet->book[i].struct_buf,sizeof(book_play)); memcpy(&bookPlay2,pEpgBookGet->book[j].struct_buf,sizeof(book_play)); if (bookPlay1.start_time > bookPlay2.start_time) { memcpy(&pBookTemp,(GxBook *)&pEpgBookGet->book[i],sizeof(GxBook)); memcpy((GxBook *)&pEpgBookGet->book[i],(GxBook *)&pEpgBookGet->book[j],sizeof(GxBook)); memcpy((GxBook *)&pEpgBookGet->book[j],&pBookTemp,sizeof(GxBook)); } } } } return 0 ; } return -1; }
/*----------------------------------------------------------------------------*/ void usb_device(void) { u8 key; u8 connect_counter = 0; bool usb_con = 0; while (1) { #if ((USB_DEVICE_CFG & USB_MASS) == USB_MASS) UFI_massstorage(); #endif #if ((USB_DEVICE_CFG & USB_SPEAKER) == USB_SPEAKER) key_voice_en=1; dac_out_select(DAC_MUSIC, 0); #endif key = app_get_msg(); if (alm_request_cnt) { key = alm_request_msg_convert(key); } switch (key) { #if ((USB_DEVICE_CFG & USB_SPEAKER) == USB_SPEAKER) #if (MUSIC_SPECTRUM_EN == 1) case MSG_100MS: if (cur_menu == MENU_USBDEV_MAIN) { music_spec_cul(1); disp_port(MENU_100MS_REFRESH); } break; #endif /* case MSG_MUSIC_NEXT_EQ: eq_mode++; if (eq_mode > CLASSIC) { eq_mode = NORMAL; } //set_dsp_eq(eq_mode); set_eq(eq_mode); disp_port(MENU_SET_EQ); break; */ case MSG_PC_MUTE: dac_mute_control(1,1); break; case MSG_PC_UNMUTE: dac_mute_control(0,1); break; #else case MSG_VOL_UP: break; case MSG_VOL_DOWN: break; #endif #if ((USB_DEVICE_CFG & USB_HID) == USB_HID) case MSG_MUSIC_PP: //Usb_Audio_Mute_Ctl(); usb_hid_control(USB_AUDIO_PP); break; case MSG_MUSIC_NEXT_FILE: usb_hid_control(USB_AUDIO_NEXTFILE); break; case MSG_MUSIC_PREV_FILE: usb_hid_control(USB_AUDIO_PREFILE); break; #endif case MSG_USB_PC_OUT: Set_Curr_Func(SYS_MP3DECODE_USB); return; case MSG_HALF_SECOND: if (!usb_con) { connect_counter++; if(USBCON0 & BIT(6)) usb_con = 1; else if (connect_counter > 4) return; } //printf("alm_request_cnt:%u,main_menu_conter:%u\n",(u16)alm_request_cnt,(u16)main_menu_conter); if (alm_request_cnt) { alm_request_cnt++; disp_port(MENU_ALM_REQUEST); if (alm_request_cnt > 60) { alm_request_cnt = 0; Set_Curr_Func(SYS_RTC); put_msg_lifo(MSG_CHANGE_WORK_MODE); } break; } set_brightness_fade_out(); if (main_menu_conter < SUB_MENU_TIME) { main_menu_conter++; } else if (cur_menu != main_menu) { cur_menu = main_menu; disp_port(cur_menu); } break; #if RTC_ENABLE case MSG_CHANGE_WORK_MODE: if (alm_cnt) { return; } break; case MSG_REQUEST_Y: alm_request_cnt = 0; Set_Curr_Func(SYS_RTC); put_msg_lifo(MSG_CHANGE_WORK_MODE); break; case MSG_REQUEST_N: alm_request_cnt = 0; close_alarm(); main_menu_conter = SUB_MENU_TIME; break; case MSG_ALM_ON: alm_request_cnt = 1; write_next_alm_sec(); disp_port(MENU_ALM_REQUEST); break; #endif default : ap_handle_hotkey(key); break; } } }
/*----------------------------------------------------------------------------*/ void fm_rev( void ) { u8 key; sys_mute_flag =0; PT2313_Config(sys_main_vol,VOL_ADJ); amp_mute(0); while (1) { #if ECHO_ENABLE dac_out_select(DAC_AMUX1 | ADD_DEC, 0); #else dac_out_select(DAC_AMUX1, 0); #endif key = app_get_msg(); switch (key) { case MSG_CHANGE_WORK_MODE: return; case MSG_MUSIC_NEW_DEVICE_IN: //有新设备接入 work_mode = MUSIC_MODE; return; case MSG_FM_SCAN_STOP: if(key_ir_detect){ key_ir_detect =0; ir_remote_set_snooze(); } break; case MSG_FM_SCAN_ALL: //play 长按自动全频搜索 key = fm_scan(0); if (key == 3) { put_msg_lifo(MSG_ALM_ON); break; } if (key == 2) return; put_msg_lifo(MSG_FM_NEXT_STATION); break; case MSG_FM_SCAN_ALL_DOWN : key = fm_scan(1); if (key == 3) { put_msg_lifo(MSG_ALM_ON); break; } if (key == 2) return; break; case MSG_FM_SCAN_ALL_UP: key =fm_scan(2); if (key == 3) { put_msg_lifo(MSG_ALM_ON); break; } if (key == 2) return; break; #if 0 case MSG_MUSIC_PP: //play 短按静音 put_msg_lifo(MSG_MUTE); break; case MSG_MUTE: break; #endif case MSG_MUSIC_FR: //搜索上一个台 flush_all_msg(); break; case MSG_MUSIC_FF: //搜索下一个台 flush_all_msg(); break; case MSG_FM_PREV_STEP: set_fre(FM_FRE_DEC); fre_channel = get_channel_via_fre(frequency - MIN_FRE); //查找该频点是否有记忆过 disp_port(MENU_FM_MAIN); write_info(MEM_FRE, frequency-MIN_FRE); write_info(MEM_CHAN, fre_channel); break; case MSG_FM_NEXT_STEP: set_fre(FM_FRE_INC); fre_channel = get_channel_via_fre(frequency - MIN_FRE); //查找该频点是否有记忆过 disp_port(MENU_FM_MAIN); write_info(MEM_FRE, frequency-MIN_FRE); write_info(MEM_CHAN, fre_channel); break; case MSG_FM_PREV_STATION: if (total_channel == 0) break; fre_channel -= 2; case MSG_FM_NEXT_STATION: if (total_channel == 0) break; fre_channel++; if ((fre_channel == 0) || (fre_channel == 0xff)) { fre_channel = total_channel; } else if (fre_channel > total_channel) { fre_channel = 1; } frequency = get_fre_via_channle(fre_channel) + MIN_FRE; //根据台号找频点 main_vol_set(0, CHANGE_VOL_NO_MEM); set_fre(FM_CUR_FRE); main_vol_set(0, SET_USE_CURRENT_VOL); disp_port(MENU_FM_CHANNEL); write_info(MEM_FRE, frequency-MIN_FRE); write_info(MEM_CHAN, fre_channel); break; case MSG_CH_SET: if (cur_menu == MENU_INPUT_NUMBER) //数字输入模式 { if (input_number <= MAX_CHANNL) //输入的是台号 { key = get_fre_via_channle(input_number); if (key != 0xff) { frequency = key + MIN_FRE; fre_channel = input_number; main_vol_set(0, CHANGE_VOL_NO_MEM); set_fre(FM_CUR_FRE); main_vol_set(0, SET_USE_CURRENT_VOL); disp_port(MENU_FM_CHANNEL); //break; } } else if ((input_number >= MIN_FRE) && (input_number <= MAX_FRE)) //输入的是频点 { frequency = input_number; fre_channel = get_channel_via_fre(frequency - MIN_FRE); main_vol_set(0, CHANGE_VOL_NO_MEM); set_fre(FM_CUR_FRE); main_vol_set(0, SET_USE_CURRENT_VOL); } } write_info(MEM_FRE, frequency-MIN_FRE); write_info(MEM_CHAN, fre_channel); disp_port(main_menu); break; case MSG_CH_SAVE: ch_save(); break; case MSG_HALF_SECOND: alarm_setting_vol_hdlr(); //bmt_hdlr(); timer_pwr_off_hdlr(); set_brightness_fade_out(); if (main_menu_conter < SUB_MENU_TIME) { main_menu_conter++; } else if (cur_menu != main_menu) { put_msg_lifo(MSG_CH_SET); //跳转至CH_SET消息处理 } if(cur_menu == main_menu) { disp_port(main_menu); } break; #if 0//RTC_ENABLE case MSG_ALM_ON: write_next_alm_sec(); work_mode = RTC_MODE; put_msg_lifo(MSG_CHANGE_WORK_MODE); break; #endif #if KALAOK_FUNCTION case MSG_KALAOK: work_mode = REC_MIC_MODE; return ; #endif default : ap_handle_hotkey(key); break; } } }