高级会员

- 积分
- 513
- 金钱
- 513
- 注册时间
- 2013-7-26
- 在线时间
- 72 小时
|
字符写入函数
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 size,u8 mode)
{
u8 temp,t1,t;
u16 y0=y;
u16 colortemp=POINT_COLOR;
//设置窗口
num=num-' ';//得到偏移后的值
if(!mode) //非叠加方式
{
for(t=0;t<size;t++)
{
if(size==12)temp=asc2_1206[num][t]; //调用1206字体
else temp=asc2_1608[num][t]; //调用1608字体
for(t1=0;t1<8;t1++)
{
if(temp&0x80)POINT_COLOR=colortemp;
else POINT_COLOR=BACK_COLOR;
LCD_DrawPoint(x,y);
temp<<=1;
y++;
if(x>=lcddev.width){POINT_COLOR=colortemp;return;}//超区域了 //if(y>=lcddev.height){POINT_COLOR=colortemp;return;}//超区域了
if((y-y0)==size)
{
y=y0;
x++;
if(x>=lcddev.width){POINT_COLOR=colortemp;return;}//超区域了 //对的
break;
}
}
}
}else//叠加方式
{
for(t=0;t<size;t++)
{
if(size==12)temp=asc2_1206[num][t]; //调用1206字体
else temp=asc2_1608[num][t]; //调用1608字体
for(t1=0;t1<8;t1++)
{
if(temp&0x80)LCD_DrawPoint(x,y);
temp<<=1;
y++;
if(x>=lcddev.height){POINT_COLOR=colortemp;return;}//超区域了 // if(y>=lcddev.height){POINT_COLOR=colortemp;return;}
if((y-y0)==size)
{
y=y0;
x++;
if(x>=lcddev.width){POINT_COLOR=colortemp;return;}//超区域了 //对的
break;
}
}
}
}
POINT_COLOR=colortemp;
}
一般情况不会超出边界,所以基本不会执行错误吧。
|
|