muwerk mupplet Display Library
muwerk applets; mupplets: functional units that support specific hardware or reusable applications
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ustd::Max72xxMatrix Class Reference

The MAX72XX Matrix Display Class. More...

#include <max72xx_matrix.h>

Inherits Adafruit_GFX.

Public Member Functions

 Max72xxMatrix (uint8_t csPin, uint8_t hDisplays=1, uint8_t vDisplays=1, uint8_t rotation=0)
 
void begin ()
 
void setPowerSave (bool powersave)
 
void setIntensity (uint8_t intensity)
 
void setTestMode (bool testmode)
 
void write ()
 
void setPosition (uint8_t display, uint8_t x, uint8_t y)
 
void setRotation (uint8_t display, uint8_t rotation)
 
bool getTextWrap () const
 
int16_t getCursorX () const
 
int16_t getCursorY () const
 
void getCharBounds (unsigned char c, int16_t *x, int16_t *y, int16_t *minx, int16_t *miny, int16_t *maxx, int16_t *maxy)
 
bool printFormatted (int16_t x, int16_t y, int16_t w, int16_t align, String content, uint8_t baseLine, uint8_t yAdvance=0)
 
virtual void fillScreen (uint16_t color)
 
void drawPixel (int16_t xx, int16_t yy, uint16_t color)
 

Detailed Description

The MAX72XX Matrix Display Class.

This class derived from Adafruit's core graphics class provides an implementation of a dot matrix display based on 8x8 led modules driven by a maxim MAX7219 or MAX7221 controller connected over SPI.

Constructor & Destructor Documentation

◆ Max72xxMatrix()

ustd::Max72xxMatrix::Max72xxMatrix ( uint8_t  csPin,
uint8_t  hDisplays = 1,
uint8_t  vDisplays = 1,
uint8_t  rotation = 0 
)
inline

Instantiate a Max72xxMatrix instance

Parameters
csPinThe chip select pin.
hDisplaysHorizontal number of 8x8 display units. (default: 1)
vDisplaysVertical number of 8x8 display units. (default: 1)
rotationDefine if and how the displays are rotated. The first display is the one closest to the Connections. rotation can be a numeric value from 0 to 3 representing respectively no rotation, 90 degrees clockwise, 180 degrees and 90 degrees counter clockwise.

Member Function Documentation

◆ begin()

void ustd::Max72xxMatrix::begin ( )
inline

Start the matrix display

◆ drawPixel()

void ustd::Max72xxMatrix::drawPixel ( int16_t  xx,
int16_t  yy,
uint16_t  color 
)
inline

Draw a pixel to the canvas framebuffer

Parameters
xxx coordinate
yyy coordinate
color8-bit Color to fill with. Only lower byte of uint16_t is used.

◆ fillScreen()

virtual void ustd::Max72xxMatrix::fillScreen ( uint16_t  color)
inlinevirtual

Fill the framebuffer completely with one color

Parameters
colorBinary (on or off) color to fill with

◆ getCharBounds()

void ustd::Max72xxMatrix::getCharBounds ( unsigned char  c,
int16_t *  x,
int16_t *  y,
int16_t *  minx,
int16_t *  miny,
int16_t *  maxx,
int16_t *  maxy 
)
inline

Calculates the bounding box of a character

Parameters
cThe ASCII character in question
xPointer to x location of character. Value is modified by this function to advance to next character.
yPointer to y location of character. Value is modified by this function to advance to next character.
minxPointer to minimum X coordinate, passed in to AND returned by this function – this is used to incrementally build a bounding rectangle for a string.
minyPointer to minimum Y coord, passed in AND returned.
maxxPointer to maximum X coord, passed in AND returned.
maxyPointer to maximum Y coord, passed in AND returned.

◆ getCursorX()

int16_t ustd::Max72xxMatrix::getCursorX ( ) const
inline

Get text cursor X location

Returns
X coordinate in digit positions

◆ getCursorY()

int16_t ustd::Max72xxMatrix::getCursorY ( ) const
inline

Get text cursor Y location

Returns
Y coordinate in digit positions

◆ getTextWrap()

bool ustd::Max72xxMatrix::getTextWrap ( ) const
inline

Returns if too long text will be wrapped to the next line

Returns
Wrapping mode

◆ printFormatted()

bool ustd::Max72xxMatrix::printFormatted ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  align,
String  content,
uint8_t  baseLine,
uint8_t  yAdvance = 0 
)
inline

Prints a text at a specified location with a specified formatting

This method prints a text at the specified location with the specified length using left, right or centered alignment. All parameters are checked for plasibility and will be adapted to the current display size.

Parameters
xTop left corner x coordinate
yTop left corner y coordinate
wWidth in digit positions
alignAlignment of the string to display: 0 = left, 1 = center, 2 = right
contentThe string to print
baseLineThe distance between baseline and topline
yAdvanceThe newline distance - If specified, the height of the calculated bounding box is adjusted to a multiple of this value
Returns
true if the string fits the defined space, false if output was truncated

◆ setIntensity()

void ustd::Max72xxMatrix::setIntensity ( uint8_t  intensity)
inline

Set the brightness of the display

Parameters
intensityThe brightness of the display. (0..15)

◆ setPosition()

void ustd::Max72xxMatrix::setPosition ( uint8_t  display,
uint8_t  x,
uint8_t  y 
)
inline

Define how the displays are ordered.

Parameters
displayDisplay index (0 is the first)
xHorizontal display index
yVertical display index

◆ setPowerSave()

void ustd::Max72xxMatrix::setPowerSave ( bool  powersave)
inline

Set the power saving mode for the display

Parameters
powersaveIf true the display goes into power-down mode. Set to false for normal operation.

◆ setRotation()

void ustd::Max72xxMatrix::setRotation ( uint8_t  display,
uint8_t  rotation 
)
inline

Define if and how the displays are rotated.

Parameters
displayDisplay index (0 is the first)
rotationRotation of the display: 0: no rotation 1: 90 degrees clockwise 2: 180 degrees 3: 90 degrees counter clockwise

◆ setTestMode()

void ustd::Max72xxMatrix::setTestMode ( bool  testmode)
inline

Set the test mode for the display

Parameters
testmodeIf true the display goes into test mode. Set to false for normal operation.

◆ write()

void ustd::Max72xxMatrix::write ( )
inline

Flushes the frame buffer to the display

In order to implement flicker free double buffering, no graphic function has any immediate effect on the display. All graphic operations are buffered into a frame buffer. By calling this method, the current content of the frame buffer is displayed.


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