RGB matrix Panel
|
Class encapsulating RGB LED matrix functionality. More...
#include <RGBmatrixPanel.h>
Public Member Functions | |
RGBmatrixPanel (uint8_t a, uint8_t b, uint8_t c, uint8_t clk, uint8_t lat, uint8_t oe, boolean dbuf) | |
Constructor for 16x32 panel. More... | |
RGBmatrixPanel (uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t clk, uint8_t lat, uint8_t oe, boolean dbuf, uint8_t width=32) | |
Constructor for 32x32 or 32x64 panel. More... | |
void | begin (void) |
Start RGB matrix. Initializes timers and interrupts. | |
void | drawPixel (int16_t x, int16_t y, uint16_t c) |
Lowest-level pixel drawing function required by Adafruit_GFX. Does not have an immediate effect – must call updateDisplay() after any drawing operations to refresh matrix contents. More... | |
void | fillScreen (uint16_t c) |
Fill entire matrix a single color. Does not have an immediate effect – must call updateDisplay() after any drawing operations to refresh matrix contents. More... | |
void | updateDisplay (void) |
Refresh matrix contents following one or more drawing calls. | |
void | swapBuffers (boolean) |
If using double buffering, swap the front and back buffers. | |
void | dumpMatrix (void) |
Dump display contents to the Serial Monitor, adding some formatting to simplify copy-and-paste of data as a PROGMEM- embedded image for another sketch. If using multiple dumps this way, you'll need to edit the output to change the 'img' name for each. Data can then be loaded back into the display using a pgm_read_byte() loop. | |
uint8_t * | backBuffer (void) |
Get address of back buffer – can then load/store data directly. Format is very strangely interleaved, used at the lowest level by the timer interrupt, and not an intuitive pixel sequence, so this will likely only be used with data previously stored from dumpMatrix(). More... | |
uint16_t | Color333 (uint8_t r, uint8_t g, uint8_t b) |
Promote 3-bits R,G,B (used by earlier versions of this library) to the '565' color format used in Adafruit_GFX. New code should not use this, it's provided for backward compatibility. More... | |
uint16_t | Color444 (uint8_t r, uint8_t g, uint8_t b) |
Promote 4-bits R,G,B (handled by the current version of this library) to the '565' color format used in Adafruit_GFX. More... | |
uint16_t | Color888 (uint8_t r, uint8_t g, uint8_t b) |
Decimate 8-bits R,G,B (used in a lot of existing graphics code in other projects and languages) to the '565' color format used in Adafruit_GFX. More... | |
uint16_t | Color888 (uint8_t r, uint8_t g, uint8_t b, boolean gflag) |
Decimate 8-bits R,G,B (used in a lot of existing graphics code in other projects and languages) to the '565' color format used in Adafruit_GFX, applying gamma correction if requested. More... | |
uint16_t | ColorHSV (long hue, uint8_t sat, uint8_t val, boolean gflag) |
Convert hue, saturation, value (used in some existing graphics code in other projects and languages) to the '565' RGB color format used in Adafruit_GFX, with gamma correction if requested. More... | |
Class encapsulating RGB LED matrix functionality.
RGBmatrixPanel::RGBmatrixPanel | ( | uint8_t | a, |
uint8_t | b, | ||
uint8_t | c, | ||
uint8_t | clk, | ||
uint8_t | lat, | ||
uint8_t | oe, | ||
boolean | dbuf | ||
) |
Constructor for 16x32 panel.
a | Address/row-select A pin number. |
b | Address/row-select B pin number. |
c | Address/row-select C pin number. |
clk | RGB clock pin number. |
lat | RGB latch pin number. |
oe | Output enable pin number. |
dbuf | If true, display is double-buffered, allowing for smoother animation (requires 2X RAM). |
RGBmatrixPanel::RGBmatrixPanel | ( | uint8_t | a, |
uint8_t | b, | ||
uint8_t | c, | ||
uint8_t | d, | ||
uint8_t | clk, | ||
uint8_t | lat, | ||
uint8_t | oe, | ||
boolean | dbuf, | ||
uint8_t | width = 32 |
||
) |
Constructor for 32x32 or 32x64 panel.
a | Address/row-select A pin number. |
b | Address/row-select B pin number. |
c | Address/row-select C pin number. |
d | Address/row-select D pin number. |
clk | RGB clock pin number. |
lat | RGB latch pin number. |
oe | Output enable pin number. |
dbuf | If true, display is double-buffered, allowing for smoother animation (requires 2X RAM). |
width | Specify 32 or 64 for the two supported matrix widths (default is 32). |
void RGBmatrixPanel::drawPixel | ( | int16_t | x, |
int16_t | y, | ||
uint16_t | c | ||
) |
Lowest-level pixel drawing function required by Adafruit_GFX. Does not have an immediate effect – must call updateDisplay() after any drawing operations to refresh matrix contents.
x | Pixel column (horizontal). |
y | Pixel row (vertical). |
c | Pixel color (16-bit 5/6/5 color, but actual color on matrix will be decimated from this as it uses fewer bitplanes). |
void RGBmatrixPanel::fillScreen | ( | uint16_t | c | ) |
Fill entire matrix a single color. Does not have an immediate effect – must call updateDisplay() after any drawing operations to refresh matrix contents.
c | Color (16-bit 5/6/5 color, but actual color on matrix will be decimated from this as it uses fewer bitplanes). |
uint8_t * RGBmatrixPanel::backBuffer | ( | void | ) |
Get address of back buffer – can then load/store data directly. Format is very strangely interleaved, used at the lowest level by the timer interrupt, and not an intuitive pixel sequence, so this will likely only be used with data previously stored from dumpMatrix().
uint16_t RGBmatrixPanel::Color333 | ( | uint8_t | r, |
uint8_t | g, | ||
uint8_t | b | ||
) |
Promote 3-bits R,G,B (used by earlier versions of this library) to the '565' color format used in Adafruit_GFX. New code should not use this, it's provided for backward compatibility.
r | Red value, 0-7. |
g | Green value, 0-7. |
b | Blue value, 0-7. |
uint16_t RGBmatrixPanel::Color444 | ( | uint8_t | r, |
uint8_t | g, | ||
uint8_t | b | ||
) |
Promote 4-bits R,G,B (handled by the current version of this library) to the '565' color format used in Adafruit_GFX.
r | Red value, 0-15. |
g | Green value, 0-15. |
b | Blue value, 0-15. |
uint16_t RGBmatrixPanel::Color888 | ( | uint8_t | r, |
uint8_t | g, | ||
uint8_t | b | ||
) |
Decimate 8-bits R,G,B (used in a lot of existing graphics code in other projects and languages) to the '565' color format used in Adafruit_GFX.
r | Red value, 0-255. |
g | Green value, 0-255. |
b | Blue value, 0-255. |
uint16_t RGBmatrixPanel::Color888 | ( | uint8_t | r, |
uint8_t | g, | ||
uint8_t | b, | ||
boolean | gflag | ||
) |
Decimate 8-bits R,G,B (used in a lot of existing graphics code in other projects and languages) to the '565' color format used in Adafruit_GFX, applying gamma correction if requested.
r | Red value, 0-255. |
g | Green value, 0-255. |
b | Blue value, 0-255. |
gflag | If true, run 8-bit inputs through gamma correction table. |
uint16_t RGBmatrixPanel::ColorHSV | ( | long | hue, |
uint8_t | sat, | ||
uint8_t | val, | ||
boolean | gflag | ||
) |
Convert hue, saturation, value (used in some existing graphics code in other projects and languages) to the '565' RGB color format used in Adafruit_GFX, with gamma correction if requested.
hue | Hue (0 to 1535). |
sat | Saturation (0 (monochrome) to 255 (full color)). |
val | Value (0 (darkest) to 255 (brightest)). |
gflag | If true, apply gamma correction table. |