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

📄 ztype.h

📁 &#8226 控制器(CPU): Atmel AT90S8515 AVR &#8226 MP3解码器: STA013 &#8226 音频 DAC: CS4334 &#8226 IDE 接口
💻 H
字号:
#ifndef __ZTYPE_H__
#define __ZTYPE_H__

typedef unsigned char 		byte;
typedef unsigned int 		word;
typedef unsigned long int 	dword;



#define false			0;
#define true 			1;
#define playModeMask		1; //# of avialable play modes 0, 1
#define soundModeMask		7; //# of available sound modes 0, 1, 2, 3, 4, 5, 6, 7


								
        dword		filePos=0;	//holds offset of file read.        				
        				
//        byte		sectorPos=0;	//# of sectors read for a file, reset to 0 when reaches cluster size
					
	byte		play;		//When set, Player will stop playing.
	byte		intFlag=0;	//Set 1, after Interrupt Routine executed.
	byte		playMode=0;	//Playback mode, cycles through cont, random, repeat, program.
	word		totalFiles=0;	//Total number of files in drive.
	
	byte		mp3Pos=0;	//MP3 send pos. Reset to 0 when reaches 256 (reaches the sectorBuffer size)
	
	
	byte 		clusterBufferReadPos; //Current read pos of circular cluster buffer
	byte		clusterBufferWritePos;//Current write pos of circular cluster buffer
	byte		headMoved;	      //when set head was moved for current read.	
	
	//Bass and FF
//	byte		bass=0;	      	      //sets bass
//	byte		treble=0;	      //sets treble
	byte		soundMode=0;

	byte		key;		//input keys for control

//eeprom dword		HDSerialNumber=0;	

//eeprom byte  		attenuation=10;       //Sound attenuation factor
//eeprom byte  		bassFreq[2]={100,0}; // data for lower, upper register of Bass Enhance
//eeprom byte  		bassEnhance=0x0C;    // Set at 
//eeprom byte  		trebleFreq[2]={0x58,0x1B}; // data for lower, upper registre of Treble Enhance
//eeprom byte  		trebleEnhance=0x06;
eeprom byte		dash[3]={' ','-',' '};   //String " - ". Used for printing - in ID3 tag Signer - Title
 
					        //0x77	0x78	0x79	0x7A	0x7B	0x7C     
//eeprom byte	lcdSetup[4]={0x28,1,0x0C,0x40};
eeprom byte	lcdLineStart[4]={0,0x40,0x14,0x54}; //Supports 4 line, current setting for 20*4	    

eeprom byte	soundCg[32] = { //Different sound mode bar graph characters.
				0b00000000,
				0b00000000,
				0b00000000,
				0b00000000,       
				0b00000000,
				0b00001110,
				0b00011111,
				0b00011111,
				
				0b00000000,
				0b00000000,
				0b00000000,
				0b00001110,
				0b00011111,
				0b00011111,
				0b00011111,
				0b00011111,
				
				0b00000000,
				0b00001110,
				0b00011111,
				0b00011111,
				0b00011111,
				0b00011111,
				0b00011111,
				0b00011111,
				
				0b00001110,
				0b00011111,
				0b00011111,
				0b00011111,
				0b00011111,
				0b00011111,
				0b00011111,
				0b00011111																																																																																																
                                          			
};                                        


eeprom byte	cg[64]= {       //Characters for CGRAM of LCD
				//Lefttop, righttop, leftbottom, rightbottom are for
				//boot up display. These 4 are overwritten with soundCg array
				//after bootup.
				0b00000000,
				0b00000000,
				0b00001111,
				0b00001000,       //lefttop 
				0b00001011,
				0b00001010,
				0b00001010,
				0b00001010,



			 
				0b00000000,
				0b00000000,
				0b00011110,
				0b00000010,       //righttop
				0b00011010,
				0b00001010,
				0b00001010,
				0b00001010,


				0b00001010,
				0b00001010,
				0b00001011,
				0b00001000,       //leftbottom
				0b00001111,
				0b00000000,
				0b00000000,
				0b00000000,


				0b00001010,
				0b00001010,
				0b00011010,       //rightbottom
				0b00000010,
				0b00011110,
				0b00000000,
				0b00000000,
				0b00000000,

				0b00001000,
				0b00001100,
				0b00001110,       //Play character
				0b00001111,
				0b00001110,
				0b00001100,
				0b00001000,
				0b00000000,


				0b00011011,
				0b00011011,
				0b00011011,       //Pause character
				0b00011011,
				0b00011011,
				0b00011011,
				0b00011011,
				0b00000000,


				0b00000000,
				0b00010001,
				0b00001110,       //Bass Boost. Not used in version 2.x
				0b00001010,
				0b00001110,
				0b00010001,
				0b00000000,
				0b00000000,
				

				0b00001110,
				0b00010001,
				0b00010000,       //Repeat
				0b00010100,
				0b00010010,
				0b00001111,
				0b00000010,
				0b00000100

			 };
			 
