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; } } }
/*----------------------------------------------------------------------------*/ 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 blue_tooth_main(void) { u8 key; #ifdef TURN_OFF_PLAY_STATUS_LED_IN_BLUETOOTH_MODE set_play_flash(LED_FLASH_STOP); #endif #ifdef K000_XC_BC_BT_V001 play_status =MUSIC_PAUSE; #endif while (1) { key = get_msg(); #if 0 if(key!=0xFF) printf( "---->---deal_aux %x \r\n",(u16)key); #endif #if defined(KEY_PRESS_LED_INDICATOR) key_press_led_indicator(key); #elif defined(CUSTOM_KEY_FEATURE_USE) custom_key_hdlr(key); #endif #ifdef BLUE_TOOTH_GPIO_STATUS if(blue_tooth_detect){ blue_tooth_detect=0; bt_disp_status_hdlr(); } #endif #if defined(KPL_MSG_COMPATIBLE) kpl_msg_hdlr(key); #endif dac_sw_check(); switch (key) { #ifdef BLUE_TOOTH_DETECTION_FOR_POWER_OFF case INFO_POWER|KEY_SHORT_UP: sys_power_down(); break; #endif #ifdef PP_KEY_LONG_CONFIG_BT case INFO_PLAY | KEY_LONG: blue_tooth_key_hdlr(BT_CONFIG_HOLD); break; #endif case INFO_PLAY | KEY_HOLD: #ifdef PP_KEY_LONG_CONFIG_BT break; //blue_tooth_key_hdlr(BT_CONFIG_HOLD); #else blue_tooth_key_hdlr(BT_PP_HOLD); #endif break; case INFO_PLAY | KEY_SHORT_UP : blue_tooth_key_hdlr(BT_PP); #ifndef BLUE_TOOTH_NO_SYS_MUTE_CTRL #if !defined(BLUE_TOOTH_BYPASS) if (play_status == MUSIC_PAUSE) { play_status =MUSIC_PLAY; my_main_vol(my_music_vol); #ifndef BLUE_TOOTH_PP_NOT_EXT_MUTE Mute_Ext_PA(UNMUTE); #endif } else if (play_status == MUSIC_PLAY){ play_status =MUSIC_PAUSE; #ifndef BLUE_TOOTH_PP_NOT_EXT_MUTE Mute_Ext_PA(MUTE); #endif my_main_vol(0); } #endif #endif Disp_Con(DISP_BLUE_TOOTH); break; case INFO_NEXT_FIL | KEY_SHORT_UP: blue_tooth_key_hdlr(BT_NEXT_FILE); break; case INFO_PREV_FIL | KEY_SHORT_UP: blue_tooth_key_hdlr(BT_PREV_FILE); break; case INFO_HALF_SECOND : #ifdef USE_USB_HOTPLUG_FUNC usb_hotplug_hdlr(); #endif #ifdef BLUE_TOOTH_MUTE_DETECT_FUNC blue_tooth_mute_detect(); #endif #if defined(USE_BAT_MANAGEMENT) bmt_hdlr(); #endif #ifdef DISP_BACKLIGHT_AUTO_SAVE_POWER Disp_BL_time_out(); #endif #ifdef BLUE_TOOTH_LINK_IDLE_POWER_OFF bt_link_idle_hdlr(); #endif if(bt_key_release_cnt--==0){ #ifdef PP_KEY_HOLD_CONFIG_BT if(key_release_hdlr==BT_CONFIG_HOLD){ blue_tooth_key_hdlr(BT_CONFIG_HOLD_RELEASE); #else if(key_release_hdlr==BT_PP_HOLD){ blue_tooth_key_hdlr(BT_PP_HOLD_RELEASE); #endif } else if((key_release_hdlr==BT_VOL_UP_HOLD)||(key_release_hdlr==BT_VOL_DOWN_HOLD)){ blue_tooth_key_hdlr(BT_VOL_HOLD_RELEASE); } } #ifdef USE_BT_ACTIVATED_PIN if(ACTIVATED_PIN_cnt--==0){ BT_RST_OFF(); } #endif #ifdef BT_DISP_CONNECT_TIME bt_disp_time_hdlr(); #endif #if defined(LINE_IN_PLAY_KEY_PAUSE) if(play_status==MUSIC_PAUSE){ #ifdef LINE_IN_FLASH_WHOLE_SCREEN aux_screen_flash_bit=~aux_screen_flash_bit; if(aux_screen_flash_bit){ Disp_Con(DISP_BLUE_TOOTH); } else{ Disp_Con(DISP_PWR_OFF); break; } #endif } #endif #if defined(TIME_FORCE_SHOW_ON_SCREEN) if(DISP_BLUE_TOOTH == curr_menu){ if (time_show_return_cnt>RETURN_TIME_SHOW_TIME){ get_curr_date(); Disp_Con(DISP_RTC_POINT); break; } else{ #if defined(MANUAL_SWITCH_TIME_DISPLAY) Disp_Con(DISP_BLUE_TOOTH); #else if(DISP_RTC != curr_menu){ time_show_return_cnt++; } #endif } } #endif if (return_cnt < RETURN_TIME) { return_cnt++; } else if (RETURN_TIME == return_cnt) { if (DISP_BLUE_TOOTH != curr_menu) Disp_Con(DISP_BLUE_TOOTH); #if defined(CUSTOM_MAIN_DISP_VOL) if (DISP_BLUE_TOOTH== curr_menu){ Disp_Con(DISP_VOL); } #endif } if (DISP_BLUE_TOOTH == curr_menu) Disp_Con(DISP_BLUE_TOOTH); Disp_Update(); break; #ifdef BLUE_TOOTH_BYPASS case INFO_VOL_PLUS: case INFO_VOL_PLUS | KEY_HOLD : case INFO_NEXT_FIL: case INFO_NEXT_FIL| KEY_HOLD : case INFO_VOL_MINUS: case INFO_VOL_MINUS | KEY_HOLD : case INFO_PREV_FIL: case INFO_PREV_FIL| KEY_HOLD : break; #else #if defined(NEW_VOLUME_KEY_FEATURE) case INFO_NEXT_FIL : case INFO_NEXT_FIL | KEY_SHORT_UP: case INFO_NEXT_FIL | KEY_HOLD: if(!new_vol_feature){ break; } #else case INFO_VOL_PLUS: break; case INFO_VOL_PLUS| KEY_SHORT_UP: #ifdef BLUE_TOOTH_INDEPENDENT_VOLUME_KEY blue_tooth_key_hdlr(BT_VOL_UP); break; #endif case INFO_VOL_PLUS | KEY_HOLD : #if !defined(INDEPENDENT_VOLUME_KEY) //case INFO_NEXT_FIL: case INFO_NEXT_FIL| KEY_HOLD : if(IR_KEY_Detect){ IR_KEY_Detect =0; break; } #endif #endif #ifdef SUPPORT_PT2313 if((audio_effect_state>0)){ audio_effect_hdlr(0x01); flush_low_msg(); break; } #endif #ifndef BLUE_TOOTH_INDEPENDENT_VOLUME my_music_vol += 2; #endif blue_tooth_key_hdlr(BT_VOL_UP_HOLD); goto __VOL_HDLR; #if defined(NEW_VOLUME_KEY_FEATURE) case INFO_PREV_FIL : case INFO_PREV_FIL | KEY_SHORT_UP: case INFO_PREV_FIL | KEY_HOLD: if(!new_vol_feature){ break; } #else case INFO_VOL_MINUS: break; case INFO_VOL_MINUS| KEY_SHORT_UP: #ifdef BLUE_TOOTH_INDEPENDENT_VOLUME_KEY blue_tooth_key_hdlr(BT_VOL_DOWN); break; #endif case INFO_VOL_MINUS | KEY_HOLD : #if !defined(INDEPENDENT_VOLUME_KEY) //case INFO_PREV_FIL: case INFO_PREV_FIL| KEY_HOLD : if(IR_KEY_Detect){ IR_KEY_Detect =0; break; } #endif #endif #ifdef SUPPORT_PT2313 if((audio_effect_state>0)){ audio_effect_hdlr(0x02); flush_low_msg(); break; } #endif blue_tooth_key_hdlr(BT_VOL_DOWN_HOLD); __VOL_HDLR: #ifndef BLUE_TOOTH_INDEPENDENT_VOLUME if(my_music_vol) my_music_vol--; if (my_music_vol > MAX_VOL) { my_music_vol = MAX_VOL; } #if defined(LINE_IN_PLAY_KEY_PAUSE) if (play_status == MUSIC_PAUSE) { play_status =MUSIC_PLAY; } #endif clear_super_mute_lock(); write_info(MEM_VOL,my_music_vol); my_main_vol(my_music_vol); Disp_Con(DISP_VOL); #endif break; #endif #if RTC_ENABLE case INFO_ALM_BELL : ///<闹钟响消息,进入闹钟循环 sys_clock_pll(); dac_out_select(DAC_DECODE); if(alm_bell_mode()) { dac_out_select(DAC_AMUX0); return; } dac_out_select(DAC_AMUX0); break; #endif default : if (!ap_handle_hotkey(key)) return; } } } /*----------------------------------------------------------------------------*/ /**@brief AUX功能入口 @param 无 @return 无 @note void aux_function(void) */ /*----------------------------------------------------------------------------*/ void blue_tooth_hdlr(void) { #if 1//defined(LINE_IN_PLAY_KEY_PAUSE) play_status =MUSIC_PLAY; #endif #ifdef BLUE_TOOTH_MUTE_DETECT_FUNC bluetooth_mute_detect=0; #endif #ifdef BT_DISP_CONNECT_TIME link_sec =0; link_min =0; link_hour =0; #endif set_play_flash(LED_FLASH_ON); Disp_Con(DISP_BLUE_TOOTH); PT1 = 1; //timer1 interrupt 低优先级 flush_low_msg(); #if SDMMC_CMD_MODE sd_chk_ctl(SET_SD_L_CHK); #endif main_vol(0); blue_tooth_init(); set_max_vol(MAX_ANALOG_VOL, MAX_DIGITAL_VOL); //设置AUX模式的音量上限 #ifdef SUPPORT_PT2313 #ifdef BT_USE_AUX_0 aux_channel_crosstalk_improve(DAC_AMUX0); //4P24,P25 AUX_IN #else aux_channel_crosstalk_improve(DAC_AMUX1);//4 P26,P27 AUX_IN #endif PT2313_Config(MP3_CHAN,CHAN_ADJ); my_main_vol(my_music_vol); #elif defined(BLUE_TOOTH_BYPASS)||defined(BLUE_TOOTH_PATH_DIRECT_IN_PA) dac_out_select(DAC_DECODE); my_main_vol(0); #else #ifdef BT_USE_AUX_0 aux_channel_crosstalk_improve(DAC_AMUX0); //4P24,P25 AUX_IN #else aux_channel_crosstalk_improve(DAC_AMUX1);//4 P26,P27 AUX_IN #endif my_main_vol(my_music_vol); #endif #ifdef FIX_VOL_TO_MAX my_main_vol(30); #endif sysclock_div2(1); Mute_Ext_PA(UNMUTE); blue_tooth_main(); main_vol_set(0, CHANGE_VOL_NO_MEM); sys_clock_pll(); Mute_Ext_PA(MUTE); #ifdef BLUETOOTH_GPIO_CTRL BT_PWR_OFF(); #endif #if SDMMC_CMD_MODE sd_chk_ctl(SET_SD_H_CHK); #endif }
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 ipone_hdlr() { u8 key; #if defined(IPHONE_PP_FLASH) bool PP_FLASH_LED = 0; #endif Disp_Con(DISP_IPOD); #if defined(TURN_ON_MUSIC_WHEN_IPHONE_DOCK) delay_10ms(120); IPOD_STOP; delay_10ms(1); IPOD_RELEASE; delay_10ms(2); IPOD_PLAY; delay_10ms(1); IPOD_RELEASE; delay_10ms(10); #endif #if defined(IPONE_LINE_IN_CHANNEL_USE_AUX0) aux_channel_crosstalk_improve(DAC_AMUX0); #else aux_channel_crosstalk_improve(DAC_AMUX1); #endif Mute_Ext_PA(UNMUTE); my_main_vol(my_music_vol); while (1) { key = get_msg(); #if 0 if(key!=0xff) printf(" ipone_hdlr %x \r\n",(u16)key); #endif dac_out_select(aux_ch_reg); dac_sw_check(); switch (key) { case INFO_PLAY | KEY_SHORT_UP : play_status = !play_status; #if defined(IPHONE_CTRL_FAKE) if (play_status) { my_main_vol(my_music_vol); Mute_Ext_PA(UNMUTE); } else{ Mute_Ext_PA(MUTE); my_main_vol(0); } #endif IPOD_PLAY; delay_10ms(1); IPOD_RELEASE; Disp_Con(DISP_IPOD); break; case INFO_NEXT_FIL | KEY_SHORT_UP: IPOD_NEXT_TRACK; delay_10ms(1); IPOD_RELEASE; break; case INFO_PREV_FIL | KEY_SHORT_UP: IPOD_PREVIOUS_TRACK; delay_10ms(1); IPOD_RELEASE; break; case INFO_HALF_SECOND : #ifdef USE_USB_HOTPLUG_FUNC usb_hotplug_hdlr(); #endif #ifdef DISP_BACKLIGHT_AUTO_SAVE_POWER Disp_BL_time_out(); #endif if (return_cnt < RETURN_TIME) { return_cnt++; } #if defined(TIME_FORCE_SHOW_ON_SCREEN) if (time_show_return_cnt>RETURN_TIME_SHOW_TIME){ get_curr_date(); Disp_Con(DISP_RTC_POINT); break; } else{ #if defined(MANUAL_SWITCH_TIME_DISPLAY) Disp_Con(DISP_IPOD); #else if(DISP_RTC != curr_menu){ time_show_return_cnt++; } #endif } #endif if (RETURN_TIME == return_cnt) { #ifdef SUPPORT_PT2313 clr_aud_effect_state(); #endif if (DISP_DWORD_NUMBER == curr_menu) { cfilenum = 0; } if (DISP_IPOD != curr_menu) Disp_Con(DISP_IPOD); } #if defined(IPHONE_PP_FLASH) if(!play_status){ PP_FLASH_LED=~PP_FLASH_LED; if(PP_FLASH_LED){ Disp_Con(DISP_CLR); } else{ Disp_Con(DISP_IPOD); } } #endif #if defined(USE_BAT_MANAGEMENT) bmt_hdlr(); #endif Disp_Update(); break; case INFO_VOL_PLUS: case INFO_VOL_PLUS | KEY_HOLD : #if 1//!defined(INDEPENDENT_VOLUME_KEY) //case INFO_NEXT_FIL: //case INFO_NEXT_FIL| KEY_HOLD : // if(IR_KEY_Detect){ // IR_KEY_Detect =0; // break; // } #endif IPOD_VOLUME_UP; delay_10ms(1); IPOD_RELEASE; delay_10ms(1); goto __HOTKEY_HDLR; break; case INFO_VOL_MINUS: case INFO_VOL_MINUS | KEY_HOLD : #if 1//!defined(INDEPENDENT_VOLUME_KEY) //case INFO_PREV_FIL: //case INFO_PREV_FIL| KEY_HOLD : // if(IR_KEY_Detect){ // IR_KEY_Detect =0; // break; // } #endif IPOD_VOLUME_DOWN; delay_10ms(1); IPOD_RELEASE; delay_10ms(1); goto __HOTKEY_HDLR; break; default : __HOTKEY_HDLR: if (!ap_handle_hotkey(key)) return; } } }
void deal_aux( void ) { u8 key; #if defined(K755_JinYeHeLi_755_V001)||defined(K755_AnJieEr_755_V001) set_play_flash(LED_FLASH_SLOW); #endif #if defined(AUX_PAUSE_LED_INDICATOR_FLASH_WHEN_PLAY) set_play_flash(LED_FLASH_NOR); #endif #if defined(SPECTRUM_FUNC_ENABLE) set_spectrum_lock(UNLOCK); #endif my_main_vol(my_music_vol); while (1) { key = get_msg(); #if 0 if(key!=0xFF) printf( "---->---deal_aux %x \r\n",(u16)key); #endif dac_out_select(aux_ch_reg); #if defined(KEY_PRESS_LED_INDICATOR) key_press_led_indicator(key); #elif defined(CUSTOM_KEY_FEATURE_USE) custom_key_hdlr(key); #endif #if defined(KPL_MSG_COMPATIBLE) kpl_msg_hdlr(key); #endif dac_sw_check(); switch (key) { #ifdef USE_IR_LONG_POWER_KEY_TO_FAKE_POWER_OFF case INFO_POWER | KEY_LONG: if(IR_KEY_Detect){ goto _HOT_KEY_HDLR; } break; #endif #if defined(LINE_IN_PLAY_KEY_PAUSE) #if 1//defined(USE_ONLY_POWER_HOLD_CTRL) #if defined(USE_POWER_KEY_FOR_AUX_PLAY) case INFO_POWER | KEY_SHORT_UP : #ifdef USE_IR_LONG_POWER_KEY_TO_FAKE_POWER_OFF if(IR_KEY_Detect){ IR_KEY_Detect=0; break; } case INFO_PLAY | KEY_SHORT_UP : #endif #ifdef USE_IR_POWER_KEY_TO_POWER_OFF if(IR_KEY_Detect){ goto _HOT_KEY_HDLR; } case INFO_PLAY | KEY_SHORT_UP : #endif #else case INFO_PLAY | KEY_SHORT_UP : #endif #else case INFO_PLAY | KEY_SHORT_UP : #endif #ifdef K722_YJH_722_V001 if(IR_KEY_Detect){ IR_KEY_Detect = 0; break; } #endif if (play_status == MUSIC_PAUSE) { play_status =MUSIC_PLAY; my_main_vol(my_music_vol); #ifndef NO_AUX_MUTE_WHEN_PAUSE Mute_Ext_PA(UNMUTE); #endif #if defined(USE_SPECTRUM_PARTTERN) set_lcd_flash_lock(UNLOCK); #endif #if defined(AUX_PAUSE_LED_INDICATOR) set_play_flash(LED_FLASH_ON); #elif defined(AUX_PAUSE_LED_INDICATOR_FLASH_WHEN_PLAY) set_play_flash(LED_FLASH_NOR); #endif #if defined(SPECTRUM_FUNC_ENABLE) set_spectrum_lock(UNLOCK); #endif } else if (play_status == MUSIC_PLAY){ play_status =MUSIC_PAUSE; #ifndef NO_AUX_MUTE_WHEN_PAUSE Mute_Ext_PA(MUTE); #endif my_main_vol(0); #if defined(USE_SPECTRUM_PARTTERN) set_lcd_flash_lock(LOCK); #endif #if defined(AUX_PAUSE_LED_INDICATOR) set_play_flash(LED_FLASH_FAST); #elif defined(AUX_PAUSE_LED_INDICATOR_FLASH_WHEN_PLAY) set_play_flash(LED_FLASH_ON); #endif #if defined(SPECTRUM_FUNC_ENABLE) set_spectrum_lock(LOCK); #endif } #if defined(PAUSE_FLASH_WHOLE_SCREEN) if (play_status == MUSIC_PAUSE) set_led_flash_tpye(2); else{ set_led_flash_tpye(0); } #endif Disp_Con(DISP_AUX); break; #endif #ifdef ADC_DETECT_LINE_IN case MSG_AUX_IN : sys_printf(" MSG_AUX_IN"); my_main_vol(my_music_vol); Mute_Ext_PA(UNMUTE); break; case MSG_AUX_OUT : sys_printf(" MSG_AUX_OUT"); Mute_Ext_PA(MUTE); main_vol(0); break; #endif #ifdef USE_AUX_2 case INFO_MODE | KEY_SHORT_UP: if(aux_2_sel==0){ aux_2_sel =1; Set_Curr_Func(AUX_2_DEV); set_play_flash(LED_FLASH_ON); PT2313_Config(AUX_CHAN,CHAN_ADJ); } else{ aux_2_sel =0; goto _HOT_KEY_HDLR; } break; case INFO_AUX_MOD | KEY_SHORT_UP: aux_2_sel=~aux_2_sel; if(aux_2_sel){ Set_Curr_Func(AUX_2_DEV); PT2313_Config(AUX_CHAN,CHAN_ADJ); } else{ Set_Curr_Func(AUX_DEV); PT2313_Config(MP3_CHAN,CHAN_ADJ); } set_play_flash(LED_FLASH_ON); break; #endif case INFO_HALF_SECOND : #if ((USE_DEVICE == MEMORY_STYLE)&&(FAT_MEMORY)) updata_fat_memory(); #endif #if defined(AD_MEASURE_TEMP_FUNC) adc_diode_temp_measure_hdlr(); #endif #ifdef USE_USB_HOTPLUG_FUNC usb_hotplug_hdlr(); #endif #ifdef VOL_ADJ_SPARK_LED if(vol_adj_spark_bit){ vol_adj_spark_bit=0; restore_led_flash_mod(last_led_play_mod); } #endif #ifdef DISP_BACKLIGHT_AUTO_SAVE_POWER Disp_BL_time_out(); #endif if (return_cnt < RETURN_TIME) { return_cnt++; } #if defined(LINE_IN_PLAY_KEY_PAUSE) if(play_status==MUSIC_PAUSE){ #ifdef LINE_IN_FLASH_WHOLE_SCREEN aux_screen_flash_bit=~aux_screen_flash_bit; if(aux_screen_flash_bit){ Disp_Con(DISP_AUX); } else{ Disp_Con(DISP_PWR_OFF); break; } #endif } #endif #if defined(TIME_FORCE_SHOW_ON_SCREEN) if(DISP_AUX == curr_menu){ if (time_show_return_cnt>RETURN_TIME_SHOW_TIME){ get_curr_date(); Disp_Con(DISP_RTC_POINT); break; } else{ #if defined(MANUAL_SWITCH_TIME_DISPLAY) Disp_Con(DISP_AUX); #else if(DISP_RTC != curr_menu){ time_show_return_cnt++; } #endif } } #endif if (RETURN_TIME == return_cnt) { #ifdef SUPPORT_PT2313 clr_aud_effect_state(); #endif #if defined(LED_DRV_USE_SM1628) led_spark_protect=0; #endif if (DISP_DWORD_NUMBER == curr_menu) { cfilenum = 0; } if (DISP_AUX != curr_menu) Disp_Con(DISP_AUX); #if defined(CUSTOM_MAIN_DISP_VOL) if (DISP_AUX== curr_menu){ Disp_Con(DISP_VOL); } #endif } #if defined(USE_BAT_MANAGEMENT) bmt_hdlr(); #endif Disp_Update(); break; #if defined(NEW_VOLUME_KEY_FEATURE) case INFO_NEXT_FIL : case INFO_NEXT_FIL | KEY_SHORT_UP: case INFO_NEXT_FIL | KEY_HOLD: if(!new_vol_feature){ break; } #else case INFO_VOL_PLUS: case INFO_VOL_PLUS | KEY_HOLD : #ifdef KEY_NEXT_PREV_HOLD_ADJ_VOL_IN_AUX case INFO_NEXT_FIL| KEY_HOLD : #endif #if !defined(INDEPENDENT_VOLUME_KEY) case INFO_NEXT_FIL: case INFO_NEXT_FIL| KEY_HOLD : if(IR_KEY_Detect){ IR_KEY_Detect =0; break; } #endif #endif #ifdef SUPPORT_PT2313 if((audio_effect_state>0)){ audio_effect_hdlr(0x01); flush_low_msg(); break; } #endif my_music_vol += 2; #if defined(NEW_VOLUME_KEY_FEATURE) case INFO_PREV_FIL : case INFO_PREV_FIL | KEY_SHORT_UP: case INFO_PREV_FIL | KEY_HOLD: if(!new_vol_feature){ break; } #else case INFO_VOL_MINUS: case INFO_VOL_MINUS | KEY_HOLD : #ifdef KEY_NEXT_PREV_HOLD_ADJ_VOL_IN_AUX case INFO_PREV_FIL| KEY_HOLD : #endif #if !defined(INDEPENDENT_VOLUME_KEY) case INFO_PREV_FIL: case INFO_PREV_FIL| KEY_HOLD : if(IR_KEY_Detect){ IR_KEY_Detect =0; break; } #endif #endif #ifdef SUPPORT_PT2313 if((audio_effect_state>0)){ audio_effect_hdlr(0x02); flush_low_msg(); break; } #endif if(my_music_vol) my_music_vol--; #ifdef VOL_ADJ_SPARK_LED if(!vol_adj_spark_bit){ vol_adj_spark_bit=1; last_led_play_mod = get_led_flash_mode(); } set_play_flash(LED_FLASH_VERY_FAST); #endif if (my_music_vol > MAX_VOL) { my_music_vol = MAX_VOL; } #if defined(LINE_IN_PLAY_KEY_PAUSE) if (play_status == MUSIC_PAUSE) { play_status =MUSIC_PLAY; #ifndef NO_AUX_MUTE_WHEN_PAUSE Mute_Ext_PA(UNMUTE); #endif } #endif clear_super_mute_lock(); write_info(MEM_VOL,my_music_vol); my_main_vol(my_music_vol); Disp_Con(DISP_VOL); break; #if RTC_ENABLE case INFO_ALM_BELL : ///<闹钟响消息,进入闹钟循环 sys_clock_pll(); dac_out_select(DAC_DECODE); if(alm_bell_mode()) { dac_out_select(DAC_AMUX0); return; } dac_out_select(DAC_AMUX0); break; #endif default : _HOT_KEY_HDLR: if (!ap_handle_hotkey(key)) return; } } }
void deal_rtc(void) { u8 key; #ifdef USE_RTC_YEAR_FUNCTION bool date_show_active=0; #endif #ifdef TURN_OFF_PLAY_STATUS_LED_IN_RTC_MODE set_play_flash(LED_FLASH_STOP); #endif #ifdef PWR_OFF_IN_RTC_MODE_AFTER_30_MIN #if defined(USE_TIMER_POWER_OFF_FUNC) timer_pwr_idx=3; timer_disp=30; #endif #endif while (1) { key = get_msg(); switch (key) { #if defined(K820_LHD_820_V001) case INFO_EQ_DOWN| KEY_SHORT_UP : if(rtc_set==0){ rtc_mode = RTC_SET_MODE; rtc_set=3; } else if (rtc_set==4) { rtc_set=0; rtc_mode = RTC_PLAY_MODE; } else if(rtc_set==3){ rtc_set=4; } Disp_Con(DISP_RTC); break; #endif #if defined(K686_ZhengYang_686_V001)||defined(USE_MODE_LONG_FOR_RTC_SETTING) case INFO_MODE | KEY_LONG: //4RTC闹钟设置模式 #elif defined(CUSTOM_KEY_LONG_FOR_RTC_HOTKEY) case INFO_CUS_KEY_1 | KEY_LONG: #elif defined(USE_PLAY_LONG_FOR_RTC_SETTING) case INFO_PLAY | KEY_LONG: #elif defined(USE_PREV_LONG_FOR_RTC_SETTING) case INFO_PREV_FIL | KEY_LONG: //4RTC闹钟设置模式 #elif defined(USE_PLAY_MODE_LONG_FOR_RTC_SETTING) case INFO_PLAY_MODE | KEY_LONG: //4RTC闹钟设置模式 #elif defined(MINI_DIGIT_BOX) case INFO_1|KEY_LONG: #elif defined(RTC_MODE_HOT_KEY_ENABLE) case INFO_RTC_MOD | KEY_SHORT_UP: #else case INFO_PLAY | KEY_LONG: //4RTC闹钟设置模式 #endif #if defined(RTC_SETTING_OP_TIMER_ENABLE) op_timer=0; #endif #ifdef INDEPENDENT_KEY_ADJ_TIME if (rtc_mode != ALM_UP_MODE) { if (rtc_mode==RTC_PLAY_MODE) { #ifdef USE_RTC_TIME_ONLY rtc_set=3; #else rtc_set=0; #endif rtc_mode = RTC_SET_MODE; } else if(rtc_mode==RTC_SET_MODE){ goto __TIME_ADJ_POS; } else if (rtc_mode == ALM_SET_MODE) { goto __TIME_ADJ_POS; } Disp_Con(DISP_RTC); } #elif defined(NEW_RTC_SETTING_CTRL) if (rtc_mode != ALM_UP_MODE) { if(new_rtc_setting==0){ rtc_mode=RTC_SET_MODE; rtc_set=3; } else if(new_rtc_setting==1){ rtc_mode=RTC_SET_MODE; rtc_set=0; } else if(new_rtc_setting==2){ rtc_mode=RTC_SET_MODE; rtc_set=1; } else if(new_rtc_setting==3){ rtc_mode=ALM_SET_MODE; alm_set=1; } else if(new_rtc_setting==4){ rtc_mode=ALM_SET_MODE; alm_set=0; } Disp_Con(DISP_RTC); } #else #ifdef K3031_AP_668_V001 if (rtc_mode==ALM_SET_MODE){ if(alm_set==0){ alm_set=1; break; } } #endif #if defined(K820_LHD_820_V001) break; #endif if (rtc_mode != ALM_UP_MODE) { #if defined(MINI_DIGIT_BOX) if (rtc_mode==RTC_SET_MODE) { rtc_mode = RTC_PLAY_MODE; } else{ rtc_mode=RTC_SET_MODE; } op_timer=0; #else rtc_mode++; #ifdef USE_RTC_ALARM_FUNCTION if (rtc_mode>ALM_SET_MODE) { rtc_mode = RTC_PLAY_MODE; } #else if (rtc_mode>RTC_SET_MODE) { rtc_mode = RTC_PLAY_MODE; } #endif #endif #ifdef USE_RTC_TIME_ONLY rtc_set=3; #else rtc_set=0; #endif alm_set=0; Disp_Con(DISP_RTC); } #endif break; #if defined(MINI_DIGIT_BOX) case INFO_6|KEY_LONG: if (rtc_mode != ALM_UP_MODE) { //rtc_mode++; if (rtc_mode==ALM_SET_MODE) { rtc_mode = RTC_PLAY_MODE; } else{ rtc_mode = ALM_SET_MODE; alm_set=1; } } op_timer=0; Disp_Con(DISP_RTC); break; case INFO_2|KEY_LONG: rtc_mode = ALM_SET_MODE; alm_set=0; alm_sw =~alm_sw; Disp_Con(DISP_RTC); op_timer=0; break; #endif #ifdef INDEPENDENT_KEY_ADJ_TIME #ifdef RTC_MODE_HOT_KEY_ENABLE case INFO_RTC_MOD | KEY_LONG: #else case INFO_PLAY | KEY_SHORT_UP: #endif if (rtc_mode==RTC_PLAY_MODE) { alm_set=0; rtc_mode = ALM_SET_MODE; } Disp_Con(DISP_RTC); break; #elif defined(USE_NEXT_LONG_FOR_ALM_SETTING) case INFO_NEXT_FIL | KEY_LONG: //4RTC闹钟设置模式 if (rtc_mode==RTC_PLAY_MODE) { alm_set=0; rtc_mode = ALM_SET_MODE; } Disp_Con(DISP_RTC); break; #endif #if defined(K686_ZhengYang_686_V001)||defined(USE_POWER_KEY_TO_ADJ_HOUR_AND_MIN) case INFO_POWER| KEY_SHORT_UP: #elif defined(USE_MODE_LONG_FOR_RTC_SETTING) case INFO_MODE| KEY_SHORT_UP: if(rtc_mode == RTC_PLAY_MODE){ goto _HOT_KEY_HDLR; } #elif defined(CUSTOM_KEY_LONG_FOR_RTC_HOTKEY) case INFO_CUS_KEY_1 | KEY_SHORT_UP: #elif defined(MINI_DIGIT_BOX) case INFO_1|KEY_SHORT_UP: case INFO_6|KEY_SHORT_UP: op_timer=0; #else case INFO_PLAY| KEY_SHORT_UP: #endif #if defined(RTC_SETTING_OP_TIMER_ENABLE) op_timer=0; #endif #if defined(NEW_RTC_SETTING_CTRL) if ((rtc_mode != ALM_UP_MODE)&&(rtc_mode !=RTC_PLAY_MODE)) { if(new_rtc_setting==0){ rtc_mode=RTC_SET_MODE; rtc_set++; if(rtc_set>4){ rtc_mode=RTC_PLAY_MODE; } } else if(new_rtc_setting==1){ rtc_mode=RTC_PLAY_MODE; Disp_Con(DISP_RTC_DATE); break; } else if(new_rtc_setting==2){ rtc_mode=RTC_SET_MODE; rtc_set++; if(rtc_set>2){ Disp_Con(DISP_RTC_DATE); rtc_mode=RTC_PLAY_MODE; break; } } else if(new_rtc_setting==3){ rtc_mode=ALM_SET_MODE; alm_set++; if(alm_set>2){ Disp_Con(DISP_RTC_DATE); rtc_mode=RTC_PLAY_MODE; break; } } else if(new_rtc_setting==4){ Disp_Con(DISP_RTC_DATE); rtc_mode=RTC_PLAY_MODE; alm_set=0; break; } Disp_Con(DISP_RTC); } #else #if defined(K820_LHD_820_V001) break; #endif __TIME_ADJ_POS: if (rtc_mode == RTC_SET_MODE) { rtc_set++; if (rtc_set>4) { #ifdef USE_RTC_TIME_ONLY rtc_set=3; #else rtc_set=0; #endif #ifdef RTC_SETTING_NO_CYC rtc_mode = RTC_PLAY_MODE; #endif } Disp_Con(DISP_RTC); } else if (rtc_mode == ALM_SET_MODE) { #ifdef K3031_AP_668_V001 if(alm_set==0)break; #endif alm_set++; #if defined(ALARM_SEL_SOURCE) if (alm_set>3) #elif defined(ALARM_ADJ_VOL) if (alm_set>3) #else if (alm_set>2) #endif { #ifdef K3031_AP_668_V001 alm_set=1; #else alm_set=0; #endif #ifdef RTC_SETTING_NO_CYC rtc_mode = RTC_PLAY_MODE; #endif } Disp_Con(DISP_RTC); } #endif break; #ifdef ADJ_TIME_USE_VOL_KEY case INFO_VOL_PLUS: #ifdef RTC_ADJ_VOL if (rtc_mode==RTC_PLAY_MODE) goto _HOT_KEY_HDLR; #endif break; case INFO_VOL_PLUS | KEY_SHORT_UP: case INFO_VOL_PLUS | KEY_HOLD : //4RTC 设置模式下的时间选择(增加) #else case INFO_NEXT_FIL | KEY_SHORT_UP: case INFO_NEXT_FIL | KEY_HOLD: #endif #ifdef USE_NEXT_PREV_KEY_HOLD_FUNC_SKIP if(key==(INFO_NEXT_FIL | KEY_HOLD)) break; #endif #if defined(MINI_DIGIT_BOX)||defined(RTC_SETTING_OP_TIMER_ENABLE) op_timer=0; #endif if (rtc_mode==RTC_SET_MODE) { curr_date_plus(); set_date_sec(); fond_alm_clk(); Disp_Con(DISP_RTC); } else if (rtc_mode==ALM_SET_MODE) { #ifdef ALARM_SEL_SOURCE if (alm_set==3){ alm_source++; if(alm_source>ALM_SOUR_FM){ alm_source=ALM_SOUR_USB; } Disp_Con(DISP_RTC); break; } #elif defined(ALARM_ADJ_VOL) if(alm_set==3){ my_music_vol++; clear_super_mute_lock(); if (my_music_vol > MAX_VOL) { my_music_vol = MAX_VOL; } } #endif alm_time_plus(); set_alm_sec(); Disp_Con(DISP_RTC); } else { #ifdef RTC_ADJ_VOL goto _HOT_KEY_HDLR; #endif #ifdef NEW_RTC_SETTING_CTRL new_rtc_setting++; if(new_rtc_setting>4){ new_rtc_setting=0; } if(new_rtc_setting==0){ Disp_Con(DISP_RTC); } else{ Disp_Con(DISP_RTC_DATE); } #else #ifdef USE_RTC_YEAR_FUNCTION date_show_active = 1; Disp_Con(DISP_RTC_DATE); #endif #endif } break; #ifdef ADJ_TIME_USE_VOL_KEY case INFO_VOL_MINUS: #ifdef RTC_ADJ_VOL if (rtc_mode==RTC_PLAY_MODE) goto _HOT_KEY_HDLR; #endif break; case INFO_VOL_MINUS| KEY_SHORT_UP: case INFO_VOL_MINUS | KEY_HOLD : //4RTC 设置模式下的时间选择(减少) #else case INFO_PREV_FIL | KEY_SHORT_UP: case INFO_PREV_FIL | KEY_HOLD: #endif #ifdef USE_NEXT_PREV_KEY_HOLD_FUNC_SKIP if(key==(INFO_PREV_FIL | KEY_HOLD)) break; #endif #if defined(MINI_DIGIT_BOX)||defined(RTC_SETTING_OP_TIMER_ENABLE) op_timer=0; #endif if (rtc_mode==RTC_SET_MODE) { curr_date_minus(); set_date_sec(); fond_alm_clk(); Disp_Con(DISP_RTC); } else if (rtc_mode==ALM_SET_MODE) { #ifdef ALARM_SEL_SOURCE if (alm_set==3){ if(alm_source--==ALM_SOUR_USB){ alm_source=ALM_SOUR_FM; } Disp_Con(DISP_RTC); break; } #elif defined(ALARM_ADJ_VOL) if(alm_set==3){ if (my_music_vol) my_music_vol--; clear_super_mute_lock(); if(my_music_vol == MIN_VOL){ Mute_Ext_PA(MUTE); } } #endif alm_time_minus(); set_alm_sec(); Disp_Con(DISP_RTC); } else { #ifdef NEW_RTC_SETTING_CTRL new_rtc_setting--; if(new_rtc_setting>4){ new_rtc_setting=4; } if(new_rtc_setting==0){ Disp_Con(DISP_RTC); } else{ Disp_Con(DISP_RTC_DATE); } #else #ifdef USE_RTC_YEAR_FUNCTION date_show_active = 1; Disp_Con(DISP_RTC_DATE); #endif #endif } break; #if defined(MINI_DIGIT_BOX) #if defined(USE_SNOOZE_FUNC) case INFO_7|KEY_SHORT_UP: if (alm_flag>0) //4闹钟响后默认增加一天秒数 { set_snooze_func(); close_alm_bell(); Disp_Con(DISP_RTC); } break; #endif #endif case INFO_EQ_UP | KEY_SHORT_UP: //4清除闹钟 if (alm_flag) //4闹钟响后默认增加一天秒数 { #if defined(USE_SNOOZE_FUNC) set_snooze_func(); #endif close_alm_bell(); Disp_Con(DISP_RTC); } break; case INFO_HALF_SECOND : #if ((USE_DEVICE == MEMORY_STYLE)&&(FAT_MEMORY)) updata_fat_memory(); #endif #if defined(AD_MEASURE_TEMP_FUNC) adc_diode_temp_measure_hdlr(); #endif #ifdef DISP_BACKLIGHT_AUTO_SAVE_POWER Disp_BL_time_out(); #endif #if defined(USE_SNOOZE_FUNC) snooze_hdlr(); #endif #if defined(USE_TIMER_POWER_OFF_FUNC) timer_pwr_off_hdlr(); #endif #ifdef USE_MICPHONE_GPIO_DETECTION if(get_mic_online_status()){ Disp_Con(DISP_MIC); break; } #endif if ((DISP_ALM_UP == curr_menu) || (alm_flag>0)) { if (alm_flag>=60) { close_alm_bell(); return_cnt = (RETURN_TIME); #ifdef RTC_ALRM_MEM_LAST_WORK_MODE Set_Curr_Func(last_work_mode); return; #endif } else if (alm_flag) { rtc_mode = ALM_UP_MODE; alm_flag++; //key_voice_disable = 1; Mute_Ext_PA(UNMUTE); set_max_vol(MAX_ANALOG_VOL, MAX_DIGITAL_VOL); //设置RTC模式的音量上限 dac_out_select(DAC_DECODE); sys_clock_pll(); my_main_vol(my_music_vol); write_dsp(-3, 10, 0x10); #ifdef ALM_UP_DISP_TIME Disp_Con(DISP_RTC_POINT); #else Disp_Con(DISP_ALM_UP); #endif #ifdef ALM_ON_FLASH_SCR alm_flash_flag=~alm_flash_flag; if(alm_flash_flag){ Disp_Con(DISP_PWR_OFF); } #endif #if defined(USE_BAT_MANAGEMENT) bmt_hdlr(); #endif //delay_10ms(10); break; } } if ((rtc_mode==RTC_PLAY_MODE)||(rtc_mode==ALM_UP_MODE)) //4除闹钟模式外一直更新now_time { get_curr_date(); chk_date_err(); //Disp_Con(DISP_RTC); } #if defined(MINI_DIGIT_BOX)||defined(RTC_SETTING_OP_TIMER_ENABLE) rtc_setting_key_hdlr(); #endif if (return_cnt < (RETURN_TIME)) { return_cnt++; } if ((RETURN_TIME) == return_cnt) { if ((DISP_RTC != curr_menu) || (0 != rtc_mode)) { rtc_set = 0; alm_set = 0; rtc_mode = 0; #if defined(NEW_RTC_SETTING_CTRL) new_rtc_setting=0; #endif get_curr_date(); Disp_Con(DISP_RTC); } #ifdef USE_RTC_YEAR_FUNCTION date_show_active=0; #endif } #ifdef RTC_ADJ_VOL if(DISP_VOL == curr_menu){ } else #endif #ifdef USE_RTC_YEAR_FUNCTION if(!date_show_active) #elif defined(NEW_RTC_SETTING_CTRL) if((rtc_mode == RTC_PLAY_MODE)&&(new_rtc_setting>0)){ break; } #endif { Disp_Con(DISP_RTC_POINT); } #if defined(USE_BAT_MANAGEMENT) bmt_hdlr(); #endif break; default : _HOT_KEY_HDLR: if (!ap_handle_hotkey(key)) { close_alm_bell(); return; } } } }
void music_play(void) { u8 key; u8 file_end_time; #ifdef ADKEY_SELECT_MODE mode_switch_protect_bit=0; #endif while (1) { if (play_status == MUSIC_PLAY) { dac_out_select(DAC_DECODE); } //suspend_sdmmc(); key = get_msg(); #ifdef USE_USB_PROG_PLAY_MODE if(usb_play_prog_mode){ usb_prog_hdlr(key); if((key==INFO_HALF_SECOND)||(key==(INFO_MODE | KEY_SHORT_UP))||(key==(INFO_NEXT_FIL | KEY_SHORT_UP))||(key==(INFO_PREV_FIL | KEY_SHORT_UP))){ key = 0xFF; } } #endif switch (key) { case INFO_NEXT_SYS_MODE: return; case INIT_PLAY: //开始解码播放 file_end_time = 0; stop_decode(); playpoint_flag = 0; if(playpoint_filenum) { playpoint_flag = 1; given_file_number = playpoint_filenum; } #if FILE_ENCRYPTION password_start(0); #endif if (!fs_getfile_bynumber(given_file_number)) { put_msg_lifo(INFO_NEXT_FIL | KEY_SHORT_UP); break; } if (!start_decode()) { put_msg_lifo(INFO_NEXT_FIL | KEY_SHORT_UP); } #ifdef USE_USB_PROG_PLAY_MODE if(usb_prog_icon_bit){ usb_prog_play=1; } #endif break; case SEL_GIVEN_DEVICE_GIVEN_FILE: ///<获取指定设备的指定文件 get_music_file2(); break; case INFO_STOP| KEY_SHORT_UP : #ifdef USE_USB_PROG_PLAY_MODE if(usb_prog_play){ usb_prog_play=0; usb_play_prog_index =0; flush_all_msg(); stop_decode(); Disp_Con(DISP_STOP); //printf(" ---> usb_prog_icon_bit %x \r\n",(u16)usb_prog_icon_bit); play_mode =REPEAT_OFF; break; } usb_prog_mode_cls(); #endif if((get_device_online_status()==0)){ break; } Mute_Ext_PA(MUTE); disp_play_filenum_timer=6; play_mode =REPEAT_OFF; flush_all_msg(); stop_decode(); Disp_Con(DISP_STOP); break; case INFO_NEXT_FIL | KEY_SHORT_UP: #ifdef USE_FOLDER_SELECT_FUNC if(folder_select){ select_folder_file(FIND_NEXT_DIR); Disp_Con(DISP_DIR); break; } #endif disp_play_filenum_timer=10; get_music_file1(GET_NEXT_FILE); break; case INFO_PREV_FIL | KEY_SHORT_UP: #ifdef USE_FOLDER_SELECT_FUNC if(folder_select){ select_folder_file(FIND_PREV_DIR); Disp_Con(DISP_DIR); break; } #endif if(rew_play_timer>0){ rew_play_timer=0; put_msg_lifo(INIT_PLAY); } else { disp_play_filenum_timer=10; get_music_file1(GET_PREV_FILE); } break; case INFO_NEXT_FIL | KEY_HOLD: if(play_status) { ff_fr_step = FAST_FARWORD_STEP; play_status = MUSIC_FF_FR; #if (FF_FR_MUSIC) if(0 == decode_cmd) #endif { analog_vol_set(0); decode_cmd = 0xf0; } } break; case INFO_PREV_FIL | KEY_HOLD: if(music_type == 2) //wav文件不支持断点记忆,故可以快退 { playpoint_flag =0; } if(!playpoint_flag) //读取断点信息后不支持快退 { if(play_status) { ff_fr_step = -FAST_FARWORD_STEP; play_status = MUSIC_FF_FR; #if (FF_FR_MUSIC) if(0 == decode_cmd) #endif { analog_vol_set(0); decode_cmd = 0xf1; } } } break; case DECODE_MSG_DISK_ERR: #ifdef MP3_UART_ENABLE sys_printf(" DECODE_MSG_DISK_ERR"); #endif get_music_file3(); break; case DECODE_MSG_FILE_END: ////*将文件结束的消息放到半秒消息中处理,防止单曲循环遇到错误歌曲无法手动切换下一首,或遇到错误歌曲无法到上一首,每首歌曲至少播放约5S*/ if (get_music_play_time() < 5) { file_end_time = 7 - (u8)get_music_play_time(); } else { #ifdef MP3_UART_ENABLE sys_printf(" DECODE_MSG_FILE_END"); #endif get_music_file1(GET_PLAY_FILE); } break; case MSG_USB_DISK_IN : Disp_Con(DISP_SCAN_DISK); disp_scenario = DISP_NORMAL; //Add_Func_To_List(USB_DEV); given_device = BIT(USB_DISK); put_msg_lifo(SEL_GIVEN_DEVICE_GIVEN_FILE); break; case INFO_NEXTMODE: ///<下一个模式 //work_mode = SYS_IDLE; //return; stop_decode(); #ifdef NO_DEV_SHOW_NO_DEV #ifdef USE_USB_PROG_PLAY_MODE usb_prog_mode_cls(); #endif folder_select=0; folder_mode_select=0; Disp_Con(DISP_NODEVICE); #else Disp_Con(DISP_RTC); disp_scenario = DISP_RTC_SCEN; #endif break; case INFO_PLAY | KEY_SHORT_UP : #if defined(USE_TIMER_POWER_OFF_FUNC) if(timer_setting_enable){ timer_pwr_setting(); break; } #endif if((get_device_online_status()&0x03)==0){ break; } if (DISP_DWORD_NUMBER == curr_menu) { Disp_Con(DISP_NULL); put_msg_fifo(INFO_PICK_SONG | KEY_SHORT_UP); break; } if (play_status == MUSIC_PAUSE) { Mute_Ext_PA(UNMUTE); play_status = MUSIC_PLAY; Disp_Con(DISP_PLAY); mad_control(MAD_PLAY,0); if(music_type == 1) enable_decodeint(); if(music_type == 2) enable_softint(); } else if (play_status == MUSIC_PLAY) { Mute_Ext_PA(MUTE); play_status = MUSIC_PAUSE; if(music_type == 1) disable_decodeint(); Disp_Con(DISP_PAUSE); mad_control(MAD_PAUSE,0); read_usb_remain_data(); write_playtime(&playpoint_time); //暂停时记忆断点信息(EEPROM) } else if (play_status == MUSIC_STOP){ disp_play_filenum_timer=10; #ifdef USE_USB_PROG_PLAY_MODE if(usb_play_prog_mode){ if(usb_prog_tab[0]!=0){ given_file_number =usb_prog_tab[0]; } else{ usb_prog_mode_cls(); } usb_play_prog_mode=0; } #endif put_msg_lifo(INIT_PLAY); //Mute_Ext_PA(UNMUTE); } break; case INFO_PICK_SONG | KEY_SHORT_UP : given_file_number = (u16)cfilenum; cfilenum = 0; if ((given_file_number > 0) && (given_file_number <= fs_msg.fileTotal)) { put_msg_lifo(INIT_PLAY); break; } Disp_Con(DISP_ERROR); break; case INFO_HALF_SECOND : #if ((USE_DEVICE == MEMORY_STYLE)&&(FAT_MEMORY)) updata_fat_memory(); #endif #if defined(USE_BAT_MANAGEMENT) bmt_hdlr(); #endif #ifdef USE_USB_ERP_2_HDLR usb_erp_2_timer_hdlr(); #endif #if defined(USE_TIMER_POWER_OFF_FUNC) timer_pwr_off_hdlr(); #endif set_brightness_fade_out(); update_playpoint(&playpoint_time); //半秒更新断点进度,不写入存储器 #if 1//defined(USE_FOLDER_SELECT_FUNC) if(folder_select){ return_cnt++; if (RETURN_TIME == return_cnt){ return_cnt=4; folder_select=0; } else{ break; } } #endif if(adkey_detect){ adkey_detect=0; set_sys_vol(my_music_vol); } if(disp_play_filenum_timer>0)disp_play_filenum_timer--; if (file_end_time) { file_end_time--; if (file_end_time == 0) { get_music_file1(GET_PLAY_FILE); } } #if FF_FR_MUSIC ///在每一次快进完成之后,播出半秒左右的声音 if ((2 == decode_cmd)&&(play_status == MUSIC_FF_FR)) { decode_cmd = 0; set_eq(eq_mode); play_status = MUSIC_PLAY; } #else if ((decode_cmd != 0) && (decode_cmd <= 2)) { decode_cmd--; set_eq(eq_mode); if (decode_cmd == 0) ///<快进快退结束后1S,打开主音量 { play_status = MUSIC_PLAY; } } #endif #ifdef RTC_DISP_IN_IDLE_MODE if(disp_scenario == DISP_RTC_SCEN){ rtc_setting_exit(); if(curr_menu != DISP_RTC){ return_cnt++; if (RETURN_TIME == return_cnt){ rtc_disp_hdlr(); } break; } rtc_disp_hdlr(); break; } #endif #ifdef NO_DEV_SHOW_NO_DEV if((get_device_online_status()&0x03)==0){ Disp_Con(DISP_NODEVICE); break; } #endif if (DISP_PLAY == curr_menu) { rew_play_timer=1; disp_file_time(); } return_cnt++; if (RETURN_TIME == return_cnt) { #if defined(USE_TIMER_POWER_OFF_FUNC) timer_setting_enable=0; #endif if (DISP_DWORD_NUMBER == curr_menu) { Disp_Con(DISP_NULL); put_msg_fifo(INFO_PICK_SONG | KEY_SHORT_UP); } else { if (play_status== MUSIC_PAUSE){ if (curr_menu != DISP_PAUSE) Disp_Con(DISP_PAUSE); } else if(play_status== MUSIC_PLAY){ if (curr_menu != DISP_PLAY){ if(disp_play_filenum_timer==0) Disp_Con(DISP_PLAY); else Disp_Con(curr_menu); } } else if(play_status== MUSIC_STOP){ if (curr_menu != DISP_STOP) Disp_Con(DISP_STOP); } } } #if 1//( USE_RTCRAM == MEMORY_STYLE ) save_playpoint(2); //2*0.5 = 1s 1s记录一次播放进度, #endif break; case INFO_MODE | KEY_LONG: if((get_device_online_status()==0)){ break; } #if 0 #ifdef USE_USB_PROG_PLAY_MODE if(play_status == MUSIC_STOP){ usb_prog_play_init(); break; } #endif #endif folder_mode_select=~folder_mode_select; folder_select=folder_mode_select; if(folder_mode_select){ #ifdef USE_USB_PROG_PLAY_MODE usb_prog_mode_cls(); #endif Disp_Con(DISP_DIR); } else{ Disp_Con(DISP_PLAY); } break; case INFO_MODE | KEY_SHORT_UP: if((get_device_online_status()==0)){ break; } #ifdef USE_USB_PROG_PLAY_MODE if(play_status == MUSIC_STOP){ usb_prog_play_init(); break; } #endif case INFO_PLAY_MODE : //if(usb_play_prog_mode||usb_prog_icon_bit){ // break; //} play_mode++; if (play_mode > REPEAT_END) { play_mode = REPEAT_HEAD; } #ifndef NO_PLAY_MODE_STR_DISP write_info(MEM_PLAY_MODE,play_mode); Disp_Con(DISP_PLAYMODE); #endif break; case INFO_EQ_UP | KEY_SHORT_UP : eq_mode++; if (eq_mode > CLASSIC) { eq_mode = NORMAL; } write_info(MEM_EQ_MODE,eq_mode); set_eq(eq_mode); Disp_Con(DISP_EQ); break; #if 0 case INFO_MODE | KEY_LONG: if(disp_scenario == DISP_RTC_SCEN){ if(rtc_setting==0){ rtc_setting = 0x01; rtc_set = 3; rtc_set_cnt=30; } } break; #endif #if RTC_ENABLE case INFO_ALM_BELL : ///<闹钟响消息,进入闹钟循环 if (play_status) { /**/ if(music_type == 1) disable_decodeint(); mad_control(MAD_PAUSE,0); read_usb_remain_data(); } if(alm_bell_mode()) { if (play_status) { mad_control(MAD_PLAY,0); if(music_type == 1) enable_decodeint(); if(music_type == 2) enable_softint(); } return; } if (play_status) { mad_control(MAD_PLAY,0); if(music_type == 1) enable_decodeint(); if(music_type == 2) enable_softint(); } #ifdef PWR_CTRL_IN_IDLE_MODE #if defined(PWR_CTRL_WKUP) wkup_pin_ctrl(1); #else PWR_CTRL_GPIO_INIT(); PWR_CTRL_EN(); #endif #endif break; #endif default : _HOT_KEY_HDLR: if (!ap_handle_hotkey(key)) return; if ((!play_status) && (!device_check())) { if(disp_scenario == DISP_NORMAL){ stop_decode(); Disp_Con(DISP_RTC); disp_scenario = DISP_RTC_SCEN; } play_status = MUSIC_PLAY; //return; } } } }
/*----------------------------------------------------------------------------*/ 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; } } }
/*----------------------------------------------------------------------------*/ 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 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; } } }
/*----------------------------------------------------------------------------*/ 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; } } }
/*----------------------------------------------------------------------------*/ 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 idle_mode(void) { u8 key; //dac_out_select(DAC_MUSIC, 0); //clear_all_event(); #ifdef UART_ENABLE sys_printf(" SYS GO IN IDLE MODE"); #endif #ifdef PWR_CTRL_IN_IDLE_MODE #if defined(PWR_CTRL_WKUP) wkup_pin_ctrl(0); #else PWR_CTRL_GPIO_INIT(); PWR_CTRL_DIS(); #endif #endif flush_all_msg(); KT_AMFMStandby(); sys_sleep_mode(); #ifdef RTC_DISP_IN_IDLE_MODE disp_scenario = DISP_RTC_SCEN; Disp_Con(DISP_RTC); #else Disp_Con(DISP_POWER_OFF); #endif #if 0 alm_flag = 1; put_msg_lifo(INFO_ALM_BELL); #endif #ifdef ADKEY_SELECT_MODE mode_switch_protect_bit=0; #endif while (1) { key = get_msg(); //suspend_sdmmc(); #ifndef RTC_DISP_IN_IDLE_MODE if(sys_pwr_flag){ if(key!=(INFO_POWER | KEY_SHORT_UP)){ key = NO_KEY; } } #endif switch (key) { #if 0 case INFO_PLAY| KEY_SHORT_UP : alm_flag = 1; put_msg_lifo(INFO_ALM_BELL); break; #endif case INFO_POWER | KEY_SHORT_UP : if(sys_pwr_flag){ //sys_mute_flag =0; dac_mute_control(0,1); //调节音量时,自动UNMUTE sys_pwr_flag =0; //work_mode = SYS_IDLE; } break; case INFO_HALF_SECOND : #ifdef RTC_DISP_IN_IDLE_MODE #if defined(USE_BAT_MANAGEMENT) bmt_hdlr(); #endif set_brightness_fade_out(); rtc_setting_exit(); if(disp_scenario == DISP_RTC_SCEN){ if(curr_menu != DISP_RTC){ return_cnt++; if (RETURN_TIME == return_cnt){ rtc_disp_hdlr(); } break; } rtc_disp_hdlr(); break; } #ifdef USE_RTC_ALARM_FUNCTION else if(disp_scenario == DISP_ALM_SCEN){ rtc_disp_hdlr(); } #endif #endif break; case INFO_NEXT_SYS_MODE: return; #ifdef USE_RTC_ALARM_FUNCTION case INFO_ALM_BELL: sys_restore_mode(); alm_bell_mode(); //sys_sleep_mode(); #ifdef ALARM_USE_MULTI_SOURCE_FUNC if(get_cur_select_func()==SYS_MP3DECODE_USB){ if(get_device_online_status()>0){ alarm_power_on_protect =1; work_mode = SYS_MP3DECODE_USB; flush_all_msg(); put_msg_lifo(INFO_NEXT_SYS_MODE); break; } } else if(get_cur_select_func()==SYS_FMREV){ work_mode = SYS_FMREV; alarm_power_on_protect =1; flush_all_msg(); put_msg_lifo(INFO_NEXT_SYS_MODE); break; } #endif break; #endif case MSG_USB_DISK_IN : case MSG_SDMMC_IN : break; default: ap_handle_hotkey(key); break; } } }
/*----------------------------------------------------------------------------*/ void fm_rev( void ) { u8 key; #if defined(SPECTRUM_FUNC_ENABLE) set_spectrum_lock(UNLOCK); #endif #if defined(FM_PAUSE_LED_INDICATOR) set_play_flash(LED_FLASH_NOR); #endif my_main_vol(my_music_vol); while (1) { key = get_msg(); #if defined(KEY_PRESS_LED_INDICATOR) key_press_led_indicator(key); #elif defined(CUSTOM_KEY_FEATURE_USE) custom_key_hdlr(key); #endif #if defined(KPL_MSG_COMPATIBLE) kpl_msg_hdlr(key); #endif #if 0 if(key!=0xff) printf(" music_play get_msg %x \r\n",(u16)key); #endif dac_sw_check(); #ifndef FM_BY_PASS dac_out_select(aux_ch_reg); #endif switch (key) { #if defined(K000_HG_898_V001)||defined(USE_STOP_KEY_SHORT_CH_DOWN) case INFO_STOP |KEY_SHORT_UP : goto __CH_DOWN; break; #endif #ifdef USE_STOP_KEY_SHORT_SCAN case INFO_STOP| KEY_SHORT_UP : goto __SCAN_FREQ; #endif #ifdef IR_INFO_EQ_DOWN_SCAN case INFO_EQ_DOWN| KEY_SHORT_UP : if(IR_KEY_Detect){ IR_KEY_Detect = 0; goto __SCAN_FREQ; } break; #endif #ifdef USE_MODE_KEY_LONG_SCAN case INFO_MODE | KEY_LONG : goto __SCAN_FREQ; #endif #ifdef RADIO_MODE_HOT_KEY_ENABLE #ifdef RADIO_MODE_HOT_KEY_LONG_SCAN case INFO_FM_MOD| KEY_LONG : goto __SCAN_FREQ; #endif #endif #ifdef USE_EQ_KEY_SHORT_SCAN case INFO_EQ_UP| KEY_SHORT_UP : goto __SCAN_FREQ; #endif #ifdef USE_EQ_KEY_SHORT_CH_UP case INFO_EQ_UP | KEY_SHORT_UP : goto __CH_DOWN; break; #endif #if 1//def USE_POWER_KEY #ifdef USE_POWER_KEY_SHORT_SCAN case INFO_POWER | KEY_SHORT_UP : #ifdef USE_IR_POWER_KEY_TO_POWER_OFF if(IR_KEY_Detect){ IR_KEY_Detect =0; goto _HOT_KEY_HDLR; } #endif goto __SCAN_FREQ; #endif #endif #if defined(VOL_TUNE_VOL_DEFAULT_TUNE_FREQ_POP) case INFO_CUS_KEY_1 | KEY_SHORT_UP : radio_freq_tune_pop=~radio_freq_tune_pop; radio_tune_timer=12; if(radio_freq_tune_pop){ Disp_Con(DISP_FREQ); } break; #endif #ifdef RADIO_MODE_HOT_KEY_ENABLE #ifdef RADIO_AM_WM_SEL_IN_ONE_KEY #ifdef RADIO_AM_WM_ENABLE case INFO_FM_MOD | KEY_SHORT_UP: if (work_mode == SYS_AMREV){ Set_Curr_Func(SYS_FMREV); FMAM_Mode_Switch_Profile(SYS_FMREV); } else if(work_mode == SYS_FMREV){ Set_Curr_Func(SYS_AMREV); FMAM_Mode_Switch_Profile(SYS_AMREV); } break; #endif #endif #endif #if defined(USE_POWER_KEY_FOR_FM_PLAY) case INFO_POWER | KEY_SHORT_UP : #if defined(USE_IR_LONG_POWER_KEY_TO_FAKE_POWER_OFF) if(IR_KEY_Detect){ IR_KEY_Detect = 0; break; } #endif #ifdef USE_IR_POWER_KEY_TO_POWER_OFF if(IR_KEY_Detect){ IR_KEY_Detect = 0; break; } #endif #elif defined(USE_MODE_LONG_FOR_FM_PLAY) case INFO_MODE| KEY_LONG: #endif case INFO_PLAY | KEY_SHORT_UP : #if defined(FM_PLAY_KEY_PAUSE) #if defined(K722_YJH_722_V001) if(IR_KEY_Detect){ IR_KEY_Detect = 0; break; } #endif #if defined(IR_PLAY_KEY_SCAN_FREQ_ALL) if(IR_KEY_Detect){ IR_KEY_Detect = 0; goto __SCAN_FREQ; } #endif play_status = !play_status; if (play_status) { my_main_vol(my_music_vol); Mute_Ext_PA(UNMUTE); #if defined(FM_PAUSE_LED_INDICATOR) set_play_flash(LED_FLASH_ON); #endif } else{ Mute_Ext_PA(MUTE); my_main_vol(0); #if defined(USE_SPECTRUM_PARTTERN) set_lcd_flash_lock(LOCK); #endif #if defined(FM_PAUSE_LED_INDICATOR) set_play_flash(LED_FLASH_NOR); #endif } #if defined(PAUSE_FLASH_WHOLE_SCREEN) if (play_status == MUSIC_PAUSE) set_led_flash_tpye(2); else{ set_led_flash_tpye(0); } #endif Disp_Con(DISP_FREQ); break; #endif if(IR_KEY_Detect){ IR_KEY_Detect =0; #if defined(IR_PLAY_KEY_SCAN_FREQ_DISABLE) break; #elif defined(IR_PLAY_SHORT_CH_UP) goto __CH_UP; #else goto __SCAN_FREQ; #endif } else{ #if defined(ADKEY_PLAY_SHORT_SCAN_FRE_DISABLE) break; #endif #ifdef ADKEY_PLAY_SHORT_SCAN_FRE goto __SCAN_FREQ; #else #if defined( ADKEY_NEXT_ADJST_FREQ) goto __CH_UP; #endif #if defined(ADKEY_PLAY_SHORT_ADJ_CH) goto __CH_UP; #endif #endif } break; #if defined(K120_YJH_120_V001)||defined(K000_HG_898_V001)||defined(EQ_DOWN_SCAN_ALL) case INFO_EQ_DOWN| KEY_SHORT_UP : #if 1//defined(EQ_DOWN_SCAN_ALL) goto __SCAN_FREQ; #endif #ifndef K722_YJH_722_V001 goto __FRE_DOWN; #endif #endif case INFO_PLAY | KEY_LONG : if(IR_KEY_Detect){ IR_KEY_Detect =0; #if defined(IR_PLAY_KEY_LONG_SCAN_FREQ) goto __SCAN_FREQ; #else break; #endif } #ifdef USE_LONG_PLAY_KEY_TO_SWITCH_MODE goto _HOT_KEY_HDLR; #endif #ifdef AUX_MODE_HOT_KEY_USE_PLAY_LONG goto _HOT_KEY_HDLR; #endif #ifdef USE_EQ_KEY_SHORT_SCAN break; #endif #ifdef ADKEY_PLAY_SHORT_SCAN_FRE break; #endif __SCAN_FREQ: #if defined(USE_SPECTRUM_PARTTERN) set_lcd_flash_lock(LOCK); #endif #ifdef DISP_SCH_AT_FM_SCAN Disp_Con(DISP_SCH); delay_10ms(60); #endif scan_fre(); #if defined(USE_SPECTRUM_PARTTERN) set_lcd_flash_lock(UNLOCK); #endif if(IR_KEY_Detect){ IR_KEY_Detect =0; //break; } //flush_low_msg(); fre_channl = 1; get_channl(fre_channl); //Disp_Con(DISP_FREQ); break; #if RTC_ENABLE case INFO_ALM_BELL : ///<闹钟响消息,进入闹钟循环 sys_clock_pll(); dac_out_select(DAC_DECODE); if(alm_bell_mode()) { dac_out_select(DAC_AMUX0); return; } dac_out_select(DAC_AMUX0); break; #endif case INFO_HALF_SECOND : #if ((USE_DEVICE == MEMORY_STYLE)&&(FAT_MEMORY)) updata_fat_memory(); #endif #if defined(AD_MEASURE_TEMP_FUNC) adc_diode_temp_measure_hdlr(); #endif #ifdef DISP_BACKLIGHT_AUTO_SAVE_POWER Disp_BL_time_out(); #endif #ifdef USE_USB_HOTPLUG_FUNC usb_hotplug_hdlr(); #endif #ifdef MUTE_EXAMP_AT_FM_NEXT_PREV_IMPROVE if(mute_release_timer>0) mute_release_timer--; if(mute_release_timer==0){ my_main_vol(my_music_vol); Mute_Ext_PA(UNMUTE); } #endif #if defined(VOL_TUNE_VOL_DEFAULT_TUNE_FREQ_POP) if(radio_tune_timer>0){ radio_tune_timer--; if(radio_tune_timer==0){ radio_freq_tune_pop=0; Disp_Con(DISP_FREQ); } if(radio_freq_tune_pop){ pop_spark=~pop_spark; if(pop_spark){ Disp_Con(DISP_PWR_OFF); } else{ Disp_Con(DISP_FREQ); } } } #endif #ifdef VOL_ADJ_SPARK_LED if(vol_adj_spark_bit){ vol_adj_spark_bit=0; restore_led_flash_mod(last_led_play_mod); } #endif if (return_cnt < RETURN_TIME) { return_cnt++; } #if defined(TIME_FORCE_SHOW_ON_SCREEN) if (DISP_FREQ == curr_menu){ if (time_show_return_cnt>RETURN_TIME_SHOW_TIME){ get_curr_date(); Disp_Con(DISP_RTC_POINT); break; } else{ #if defined(MANUAL_SWITCH_TIME_DISPLAY) Disp_Con(DISP_FREQ); #else if(DISP_RTC != curr_menu){ time_show_return_cnt++; } #endif } } #endif if (RETURN_TIME == return_cnt) { #ifdef SUPPORT_PT2313 clr_aud_effect_state(); #endif #if defined(LED_DRV_USE_SM1628) led_spark_protect=0; #endif if (DISP_DWORD_NUMBER == curr_menu) { goto _PICK_CH; } else if (DISP_FREQ != curr_menu) Disp_Con(DISP_FREQ); #if defined(NEW_VOLUME_KEY_FEATURE)||defined(VOL_TUNE_NEW_VOLUME_KEY_FEATURE) if(new_vol_feature){ new_vol_feature =0; if(last_disp_menu!=DISP_NULL) Disp_Con(last_disp_menu); } #endif } #if defined(USE_BAT_MANAGEMENT) bmt_hdlr(); #endif Disp_Update(); break; case INFO_PICK_FRE | KEY_LONG: save_fre(frequency); Disp_Con(DISP_FREQ); break; case INFO_PICK_FRE | KEY_SHORT_UP: _PICK_CH: if (DISP_DWORD_NUMBER != curr_menu) { break; } if (( cfilenum <= MAX_FRE) && (cfilenum >= MIN_FRE)) { frequency = cfilenum; cfilenum = 0; set_fre(frequency, 1); } else if ((cfilenum) && (cfilenum<=all_channl)) { fre_channl = cfilenum; get_channl(fre_channl); } cfilenum = 0; Disp_Con(DISP_FREQ); write_info(MEM_FRE,frequency - MIN_FRE); break; #if defined(VOL_TUNE_FREQ_VOL)||defined(VOL_TUNE_FREQ_ONLY)||defined(VOL_TUNE_NEW_VOLUME_KEY_FEATURE)||defined(VOL_TUNE_VOL_DEFAULT_TUNE_FREQ_POP) case INFO_PLUS: frequency += 2; goto __FRE_DOWN; case INFO_MINUS: goto __FRE_DOWN; break; #endif case INFO_NEXT_FIL | KEY_SHORT_UP: #if defined(NEW_VOLUME_KEY_FEATURE) break; case INFO_NEXT_FIL : case INFO_NEXT_FIL | KEY_HOLD: if(new_vol_feature){ goto _HOT_KEY_HDLR; } #endif if(IR_KEY_Detect){ IR_KEY_Detect =0; #if defined(IR_NEXT_PREV_SHORT_ADJ_CH) goto __CH_UP; #elif defined( IR_NEXT_PREV_DO_NOTHING) break; #elif defined( IR_NEXT_PREV_SHORT_AUTO_SCAN) goto __SCAN_UP; #else frequency += 2; goto __FRE_DOWN; #endif } else{ #if defined(K722_YJH_722_V001) if(fre_channl==1){ frequency += 2; goto __FRE_DOWN; } else{ goto __CH_UP; } #endif #if defined( ADKEY_NEXT_ADJST_FREQ) frequency += 2; goto __FRE_DOWN; #elif defined(ADKEY_NEXT_PREV_SHORT_AUTO_SCAN) goto __SCAN_UP; #else goto __CH_UP; #endif } case INFO_PREV_FIL | KEY_SHORT_UP: #if defined(NEW_VOLUME_KEY_FEATURE) break; case INFO_PREV_FIL : case INFO_PREV_FIL | KEY_HOLD: if(new_vol_feature){ goto _HOT_KEY_HDLR; } #endif if(IR_KEY_Detect){ IR_KEY_Detect =0; #if defined(IR_NEXT_PREV_SHORT_ADJ_CH) goto __CH_DOWN; #elif defined( IR_NEXT_PREV_DO_NOTHING) break; #elif defined(IR_NEXT_PREV_SHORT_AUTO_SCAN) goto __SCAN_DOWN; #else goto __FRE_DOWN; #endif } else{ #if defined(K722_YJH_722_V001) if(fre_channl==1){ goto __FRE_DOWN; } else{ goto __CH_DOWN; } #endif #if defined( ADKEY_NEXT_ADJST_FREQ) goto __FRE_DOWN; #elif defined(ADKEY_NEXT_PREV_SHORT_AUTO_SCAN) goto __SCAN_DOWN; #else goto __CH_DOWN; #endif } __FRE_DOWN: frequency--; #ifdef MUTE_EXAMP_AT_FM_NEXT_PREV #ifdef MUTE_EXAMP_AT_FM_NEXT_PREV_IMPROVE if(mute_release_timer==0) #endif { Mute_Ext_PA(MUTE); my_main_vol(0); } #endif #ifdef RADIO_AM_WM_ENABLE if(work_mode==SYS_FMREV){ if ( frequency > MAX_FRE) { frequency = MIN_FRE; } else if (frequency < MIN_FRE) { frequency = MAX_FRE; } set_fre(frequency, 1); write_info(MEM_FRE,frequency - MIN_FRE); } else { if ( frequency > AM_MAX_FRE) { frequency = AM_MIN_FRE; } else if (frequency < AM_MIN_FRE) { frequency = AM_MAX_FRE; } set_fre(frequency, 1); Save_AM_Freq((frequency - AM_MIN_FRE),(AM_FREQ_MAGIC_NUM)); } #else if ( frequency > MAX_FRE) { frequency = MIN_FRE; } else if (frequency < MIN_FRE) { frequency = MAX_FRE; } set_fre(frequency, 1); write_info(MEM_FRE,frequency - MIN_FRE); #endif Disp_Con(DISP_FREQ); #ifdef MUTE_EXAMP_AT_FM_NEXT_PREV #ifdef MUTE_EXAMP_AT_FM_NEXT_PREV_IMPROVE mute_release_timer=2; #else my_main_vol(my_music_vol); Mute_Ext_PA(UNMUTE); #endif #endif //delay_ms(20); break; #if defined(USE_MODE_LONG_FOR_FM_CH_UP) case INFO_MODE| KEY_LONG: #endif case INFO_CH_NEXT | KEY_SHORT_UP: case INFO_CH_UP| KEY_SHORT_UP: __CH_UP: fre_channl += 2; case INFO_CH_PREV | KEY_SHORT_UP: case INFO_CH_DOWN| KEY_SHORT_UP: __CH_DOWN: fre_channl--; if (fre_channl > all_channl) { fre_channl = 1; } else if (!fre_channl) { fre_channl = all_channl; } get_channl(fre_channl); Disp_Con(DISP_FREQ); flush_low_msg(); break; #ifdef SEMI_AUTO_SCAN_FREQ #if defined(K722_YJH_722_V001) case INFO_PLAY_MODE | KEY_SHORT_UP: frequency += 2; goto __FRE_DOWN; #endif case INFO_CH_UP| KEY_HOLD: case INFO_NEXT_FIL | KEY_HOLD: if(IR_KEY_Detect){ IR_KEY_Detect =0; #if defined(IR_NEXT_PREV_HOLD_AUTO_SCAN) #elif defined(IR_NEXT_PREV_KEY_HOLD_DO_NOTHING) break; #else break; #endif } else{ #if defined(ADKEY_NEXT_PREV_HOLD_AUTO_SCAN) //goto __SCAN_UP; #elif defined(ADKEY_NEXT_PREV_HOLD_FREQ_ADJ) frequency += 2; goto __FRE_DOWN; #elif defined(ADKEY_NEXT_PREV_HOLD_CH_SEL) goto __CH_UP; #else goto _HOT_KEY_HDLR; #endif } case INFO_PLUS | KEY_SHORT_UP: #if defined(INDEPENDENT_KEY_TUNE_FREQ) frequency += 2; goto __FRE_DOWN; #endif case INFO_PLUS | KEY_HOLD: #if defined(INDEPENDENT_KEY_FAST_TUNE_FREQ) frequency += 2; goto __FRE_DOWN; #endif __SCAN_UP: auto_scan(SEARCH_UP); break; #if defined(K722_YJH_722_V001) case INFO_EQ_UP | KEY_SHORT_UP: goto __FRE_DOWN; #endif case INFO_CH_DOWN| KEY_HOLD: case INFO_PREV_FIL | KEY_HOLD: if(IR_KEY_Detect){ IR_KEY_Detect =0; #if defined(IR_NEXT_PREV_HOLD_AUTO_SCAN) #elif defined(IR_NEXT_PREV_KEY_HOLD_DO_NOTHING) break; #else break; #endif } else{ #if defined(ADKEY_NEXT_PREV_HOLD_AUTO_SCAN) //goto __SCAN_DOWN; #elif defined(ADKEY_NEXT_PREV_HOLD_FREQ_ADJ) goto __FRE_DOWN; #elif defined(ADKEY_NEXT_PREV_HOLD_CH_SEL) goto __CH_DOWN; #else goto _HOT_KEY_HDLR; #endif } case INFO_MINUS|KEY_SHORT_UP: #if defined(INDEPENDENT_KEY_TUNE_FREQ) goto __FRE_DOWN; #endif case INFO_MINUS| KEY_HOLD: #if defined(INDEPENDENT_KEY_FAST_TUNE_FREQ) goto __FRE_DOWN; #endif __SCAN_DOWN: auto_scan(SEARCH_DN); break; #endif default : _HOT_KEY_HDLR: if (!ap_handle_hotkey(key)) return; } } }
/*----------------------------------------------------------------------------*/ void deal_aux( void ) { u8 key; aux_channel_crosstalk_improve(DAC_AMUX0); delay_10ms(60); Mute_Ext_PA(UNMUTE); while (1) { dac_out_select(DAC_AMUX0); //suspend_sdmmc(); key = get_msg(); if(dac_cnt > 20) { dac_sw(0); } switch (key) { case INFO_NEXT_SYS_MODE: return; case INFO_HALF_SECOND : #if ((USE_DEVICE == MEMORY_STYLE)&&(FAT_MEMORY)) updata_fat_memory(); #endif #if defined(USE_BAT_MANAGEMENT) bmt_hdlr(); #endif #if defined(USE_TIMER_POWER_OFF_FUNC) timer_pwr_off_hdlr(); #endif #ifdef USE_ERP_2_HDLR aux_erp_2_timer_hdlr(); #endif if(adkey_detect){ adkey_detect=0; set_sys_vol(my_music_vol); } set_brightness_fade_out(); if (return_cnt < RETURN_TIME) { return_cnt++; } if (RETURN_TIME == return_cnt) { if (DISP_DWORD_NUMBER == curr_menu) { cfilenum = 0; } if (DISP_AUX != curr_menu) Disp_Con(DISP_AUX); } break; #if RTC_ENABLE case INFO_ALM_BELL : ///<闹钟响消息,进入闹钟循环 dac_out_select(DAC_DECODE); alm_bell_mode(); #ifdef PWR_CTRL_IN_IDLE_MODE #if defined(PWR_CTRL_WKUP) wkup_pin_ctrl(1); #else PWR_CTRL_GPIO_INIT(); PWR_CTRL_EN(); #endif #endif break; #endif default : if (!ap_handle_hotkey(key)) return; } } }