-
Notifications
You must be signed in to change notification settings - Fork 0
/
EnhancedRGBmatrixPanel.h
68 lines (56 loc) · 1.89 KB
/
EnhancedRGBmatrixPanel.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//Modified by Russell Peake
//www.flinders.edu.au/people/peak0042
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#include "pins_arduino.h"
#endif
#include "Adafruit_GFX.h"
class EnhancedRGBmatrixPanel : public Adafruit_GFX {
public:
// Constructor for 16x32 panel:
EnhancedRGBmatrixPanel(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):
EnhancedRGBmatrixPanel(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),
updateStaticDisplay(void),
swapBuffers(boolean),
dumpMatrix(void),
setColour(byte col),
setDynamic();
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);
volatile uint8_t useStatic;
private:
uint8_t currentColour;
uint8_t nextColour;
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);
// PORT register pointers, pin bitmasks, pin numbers:
volatile uint8_t
*latport, *oeport, *addraport, *addrbport, *addrcport, *addrdport;
uint8_t
sclkpin, latpin, oepin, addrapin, addrbpin, addrcpin, addrdpin,
_sclk, _latch, _oe, _a, _b, _c, _d;
// Counters/pointers for interrupt handler:
volatile uint8_t row, plane;
volatile uint8_t *buffptr;
};