比如这个字符是16*8的,加个框框,变成16*16的/*
x:0~112;
y:0~2;
num:0~9
实现显示带框的字符,显示形态16*16,内部为8*16字符
*/
void NumberShow(unsigned char numb,unsigned char x,unsigned char y)
{
unsigned char i;
for(i=0;i<16;i++)
{
if(i==0||i==15)
{
OLED_Set_Pos(x+i,y+0);
OLED_WR_Byte(0xFF,OLED_DATA);
OLED_Set_Pos(x+i,y+1);
OLED_WR_Byte(0xFF,OLED_DATA);
}
else if((i>0&&i<4)||(i>12&&i<16))
{
OLED_Set_Pos(x+i,y+0);
OLED_WR_Byte(0x01,OLED_DATA);
OLED_Set_Pos(x+i,y+1);
OLED_WR_Byte(0x80,OLED_DATA);
}
else
{
OLED_Set_Pos(x+i,y+0);
OLED_WR_Byte(0x01|F8X16[(numb+'0'-' ')*16+i-4],OLED_DATA);
OLED_Set_Pos(x+i,y+1);
OLED_WR_Byte(0x80|F8X16[(numb+'0'-' ')*16+i+4],OLED_DATA);
}
}
}
跟群里大佬学的,分享过来。
|