You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
790 B

  1. #include <stdio.h>
  2. #include <stdint.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include "spilcd_font.h"
  6. #include "font8x8_basic.h"
  7. static void lcd_pushChar(lcd_t* lcd, char c)
  8. {
  9. char* bitmap = font8x8_basic[(unsigned int) c];
  10. int x,y;
  11. int set;
  12. for (x=0; x < 8; x++) {
  13. for (y=0; y < 8; y++) {
  14. set = bitmap[x] & 1 << y;
  15. if (set) {
  16. lcd_pushPixel(lcd, 200, 0, 0);
  17. } else {
  18. lcd_pushPixel(lcd, 0, 0, 0);
  19. }
  20. }
  21. }
  22. }
  23. void lcd_drawChar(lcd_t* lcd, uint8 x, uint8 y, char c, uint8 r, uint8 g, uint8 b)
  24. {
  25. lcd_setWindow(lcd, x, y, x+8 - 1, y+8 - 1);
  26. lcd_pushChar(lcd, c);
  27. }
  28. void lcd_drawText(lcd_t* lcd, uint8 x, uint8 y, char* text, uint8 r, uint8 g, uint8 b)
  29. {
  30. for (int i = 0; i < strlen(text); i++) {
  31. lcd_drawChar(lcd, x + i * 8, y, text[i], r, g, b);
  32. }
  33. }