Char write using burst
This commit is contained in:
parent
5fd9a4a86f
commit
0017804193
@ -22,7 +22,7 @@ void GFX_DrawChar(
|
||||
if (startX + glyph->width <= 0 || startX >= LCD_WIDTH) return;
|
||||
if (startY + glyph->height <= 0 || startY >= LCD_HEIGHT) return;
|
||||
|
||||
// LCD_Set_Address(startX, startY, startX + glyph->width - 1, startY + glyph->height - 1);
|
||||
LCD_Set_Address(startX, startY, startX + glyph->width - 1, startY + glyph->height - 1);
|
||||
uint16_t pendingPixelCount = 0;
|
||||
uint8_t pendingPixelBit = 0;
|
||||
|
||||
@ -33,24 +33,25 @@ void GFX_DrawChar(
|
||||
uint8_t bitIndex = bitPos % 8;
|
||||
uint8_t pixelBit = font->bitmaps[byteIndex] & (0x80 >> bitIndex);
|
||||
|
||||
// if(pixelBit == pendingPixelBit) {
|
||||
// pendingPixelCount++;
|
||||
// }else {
|
||||
// if(pendingPixelCount != 0) {
|
||||
// LCD_Draw_Colour_Burst(pendingPixelBit ? fg_color : bg_color, pendingPixelCount);
|
||||
// pendingPixelCount = 0;
|
||||
// }
|
||||
// pendingPixelBit = pixelBit;
|
||||
// }
|
||||
|
||||
uint16_t pixelColor = pixelBit ? fg_color : bg_color;
|
||||
|
||||
int16_t absX = startX + col;
|
||||
int16_t absY = startY + row;
|
||||
|
||||
if (absX >= 0 && absX < LCD_WIDTH && absY >= 0 && absY < LCD_HEIGHT) {
|
||||
LCD_Draw_Pixel(absX, absY, pixelColor);
|
||||
if(pixelBit == pendingPixelBit) {
|
||||
pendingPixelCount++;
|
||||
}else {
|
||||
if(pendingPixelCount != 0) {
|
||||
LCD_Draw_Colour_Burst(pendingPixelBit ? fg_color : bg_color, pendingPixelCount);
|
||||
pendingPixelCount = 1;
|
||||
}
|
||||
pendingPixelBit = pixelBit;
|
||||
}
|
||||
|
||||
// Per pixel way: slower
|
||||
// uint16_t pixelColor = pixelBit ? fg_color : bg_color;
|
||||
//
|
||||
// int16_t absX = startX + col;
|
||||
// int16_t absY = startY + row;
|
||||
//
|
||||
// if (absX >= 0 && absX < LCD_WIDTH && absY >= 0 && absY < LCD_HEIGHT) {
|
||||
// LCD_Draw_Pixel(absX, absY, pixelColor);
|
||||
// }
|
||||
|
||||
bitPos++;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user