forked from adafruit/RGB-matrix-Panel
-
Notifications
You must be signed in to change notification settings - Fork 7
/
RGBmatrixPanel.h
65 lines (54 loc) · 2.05 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
53
54
55
56
57
58
59
60
61
62
63
64
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#include "pins_arduino.h"
#endif
#include "Adafruit_GFX.h"
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, uint8_t pwidth);
/* Parameters
a, b, c are the pins used for addressing the rows
cclk, latch and oe are the pins used for Serial Clock, Latach and Output Enable
dbuf enables double buffering. This will use 2x RAM for frame buffer, but will give nice smooth animation
pwidth is the number of Panels used together in a multi panel configuration
*/
// Constructor for 32x32 panel (adds 'd' pin): (THIS HAS NOT BEEN TESTED WITH MULTIPLE PANELS)
RGBmatrixPanel(uint8_t a, uint8_t b, uint8_t c, uint8_t d,
uint8_t sclk, uint8_t latch, uint8_t oe, boolean dbuf,uint8_t pwidth);
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);
// Printing
private:
uint8_t *matrixbuff[2];
uint8_t nRows, nPlanes, backindex, nPanels;
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 pwidth);
// 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;
};