新手上路
- 积分
- 21
- 金钱
- 21
- 注册时间
- 2013-3-14
- 在线时间
- 52 小时
|
发表于 2015-7-4 09:44:16
|
显示全部楼层
//在指定区域内填充指定颜色
//区域大小:
// (xend-xsta)*(yend-ysta)
void LCD_Fill(u16 xsta,u16 ysta,u16 xend,u16 yend,u16 color)
{
/*
D7 D6 D5 D4 D3 D2 D1 D0
org 0 i/d1 i/d0 AM 0 0 0
i/d [1:0]=00 [1:0]=01 [1:0]=10 [1:0]=11
AM=0
E<--- -->E B B
B B E<-- -->E
AM=1
E E B B
^ ^
| | | |
B B E E
*/
u16 i,j;
u16 xlen=0;
if(xsta>xend)return;
if(ysta>yend)return;
#if USE_HORIZONTAL==1
#if DISP_Y_TRUN_OVER==1
xlen=yend-ysta+1;
for(i=xsta;i<=xend;i++)
{
LCD_SetCursor(i,yend); //设置光标位置
LCD_WriteRAM_Prepare(); //开始写入GRAM
for(j=0;j<xlen;j++)LCD_WR_DATA(color);//设置光标位置
}
#else
xlen=yend-ysta+1;
for(i=xsta;i<=xend;i++)
{
LCD_SetCursor(i,ysta); //设置光标位置
LCD_WriteRAM_Prepare(); //开始写入GRAM
for(j=0;j<xlen;j++)LCD_WR_DATA(color);//设置光标位置
}
#endif
#else
#if DISP_X_TRUN_OVER==1
xlen=xend-xsta+1;
for(i=ysta;i<=yend;i++)
{
LCD_SetCursor(xend,i); //设置光标位置
LCD_WriteRAM_Prepare(); //开始写入GRAM
for(j=0;j<xlen;j++)LCD_WR_DATA(color);//设置光标位置
}
#else
xlen=xend-xsta+1;
for(i=ysta;i<=yend;i++)
{
LCD_SetCursor(xsta,i); //设置光标位置
LCD_WriteRAM_Prepare(); //开始写入GRAM
for(j=0;j<xlen;j++)LCD_WR_DATA(color);//设置光标位置
}
#endif
#endif
}> |
|