您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

spilcd_font.c 730 B

12345678910111213141516171819202122232425262728293031323334353637
  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_printChar(lcd_t* lcd, uint8 x, uint8 y, char c)
  24. {
  25. lcd_setWindow(lcd, x, y, x+8 - 1, y+8 - 1);
  26. lcd_pushChar(lcd, c);
  27. }
  28. void lcd_printText(lcd_t* lcd, uint8 x, uint8 y, char* text)
  29. {
  30. for (int i = 0; i < strlen(text); i++) {
  31. lcd_printChar(lcd, x + i * 8, y, text[i]);
  32. }
  33. }