RGB matrix Panel
Public Member Functions | List of all members
RGBmatrixPanel Class Reference

Class encapsulating RGB LED matrix functionality. More...

#include <RGBmatrixPanel.h>

Inheritance diagram for RGBmatrixPanel:

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...
 

Detailed Description

Class encapsulating RGB LED matrix functionality.

Constructor & Destructor Documentation

◆ RGBmatrixPanel() [1/2]

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.

Parameters
aAddress/row-select A pin number.
bAddress/row-select B pin number.
cAddress/row-select C pin number.
clkRGB clock pin number.
latRGB latch pin number.
oeOutput enable pin number.
dbufIf true, display is double-buffered, allowing for smoother animation (requires 2X RAM).
Note
pinlist (SAMD only) uint8_t array of 6 pin numbers corresponding to upper R, G, B and lower R, G, B pins.

◆ RGBmatrixPanel() [2/2]

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.

Parameters
aAddress/row-select A pin number.
bAddress/row-select B pin number.
cAddress/row-select C pin number.
dAddress/row-select D pin number.
clkRGB clock pin number.
latRGB latch pin number.
oeOutput enable pin number.
dbufIf true, display is double-buffered, allowing for smoother animation (requires 2X RAM).
widthSpecify 32 or 64 for the two supported matrix widths (default is 32).
Note
pinlist (SAMD only) uint8_t array of 6 pin numbers corresponding to upper R, G, B and lower R, G, B pins.

Member Function Documentation

◆ drawPixel()

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.

Parameters
xPixel column (horizontal).
yPixel row (vertical).
cPixel color (16-bit 5/6/5 color, but actual color on matrix will be decimated from this as it uses fewer bitplanes).

◆ fillScreen()

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.

Parameters
cColor (16-bit 5/6/5 color, but actual color on matrix will be decimated from this as it uses fewer bitplanes).

◆ backBuffer()

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().

Returns
uint8_t* pointer to back buffer.

◆ Color333()

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.

Parameters
rRed value, 0-7.
gGreen value, 0-7.
bBlue value, 0-7.
Returns
16-bit '565' color as used by Adafruit_GFX, can then be passed to drawing functions. Actual colors issued to matrix will be decimated from this, since it uses fewer bitplanes.

◆ Color444()

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.

Parameters
rRed value, 0-15.
gGreen value, 0-15.
bBlue value, 0-15.
Returns
16-bit '565' color as used by Adafruit_GFX, can then be passed to drawing functions. Actual colors issued to matrix will be decimated from this (back to 444), since it uses fewer bitplanes.

◆ Color888() [1/2]

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.

Parameters
rRed value, 0-255.
gGreen value, 0-255.
bBlue value, 0-255.
Returns
16-bit '565' color as used by Adafruit_GFX, can then be passed to drawing functions. Actual colors issued to matrix will be further decimated from this, since it uses fewer bitplanes.

◆ Color888() [2/2]

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.

Parameters
rRed value, 0-255.
gGreen value, 0-255.
bBlue value, 0-255.
gflagIf true, run 8-bit inputs through gamma correction table.
Returns
16-bit '565' color as used by Adafruit_GFX, can then be passed to drawing functions. Actual colors issued to matrix will be further decimated from this, since it uses fewer bitplanes.

◆ ColorHSV()

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.

Parameters
hueHue (0 to 1535).
satSaturation (0 (monochrome) to 255 (full color)).
valValue (0 (darkest) to 255 (brightest)).
gflagIf true, apply gamma correction table.
Returns
16-bit '565' color as used by Adafruit_GFX, can then be passed to drawing functions. Actual colors issued to matrix will be decimated from this, since it uses fewer bitplanes.

The documentation for this class was generated from the following files: