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.

39 lines
853 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, uint8 r, uint8 g, uint8 b)
  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, r, g, b);
  17. } else {
  18. //lcd_pushPixel(lcd, 0, 0, 0);
  19. lcd_pushPixelSkip(lcd);
  20. }
  21. }
  22. }
  23. }
  24. void lcd_drawChar(lcd_t* lcd, uint8 x, uint8 y, char c, uint8 r, uint8 g, uint8 b)
  25. {
  26. lcd_setWindow(lcd, x, y, x+8 - 1, y+8 - 1);
  27. lcd_pushChar(lcd, c, r, g, b);
  28. }
  29. void lcd_drawText(lcd_t* lcd, uint8 x, uint8 y, char* text, uint8 r, uint8 g, uint8 b)
  30. {
  31. for (int i = 0; i < strlen(text); i++) {
  32. lcd_drawChar(lcd, x + i * 8, y, text[i], r, g, b);
  33. }
  34. }