文字显示
oled.c文件 本次例程取模大小为 16*16
注意 wide字宽要与取模对应的字宽相对应
void OLED_ShowCHINESE(uint8_t Line, uint8_t Column, uint8_t Num)
{
uint8_t i;
uint8_t wide = 16;//字宽
OLED_SetCursor(( Line - 1 ) * 2, ( Column - 1 )* wide); //参数1:把光标设置在第几页. 参数2:把光标设置在第几列
for (i = 0; i < wide; i++)
{
OLED_WriteData(OLED_F10x16[Num][i]); //显示上半部分内容
}
OLED_SetCursor(( Line - 1 ) * 2 + 1,( Column - 1) * wide);
for (i = 0; i < wide ; i++)
{
OLED_WriteData(OLED_F10x16[Num][i+wide]); //显示下半部分内容
}
}
OLED_Font.h 文字取模存放的位置
const uint8_t OLED_F10x16[][16]={
0x00,0x20,0x20,0x20,0x20,0xFF,0x00,0x00,0x00,0xFF,0x40,0x20,0x10,0x08,0x00,0x00,
0x20,0x60,0x20,0x10,0x10,0xFF,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x40,0x78,0x00,/*"北",0*/
};
main.c 调用
OLED_ShowCHINESE(1, 2, 0);//调用数组第一个汉字