void OLED_Printf(int16_t X, int16_t Y, uint8_t FontSize, char *format, ...)
{
char String[256]; //定义字符数组
va_list arg; //定义可变参数列表数据类型的变量arg
va_start(arg, format); //从format开始,接收参数列表到arg变量
vsprintf(String, format, arg); //使用vsprintf打印格式化字符串和参数列表到字符数组中
va_end(arg); //结束变量arg
if(FontSize == OLED_6X8) //在显示6X8字符时效果不好,因为128/6 = 21...2
{ //这会导致每行的最后会多显示两列,需要更改底层解决
for(uint16_t i = 0; i < strlen(String); i+=21)
{
OLED_ShowString(X, Y+i/21*9, &String[i], FontSize);//OLED显示字符数组(字符串)
}
}else if(FontSize == OLED_8X16){
for(uint16_t i = 0; i < strlen(String); i+=16)
{
OLED_ShowString(X, Y+i, &String[i], FontSize);//OLED显示字符数组(字符串)
}
}
}
6X8字符显示
OLED_Printf(0, 0, OLED_6X8, "Hi crkylin, this is your thirty-two days in this company, congratulations for you honestly!");
显示效果

8X16字符显示
OLED_Printf(0, 0, OLED_8X16, "Hi crkylin, this is your thirty-two days in this company, congratulations for you honestly!");
显示效果

中文字符显示效果
