Updated font API

This commit is contained in:
Dejvino 2020-08-02 15:57:45 +00:00
parent 93eda44559
commit d1626382cb
3 changed files with 8 additions and 8 deletions

6
main.c
View File

@ -78,9 +78,9 @@ int main(int argc, char *argv[])
printf("Text...");
lcd_fillScreen(lcd, 0, 0, 0);
lcd_printChar(lcd, 10, 90, 'A');
lcd_printText(lcd, 10, 50, "Hello, world!");
lcd_printChar(lcd, 10, 100, 'Z');
lcd_drawChar(lcd, 10, 90, 'A', 255, 0, 0);
lcd_drawText(lcd, 10, 50, "Hello, world!", 0, 255, 0);
lcd_drawChar(lcd, 10, 100, 'Z', 0, 0, 255);
printf("DONE\n");
printf("...waiting 2 seconds...\n");

View File

@ -22,16 +22,16 @@ static void lcd_pushChar(lcd_t* lcd, char c)
}
}
void lcd_printChar(lcd_t* lcd, uint8 x, uint8 y, char c)
void lcd_drawChar(lcd_t* lcd, uint8 x, uint8 y, char c, uint8 r, uint8 g, uint8 b)
{
lcd_setWindow(lcd, x, y, x+8 - 1, y+8 - 1);
lcd_pushChar(lcd, c);
}
void lcd_printText(lcd_t* lcd, uint8 x, uint8 y, char* text)
void lcd_drawText(lcd_t* lcd, uint8 x, uint8 y, char* text, uint8 r, uint8 g, uint8 b)
{
for (int i = 0; i < strlen(text); i++) {
lcd_printChar(lcd, x + i * 8, y, text[i]);
lcd_drawChar(lcd, x + i * 8, y, text[i], r, g, b);
}
}

View File

@ -1,5 +1,5 @@
#include "spilcd.h"
void lcd_printChar(lcd_t* lcd, uint8 x, uint8 y, char c);
void lcd_printText(lcd_t* lcd, uint8 x, uint8 y, char* text);
void lcd_drawChar(lcd_t* lcd, uint8 x, uint8 y, char c, uint8 r, uint8 g, uint8 b);
void lcd_drawText(lcd_t* lcd, uint8 x, uint8 y, char* text, uint8 r, uint8 g, uint8 b);