Adafruit NeoMatrix
Public Member Functions | Static Public Member Functions | List of all members
Adafruit_NeoMatrix Class Reference

Class for using NeoPixel matrices with the GFX graphics library. More...

#include <Adafruit_NeoMatrix.h>

Inheritance diagram for Adafruit_NeoMatrix:

Public Member Functions

 Adafruit_NeoMatrix (int w, int h, uint8_t pin=6, uint8_t matrixType=NEO_MATRIX_TOP+NEO_MATRIX_LEFT+NEO_MATRIX_ROWS, neoPixelType ledType=NEO_GRB+NEO_KHZ800)
 Construct a single (non-tiled) matrix. More...
 
 Adafruit_NeoMatrix (uint8_t matrixW, uint8_t matrixH, uint8_t tX, uint8_t tY, uint8_t pin=6, uint8_t matrixType=NEO_MATRIX_TOP+NEO_MATRIX_LEFT+NEO_MATRIX_ROWS+NEO_TILE_TOP+NEO_TILE_LEFT+NEO_TILE_ROWS, neoPixelType ledType=NEO_GRB+NEO_KHZ800)
 Construct a tiled matrix. More...
 
void drawPixel (int16_t x, int16_t y, uint16_t color)
 Pixel-drawing function for Adafruit_GFX. More...
 
void fillScreen (uint16_t color)
 Fill matrix with a single color. More...
 
void setPassThruColor (uint32_t c)
 Pass-through is a kludge that lets you override the current drawing color with a 'raw' RGB (or RGBW) value that's issued directly to pixel(s), side-stepping the 16-bit color limitation of Adafruit_GFX. This is not without some limitations of its own – for example, it won't work in conjunction with the background color feature when drawing text or bitmaps (you'll just get a solid rect of color), only 'transparent' text/bitmaps. Also, no gamma correction. Remember to UNSET the passthrough color immediately when done with it (call with no value)! More...
 
void setPassThruColor (void)
 Stop using pass-through color, return to normal 16-bit color usage.
 
void setRemapFunction (uint16_t(*fn)(uint16_t, uint16_t))
 Register a function for mapping X/Y coordinates to absolute pixel indices (for unusual layouts if if NEO_MATRIX_* and NEO_TILE_* settings do not provide sufficient control). More...
 

Static Public Member Functions

static uint16_t Color (uint8_t r, uint8_t g, uint8_t b)
 Quantize a 24-bit RGB color value to 16-bit '565' format. More...
 

Detailed Description

Class for using NeoPixel matrices with the GFX graphics library.

Constructor & Destructor Documentation

◆ Adafruit_NeoMatrix() [1/2]

Adafruit_NeoMatrix::Adafruit_NeoMatrix ( int  w,
int  h,
uint8_t  pin = 6,
uint8_t  matrixType = NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_ROWS,
neoPixelType  ledType = NEO_GRB + NEO_KHZ800 
)

Construct a single (non-tiled) matrix.

Parameters
wMatrix width in pixels.
hMatrix height in pixels.
pinArduino pin number for NeoPixel data out.
matrixTypeMatrix layout - add together NEO_MATRIX_* values to declare orientation, rotation, etc.
ledTypeNeoPixel LED type, similar to Adafruit_NeoPixel constructor (e.g. NEO_GRB).

◆ Adafruit_NeoMatrix() [2/2]

Adafruit_NeoMatrix::Adafruit_NeoMatrix ( uint8_t  matrixW,
uint8_t  matrixH,
uint8_t  tX,
uint8_t  tY,
uint8_t  pin = 6,
uint8_t  matrixType = NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_ROWS + NEO_TILE_TOP + NEO_TILE_LEFT + NEO_TILE_ROWS,
neoPixelType  ledType = NEO_GRB + NEO_KHZ800 
)

Construct a tiled matrix.

Parameters
matrixWIndividual sub-matrix (tile) width in pixels.
matrixHIndividual sub-matrix (tile) height in pixels.
tXNumber of tiles on the X (horizontal) axis.
tYNumber of tiles on the Y (vertical) axis.
pinArduino pin number for NeoPixel data out.
matrixTypeTiled matrix layout - add together NEO_MATRIX_* and NEO_TILE_* values to declare orientation, rotation, etc.
ledTypeNeoPixel LED type, similar to Adafruit_NeoPixel constructor (e.g. NEO_GRB).

Member Function Documentation

◆ drawPixel()

void Adafruit_NeoMatrix::drawPixel ( int16_t  x,
int16_t  y,
uint16_t  color 
)

Pixel-drawing function for Adafruit_GFX.

Parameters
xPixel column (0 = left edge, unless rotation used).
yPixel row (0 = top edge, unless rotation used).
colorPixel color in 16-bit '565' RGB format.

◆ fillScreen()

void Adafruit_NeoMatrix::fillScreen ( uint16_t  color)

Fill matrix with a single color.

Parameters
colorPixel color in 16-bit '565' RGB format.

◆ setPassThruColor()

void Adafruit_NeoMatrix::setPassThruColor ( uint32_t  c)

Pass-through is a kludge that lets you override the current drawing color with a 'raw' RGB (or RGBW) value that's issued directly to pixel(s), side-stepping the 16-bit color limitation of Adafruit_GFX. This is not without some limitations of its own – for example, it won't work in conjunction with the background color feature when drawing text or bitmaps (you'll just get a solid rect of color), only 'transparent' text/bitmaps. Also, no gamma correction. Remember to UNSET the passthrough color immediately when done with it (call with no value)!

Parameters
cPixel color in packed 32-bit 0RGB or WRGB format.

◆ setRemapFunction()

void Adafruit_NeoMatrix::setRemapFunction ( uint16_t(*)(uint16_t, uint16_t)  fn)

Register a function for mapping X/Y coordinates to absolute pixel indices (for unusual layouts if if NEO_MATRIX_* and NEO_TILE_* settings do not provide sufficient control).

Parameters
fnPointer to function that accepts two uint16_t arguments (column and row), returns absolute pixel index.

◆ Color()

uint16_t Adafruit_NeoMatrix::Color ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
static

Quantize a 24-bit RGB color value to 16-bit '565' format.

Parameters
rRed component (0 to 255).
gGreen component (0 to 255).
bBlue component (0 to 255).
Returns
uint16_t Quantized color for GFX drawing functions.

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