//Following is file name invalid characters table. Invalid chars are defined by MS. File is 
//disregarded if one of these characters are found in name. Used in getDirEntry function
eeprom	byte invalidFileChars[47] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x06,
				      0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
				      0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12,
				      0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
				      0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
				      0x1F, 0x22, 0x2A, 0x2B, 0x2C, 0x2E, 
				      0x2F, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 
				      0x3F, 0x5B, 0x5C, 0x5D, 0x7C };
				      
//Long file name byte offset table. It is used to select 13 characters of file name
//in each Long File Entry of directory table. Each entry in LFN is word wide, but 
//we look in low byte only for ASCII char. This table is used in getDirEntry function                        
//				  PART1        PART2             PART3
eeprom byte longNameOffset[13] = {1,3,5,7,9,  14,16,18,20,22,24,  28,30};

//Character table for displaying play mode on LCD
eeprom byte PlayModeDisplayStrTable[4,4]={'-','-',0x7E,0,  //prints -->
					  0x7E,'R',0x7F,0, //prints >R<
					  'R','E','P',0,
					  'D','I','R',0};   

//ERROR Strings
eeprom byte ErrStr[8,21] = { 	{"Error Detecteded :-("},
				{"Sector Read Error!"},
				{"Sector Write Error!"},
				{"FAT16 Not Supported!"},
				{"Missing SYS or CFG!"},
				{"Missing STA013.BIN!"},
				{"STA013 Not Found!"},
				{"STA013 Load Failed!"}
                           };


//This 8x4 array stores CGRAM char value to be displayed for corresponding soundMode value
//It is organized in order of BassTrebleTable
eeprom byte		SoundModeDisplay[8,4] = {
						 1,1,1,1, //Normal
						 3,1,1,3, //HiBs, HiTrbl
						 1,2,2,1, //Hi vocal
						 1,0,0,1, //LowBs, LowTrbl, LowVocal
						 3,2,1,0, //HiBs, LowTrbl
						 0,1,2,3, //HiTrbl, LowBs
						 0,1,3,1, //HiMidTrbl, lowMidBs
						 1,3,1,0  //HiMidBs, LowMidTrbl
						};


//This 8x6 array stores STA013 addresses for bass treble configruation for different sound modes.
eeprom byte		BassTrebleTable[8,6]= { //TRLow	TRHigh	BSLow	BSHigh	TEhnc	BSEnhc         
					          0x40, 0x1F,	70,	0,	0x00,	0x00,  //Normal
					          0x58,	0x1B,	100,	0,	0x06,	0x0C, //HiBS, HiTrbl
					          0xE8, 0x03,	0x58,	0x02,	0x06,	0x09, //HiVocal
					          0x58, 0x1B,	100,	0,	0xF7,	0xF7, //LowBS, LowTrbl, LowVocal
					          0x58, 0x1B,   70,     0,      0xF7,   0x0C, //HiBs, LowTrbl
					          0x58, 0x1B,   70,     0,      0x06,   0xF7, //LowBs, HiTrbl
					          0xE8, 0x03,   0x58,   0x02,   0x06,   0xF7, //LowMidBS, HiMidTrbl
					          0xE8, 0x03,   0x58,   0x02,   0xF7,   0x06 //HiMidBS, LowMidTrbl
					      }; 
					      

eeprom byte		advance=1;	      //advance used for quick jumps		
#endif

⌨️ 快捷键说明

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