Plain C AVR library for ST7735 displays
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.

25 lines
773 B

  1. #ifndef _ST7735_FONT_H_
  2. #define _ST7735_FONT_H_
  3. #include <stdint.h>
  4. #include <avr/pgmspace.h>
  5. typedef struct { // Data stored PER GLYPH
  6. uint16_t bitmapOffset; // Pointer into GFXfont->bitmap
  7. uint8_t width, height; // Bitmap dimensions in pixels
  8. uint8_t xAdvance; // Distance to advance cursor (x axis)
  9. int8_t xOffset, yOffset; // Dist from cursor pos to UL corner
  10. } GFXglyph;
  11. typedef struct { // Data stored for FONT AS A WHOLE:
  12. uint8_t *bitmap; // Glyph bitmaps, concatenated
  13. GFXglyph *glyph; // Glyph array
  14. uint8_t first, last; // ASCII extents
  15. uint8_t yAdvance; // Newline distance (y axis)
  16. } GFXfont;
  17. void st7735_draw_text(int8_t x, int8_t y, char *text, const GFXfont *p_font, uint8_t size, uint16_t color);
  18. #endif