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

📄 lcd.c

📁 基于ARM处理器的S3C44Bx芯片
💻 C
📖 第 1 页 / 共 2 页
字号:
		if( (UINT8T)*(s+i) >= 161 )
		{
			temp[0] = *(s + i);
			temp[1] = '\0';
			return;
		}
		else
		{
			qm = *(s+i);
			ulOffset = (UINT32T)(qm) * 16;		//Here to be changed tomorrow
			for( j = 0; j < 16; j ++ )
			{
				ywbuf[j] = g_ucAscii8x16[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;
			       		LCD_PutPixel(xx, y + y0, (UINT8T)ForeColor);
			       	}
			   	}
            }
		}
	}
}

#ifdef ASCII6x8
/*********************************************************************************************
* name:		lcd_disp_ascii6x8()
* func:		display 6x8 ASCII character string 
* para:		usX0,usY0 -- ASCII character string's start point coordinate
*			ForeColor -- appointed color value
*			pucChar   -- ASCII character string
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void lcd_disp_ascii6x8(UINT16T usX0, UINT16T usY0,UINT8T ForeColor, UINT8T* pucChar)
{
	UINT32T i,j;
	UINT8T  ucTemp;

	while( *pucChar != 0 )
	{
		for( i=0; i < 8; i++ )
		{
  			ucTemp = g_ucAscii6x8[(*pucChar) * 8 + i];
  			for( j = 0; j < 8; j++ )
  			{
  				if( (ucTemp & (0x80 >> j)) != 0 )
  				{
  					LCD_PutPixel(usX0 + i, usY0 + 8 - j, (UINT8T)ForeColor);
  				}  				
  			}
		}
		usX0 += XWIDTH;
		pucChar++;
	}
}
#endif

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

    	for(i = 0; i < strlen((const char*)s); i++)
    	{
    		if( (INT8U)*(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 = (S32)(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;
					     		LCD_PutPixel( xx, y + y0, ForeColor);			       	
						}
    			   		}
    				}
    			} 
    			/* One HZ Ocupy 2 bytes, So i++ */
    			i++;    		
    		}
    	}
}
#endif

#ifdef HZK16
/*********************************************************************************************
* name:		lcd_disp_hz16()
* func:		display chinese character string in 16x16 dot array
* para:		usX0,usY0 -- ASCII character string's start point coordinate
*			ForeColor -- appointed color value
*			pucChar   -- ASCII character string
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void lcd_disp_hz16(UINT16T x0, UINT16T y0, UINT8T ForeColor, UINT8T *s)
{
	UINT16T i,j,k,x,y,xx;
	UINT8T qm,wm;
	UINT32T 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 = (UINT32T)(qm * 94 + wm) * 32;
			for( j = 0; j < 32; j ++ )
            {
            	hzbuf[j] = g_ucHZK16[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;
				    	LCD_PutPixel( xx, y + y0, (UINT8T)ForeColor);
				    }
			   	}
           	}
		    i++;
		}
	}
}
/*********************************************************************************************
* name:		lcd_disp_str16()
* func:		display 8x16 ASCII character string and 16x16 chinese character string 
* para:		usX0,usY0 -- character string's start point coordinate
*			ForeColor -- appointed color value
*			pucChar   -- ASCII character string
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void lcd_disp_str16(UINT16T x0, UINT16T y0, UINT8T ForeColor, UINT8T *s)
{
	UINT16T i,j,k,x,y,xx=0,yy,ch=0;
	UINT8T qm,wm;
	UINT32T ulOffset,ulPadRow;
	INT8T ywbuf[16],hzbuf[32];//,temp[2];

	for( i = 0; i < strlen((const char*)s); i++ )
	{
		if( ((UINT8T)(*(s+i))) < 161 )
		{
			ch++;
			if(xx > 300)
			{
				ch = 0;
				x0 = 15;
				y0 += ulPadRow;
			}
			qm = *(s+i);
			ulOffset = (UINT32T)(qm) * 16;		//Here to be changed tomorrow
			for( j = 0; j < 16; j ++ )
			{
				ywbuf[j] = g_ucAscii8x16[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 + ch*8;
			       			yy = y + y0;
			       			LCD_PutPixel(xx, yy, (UINT8T)ForeColor);
			       		}
			   	}
            		}
		}
		else
		{
			ch++;
			if(xx > 288) 
			{
				ch = 0;
				x0 = 15;
				y0 += ulPadRow;
			}
			qm = *(s+i) - 161;
    		wm = *(s + i + 1) - 161;
       		ulOffset = (UINT32T)(qm * 94 + wm) * 32;
			for( j = 0; j < 32; j ++ )
            		{
            			hzbuf[j] = g_ucHZK16[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 + ch * 8;
				    		yy = y + y0;
				    		LCD_PutPixel( xx, yy, (UINT8T)ForeColor);
				    	}
			   	}
           		}
	    	i++;
	    	ch++;
		}
	}
}
#endif

#ifdef HZK24
//*****************************************************************
//** 函数名:void lcd_disp_hz24(UINT16T x0, UINT16T y0, UINT8T ForeColor, UINT8T *s)
//** 输 入: x0--字符串的左上角x坐标
//		   y0--字符串的左上角y坐标
//**          ForeColor--填充的颜色
//		   s--字符串数组指针
//** 输 出: Null
//** 功能描述:显示24x24汉字字符串
//** 全局变量:Null
//*****************************************************************
void lcd_disp_hz24(UINT16T x0, UINT16T y0, UINT8T ForeColor, UINT8T *s)
{
	INT16T i,j,k,x,y,xx;
	UINT8T qm,wm;
	INT32T ulOffset;
	UINT8T 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;
			       		LCD_PutPixel( xx, y + y0, (UINT8T)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;
    						LCD_PutPixel(xx,y+y0,(UINT8T)ForeColor);
    					}
            			}
            		}*/
			i++;
		}
	}     	
}
#endif
/*********************************************************************************************
* name:		color_lcd_test()
* func:		LCD test function
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void color_lcd_test(void)
{
//	f_nInterface = 15;
	
	int i,j;
	
	lcd_init();									// initial LCD controller
	lcd_clr();									// clear screen

#ifdef CHINESE_VERSION
	lcd_disp_hz16(10,10,BLUE,"英蓓特三星实验平台");
#else
	lcd_disp_ascii8x16(10,10,BLUE,"Embest S3CEV40 ");
#endif
	lcd_disp_ascii8x16(10,24,GREEN-55,"ShenZhen Embest Info&Tech Co.,LTD");
	
	/* draw rectangle pattern */ 
	lcd_draw_box(10,40,310,230,RED);
	lcd_draw_box(20,45,300,225,GREEN);
	lcd_draw_box(30,50,290,220,BLUE);
	lcd_draw_box(40,55,280,215,GREEN-55);

	LCD_D_ON;
	delay(10000);

	for(j=0;j<2;j++)
	{
		for (i = 0; i < 3; i++)
		{
			bitmap_view320x240x256((UINT8T*)(g_ucBitmap[i]));
			delay(5000);
		}
	}
}

⌨️ 快捷键说明

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