?? color_lcd_test.c
字號:
}
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, (UINT8T)ForeColor);
}
}
}
}
}
}
//#endif
/*********************************************************************************************
* name: print_lcd
* func: print message to LCD
* para: col -- y value
row -- x value
color -- color
info -- deplay message pointer
* ret: none
* modify:
* comment:
*********************************************************************************************/
void print_lcd (INT16T col, INT16T row, UINT8T color, UINT8T * info)
{
// lcd_clr_rect (col,row,316,row+8,BLUE);
lcd_disp_ascii8x16(col,row,color,info);
}
/*********************************************************************************************
* name: lcd_clr
* func: clear LCD screen
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
void lcd_clr(void)
{
UINT32T i;
UINT32T *pDisp = (UINT32T*)LCD_ACTIVE_BUFFER;
for (i = 0; i < (SCR_XSIZE_CSTN * SCR_YSIZE_CSTN /4); i++)
{
*pDisp = ALLWHITE;
}
}
/*********************************************************************************************
* 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, UINT8T 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;
}
}
/*********************************************************************************************
* name: Lcd_Draw_Box()
* func: Draw rectangle with appointed color
* para: usLeft,usTop,usRight,usBottom -- rectangle's acme coordinate
* ucColor -- appointed color value
* ret: none
* modify:
* comment:
*********************************************************************************************/
void Lcd_Draw_Box(INT16T usLeft, INT16T usTop, INT16T usRight, INT16T usBottom, UINT8T ucColor)
{
Lcd_Draw_HLine(usLeft, usRight, usTop, ucColor, 1);
Lcd_Draw_HLine(usLeft, usRight, usBottom, ucColor, 1);
Lcd_Draw_VLine(usTop, usBottom, usLeft, ucColor, 1);
Lcd_Draw_VLine(usTop, usBottom, usRight, ucColor, 1);
}
/*********************************************************************************************
* name: Lcd_Draw_Line()
* func: Draw line with appointed color
* para: usX0,usY0 -- line's start point coordinate
* usX1,usY1 -- line's end point coordinate
* ucColor -- appointed color value
* usWidth -- line's width
* ret: none
* modify:
* comment:
*********************************************************************************************/
void Lcd_Draw_Line(INT16T usX0, INT16T usY0, INT16T usX1, INT16T usY1, UINT8T ucColor, UINT16T usWidth)
{
INT16T usDx;
INT16T usDy;
INT16T y_sign;
INT16T x_sign;
INT16T decision;
INT16T wCurx, wCury, wNextx, wNexty, wpy, wpx;
if( usY0 == usY1 )
{
Lcd_Draw_HLine (usX0, usX1, usY0, ucColor, usWidth);
return;
}
if( usX0 == usX1 )
{
Lcd_Draw_VLine (usY0, usY1, usX0, ucColor, usWidth);
return;
}
usDx = abs(usX0 - usX1);
usDy = abs(usY0 - usY1);
if( ((usDx >= usDy && (usX0 > usX1)) ||
((usDy > usDx) && (usY0 > usY1))) )
{
GUISWAP(usX1, usX0);
GUISWAP(usY1, usY0);
}
y_sign = (usY1 - usY0) / usDy;
x_sign = (usX1 - usX0) / usDx;
if( usDx >= usDy )
{
for( wCurx = usX0, wCury = usY0, wNextx = usX1,
wNexty = usY1, decision = (usDx >> 1);
wCurx <= wNextx; wCurx++, wNextx--, decision += usDy )
{
if( decision >= usDx )
{
decision -= usDx;
wCury += y_sign;
wNexty -= y_sign;
}
for( wpy = wCury - usWidth / 2;
wpy <= wCury + usWidth / 2; wpy++ )
{
PutPixel(wCurx, wpy, ucColor);
}
for( wpy = wNexty - usWidth / 2;
wpy <= wNexty + usWidth / 2; wpy++ )
{
PutPixel(wNextx, wpy, ucColor);
}
}
}
else
{
for( wCurx = usX0, wCury = usY0, wNextx = usX1,
wNexty = usY1, decision = (usDy >> 1);
wCury <= wNexty; wCury++, wNexty--, decision += usDx )
{
if( decision >= usDy )
{
decision -= usDy;
wCurx += x_sign;
wNextx -= x_sign;
}
for( wpx = wCurx - usWidth / 2;
wpx <= wCurx + usWidth / 2; wpx++ )
{
PutPixel(wpx, wCury, ucColor);
}
for( wpx = wNextx - usWidth / 2;
wpx <= wNextx + usWidth / 2; wpx++ )
{
PutPixel(wpx, wNexty, ucColor);
}
}
}
}
/*********************************************************************************************
* name: Lcd_Draw_HLine()
* func: Draw horizontal line with appointed color
* para: usX0,usY0 -- line's start point coordinate
* usX1 -- line's end point X-coordinate
* ucColor -- appointed color value
* usWidth -- line's width
* ret: none
* modify:
* comment:
*********************************************************************************************/
void Lcd_Draw_HLine(INT16T usX0, INT16T usX1, INT16T usY0, UINT8T ucColor, UINT16T usWidth)
{
INT16T usLen;
if( usX1 < usX0 )
{
GUISWAP (usX1, usX0);
}
while( (usWidth--) > 0 )
{
usLen = usX1 - usX0 + 1;
while( (usLen--) > 0 )
{
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 (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 )
{
PutPixel(usX0, usY0 + usLen, ucColor);
}
usX0++;
}
}
/*********************************************************************************************
* name: color_lcd_test()
* func: LCD test function
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
void color_lcd_test(void)
{
int i,j;
lcd_init_app();
//#ifndef BOARDTEST
lcd_disp_hz24(50,10,BLUE,"英蓓特三星實驗平臺");
//#endif
lcd_disp_ascii8x16(80,120,BLUE,"Embest EduKit-III");
lcd_disp_ascii8x16(28,140,GREEN,"ShenZhen Embest Info&Tech Co.,LTD");
Glib_Rectangle(10,40,310,230,RED);
Glib_Rectangle(15,45,305,225,GREEN);
Glib_Rectangle(20,50,300,220,BLUE);
Glib_Rectangle(25,55,295,215,GREEN);
LCD_D_ON;
delay(10000);
//#ifndef BOARDTEST
for(j=0;j<2;j++)
{
for (i = 0; i < 3; i++)
{
BitmapView((UINT8T*)(g_ucBitmap[i]));
delay(5000);
}
}
//#endif
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -