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

📄 lcd.c

📁 Embest EudKit-II教学系统配Samsung S3C44B0处理器的部分测试程序。
💻 C
📖 第 1 页 / 共 2 页
字号:
    {
        GUISWAP (usX1, usX0);
    }

    while( (usWidth--) > 0 )
    {
        usLen = usX1 - usX0 + 1;
        while( (usLen--) > 0 )
        {
        	LCD_PUT_PIXEL(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 (INT16T usY0, INT16T usY1, INT16T usX0, UINT8T ucColor, UINT16T usWidth)
{
	INT16T usLen;

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

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

/*********************************************************************************************
* name:		lcd_disp_ascii8x16()
* 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_disp_ascii8x16(UINT16T x0, UINT16T y0, UINT8T ForeColor, UINT8T * s)
{
	INT16T i,j,k,x,y,xx;
	UINT8T qm;
	UINT32T 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 = (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_PUT_PIXEL(xx, y + y0, (UINT8T)ForeColor);
			       	}
			   	}
            }
		}
	}
}

/*********************************************************************************************
* 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(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_PUT_PIXEL(usX0 + i, usY0 + 8 - j, (UINT8T)ForeColor);
  				}  				
  			}
		}
		usX0 += XWIDTH;
		pucChar++;
	}
}

#ifdef CHINESE_VERSION
/*********************************************************************************************
* 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)
{
	INT16T 	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_PUT_PIXEL( xx, y + y0, (UINT8T)ForeColor);
				    }
			   	}
           	}
		    i++;
		}
	}
}
#endif

/*********************************************************************************************
* name:		reverse_line()
* func:		Reverse display some lines 
* para:		ulHeight -- line's height
*			ulY -- line's Y-coordinate
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void reverse_line(UINT32T ulHeight, UINT32T ulY)
{
	UINT32T i, j, temp;
	
	for( i = 0; i < ulHeight; i++ )
	{
		for( j = 0; j < (SCR_XSIZE/4/2) ; j++ )
		{
			temp = *(UINT32T*)(LCD_VIRTUAL_BUFFER + (ulY+i)*SCR_XSIZE/2 + j*4);
			temp ^= 0xFFFFFFFF;
			*(UINT32T*)(LCD_VIRTUAL_BUFFER + (ulY+i)*SCR_XSIZE/2 + j*4) = temp;
		}
	}
}

/*********************************************************************************************
* name:		zdma0_done()
* func:		LCD dma interrupt handle function
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void zdma0_done(void)
{
	rI_ISPC=BIT_ZDMA0;	    //clear pending
	f_ucZdma0Done=0;
}

/*********************************************************************************************
* name:		lcd_dma_trans()
* func:		dma transport virtual LCD screen to LCD actual screen
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void lcd_dma_trans(void)
{
	f_ucZdma0Done=1;
	// #define LCD_VIRTUAL_BUFFER	(0xc400000)
	// #define LCD_ACTIVE_BUFFER	(LCD_VIRTUAL_BUFFER+(SCR_XSIZE*SCR_YSIZE/2))	//DMA ON
	// #define LCD_ACTIVE_BUFFER	LCD_VIRTUAL_BUFFER								//DMA OFF
	// #define LCD_BUF_SIZE			(SCR_XSIZE*SCR_YSIZE/2)
	// So the Lcd Buffer Low area is from LCD_VIRTUAL_BUFFER to (LCD_ACTIVE_BUFFER+(SCR_XSIZE*SCR_YSIZE/2))

	rNCACHBE1 = (((unsigned)(LCD_ACTIVE_BUFFER)>>12) <<16 ) | ((unsigned)(LCD_VIRTUAL_BUFFER)>>12);
  	rZDISRC0  = (DW<<30)| (1<<28) | LCD_VIRTUAL_BUFFER; 
 	rZDIDES0  = (2<<30) | (1<<28) | LCD_ACTIVE_BUFFER; 
	rZDICNT0  = (2<<28) | (1<<26) | (3<<22) | (0<<20) | (LCD_BUF_SIZE);
   	//			|            |            	|             |            |---->0 = Disable DMA
    //          |            |            	|             |------------>Int. whenever transferred
    //          |            |            	|-------------------->Write time on the fly
    //          |            |---------------------------->Block(4-word) transfer mode
    //          |------------------------------------>whole service
	//reEnable ZDMA transfer
  	rZDICNT0 |= (1<<20);										// after ES3
    rZDCON0=0x1; 												// start!!!  

	delay(500);
	//while(f_ucZdma0Done);										//wait for DMA finish
}

/*********************************************************************************************
* name:		Lcd_Test()
* func:		LCD test function
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void lcd_test(void)
{
	int i;
		
	lcd_init();											// initial LCD controller
	lcd_clr();											// clear screen
	lcd_active_clr();

#ifdef CHINESE_VERSION 
	lcd_disp_hz16(10,0,DARKGRAY,"英蓓特三星实验评估板");
#else
	lcd_disp_ascii8x16(10,0,DARKGRAY,"Embest S3CEV40 ");
#endif
	lcd_disp_ascii8x16(10,20,BLACK,"ShenZhen Embest Info&Tech Co.,LTD");

	// draw rectangle pattern 
	lcd_draw_box(10, 40, 310, 230, 14);
	lcd_draw_box(20, 45, 300, 225, 13);
	lcd_draw_box(30, 50, 290, 220, 12);
	lcd_draw_box(40, 55, 280, 215, 11);
	lcd_draw_box(50, 60, 270, 210, 10);
	lcd_draw_box(60, 65, 260, 205, 9);
	lcd_draw_box(70, 70, 250, 200, 8);
	lcd_draw_box(80, 75, 240, 195, 7);
	lcd_draw_box(90, 80, 230, 190, 6);
	lcd_draw_box(100,85, 220, 185, 5);
	lcd_draw_box(110,90, 210, 180, 4);
	lcd_draw_box(120,95, 200, 175, 3);
	lcd_draw_box(130,100,190, 170, 2);
	
	bitmap_view(125, 135, g_struBitmapMouse);
	lcd_dma_trans();
}

⌨️ 快捷键说明

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