/******************************************************************************* Display_Str: 在指定位置显示字符串 输入: X、Y坐标,颜色值,显示模式,字符串 *******************************************************************************/ void Display_Str(short x0, short y0, short Color, char Mode, unsigned const char *s) { short i, j, k, b; LCD_SET_WINDOW(x0,LCD_X2,y0,y0+13); for (j=0; j<14;++j){ if(Mode==0) __Set_Pixel(BLACK); //Normal replace Display if(Mode==1) __Set_Pixel(Color); //Inverse replace Display } while (*s!=0) { b=0x0000; if(*s==0x21) k=4; else k=8; for(i=0;i<k;++i){ if((*s>0x21)) b=__Get_TAB_8x14(*s, i); for(j=0;j<14;++j){ if(b&4) { if(Mode==0) __Set_Pixel(Color); if(Mode==1) __Set_Pixel(BLACK); } else { if(Mode==0) __Set_Pixel(BLACK); if(Mode==1) __Set_Pixel(Color); } b>>=1; } } ++s; //字符串指针+1 } LCD_SET_WINDOW(LCD_X1,LCD_X2,LCD_Y1,LCD_Y2); //恢复全尺寸窗口 }
uint16_t mytab8x14(char c, int column) { if ((uint8_t)c < 128) { uint8_t idx = font_correction_idx[(uint8_t)c]; if (idx != 0) return font_corrections[idx - 1][column]; } c &= 0x7F; if (c <= 0x20) return 0; return __Get_TAB_8x14(c, column); }