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

📄 t10a2_display.c

📁 AVR单片机基础程序实例! 十个程序源代码。
💻 C
📖 第 1 页 / 共 5 页
字号:
#include <iom64.h>
#include <inavr.h>
#include <ioavr.h>

#define uchar unsigned char
#define uint  unsigned int
#include "T10A2_flash_extern.H"
#include "T10A2_extern_data.H"
#include "Font.H"
#define XSmall		8
#define YSmall		10
#define XBig		12
#define YBig		16
#define XCha		12
#define YCha		16

void (*Current_Spect)(void);
void WriteCha(unsigned char,signed char,unsigned int);

extern void WriteMod(signed char x,signed char y,unsigned char __flash *content);
//extern void WriteASCII(enum SymbleMode mode,signed char x,signed char y,unsigned char z);


__flash unsigned char Language_Str[][10]=
{
	" 中 文 ",
	"English",
};

__flash unsigned char Volume_Str[][8]=
{
	"主音量",
	"左前置",
	"右前置",
	"左环绕",
	"右环绕",
	"中 置",
	"重低音",
	"主音量",
	" MVOL",
	"F L  ",
	"F R  ",
	"S L  ",
	"S R  ",
	"F C  ",
	"S W  ",
	"Volume",
};

__flash unsigned char Source_Str[][16]=
{
	"家庭影院",
	"家庭影院",
	"家庭影院",
	"家庭影院",
	"电视影院",
	"电视影院",
	"电视影院",
	"  U盘",
	"  U盘",
	"  U盘",
	"存储卡",
	"存储卡",
	"存储卡",
	
	"Home Theatre",
	"Home Theatre",
	"Home Theatre",
	"T V Theatre",
	"T V Theatre",
	"T V Theatre",
	"T V Theatre",
	"  USB",
	"  USB",
	"  USB",
	" CARD",
	" CARD",
	" CARD",

	"    光纤输入",
	"    同轴输入",
	"    5.1 输入",
	"    AUX 输入",
	"    同轴输入",
	"    5.1 输入",
	"    2.0 输入",
	"    电影输入",
	"    音乐输入",
	"    图片输入",
	"    电影输入",
	"    音乐输入",
	"    图片输入",
	
	"Optical Input",
	"Coaxial Input",
	"  5.1 Input",
	"  AUX Input",
	"Coaxial Input",
	"  5.1 Input",
	"  2.0 Input",
	"Movie Input",
	"Music Input",
	"Picture Input",
	"Movie Input",
	"Music Input",
	"Picture Input",
};

__flash unsigned char TheaterMode_Str[][16]=
{
	"   综合",
	"   新闻",
	"   音乐",
	"   体育",
	"   电影",
	"   标准",
	"   综合",
	"   娱乐",
	"   音乐",
	"   恐怖",
	"   枪战",
	"   标准",
	" 综合.单声道",
	" 新闻.单声道",
	" 音乐.单声道",
	" 体育.单声道",
	" 电影.单声道",
	" 标准.单声道",	
	" General",
	"   News",
	"  Music",
	"  Sport",
	"  Movie",
	" Standard",
	" General",
	"   Fun",
	"  Music",
	"  Terror",
	"  Fight",
	" Standard",
	"General.M",
	"  News.M",
	" Music.M",
	" Sport.M",
	" Movie.M",
	"Standard.M",
};

__flash unsigned char OkModeType_Str[][10]=
{
	"  通 俗",
	"  美 声",
	"  民 俗",
	"  歌 剧",
	"  演 讲",
	" 用户设定",
	"   POP",
	"Classical",
	"  Folk",
	" Opeatic",
	" Lecture",
	"User Set",
};

__flash unsigned char OkModeSet_Str[][16]=
{
	"话筒音量1",
	"话筒音量2",
	"混响深度",
	"混响延时",
	"话筒高音",
	"话筒低音",
	"MIC Volume1",
	"MIC Volume2",
	"Echo Depth",
	"Echo Delay",
	"MIC Bass",
	"MIC Treble",
};

__flash unsigned char Detect_Str[][10]=
{
	"检测到",
	"Detect",
};

__flash unsigned char MIC_Str[][19]=
{
	"  话筒拔出",
	"  话筒插入",	
	"   请插入话筒",
	"MIC Pullout",
	"MIC Insert",
	"Pls Insert MIC",
};

__flash unsigned char MultiMedia_Str[][19]=
{
	" USB 插入",
	" USB 拔出",	
	" CARD 插入",
	" CARD 拔出",
	"USB Insert",
	"USB Pullout",
	"CARD Insert",
	"CARD Pullout",
};

__flash unsigned char Theater_Str[][8]=
{
	"家 庭",
	"电 视",
	"Home",
	"T V",
	"影 院",
};

__flash unsigned char Bass_Treble_Str[][10]=
{
	"音调低音",
	"音调高音",
	" BASS",
	"TREBLE",
};

__flash unsigned char Stream_Str[][10]=
{
	"AC-3",
	"DTS",
	"PCM",
	"HDCD",
};

__flash unsigned char Mplayer_Str[][16]=
{
	"请插入",
	"存储卡或U盘",
	"Please Insert",
	"CARD or USB",
};

__flash unsigned char AI_Str[][10]=
{
	" AI 开启",
	" AI 关闭",
	"AI Open",
	"AI Close",
};

__flash unsigned char EarPhone_Str[][16]=
{
	"无线耳机",
	"无线环绕",
	"W-HeadPhone",
	"W-Surround",
};

__flash unsigned char Protect_Str[][16]=
{
	"  温度保护",
	"  直流保护",
	"  短路保护",
	"Tmp Protect",
	"DC Protect",
	"Sht Protect",
};

__flash unsigned char AutoFit_Str[][18]=
{
	" 环境自适应 开启",
	" 环境自适应 关闭",
	"AutoFit Open",
	"AutoFit Close",
};

__flash unsigned char Speaker_Str[][20]=
{
	"2/3 喇叭设置",
	"全小 喇叭设置",
	"2/3 Speaker",
	"Small Speaker",
};

__flash unsigned char OutPut_Str[][16]=
{
	"多声道 输出",
	"高保真 输出",	
	"立体声 输出",	
	"Multi Channel",
	"HI-FI",
	"Stereo",
};

__flash unsigned char PowerOff_Str[][16]=
{
	"正在关机中",
	"保存设置",
	"Power Off",
	"  Save",
};

__flash unsigned char Frequency_Str[][16]=
{
	"    频谱",
	"Spectrum",
};

__flash unsigned char Invalid_Str[][16]=
{
	"操作无效",
	"Invalid",
};

__flash unsigned char Bass_TreblePic_Tab[][2]=
{
	4,25,
	10,18,
	18,13,
	26,8,
	34,5,
	42,3,
	50,2,
	58,1,
	66,2,
	74,3,
	82,5,
	90,8,
	98,13,
	106,18,
	112,25,
};


/*****************************************************************************************/
void write_yigezi_display(uchar temp,uchar temp1)//一个字
{}
void write_data_display(uchar i,uchar temp,uchar __flash *ps)//送不定长字给显示暂存器
{}
void write_data_display_1(uchar i,uchar temp,uchar *ps)//
{}
void display_slow_side_open(void)//慢显,往上下开屏
{}
void display_slow_right_open(void)//慢显,往右开屏
{}
/*****************************************************************************************/

enum SymbleMode{big,small};

void WriteSec(enum SymbleMode mode,unsigned char x,signed char y,unsigned char *content)
{
    int hz;
    if(mode==big)
    {
    	while(*content!=0)
	    {
    	    if(*content>=' ')
        	{
            	if(*content<='~')		//ASCII字符
	            {
	            	x-=XBig;
    	            WriteMod(x,y-(YCha-YBig),ASC_Big_Tab[*content-' ']);
        	    }
            	else					//汉字
	            {
    	            if(*(content+1)<128)
        	        {
        	        	x-=XBig;
            	        WriteMod(x,y-(YCha-YBig),ASC_Big_Tab[0x7f-' ']);
	                }
    	            else
        	        {
                    	x-=XCha;
            	        hz=*(content++)<<8;
                	    hz+=*(content);
                    	WriteCha(x,y,hz);
	                }
    	        }
            	content++;
        	}
    	}
    }
    else
    {
    	while(*content!=0)
	    {
    	    if(*content>=' ')
        	{
            	if(*content<='~')		//ASCII字符
	            {
					x-=XSmall;
    	            WriteMod(x,y+2,ASC_Small_Tab[*content-' ']);					
        	    }
            	else					//汉字
	            {
    	            if(*(content+1)<128)
        	        {
        	        	x-=XSmall;
            	        WriteMod(x,y+2,ASC_Small_Tab[0x7f-' ']);						
	                }
    	            else
        	        {
                    	x-=XCha;
            	        hz=*(content++)<<8;
                	    hz+=*(content);
                    	WriteCha(x,y,hz);
	                }
    	          }
            	content++;
        	}
    	}
    }
}


void WriteCha(unsigned char x,signed char y,unsigned int z)
{
    unsigned char wp,max,min;
    unsigned char p;
    wp=sizeof(CharactorPoint)>>3;
    max=sizeof(CharactorPoint)>>2;
    min=0;
    while(1)
    {
        if(CharactorPoint[wp][0]==z)
        {
            p=CharactorPoint[wp][1];
            WriteMod(x,y,CharactorMod[p]);
            break;
        }
        else
        {
            if(CharactorPoint[wp][0]>z)
            {
                max=wp;
                wp=(max+min)>>1;
            }
            else
            {
                if(CharactorPoint[wp][0]<z)
                {
                    if(max==(min+1))
                    {
                        WriteMod(x,y+(YCha-YBig),ASC_Big_Tab[0x7f-' ']);
                        break;
                    }
                    else
                    {
                        min=wp;
                        wp=(max+min)>>1;
                    }
                }
            }
        }
    }

}


enum RectangleShape{hard,soft,halfsoft};

void DrawRectangle(uchar x1,uchar y1,uchar x2,uchar y2,enum RectangleShape shape)
{
	unsigned char comp;
	if(x1>x2)
	{
		x1=x1^x2;
		x2=x1^x2;
		x1=x1^x2;
	}
	if(y1>y2)
	{
		y1=y1^y2;
		y2=y1^y2;
		y1=y1^y2;
	}
	comp=x2-x1;
	if(comp<5 && shape==soft)
	{
		shape=halfsoft;
	}
	if(comp<3)
	{
		shape=hard;
	}
	comp=y2-y1;
	if(comp<5 && shape==soft)
	{
		shape=halfsoft;
	}
	if(comp<3)
	{
		shape=hard;
	}
	
	switch(shape)
	{
		case hard:
			VFD_PlumbLine(x1,y1,y2,1);
			VFD_PlaneLine(x1,x2,y1,1);
			VFD_PlumbLine(x2,y1,y2,1);
			VFD_PlaneLine(x1,x2,y2,1);
			break;
		case soft:
			VFD_PlumbLine(x1,y1+2,y2-2,1);
			VFD_PlaneLine(x1+2,x2-2,y1,1);
			VFD_PlumbLine(x2,y1+2,y2-2,1);
			VFD_PlaneLine(x1+2,x2-2,y2,1);
			VFD_Point(x1+1,y1+1,1);
			VFD_Point(x1+1,y2-1,1);
			VFD_Point(x2-1,y1+1,1);
			VFD_Point(x2-1,y2-1,1);
			break;
		case halfsoft:
			VFD_PlumbLine(x1,y1+1,y2-1,1);
			VFD_PlaneLine(x1+1,x2-1,y1,1);
			VFD_PlumbLine(x2,y1+1,y2-1,1);
			VFD_PlaneLine(x1+1,x2-1,y2,1);
	}
}


void WriteASCII(enum SymbleMode mode,signed char x,signed char y,unsigned char z)
{	
	if(mode==big)
	{
		WriteMod(x,y,ASC_Big_Tab[z-32]);
	}
	else
	{
		WriteMod(x,y,ASC_Small_Tab[z-32]);
	}
}


void WriteMod(signed char x,signed char y,unsigned char __flash *content)
{
	unsigned char Cache[8];
	unsigned char lx,ly,lpx,lpy,*Pd,shft,lps,ini_lps,ini_y;
	lx=*content;
	content++;
	ly=*content;
	content++;
	if(x&128)
	{
		x>>=1;
		x|=128;
		content+=(unsigned char)(0-x)*ly;
		lx=lx+x;
		if(lx&128)
		{
			lx=0;
		}
		x=0;
	}
	else
	{
		x>>=1;
		if(x+lx>62) 		  //尾列、头列要特殊处理
		{
			lx=63-x;
		}
	}
	if(y&128)
	{
		shft=y&3;
	   y=(y>>2)|192;
		ini_y=0-y;
		y=0;
	}
	else
	{
		shft=y&3;
		y>>=2;
		ini_y=0;
	}

	if(1)
	{
		for(lpx=0;lpx<lx;lpx++)
		{
			for(lpy=0;lpy<ly;lpy++)
			{
				Cache[lpy]=*content;
				if(lpy+y>7)
				{
					content+=ly+y-8;
					break;
				}
				content++;
			}
			if(lpy!=8)
			{
				Cache[lpy]=0;
			}
			ini_lps=lpy;
			for(lpy=0;lpy<shft;lpy++)
			{
				for(lps=ini_lps;lps!=0;lps--)
				{
					Cache[lps]>>=2;
					Cache[lps] |= (Cache[lps-1])*64;
				}
				Cache[0]>>=2;
			}
			Pd=Display_Buffer[x+lpx]+y-ini_y;
			if(shft==0)
			{
				lpy=0;
			}
			else
			{
				if(ini_y)
				{
					lpy=1;
				}
				else
				{
					lpy=1;
					*Pd &= ~(0xff>>(shft*2));
					*Pd  |= Cache[0];
				}
				if(ly+y<=7)
				{
					*(Pd+ly) &= (0xff>>(shft*2));
					*(Pd+ly) |= Cache[ly];
				}
				Pd++;
			}
			
			for(;lpy<ly;lpy++)
			{
				if(lpy+y>7)
				{
					break;
				}
				if(lpy>=ini_y)
				{
					*Pd=Cache[lpy];
				}
				Pd++;
			}
			
			
		}
		
	}
}

void VFD_Display(void)
{		
	extern void (*SpectrumTable[5])();	
	

⌨️ 快捷键说明

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