Exemplo n.º 1
0
//------------------------------------------------
// 程序使用例子
//-------------------------------------------------
void LCD_Show_CN_Char(unsigned short x0,unsigned short y0,unsigned char *pCN)
{
   unsigned char  temp,t;
   unsigned char  DotData[32];//存储汉字的点阵数据。
   unsigned char  count;

	GT_Read_nByte(DotData,GB2312_Add(pCN),32);

    //显示上半区
    TFT_SetWindow(x0,y0,x0+15,y0+7);
	TFT_SetCursor(x0,y0);
	temp=0x01;
	for(t=0;t<8;t++)
	{ 	
		for(count=0;count<16;count++)
		{      
		   if(DotData[count]&temp) TFT_WriteRAM(FONT_color);//字体颜色
		   else  TFT_WriteRAM(Back_color);//背景色       
		}
		temp<<=1;
	 }
    //显示下半区 	
	TFT_SetWindow(x0,y0+8,x0+15,y0+15);
	TFT_SetCursor(x0,y0+8);
	temp=0x01;
	for(t=0;t<8;t++)
	{ 	
		for(count=16;count<32;count++)
		{      
		   if(DotData[count]&temp) TFT_WriteRAM(FONT_color);//字体颜色
		   else  TFT_WriteRAM(Back_color);//背景色       
		}
		temp<<=1;
	 }
}
Exemplo n.º 2
0
void GUI_WriteASCII(uint x, uint y, uchar *p, uint wordColor, uint backColor)
{
	uchar j, wordByte,wordNum;
	uint color;
	while(*p != '\0')
	{
		wordNum = *p - 32;
		TFT_SetWindow(x,y,x+15, y+23);
		for (wordByte=0; wordByte<48; wordByte++)
		{
			color = ASCII16x24[wordNum][wordByte];
			for (j=0; j<8; j++) 
			{
				if ((color&0x80) == 0x80)
				{
					TFT_WriteData(wordColor);
				} 						
				else
				{
					TFT_WriteData(backColor);
				} 	
				color <<= 1;
			}
		}
		p++;
		x +=14;
	}
}
Exemplo n.º 3
0
void GUI_Write14CnChar(uint x,uint y,uchar *cn,uint wordColor,uint backColor)	 
{  
	uchar i, j, wordNum;
	uint color;
	while (*cn != '\0')
	{
		TFT_SetWindow(x, y, x+23, y+18);
		for (wordNum=0; wordNum<20; wordNum++)
		{	//wordNum扫描字库的字数
			if ((CnChar19x24[wordNum].Index[0]==*cn)
			     &&(CnChar19x24[wordNum].Index[1]==*(cn+1)))
			{
				for(i=0; i<57; i++) 
				{	//MSK的位数
					color=CnChar19x24[wordNum].Msk[i];
					for(j=0;j<8;j++) 
					{
						if((color&0x80)==0x80)
						{
							TFT_WriteData(wordColor);
						} 						
						else
						{
							TFT_WriteData(backColor);
						} 
						color<<=1;
					}//for(j=0;j<8;j++)结束
				}    
			}
		} //for (wordNum=0; wordNum<20; wordNum++)结束 	
		cn += 2;
		x += 24;
	}
}
Exemplo n.º 4
0
void GUI_Dot(uint x, uint y, uint color)
{  
	uchar i;

	TFT_SetWindow(x-1, y, x+2, y+2);  //单个像素

	for(i=0; i<16; i++)
	{
		TFT_WriteData(color);
	}
}
Exemplo n.º 5
0
void GUI_ShowPicture(uint x, uint y, uchar wide, uint high)
{
	uint temp = 0, tmp = 0, num = 0;
	TFT_SetWindow(x, y, x+wide-1, y+high-1);
	num = wide * high * 2;
	do
	{  
		temp = pic[tmp + 1];
		temp = temp << 8;
		temp = temp | pic[tmp];
		TFT_WriteData(temp);//逐点显示
		tmp += 2;
	}
	while(tmp < num);	
}
Exemplo n.º 6
0
u8 GUI_Writeu16(uint x, uint y, u16 temp, uint wordColor, uint backColor)
{
	uchar i,j,i1=0, wordByte,wordNum;
	static uint color;
	static u8 wordNuma[6];
	u8 plus=0;
	wordNuma[0]=temp/10000;
	temp=temp%10000;
	wordNuma[1]=temp/1000;
	temp=temp%1000;
	wordNuma[2]=temp/100;
	temp=temp%100;
	wordNuma[3]=temp/10;
	wordNuma[4]=temp%10;
		while(wordNuma[i1]==0){i1++;}
    if(i1==5)i1=4;
	
    GUI_WriteASCII( x, y, "     ", 0xf800, 0x0000);
	for(i=i1;i<5;i++) 
	{
		wordNum = wordNuma[i] + 16;
		TFT_SetWindow(x,y,x+15, y+23);
		for (wordByte=0; wordByte<48; wordByte++)
		{
			color = ASCII16x24[wordNum][wordByte];
			for (j=0; j<8; j++) 
			{
				if ((color&0x80) == 0x80)
				{
					TFT_WriteData(wordColor);
				} 						
				else
				{
					TFT_WriteData(backColor);
				} 	
				color <<= 1;
			}
		}
		x +=14;
		plus++;
	}
	return  plus;
}