Char write using burst

This commit is contained in:
Clément Grennerat 2025-09-14 22:53:11 +02:00
parent 5fd9a4a86f
commit 0017804193

View File

@ -22,7 +22,7 @@ void GFX_DrawChar(
if (startX + glyph->width <= 0 || startX >= LCD_WIDTH) return; if (startX + glyph->width <= 0 || startX >= LCD_WIDTH) return;
if (startY + glyph->height <= 0 || startY >= LCD_HEIGHT) 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; uint16_t pendingPixelCount = 0;
uint8_t pendingPixelBit = 0; uint8_t pendingPixelBit = 0;
@ -33,25 +33,26 @@ void GFX_DrawChar(
uint8_t bitIndex = bitPos % 8; uint8_t bitIndex = bitPos % 8;
uint8_t pixelBit = font->bitmaps[byteIndex] & (0x80 >> bitIndex); uint8_t pixelBit = font->bitmaps[byteIndex] & (0x80 >> bitIndex);
// if(pixelBit == pendingPixelBit) { if(pixelBit == pendingPixelBit) {
// pendingPixelCount++; pendingPixelCount++;
// }else { }else {
// if(pendingPixelCount != 0) { if(pendingPixelCount != 0) {
// LCD_Draw_Colour_Burst(pendingPixelBit ? fg_color : bg_color, pendingPixelCount); LCD_Draw_Colour_Burst(pendingPixelBit ? fg_color : bg_color, pendingPixelCount);
// pendingPixelCount = 0; pendingPixelCount = 1;
// } }
// pendingPixelBit = pixelBit; 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);
} }
// 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++; bitPos++;
} }
} }