⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lin.c

📁 mega128+VS1003做的mp3的程序 可以用WINAVR编译
💻 C
字号:
#include <iom64v.h>
#include <macros.h>
#include <string.h>
#include <stdio.h>
#include "./lin.h"
#include <eeprom.h>
#include "../Keyboard/key.h"
#include <eeprom.h>

#define  uchar unsigned char
#define  uint  unsigned int

#define	 CONFIG_1 2047   //通道存储器地址
/*
*通道自动调节
*当有播放任务时自动切换MP3通道
*/
#define	SING_A 7
#define	SING_B 6
#define	SING_C 5
void adjust_cheng(uchar mp3) //当MP3不为0时为一个强制参数打开MP3通道
{
 uchar ii;
 DDRE  |= (1<<5)|(1<<6)|(1<<7);
 PORTE &= 0x1f;
 if(mp3 != 0) {PORTE |= 1<<SING_C; PORTF |= 1<<3; return;} 
 ii = EEPROMread(CONFIG_1);
 switch(ii){
 			case 0:
				  PORTE |= 1<<SING_C;	 		    //MP3
				  break;
			case 1:
				  PORTE |= (1<<SING_B)|(1<<SING_A); //话筒				  
				  break;
			case 2:
				  PORTE |= (1<<SING_B);				//收音机
				  break;
			case 3:
				  PORTE |= (1<<SING_A);				//CD机
				  break;	  	  	  
           }
 open_close(ii);//开启相应的电源设备		   
}

extern uchar keybuf;
void Line_in(void)
{
 	uchar ii;  
 	ii = EEPROMread(CONFIG_1);
	if(ii > 3) ii = 0;
	show_clear();
    show_lcd(0, 0, 192, 2, &lin_menu[0],0);
   	while(1){
			 	     show_lcd(3, 0, 80, 2, 	  &lin_in4[0],0);//MP3
					 show_lcd(3, 80+25, 80, 2, &lin_in1[0],0); //话筒输入  
 					 show_lcd(6, 0, 80, 2, 	  &lin_in2[0],0);//收音机  
 					 show_lcd(6, 80+25,80, 2, &lin_in3[0],0);//CD机 
 					  
					 switch(ii)
  					 {
   					 case 0: show_lcd(3, 0, 80, 2, &lin_in4[0],1);
   		   			 	  	 break;
   		   			 case 1: show_lcd(3, 80+25, 80, 2, &lin_in1[0],1);
   		   			 	  	 break;
   					 case 2: show_lcd(6, 0, 80, 2, &lin_in2[0],1);
   		   			 	  	 break;
   					 case 3: show_lcd(6, 80+25, 80, 2, &lin_in3[0], 1);
					 	     break;
  					 }
					 KEYBUF_NULL;
					 while(keybuf == NULL);
					 if(keybuf == K_DOWN){(++ii == 4) ? (ii = 0) : 0;}
					 if(keybuf == K_UP){(--ii == 255) ? (ii = 3) : 0;}
					 if(keybuf == K_LIFT){(++ii == 4) ? (ii = 0) : 0;}
					 if(keybuf == K_RIFT){(--ii == 255) ? (ii = 3) : 0;}
					 if(keybuf == K_ESC) break;
					 if(keybuf != K_ENTER) continue;
					 EEPROMwrite(CONFIG_1,ii);
					 adjust_cheng(0);
					 break;
					 	
		 }//while(1)
	 			
 }
 
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -