void OLED_Printf(unsigned char x,unsigned char y,const char *fmt,...)
{
static unsigned char last_len[4]={0,0,0,0};
static char LCD_BUF[128]={0};
unsigned char len;
unsigned char i;
__va_list ap;
va_start(ap,fmt);
vsprintf((char *)LCD_BUF,fmt,ap);
va_end(ap);
len=strlen((char *)LCD_BUF)+2*y;
for(i=len;i<last_len[x];i++)
{
LCD_BUF[i-2*y]=' ';
}
LCD_BUF[i-2*y]=0;
OLED_Print(x,y,LCD_BUF);
last_len[x]=len;
} |