-
Notifications
You must be signed in to change notification settings - Fork 2
/
RGBmatrixPanel.h
52 lines (40 loc) · 1.41 KB
/
RGBmatrixPanel.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
46
47
48
49
50
51
52
#include "Adafruit_GFX.h"
#define pgm_read_byte(addr) (*(const uint8_t *)(addr))
#define PROGMEM
class RGBmatrixPanel : public Adafruit_GFX {
public:
// Constructor for 16x32 panel:
RGBmatrixPanel(uint8_t a, uint8_t b, uint8_t c,
uint8_t sclk, uint8_t latch, uint8_t oe, boolean dbuf);
// Constructor for 32x32 panel (adds 'd' pin):
RGBmatrixPanel(uint8_t a, uint8_t b, uint8_t c, uint8_t d,
uint8_t sclk, uint8_t latch, uint8_t oe, boolean dbuf);
void
begin(void),
drawPixel(int16_t x, int16_t y, uint16_t c),
fillScreen(uint16_t c),
updateDisplay(void),
swapBuffers(boolean),
dumpMatrix(void);
uint8_t
*backBuffer(void);
uint16_t
Color333(uint8_t r, uint8_t g, uint8_t b),
Color444(uint8_t r, uint8_t g, uint8_t b),
Color888(uint8_t r, uint8_t g, uint8_t b),
Color888(uint8_t r, uint8_t g, uint8_t b, boolean gflag),
ColorHSV(long hue, uint8_t sat, uint8_t val, boolean gflag);
bool started = false;
private:
uint8_t *matrixbuff[2];
uint8_t nRows;
volatile uint8_t backindex;
volatile boolean swapflag;
// Init/alloc code common to both constructors:
void init(uint8_t rows, uint8_t a, uint8_t b, uint8_t c,
uint8_t sclk, uint8_t latch, uint8_t oe, boolean dbuf);
uint8_t _sclk, _latch, _oe, _a, _b, _c, _d;
// Counters/pointers for interrupt handler:
volatile uint8_t row, plane;
volatile uint8_t *buffptr;
};