-
Notifications
You must be signed in to change notification settings - Fork 1
/
tftdisplay.h
45 lines (38 loc) · 1.21 KB
/
tftdisplay.h
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
#ifndef __TFTDISPLAY_H__
#define __TFTDISPLAY_H__
typedef enum {
portrait, landscape, reverse_portrait, reverse_landscape
} orientation_t;
typedef unsigned colour_t;
const colour_t BLACK = 0x0000;
const colour_t NAVY = 0x000F;
const colour_t DARKGREEN = 0x03E0;
const colour_t DARKCYAN = 0x03EF;
const colour_t MAROON = 0x7800;
const colour_t PURPLE = 0x780F;
const colour_t OLIVE = 0x7BE0;
const colour_t LIGHTGREY = 0xC618;
const colour_t DARKGREY = 0x7BEF;
const colour_t BLUE = 0x001F;
const colour_t GREEN = 0x07E0;
const colour_t CYAN = 0x07FF;
const colour_t RED = 0xF800;
const colour_t MAGENTA = 0xF81F;
const colour_t YELLOW = 0xFFE0;
const colour_t WHITE = 0xFFFF;
const colour_t ORANGE = 0xFDA0;
const colour_t GREENYELLOW = 0xB7E0;
const colour_t PINK = 0xFC9F;
class TFTDisplay {
public:
void begin(colour_t bg, colour_t fg, orientation_t o = landscape, unsigned xoff=0, unsigned yoff=0);
void clear();
void status(const char *s);
void drawPixel(unsigned x, unsigned y, colour_t col);
void pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t* data);
void drawString(const char *s, unsigned x, unsigned y);
void flush();
protected:
unsigned _bg, _fg, _cx, _cy, _dx, _dy, _oxs, _xoff, _yoff;
};
#endif