コード例 #1
0
void radio_chip_set_freq(u8 mode,bool disp_pro)
{
    xd_u8 freq_step =0;

    set_brightness_all_on();

    freq_step = Current_Band.Tune_Step;
	
    if (mode == FM_FRE_INC)
    {
        frequency=frequency+freq_step;
		
	 if (frequency > REG_MAX_FREQ)
	     frequency = REG_MIN_FREQ;		
    }
    else if (mode == FM_FRE_DEC)
    {
        frequency=frequency-freq_step;
		
	 if (frequency < REG_MIN_FREQ)
	      frequency =REG_MAX_FREQ;		
    }
    else{
		
	    if (frequency > REG_MAX_FREQ)
	        frequency = REG_MAX_FREQ;
		
	    if (frequency < REG_MIN_FREQ)
	        frequency =REG_MIN_FREQ;
    }
	
    set_freq(frequency);
	
    if(disp_pro)	
	Disp_Con(DISP_FREQ);			

#if 1//def SAVE_BAND_FREQ_INFO
#ifdef FM_UART_ENABLE
    printf("------->- set_radio_freq    fre:%4u   \r\n",frequency);
#endif
    save_radio_freq(frequency,cur_sw_fm_band*2+MEM_FREQ_BASE);
#endif
    set_sys_vol(my_music_vol);	

}
コード例 #2
0
ファイル: radio_api.c プロジェクト: go2net/kt-rec-pro
bool radio_band_scan(u8 mode)
{
    bool res;

    input_number_en = 0;
    vol_change_en=0;	
    //adkey_activated=1;	  
    radio_scan_safeguard=3;
		
    dac_mute_control(1,1);
	
    if(mode == RADIO_SCAN_NEXT)
    {
        radio_band.wFreq=radio_band.wFreq+radio_band.bTuneStep;
		
	 if (radio_band.wFreq > radio_band.wFreqUpLimit)
	     radio_band.wFreq = radio_band.wFreqDownLimit;		

	 if(freq_reg_stop ==radio_band.wFreq ){

    		set_radio_freq(RADIO_CUR_FRE);			
	 	return 1;
	 }
    }
    else if (mode == RADIO_SCAN_PREV)
    {
        radio_band.wFreq=radio_band.wFreq-radio_band.bTuneStep;
		
	 if (radio_band.wFreq < radio_band.wFreqDownLimit)
	      radio_band.wFreq =radio_band.wFreqUpLimit;	

	 if(freq_reg_stop ==radio_band.wFreq ){

    		set_radio_freq(RADIO_CUR_FRE);			
	 	return 1;
	 }
    }
    else{
		
        radio_band.wFreq=radio_band.wFreq+radio_band.bTuneStep;
		
	 if(radio_band.wFreq > radio_band.wFreqUpLimit){
	     	radio_band.wFreq = radio_band.wFreqDownLimit;
		radio_band.bTotalChannel=radio_band.bTotalChannel-1;						  				
		//restore_station_from_epprom((RADIO_STATION_CURR|1));
		return 1;
	 }
    }

    disp_port(MENU_RADIO_MAIN);
		
    res = radio_get_validstation(radio_band.wFreq);

    //disp_port(MENU_RADIO_MAIN);			

    if (res)						//找到一个台
    {
#ifdef DEBUG_FM    	
	printf(" ---->KT  VALID  %d  \r\n ",(u16)radio_band.bTotalChannel);
	printf(" ---->OK OK   \r\n ");
	printf(" \r\n   \r\n ");
#endif
#if 0

       	if(mode==RADIO_SCAN_ALL){
				
#ifdef SAVE_BAND_FREQ_INFO	
			//mem_radio_info(RADIO_SAVE_STATION,&radio_band.wFreq,radio_band.bTotalChannel);
			//mem_radio_info(RADIO_SAVE_STATION_SUM,&radio_band.wFreq,0);
#endif
			dac_mute_control(0,1);
			disp_port(MENU_RADIO_SCAN_STATION);
			delay_10ms(100);
			if(radio_band.bTotalChannel ==MEM_RADIO_STATION_MAX){
				restore_station_from_epprom((RADIO_STATION_CURR|1));		
			}
			else{
				radio_band.bTotalChannel++;
			}
			dac_mute_control(1,1);
       	}
		else
#endif			
		{
       		scan_mode = RADIO_SCAN_STOP;
		}
#ifdef SAVE_BAND_FREQ_INFO	
    		save_radio_freq(radio_band.wFreq,radio_band.bCurBand);
#endif
		return true;            		
    }
	
    return false;
}
コード例 #3
0
ファイル: radio_api.c プロジェクト: go2net/kt-rec-pro
void set_radio_freq(u8 mode)
{
   	xd_u16 freq_step =0;
#ifndef LCD_BACK_LIGHT_DUMMY				   
    	set_brightness_all_on();
#endif

#if defined(FAST_STICK_TUNE_FUNC)

	 if(fast_step_cnt==0){
		fast_step_cnt=1;
	 }

    	if(radio_band.bCurBand==FM_MODE){

		if(fast_step_cnt<6)				
			freq_step = (radio_band.bTuneStep*fast_step_cnt);
		else if(fast_step_cnt<12)				
			freq_step = (radio_band.bTuneStep*fast_step_cnt*5);
    	}
    	if(radio_band.bCurBand==MW_MODE){

		if(fast_step_cnt<6)				
			freq_step = (radio_band.bTuneStep*fast_step_cnt);
		else if(fast_step_cnt<12)				
			freq_step = (radio_band.bTuneStep*fast_step_cnt*5);
#ifdef MW_MODE_ADVANCED_TUNE_STEP
		else			
			freq_step = (radio_band.bTuneStep*fast_step_cnt*10);
#endif		
    	}		
	else{
		
		if(fast_step_cnt<6)				
			freq_step = (radio_band.bTuneStep*fast_step_cnt);
		else if(fast_step_cnt<12)				
			freq_step = (radio_band.bTuneStep*fast_step_cnt*10);
		else
			freq_step = (radio_band.bTuneStep*fast_step_cnt*20);
	}
#if 0
	if(fast_step_cnt>3){
		am_adj_timer=2;
	}
#endif

#elif defined(MID_SPEED_STICK_TUNE_FUNC)

	 if(fast_step_cnt==0){
		fast_step_cnt=1;
	 }

    	if(radio_band.bCurBand==FM_MODE){

		if(fast_step_cnt<8)				
			freq_step = (radio_band.bTuneStep*fast_step_cnt);
		else if(fast_step_cnt<12)				
			freq_step = (radio_band.bTuneStep*fast_step_cnt*3);
    	}
    	if(radio_band.bCurBand==MW_MODE){

		if(fast_step_cnt<6)				
			freq_step = (radio_band.bTuneStep*fast_step_cnt);
		else if(fast_step_cnt<12)				
			freq_step = (radio_band.bTuneStep*fast_step_cnt*5);
		else			
			freq_step = (radio_band.bTuneStep*fast_step_cnt*8);
		
    	}
    	else{
		
		if(fast_step_cnt<6)				
			freq_step = (radio_band.bTuneStep*fast_step_cnt);
		else if(fast_step_cnt<12)				
			freq_step = (radio_band.bTuneStep*fast_step_cnt*5);		
		else		
			freq_step = (radio_band.bTuneStep*fast_step_cnt*8);
	}
		
#else
    	if(radio_band.bCurBand==FM_MODE){
		freq_step = (radio_band.bTuneStep);
	}
    	if(radio_band.bCurBand==MW_MODE){
		freq_step = (radio_band.bTuneStep);
	}
    	else{
		freq_step = (radio_band.bTuneStep);
	}		
#endif
	
    if (mode == RADIO_FRE_INC)
    {
        radio_band.wFreq=radio_band.wFreq+freq_step;
    }
    else if (mode == RADIO_FRE_DEC)
    {
        radio_band.wFreq=radio_band.wFreq-freq_step;
    }
	
    if (radio_band.wFreq > radio_band.wFreqUpLimit)
        radio_band.wFreq = radio_band.wFreqUpLimit;
	
    if (radio_band.wFreq < radio_band.wFreqDownLimit)
        radio_band.wFreq =radio_band.wFreqDownLimit;

    if(radio_band.bCurBand==0){

#ifdef FM_SOFTMUTE
		KT_FM_SOFTMUTE(radio_band.wFreq);
#else
		KT_FMTune(radio_band.wFreq);
#endif

    }
    else{

#ifdef AM_SOFTMUTE
		KT_AM_SOFTMUTE(radio_band.wFreq);
#else
		KT_AMTune(radio_band.wFreq);
#endif

    }
	
    disp_port(MENU_RADIO_MAIN);			

#ifdef SAVE_BAND_FREQ_INFO	
    save_radio_freq(radio_band.wFreq,radio_band.bCurBand);
#endif
    flush_all_msg();
#ifdef SEMI_AUTO_SCAN_FUNC
    if(scan_mode!=RADIO_SCAN_STOP){
		radio_all_scan_stop();
    }
#endif
	
}