|
- #include <stdio.h>
- #include <stdint.h>
- #include <stdlib.h>
- #include <string.h>
- #include "spilcd_font.h"
- #include "font8x8_basic.h"
-
- static void lcd_pushChar(lcd_t* lcd, char c, uint8 r, uint8 g, uint8 b)
- {
- char* bitmap = font8x8_basic[(unsigned int) c];
- int x,y;
- int set;
- for (x=0; x < 8; x++) {
- for (y=0; y < 8; y++) {
- set = bitmap[x] & 1 << y;
- if (set) {
- lcd_pushPixel(lcd, r, g, b);
- } else {
- //lcd_pushPixel(lcd, 0, 0, 0);
- lcd_pushPixelSkip(lcd);
- }
- }
- }
- }
-
- 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, r, g, b);
- }
-
- 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_drawChar(lcd, x + i * 8, y, text[i], r, g, b);
- }
- }
|