void main(void)
{

    amp_mute(1);
    clock_in = T0CNT;									//输入时钟,define in clock.h

    sys_init();
    power_key_hdlr(SYS_PWR_ON);
    AMUX_P2IE_SET(AMUX0_IE&AMUX1_IE);
    sys_info_init();
    clear_all_event();
    flush_all_msg();
	
    enter_fm_rev();

    PT2313_Init();
	
    work_mode=RTC_MODE;
#ifdef IR_DEBUG
	IR_Debug_func();
#endif

    while (1)
    {
        switch (work_mode)
        {
        case MUSIC_MODE:
            music_decode();
            break;
#if USB_DEVICE_ENABLE
        case USB_DEVICE_MODE:
            usb_audio_massstorage();
            break;
#endif     

#if 1//FM_MODULE                     
        case FM_RADIO_MODE:
            fm_radio();
            break;
#endif

        case AUX_MODE:
            aux_fun();
            break;

#if 1//RTC_ENABLE
        case RTC_MODE:
            rtc_fun();
            break;        
#endif
        case REC_MIC_MODE:
            rec_mic_fun();
            break;			
        case IDLE_MODE:
	     //power_key_hdlr(SYS_PWR_OFF);
            break;			

	     default:
            	work_mode = MUSIC_MODE;
            break;
        }
        write_info(MEM_SYSMODE ,work_mode);
    }
    //*/
}
Example #2
0
void main(void)
{

    amp_mute(1);
    clock_in = T0CNT;									//输入时钟,define in clock.h
  //  WDT_EN();
    sys_init();
    //power_key_hdlr(SYS_PWR_ON);
    flashled(LED_ON);

    AMUX_P2IE_SET(AMUX0_IE&AMUX1_IE);
    sys_info_init();
    clear_all_event();
    flush_all_msg();
    //work_mode=REC_MIC_MODE;
    ///*
    while (1)
    {
        switch (work_mode)
        {
        case MUSIC_MODE:
            music_decode();
            break;
#if USB_DEVICE_ENABLE
        case USB_DEVICE_MODE:
            usb_audio_massstorage();
            break;
#endif     

#if FM_MODULE                     
        case FM_RADIO_MODE:
            fm_radio();
            break;
#endif

#ifndef NOT_USE_LINE_IN_FUNC
        case AUX_MODE:
            aux_fun();
            break;
#endif


#if RTC_ENABLE
        case RTC_MODE:
            rtc_fun();
            break;        
#endif
        case REC_MIC_MODE:
            rec_mic_fun();
            break;			
		
        case IDLE_MODE:
#ifndef NO_IDLE_MODE_FUNC				
            idle_mode();			
#endif
	    // power_key_hdlr(SYS_PWR_OFF);
            break;			

	     default:
            	work_mode = MUSIC_MODE;
            break;
        }
        write_info(MEM_SYSMODE ,work_mode);
    }
    //*/
}
Example #3
0
/*----------------------------------------------------------------------------*/
void sys_info_init(void)
{
    delay_10ms(80);            	      //保证U盘/SD卡能有足够时间通过在线检测,稳定接入
    dac_init(); 
#if DEVICE_ENCRYPTION
    device_password_init(0x12345678);  //输入加密设备的密码
#endif 
#if ((USE_DEVICE == MEMORY_STYLE)&&(FAT_MEMORY))    
	get_info_memory();
	get_info();
#endif  

#if ((USE_RTC_EEPROM == MEMORY_STYLE))
	check_eeprom_status();
#endif

#if 1
	my_music_vol = read_info(MEM_VOL);
    	if ((my_music_vol > MAX_MAIN_VOL) || (my_music_vol == 0))              //每次开机时,不要超过最大音量的一半,以免开机音量过大
    	{
        	my_music_vol = 16;
    	}
#endif

#if VOLUME_DEFAULT
     	my_music_vol = VOLUME_DEFAULT;
#endif
       music_vol = my_music_vol;
   	set_max_vol(MAX_ANALOG_VOL, MAX_DIGITAL_VOL);
   	main_vol_set(my_music_vol, CHANGE_VOL_MEM);
	main_fade_en = 1;
#if 0	
#if OTP_MUSIC_ENABLE
    	decode_opt_music_file();
#endif
#if RTC_ENABLE
    if (work_mode != SYS_RTC)
#endif
    {
            usb_audio_massstorage();									//每次上电判断是否连接电脑
	}
#endif

#if 0
#ifdef USE_SYS_MODE_RECOVER
        work_mode = read_info(MEM_SYSMODE);
#ifdef UART_ENABLE
    	printf("------->- MEM_SYSMODE restored   work_mode:%d   \r\n",(u16)work_mode);
#endif
        if (work_mode > SYS_IDLE){
#ifdef USE_USB_SD_DECODE_FUNC	               	
		work_mode = SYS_MP3DECODE_USB;
#else
		work_mode = SYS_FMREV;
#endif
	}
#else
	work_mode = SYS_MCU_CD;
#endif

#endif
}
Example #4
0
void main(void)
{
#if defined(USE_LCD_DRV_HT1621)
    lcd_ht1621_init();
#endif
    work_mode = MUSIC_MODE;
    //amp_mute(1);
    clock_in = T0CNT;									//输入时钟,define in clock.h
    //WDT_EN();
    sys_init();
    AMUX_P2IE_SET(AMUX1_IE);
    sys_info_init();
    clear_all_event();
    flush_all_msg();
#ifndef LCD_BACK_LIGHT_DUMMY					
    set_brightness_all_on();
#endif
#if (DISP_VER!=0)
    if(ADKEY_PORT==0){

	disp_port(MENU_VER);
	delay_10ms(80);
    }
#endif	
    delay_10ms(10);
    ///*
    while (1)
    {
        switch (work_mode)
        {
        case MUSIC_MODE:
            music_decode();
            break;
#if USB_DEVICE_ENABLE
        case USB_DEVICE_MODE:
            usb_audio_massstorage();
            break;
#endif     

#if FM_MODULE                     
        case FM_RADIO_MODE:
            radio_main_hdlr();
            break;
#endif

#ifdef USE_BLUE_TOOTH_FUNC
	case BLUE_TOOTH_MODE:
		Blue_tooth_main();
		break;
#endif
        //case AUX_MODE:
            //aux_fun();
          //  break;

#if RTC_ENABLE
        //case RTC_MODE:
            //rtc_fun();
         //   break;        
#endif
        case REC_MIC_MODE:
            rec_mic_fun();
            break;
			
        case IDLE_MODE:
            idle_mode();	
	     sys_mute_flag =0;
	     dac_mute_control(0,1);					//调节音量时,自动UNMUTE
    	     //set_brightness_all_on();
            break;		
        default:
            work_mode = MUSIC_MODE;
            break;
        }
        //write_info(MEM_SYSMODE ,work_mode);
    }
    //*/
}