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

📄 lcd.c

📁 使用ARM7在Embest IDE对于S3CEV40进行时钟万年历设计.时钟可以有闹钟的功能.
💻 C
📖 第 1 页 / 共 2 页
字号:
*			ucColor -- appointed color value
*			usWidth -- line's width
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void Lcd_Draw_HLine(INT16 usX0, INT16 usX1, INT16 usY0, INT8U ucColor, INT16U usWidth)
{
	INT16 usLen;

    if( usX1 < usX0 )
    {
        GUISWAP (usX1, usX0);
    }

    while( (usWidth--) > 0 )
    {
        usLen = usX1 - usX0 + 1;
        while( (usLen--) > 0 )
        {
        	LCD_PutPixel(usX0 + usLen, usY0, ucColor);
        }
        usY0++;
    }
}

/*********************************************************************************************
* name:		Lcd_Draw_VLine()
* func:		Draw vertical line with appointed color
* para:		usX0,usY0 -- line's start point coordinate
*			usY1 -- line's end point Y-coordinate
*			ucColor -- appointed color value
*			usWidth -- line's width
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void Lcd_Draw_VLine (INT16 usY0, INT16 usY1, INT16 usX0, INT8U ucColor, INT16U usWidth)
{
	INT16 usLen;

    if( usY1 < usY0 )
    {
        GUISWAP (usY1, usY0);
    }

    while( (usWidth--) > 0 )
    {
        usLen = usY1 - usY0 + 1;
        while( (usLen--) > 0 )
        {
        	LCD_PutPixel(usX0, usY0 + usLen, ucColor);
        }
        usX0++;
    }
}

/*--- extern variables ---*/
extern INT8U g_auc_Ascii8x16[];
/*********************************************************************************************
* name:		Lcd_DspAscII8x16()
* func:		display 8x16 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_DspAscII8x16(INT16U x0, INT16U y0, INT8U ForeColor, INT8U * s)
{
	INT16 i,j,k,x,y,xx;
	INT8U qm;
	INT32U ulOffset;
	INT8 ywbuf[16],temp[2];
    
	for( i = 0; i < strlen((const char*)s); i++ )
	{
		if( (INT8U)*(s+i) >= 161 )
		{
			temp[0] = *(s + i);
			temp[1] = '\0';
			return;
		}
		else
		{
			qm = *(s+i);
			ulOffset = (INT32U)(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;
			       		LCD_PutPixel(xx, y + y0, (INT8U)ForeColor);
			       	}
			   	}
            }
		}
	}
}

/*--- extern variables ---*/
extern INT8U g_auc_Ascii6x8[];
#define XWIDTH 				6
/*********************************************************************************************
* name:		Lcd_DspAscII6x8()
* 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_DspAscII6x8(INT16U usX0, INT16U usY0,INT8U ForeColor, INT8U* pucChar)
{
	INT32U i,j;
	INT8U  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 )
  				{
  					LCD_PutPixel(usX0 + i, usY0 + 8 - j, (INT8U)ForeColor);
  				}  				
  			}
		}
		usX0 += XWIDTH;
		pucChar++;
	}
}

#ifndef Eng_v
/*********************************************************************************************
* name:		Lcd_DspHz16()
* 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:		
*********************************************************************************************/
extern const INT8U g_auc_HZK16[];
void Lcd_DspHz16(INT16U x0, INT16U y0, INT8U ForeColor, INT8U *s)
{
	INT16 i,j,k,x,y,xx;
	INT8U qm,wm;
	INT32U ulOffset;
	INT8 hzbuf[32],temp[2];

	for( i = 0; i < strlen((const char*)s); i++ )
	{
		if( ((INT8U)(*(s+i))) < 161 )
		{
			temp[0] = *(s+i);
			temp[1] = '\0';
			break;
		}
		else
		{
			qm = *(s+i) - 161;
    		wm = *(s + i + 1) - 161;
       		ulOffset = (INT32U)(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;
				    	LCD_PutPixel( xx, y + y0, (INT8U)ForeColor);
				    }
			   	}
           	}
		    i++;
		}
	}
}
#endif

/*********************************************************************************************
* name:		Lcd_Test()
* func:		LCD test function
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void Lcd_Test(void)
{
	int i, j;
	
	Uart_Printf("\n LCD display Test Example(please look at LCD screen)\n");
	/* initial LCD controller */
	Lcd_Init();
	/* clear screen */
	Lcd_Clr();

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

	for (j = 0; j < 1000000 * 5; j++);
	while (1)
	{
		for (i = 0; i < 5; i++)
		{
			BitmapView320x240x256((INT8U*)(aucTempBitmap[i]));
			for (j = 0; j < 1000000 * 5; j++);
		}
	}
}

/*********************************************************************************************
* name:		Lcd_Test_board()
* func:		LCD test function for board all test
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void Lcd_Test_board(void)
{
	int i, j;
	/* initial LCD controller */
	Lcd_Init();
	/* clear screen */
	Lcd_Clr();

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

	for (j = 0; j < 1000000 * 5; j++);
	
	for (i = 0; i < 5; i++)
	{
		BitmapView320x240x256((INT8U*)(aucTempBitmap[i]));
		for (j = 0; j < 1000000 * 5; j++);
	}

}

⌨️ 快捷键说明

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