3、打开oledfont.h的头文件,新建一个中文字库函数chinese_2424。
const unsigned char chinese_2424[3][72]={
{0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x70,0x00,0x01,0xC0,0x00,0x0F,0xFF,0xFE,0x3C,0x00,0x00,0x30,0x00,0x0C,0x04,0x98,0x38,0x04,0x9F,0xF0,0x04,0x9F,0x88,0x3F,0xF9,0x08,0x04,0x99,0x18,0x04,0x99,0xF8,0x04,0x99,0x82,0x04,0x10,0x06,0x00,0xF8,0x0E,0x07,0xFE,0x1C,0x3F,0x07,0xF8,0x31,0x00,0xF0,0x01,0x07,0xF8,0x01,0xFE,0x0C,0x01,0x00,0x06,0x01,0x00,0x04,0x00,0x00,0x00},/*"?",0*/
{0x00,0x00,0x00,0x10,0x08,0x00,0x13,0xC9,0xFC,0x13,0xC9,0xFC,0x12,0x49,0x30,0x12,0x49,0x30,0x13,0xC9,0xF0,0x13,0xC9,0xF2,0x10,0x08,0x06,0x10,0x08,0x06,0x1F,0xEF,0xFE,0x10,0x08,0x02,0x10,0x08,0x06,0x00,0xC8,0x0E,0x03,0xC0,0x1C,0x1F,0x00,0x70,0x3B,0x3F,0xE0,0x23,0x3F,0x80,0x03,0x00,0xE0,0x03,0x00,0x38,0x03,0xC0,0x1C,0x03,0xC0,0x0E,0x00,0x00,0x04,0x00,0x00,0x00},/*"?",1*/
};
void OLED_ShowChar(u8 x, u8 y, u8 chr, u8 size, u8 mode)
{
u8 temp, t, t1;
u8 y0 = y;
u8 csize = ( size/8 + ((size%8)?1:0) ) * size;
chr=chr - '0';
for(t=0;t
5、修改字符串传递函数OLED_ShowString
void OLED_ShowString(u8 x, u8 y, const u8 *p, u8 size)
{
while((*p <= '~') && (*p >= ' '))
{
if(x > (128 - size))
{
x = 0;
y += size;
}
if(y > (64 - size))
{
y = x = 0;
OLED_Clear();
}
OLED_ShowChar(x, y, *p, size, 1);
x += size;
p++;
}
}
int main(void)
{
delay_init();
OLED_Init();
OLED_ShowString(30, 30, "01", 24);
OLED_Refresh_Gram();
}