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

📄 color_lcd_test.c

📁 S3C2410平台下的LCD固件程序
💻 C
📖 第 1 页 / 共 2 页
字号:
					{
						xx = x0 + x + ch * 8;
						yy = y + y0;
						PutPixel( xx, yy, (UINT16T)ForeColor);
					}
			    }
            }
	    	i++;
	    	ch++;
		}
	}
}	

#ifdef Hzk12
//*****************************************************************
//** 函数名:void Lcd_DspHz12(UINT16T x0, UINT16T y0, UINT8T ForeColor, UINT8T *s)
//** 输 入: x0--字符串的左上角x坐标
//		   y0--字符串的坐上角y坐标
//**          ForeColor--填充的颜色
//		   s--字符串数组指针
//** 输 出: Null
//** 功能描述:显示12x12汉字字符串
//** 全局变量:Null
//*****************************************************************
void Lcd_DspHz12(UINT16T x0, UINT16T y0, UINT16T ForeColor, UINT8T *s)
{
	INT16T i,j,k,x,y,xx;
	UINT8T qm,wm;
	INT32T ulOffset;
	INT8T hzbuf[24],temp[2];

    	for(i = 0; i < strlen((const char*)s); i++)
    	{
    		if( (UINT8T)*(s + i) < 161 )
    		{
    	    		/* AscII char */
    			temp[0] = *(s + i); 
    			temp[1] = '\0';    		
    			break;
    		}
    		else
    		{
    	    		/* HanZi */
    			qm = *(s + i) - 161;
    			wm = *(s + i + 1) - 161;
    			ulOffset = (INT32T)(qm * 94 + wm) * 24;

            		for (j = 0; j < 24; j ++)
            		{
            			hzbuf[j] = g_auc_HZK12[ulOffset + j];
             		}
             		 
    			/* Get the HZ ZiMo By X */
    			for(y = 0; y < 12; y++)
    			{
    				for(x = 0; x < 16; x++)
    				{
    			   		if(x < 12)
    			   		{
    			   	 		k = x % 8;    			   	 		
						if (hzbuf[y * 2 + x / 8]  & (0x80 >> k))
						{
	    			   	 		xx = x0 + x + i * 6;
					     		PutPixel( xx, y + y0, ForeColor);			       	
						}
    			   		}
    				}
    			} 
    			/* One HZ Ocupy 2 bytes, So i++ */
    			i++;    		
    		}
    	}
}
#endif
#ifdef Hzk16
//*****************************************************************
//** 函数名:void Lcd_DspHz16(UINT16T x0, UINT16T y0, UINT8T ForeColor, UINT8T *s)
//** 输 入: x0--字符串的左上角x坐标
//		   y0--字符串的坐上角y坐标
//**          ForeColor--填充的颜色
//		   s--字符串数组指针
//** 输 出: Null
//** 功能描述:显示16x16汉字字符串
//** 全局变量:Null
//*****************************************************************
void Lcd_DspHz16(UINT16T x0, UINT16T y0, UINT16T ForeColor, UINT8T *s)
{
	INT16T i,j,k,x,y,xx;
	UINT8T qm,wm;
	INT32T ulOffset;
	INT8T hzbuf[32],temp[2];

	for(i = 0; i < strlen((const char*)s); i++)
	{
		if(((UINT8T)(*(s+i))) < 161)
		{
			temp[0] = *(s+i);
			temp[1] = '\0';
			break;
		}
		else
		{
			qm = *(s+i) - 161;
	    		wm = *(s + i + 1) - 161;
            		ulOffset = (INT32T)(qm * 94 + wm) * 32;
            		for (j = 0; j < 32; j ++)
            		{
            			hzbuf[j] = g_auc_HZK16[ulOffset + j];
             		}
            		for(y = 0; y < 16; y++)
            		{
	               		for(x = 0; x < 16; x++) 
	               		{
                   			k = x % 8;
				       	if (hzbuf[y * 2 + x / 8]  & (0x80 >> k))
				       	{
				       		xx = x0 + x + i * 8;
				       		PutPixel( xx, y + y0, (UINT16T)ForeColor);
				       	}
			   	}
            		}
		    	i++;
         	}
     	}     	
}
#endif
#ifdef Hzk24
//*****************************************************************
//** 函数名:void Lcd_DspHz24(UINT16T x0, UINT16T y0, UINT8T ForeColor, UINT8T *s)
//** 输 入: x0--字符串的左上角x坐标
//		   y0--字符串的坐上角y坐标
//**          ForeColor--填充的颜色
//		   s--字符串数组指针
//** 输 出: Null
//** 功能描述:显示24x24汉字字符串
//** 全局变量:Null
//*****************************************************************
void Lcd_DspHz24(UINT16T x0, UINT16T y0, UINT16T ForeColor, UINT8T *s)
{
	INT16T i,j,k,x,y,xx;
	UINT8T qm,wm;
	INT32T ulOffset;
	INT8T hzbuf[72],temp[2];

	for(i = 0; i < strlen((const char*)s); i++)
	{
		if(((UINT8T)(*(s+i))) < 161)
		{
			temp[0] = *(s+i);
			temp[1] = '\0';
			break;
		}
		else
		{
			qm = *(s+i) - 176;//161;
	    		wm = *(s+i + 1) - 161;
            		ulOffset = (INT32T)(qm * 94 + wm) * 72;
            		for (j = 0; j < 72; j ++)
            		{
            			hzbuf[j] = g_auc_hzk24[ulOffset + j];
             		}
            		for(y = 0; y < 24; y++)
            		{
	               	for(x = 0; x < 24; x++) 
	               	{
           				k = x % 8;
			       	if (hzbuf[y * 3 + x / 8]  & (0x80 >> k))
			       	{
			       		xx = x0 + x + i*12;
			       		PutPixel( xx, y + y0, (UINT16T)ForeColor);
			       	}
			       }
            		}
            	/*	for(x=0;x<24;x++)
            		{
            			for(y=0;y<24;y++)
            			{
   					k = y%8;
    					if( hzbuf[x*3+y/8] & (0x80 >> k) )
    					{
    						xx = x0+x+i*8;
    						PutPixel(xx,y+y0,(UINT8T)ForeColor);
    					}
            			}
            		}*/
		    	i++;
         	}
     	}     	
}
#endif
#ifdef Ascii6x8
//*****************************************************************
//** 函数名:void Lcd_DspAscII6x8(UINT16T usX0, UINT16T usY0,UINT8T ForeColor, UINT8T* pucChar)
//** 输 入: usX0--字符串的左上角x坐标
//		    usY0--字符串的坐上角y坐标
//**        ForeColor--填充的颜色
//		    pucChar--字符串数组指针
//** 输 出: Null
//** 功能描述:显示6x8英文字符串
//** 全局变量:Null
//*****************************************************************
void Lcd_DspAscII6x8(UINT16T usX0, UINT16T usY0,UINT16T ForeColor, UINT8T* pucChar)
{
	INT32T i, j;
	UINT8T ucTemp;

	while (*pucChar != 0)
	{
		for (i=0; i < 8; i++)
		{
  			ucTemp = g_auc_Ascii6x8[(*pucChar) * 8 + i];
  			for (j = 0; j < 8; j++)
  			{
  				if ((ucTemp & (0x80 >> j)) != 0)
  				{
  					PutPixel(usX0 + i, usY0 + 8 - j, (UINT16T)ForeColor);
  				}  				
  			}
		}
		usX0 += XWIDTH;
		pucChar++;
	}
}
#endif
#ifdef Ascii8x16
//*****************************************************************
//** 函数名:void Lcd_DspAscII8X16(UINT16T x0, UINT16T y0, UINT8T ForeColor, UINT8T * s)
//** 输 入: x0--字符串的左上角x坐标
//		    y0--字符串的坐上角y坐标
//**        ForeColor--填充的颜色
//		    s--字符串数组指针
//** 输 出: Null
//** 功能描述:显示8x16英文字符串
//** 全局变量:Null
//*****************************************************************
void Lcd_DspAscII8X16(UINT16T x0, UINT16T y0, UINT16T ForeColor, UINT8T * s)
{
	INT16T i,j,k,x,y,xx;
	UINT8T qm;
	INT32T ulOffset;
	INT8T ywbuf[16],temp[2];
    
	for(i = 0; i < strlen((const char*)s); i++)
	{
		if((UINT8T)*(s+i) >= 161)
		{
			temp[0] = *(s + i);
			temp[1] = '\0';
			return;
		}
		else
		{
			qm = *(s+i);
            		ulOffset = (INT32T)(qm) * 16;		//Here to be changed tomorrow
            		for (j = 0; j < 16; j ++)
            		{
            			ywbuf[j] = g_auc_Ascii8x16[ulOffset + j];
            		}

            		for(y = 0; y < 16; y++)
            		{
               		for(x = 0; x < 8; x++) 
               		{
                   			k = x % 8;
			       	if (ywbuf[y]  & (0x80 >> k))
			       	{
			       		xx = x0 + x + i*8;
			       		PutPixel( xx, y + y0, (UINT16T)ForeColor);
			       	}
			   	}
            		}
         	}
     	}
}
#endif

/*********************************************************************************************
* name:		lcd_clr_rect
* func:		fill appointed area with appointed color
* para:		usLeft,usTop,usRight,usBottom -- area's rectangle acme coordinate
*			ucColor -- appointed color value
* ret:		none
* modify:
* comment:	also as clear screen function 
*********************************************************************************************/
void lcd_clr_rect(INT16T usLeft, INT16T usTop, INT16T usRight, INT16T usBottom, UINT16T ucColor)
{
	UINT32T i, j;
	UINT8T *pDisp = (UINT8T*)LCD_ACTIVE_BUFFER;
	
	for (i = usLeft; i < usRight; i++)
	for (j = usTop; j < usBottom; j++)
	{
		PutPixel(i,j,ucColor);
		//*(pDisp+i+j) = ucColor;
	}
}

⌨️ 快捷键说明

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