-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathfont.h
More file actions
61 lines (54 loc) · 1.33 KB
/
font.h
File metadata and controls
61 lines (54 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef _ST7735_FONTS_H
#define _ST7735_FONTS_H
#include <stdio.h>
#if defined(_FORCE_PROGMEM__)
#if defined(__AVR__)
#include <avr/pgmspace.h>
#elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__)
#include <avr/pgmspace.h>//Teensy3 and AVR arduinos can use pgmspace.h
#ifdef PROGMEM
#undef PROGMEM
#define PROGMEM __attribute__((section(".progmem.data")))
#endif
#elif defined(__SAM3X8E__)
#include <include/pio.h>
#define PROGMEM
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
typedef unsigned char prog_uchar;
#elif defined(ESP8266)
//none
#endif
typedef struct PROGMEM {
const uint8_t *data;
uint8_t image_width;
} tImage;
typedef struct {
uint8_t char_code;
const tImage *image;
} tChar;
typedef struct {
uint8_t length;
const tChar *chars;
uint8_t font_width;
uint8_t font_height;
bool rle;
} tFont;
#else
typedef struct {
const uint8_t *data;
uint8_t image_width;
} tImage;
typedef struct {
uint8_t char_code;
const tImage *image;
} tChar;
typedef struct {
uint8_t length;
const tChar *chars;
uint8_t font_width;
uint8_t font_height;
bool rle;
} tFont;
#endif
#endif