LedController  2.0.2
A library for the MAX7219 and the MAX7221 Led display drivers.
sakurajin::LedController< columns, rows > Class Template Reference

This class provied a control interface for MAX7219 and MAX7221 Led display drivers. More...

#include <LedController_template.hpp>

Collaboration diagram for sakurajin::LedController< columns, rows >:
Collaboration graph

Public Member Functions

void activateAllSegments () noexcept
 Get all segments out of power-down mode for normal operation. More...
 
void activateSegment (unsigned int segmentNumber) noexcept
 Get the segment out of power-down mode for normal operation. More...
 
void clearMatrix () noexcept
 clears all segments, turning all LEDs off. More...
 
void clearSegment (unsigned int segmentNumber) noexcept
 clears a given segment, turning all its LEDs off. More...
 
void displayOnSegment (unsigned int column, unsigned int row_num, sakurajin::ByteBlock data) noexcept
 Display 8 lines on the given segment. More...
 
void displayOnSegment (unsigned int segmentindex, sakurajin::ByteBlock data) noexcept
 Display 8 lines on the given segment. More...
 
const sakurajin::controller_configuration< columns, rows > & getConfig () noexcept
 Get the Config of the Led Controller. More...
 
byte getRow (unsigned int segmentNumber, unsigned int row) noexcept
 get one Row of one segment. More...
 
unsigned int getSegmentCount () noexcept
 Get the number of configured segments. More...
 
sakurajin::ByteBlock getSegmentData (unsigned int column, unsigned int row_num) noexcept
 Get the Segment Data of a specific Segment. More...
 
void getSegmentData (unsigned int column, unsigned int row_num, sakurajin::ByteBlock *resultLocation) noexcept
 Get the Segment Data of a specific Segment. More...
 
sakurajin::ByteBlock getSegmentData (unsigned int segmentindex) noexcept
 Get the Segment Data of a specific Segment. More...
 
void getSegmentData (unsigned int segmentindex, sakurajin::ByteBlock *resultLocation) noexcept
 Get the Segment Data of a specific Segment. More...
 
void init (const sakurajin::controller_configuration< columns, rows > &configuration) noexcept
 initilizes the LedController with a given configuration More...
 
void init (unsigned int csPin) noexcept
 initilizes the LedController for use with hardware SPI More...
 
void init (unsigned int dataPin, unsigned int clkPin, unsigned int csPin, bool useHardwareSpi=false) noexcept
 initilizes the LedController More...
 
bool isInitilized () noexcept
 returns the status of the LedController More...
 
 LedController () noexcept
 Construct a new LedController without initilizing anything. More...
 
 LedController (const LedController &other) noexcept
 The copy constructor for the LedController. More...
 
 LedController (const sakurajin::controller_configuration< columns, rows > &configuration) noexcept
 Construct a new Led Controller from a given configuration. More...
 
 LedController (unsigned int csPin) noexcept
 Construct a new LedController for use with hardware SPI. More...
 
 LedController (unsigned int dataPin, unsigned int clkPin, unsigned int csPin, bool useHardwareSpi=false) noexcept
 Construct a new LedController object. More...
 
sakurajin::ByteBlock makeColumns (sakurajin::ByteBlock rowArray) noexcept
 Turns an sakurajin::ByteBlock of rows into an sakurajin::ByteBlock of columns. More...
 
void makeColumns (sakurajin::ByteBlock rowArray, sakurajin::ByteBlock *columnArray) noexcept
 Turns an array of rows into an array of columns. More...
 
byte moveColumnDown (byte shiftedInRow=0x00, unsigned int col_num=0) noexcept
 moves the data of a column down by one More...
 
byte moveColumnUp (byte shiftedInRow=0x00, unsigned int col_num=0) noexcept
 moves the data of a column up by one More...
 
sakurajin::ByteRow< columns > moveDown () noexcept
 moves the data down by one and 0x00 will be shifted in More...
 
sakurajin::ByteRow< columns > moveDown (const sakurajin::ByteRow< columns > &shiftedInColumn) noexcept
 moves all columns down. More...
 
void moveDown (const sakurajin::ByteRow< columns > &shiftedInRow, sakurajin::ByteRow< columns > *shiftedOutRow) noexcept
 moves the data down by one More...
 
void moveDown (sakurajin::ByteRow< columns > *shiftedOutRow) noexcept
 moves the data down by one and 0x00 will be shifted in More...
 
sakurajin::ByteRow< rows > moveLeft () noexcept
 moves the data left by one and 0x00 will be shifted in More...
 
byte moveLeft (byte shiftedInColumn) noexcept
 moves the data left by one More...
 
sakurajin::ByteRow< rows > moveLeft (const sakurajin::ByteRow< rows > &shiftedInColumn) noexcept
 moves all rows to the left. More...
 
void moveLeft (const sakurajin::ByteRow< rows > &shiftedInColumn, sakurajin::ByteRow< rows > *shiftedOutColumn) noexcept
 moves all rows to the left. The passed Arrays need to have the same length as the number of rows, or be a nullptr. If shiftedInColumn is a nullptr, 0x00 will be used for all rows. More...
 
sakurajin::ByteRow< rows > moveRight () noexcept
 moves the data right by one and 0x00 will be shifted in More...
 
byte moveRight (byte shiftedInColumn) noexcept
 moves the data left by one More...
 
sakurajin::ByteRow< rows > moveRight (const sakurajin::ByteRow< rows > &shiftedInColumn) noexcept
 moves all rows to the right. More...
 
void moveRight (const sakurajin::ByteRow< rows > &shiftedInColumn, sakurajin::ByteRow< rows > *shiftedOutColumn) noexcept
 moves all rows to the right. The passed Arrays need to have the same length as the number of rows, or be a nullptr. If shiftedInColumn is a nullptr, 0x00 will be used for all rows. More...
 
byte moveRowLeft (byte shiftedInColumn=0x00, unsigned int row_num=0) noexcept
 moves the data left by one More...
 
byte moveRowRight (byte shiftedInColumn=0x00, unsigned int row_num=0) noexcept
 moves the data left by one More...
 
sakurajin::ByteRow< columns > moveUp () noexcept
 moves the data up by one and 0x00 will be shifted in More...
 
sakurajin::ByteRow< columns > moveUp (const sakurajin::ByteRow< columns > &shiftedInColumn) noexcept
 moves all columns up. More...
 
void moveUp (const sakurajin::ByteRow< columns > &shiftedInRow, sakurajin::ByteRow< columns > *shiftedOutRow) noexcept
 moves the data up by one More...
 
void moveUp (sakurajin::ByteRow< columns > *shiftedOutRow) noexcept
 moves the data up by oneand 0x00 will be shifted in More...
 
void refreshSegment (unsigned int segmentNumber) noexcept
 refreshes a given segment by first resetting it and then updating it. More...
 
void refreshSegments () noexcept
 refreshes all segments by first resetting them and then updating them. More...
 
void resetMatrix () noexcept
 activates all segments, sets to same intensity and clears them More...
 
byte reverse (byte input) noexcept
 This function changes to bitorder of a byte (useful to mirror "images" you want to display) More...
 
sakurajin::ByteBlock reverse (sakurajin::ByteBlock input) noexcept
 Reverse an sakurajin::ByteBlock of 8 bytes (mirror it) More...
 
void reverse (sakurajin::ByteBlock input, sakurajin::ByteBlock *reversedInput) noexcept
 Reverse an array of 8 bytes (mirror it) More...
 
sakurajin::ByteBlock rotate180 (sakurajin::ByteBlock input) noexcept
 rotate an sakurajin::ByteBlock by 180 degrees More...
 
void rotate180 (sakurajin::ByteBlock input, sakurajin::ByteBlock *rotatedInput) noexcept
 rotate an byte[8] array by 180 degrees More...
 
void setChar (unsigned int segmentNumber, unsigned int digit, char value, boolean dp) noexcept
 Set the Display a character on a 7-Segment display. More...
 
void setColumn (unsigned int segmentNumber, unsigned int col, byte value) noexcept
 Set one column of a given segment. More...
 
void setDigit (unsigned int segmentNumber, unsigned int digit, byte value, boolean dp) noexcept
 Set a hexadecimal digit on a 7-Segment Display. More...
 
void setIntensity (unsigned int newIntesityLevel) noexcept
 Set the Intensity of the whole matrix to the given value. More...
 
void setLed (unsigned int segmentNumber, unsigned int row, unsigned int column, boolean state) noexcept
 Set a single led to a given value. More...
 
void setRow (unsigned int segmentNumber, unsigned int row, byte value) noexcept
 Set one Row of one segment. More...
 
void setScanLimit (unsigned int segmentNumber, unsigned int limit) noexcept
 Set the number of digits (or rows) to be displayed (default: 7). More...
 
void shutdownAllSegments () noexcept
 Set all segments into power-down mode. More...
 
void shutdownSegment (unsigned int segmentNumber) noexcept
 Set the segment in power-down mode. More...
 
void updateSegment (unsigned int segmentNumber) noexcept
 update a given segment by displaying the internally stored state of the segment. More...
 
void updateSegments () noexcept
 update all segments by displaying the internally stored state of the segments. More...
 
 ~LedController () noexcept
 Destroy the Led Controller object and free the memory. More...
 

Protected Member Functions

void initConf () noexcept
 initilize the configuration More...
 
void initSPI () noexcept
 initilize the spi outputs More...
 
void resetBuffers () noexcept
 initilize the internal buffers of the LedController. More...
 
void setIntensity (unsigned int segmentNumber, unsigned int newIntesityLevel) noexcept
 Set the brightness of the segment. More...
 
void spiTransfer (unsigned int segment, byte opcode, byte data) noexcept
 This function transfers one command to the attached module. More...
 

Protected Attributes

sakurajin::controller_configuration< columns, rows > conf
 The configuration of the LedController. More...
 
bool initilized = false
 True if the LedController is fully initilized. More...
 
sakurajin::ByteBlock LedStates [columns *rows]
 This array contains the state of all of the LEDs. More...
 
byte spidata [rows *columns *2]
 The array for shifting the data to the devices. More...
 

Detailed Description

template<size_t columns, size_t rows>
class sakurajin::LedController< columns, rows >

This class provied a control interface for MAX7219 and MAX7221 Led display drivers.

Todo:
make it threading safe

This Controller Class is mainly target at led matracies consisting of more than 1 segment. While it can also handle 7-Segment Displays it is not tested that well.

Warning
This object is not thread safe yet.

Definition at line 40 of file LedController_template.hpp.

Constructor & Destructor Documentation

◆ LedController() [1/5]

template<size_t columns, size_t rows>
sakurajin::LedController< columns, rows >::LedController
noexcept

Construct a new LedController without initilizing anything.

Definition at line 9 of file LedController_core.hpp.

◆ LedController() [2/5]

template<size_t columns, size_t rows>
sakurajin::LedController< columns, rows >::LedController ( unsigned int  csPin)
noexcept

Construct a new LedController for use with hardware SPI.

Note
Only virtualMultiRow is possible with this Constructor. A custom configuration is needed to have different CS Pins for each row.
Parameters
csPinThe pin to select the led matrix

Definition at line 12 of file LedController_core.hpp.

◆ LedController() [3/5]

template<size_t columns, size_t rows>
sakurajin::LedController< columns, rows >::LedController ( unsigned int  dataPin,
unsigned int  clkPin,
unsigned int  csPin,
bool  useHardwareSpi = false 
)
noexcept

Construct a new LedController object.

Note
Only virtualMultiRow is possible with this Constructor. A custom configuration is needed to have different CS Pins for each row.
Parameters
dataPinpin on the Arduino where data gets shifted out (DIN)
clkPinpin for the clock (CLK)
csPinpin for selecting the device (CS)
useHardwareSpitrue if you want to use hardware SPI (view https://www.arduino.cc/en/Reference/SPI for pin config)

Definition at line 17 of file LedController_core.hpp.

◆ LedController() [4/5]

template<size_t columns, size_t rows>
sakurajin::LedController< columns, rows >::LedController ( const sakurajin::controller_configuration< columns, rows > &  configuration)
noexcept

Construct a new Led Controller from a given configuration.

Parameters
configurationthe configuration that should be used for the Controller

Definition at line 23 of file LedController_core.hpp.

◆ ~LedController()

template<size_t columns, size_t rows>
sakurajin::LedController< columns, rows >::~LedController
noexcept

Destroy the Led Controller object and free the memory.

Definition at line 4 of file LedController_core.hpp.

◆ LedController() [5/5]

template<size_t columns, size_t rows>
sakurajin::LedController< columns, rows >::LedController ( const LedController< columns, rows > &  other)
noexcept

The copy constructor for the LedController.

Parameters
otherthe LedController which should have its state copied

Definition at line 28 of file LedController_core.hpp.

Member Function Documentation

◆ activateAllSegments()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::activateAllSegments
noexcept

Get all segments out of power-down mode for normal operation.

Definition at line 100 of file LedController_display.hpp.

◆ activateSegment()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::activateSegment ( unsigned int  segmentNumber)
noexcept

Get the segment out of power-down mode for normal operation.

Parameters
segmentNumberThe segment to control

Definition at line 80 of file LedController_display.hpp.

References sakurajin::MAX72XX::OP_SHUTDOWN.

◆ clearMatrix()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::clearMatrix
noexcept

clears all segments, turning all LEDs off.

Definition at line 42 of file LedController_display.hpp.

◆ clearSegment()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::clearSegment ( unsigned int  segmentNumber)
noexcept

clears a given segment, turning all its LEDs off.

Parameters
segmentNumberThe segment to control.

Definition at line 111 of file LedController_display.hpp.

◆ displayOnSegment() [1/2]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::displayOnSegment ( unsigned int  column,
unsigned int  row_num,
sakurajin::ByteBlock  data 
)
noexcept

Display 8 lines on the given segment.

Parameters
columnthe column where the wanted segment is
row_numthe row where the wanted segment is
dataan array containing the data for all the pixels that should be displayed on that segment

Definition at line 65 of file LedController_display.hpp.

◆ displayOnSegment() [2/2]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::displayOnSegment ( unsigned int  segmentindex,
sakurajin::ByteBlock  data 
)
noexcept

Display 8 lines on the given segment.

Parameters
segmentindexthe Segment number of the desired segment
dataan array containing the data for all the pixels that should be displayed on that segment

Definition at line 53 of file LedController_display.hpp.

◆ getConfig()

template<size_t columns, size_t rows>
const sakurajin::controller_configuration< columns, rows > & sakurajin::LedController< columns, rows >::getConfig
noexcept

Get the Config of the Led Controller.

Returns
controlller_configuration the configuration

Definition at line 175 of file LedController_core.hpp.

◆ getRow()

template<size_t columns, size_t rows>
byte sakurajin::LedController< columns, rows >::getRow ( unsigned int  segmentNumber,
unsigned int  row 
)
noexcept

get one Row of one segment.

Parameters
segmentNumberThe Segment which should be modified
rowThe row which should be modified
Returns
value each bit set to 1 will light up the corresponding Led.

Definition at line 135 of file LedController_display.hpp.

◆ getSegmentCount()

template<size_t columns, size_t rows>
unsigned int sakurajin::LedController< columns, rows >::getSegmentCount
noexcept

Get the number of configured segments.

Returns
unsigned int The number of configured segments

Definition at line 170 of file LedController_core.hpp.

◆ getSegmentData() [1/4]

template<size_t columns, size_t rows>
sakurajin::ByteBlock sakurajin::LedController< columns, rows >::getSegmentData ( unsigned int  column,
unsigned int  row_num 
)
noexcept

Get the Segment Data of a specific Segment.

Parameters
columnthe column where the wanted segment is
row_numthe row where the wanted segment is
Returns
sakurajin::ByteBlock the requested segment

Definition at line 165 of file LedController_core.hpp.

◆ getSegmentData() [2/4]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::getSegmentData ( unsigned int  column,
unsigned int  row_num,
sakurajin::ByteBlock resultLocation 
)
noexcept

Get the Segment Data of a specific Segment.

Deprecated:
the function with sakurajin::ByteBlock as return type should be used.

Will be removed in version 2.2.0

Todo:
remove function in version 2.2.0
Parameters
columnthe column where the wanted segment is
row_numthe row where the wanted segment is
resultLocationthe location where the data should be stored

Definition at line 140 of file LedController_core.hpp.

◆ getSegmentData() [3/4]

template<size_t columns, size_t rows>
sakurajin::ByteBlock sakurajin::LedController< columns, rows >::getSegmentData ( unsigned int  segmentindex)
noexcept

Get the Segment Data of a specific Segment.

Parameters
segmentindexthe index of whose data you want to have
Returns
sakurajin::ByteBlock the requested segment

Definition at line 157 of file LedController_core.hpp.

◆ getSegmentData() [4/4]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::getSegmentData ( unsigned int  segmentindex,
sakurajin::ByteBlock resultLocation 
)
noexcept

Get the Segment Data of a specific Segment.

Deprecated:
the function with sakurajin::ByteBlock as return type should be used.

Will be removed in version 2.2.0

Todo:
remove function in version 2.2.0
Parameters
segmentindexthe index of whose data you want to have
resultLocationthe location where the data should be stored

Definition at line 146 of file LedController_core.hpp.

◆ init() [1/3]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::init ( const sakurajin::controller_configuration< columns, rows > &  configuration)
noexcept

initilizes the LedController with a given configuration

Parameters
configurationThe configuration that should be used

Definition at line 76 of file LedController_core.hpp.

◆ init() [2/3]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::init ( unsigned int  csPin)
noexcept

initilizes the LedController for use with hardware SPI

Note
Only virtualMultiRow is possible with this initilization. A custom configuration is needed to have different CS Pins for each row.
Parameters
csPinThe pin to select the led matrix

Definition at line 49 of file LedController_core.hpp.

References sakurajin::controller_configuration< columns, rows >::SPI_CS, and sakurajin::controller_configuration< columns, rows >::useHardwareSpi.

◆ init() [3/3]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::init ( unsigned int  dataPin,
unsigned int  clkPin,
unsigned int  csPin,
bool  useHardwareSpi = false 
)
noexcept

initilizes the LedController

Note
Only virtualMultiRow is possible with this initilization. A custom configuration is needed to have different CS Pins for each row.
Parameters
dataPinpin on the Arduino where data gets shifted out (DIN)
clkPinpin for the clock (CLK)
csPinpin for selecting the device (CS)
useHardwareSpitrue if you want to use hardware SPI (view https://www.arduino.cc/en/Reference/SPI for pin config)

Definition at line 59 of file LedController_core.hpp.

References sakurajin::controller_configuration< columns, rows >::SPI_CLK, sakurajin::controller_configuration< columns, rows >::SPI_CS, sakurajin::controller_configuration< columns, rows >::SPI_MOSI, and sakurajin::controller_configuration< columns, rows >::useHardwareSpi.

◆ initConf()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::initConf
protectednoexcept

initilize the configuration

Definition at line 94 of file LedController_core.hpp.

◆ initSPI()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::initSPI
protectednoexcept

initilize the spi outputs

Definition at line 104 of file LedController_core.hpp.

◆ isInitilized()

template<size_t columns, size_t rows>
bool sakurajin::LedController< columns, rows >::isInitilized
noexcept

returns the status of the LedController

Returns
true the LedController is initilized
false the LedController is not initilized

Definition at line 134 of file LedController_core.hpp.

◆ makeColumns() [1/2]

template<size_t columns, size_t rows>
sakurajin::ByteBlock sakurajin::LedController< columns, rows >::makeColumns ( sakurajin::ByteBlock  rowArray)
noexcept

Turns an sakurajin::ByteBlock of rows into an sakurajin::ByteBlock of columns.

Parameters
rowArraythe sakurajin::ByteBlock of rows of which you want the columns of
Returns
sakurajin::ByteBlock The Columns of the given sakurajin::ByteBlock

Definition at line 22 of file LedController_transformation.hpp.

References sakurajin::ByteBlock::makeColumns().

Here is the call graph for this function:

◆ makeColumns() [2/2]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::makeColumns ( sakurajin::ByteBlock  rowArray,
sakurajin::ByteBlock columnArray 
)
noexcept

Turns an array of rows into an array of columns.

Deprecated:
the function with sakurajin::ByteBlock as return type should be used.

Will be removed in version 2.2.0

Todo:
remove function in version 2.2.0
Parameters
rowArraythe array of rows of which you want the columns
columnArrayThe address where the result will be stored

Definition at line 38 of file LedController_transformation.hpp.

References sakurajin::ByteBlock::makeColumns().

Here is the call graph for this function:

◆ moveColumnDown()

template<size_t columns, size_t rows>
byte sakurajin::LedController< columns, rows >::moveColumnDown ( byte  shiftedInRow = 0x00,
unsigned int  col_num = 0 
)
noexcept

moves the data of a column down by one

Parameters
shiftedInRowthe date the will be shifted in on the top
col_numthe index of the column that will be moved
Returns
byte the row that will be shifted out

Definition at line 117 of file LedController_movement.hpp.

◆ moveColumnUp()

template<size_t columns, size_t rows>
byte sakurajin::LedController< columns, rows >::moveColumnUp ( byte  shiftedInRow = 0x00,
unsigned int  col_num = 0 
)
noexcept

moves the data of a column up by one

Parameters
shiftedInRowthe date the will be shifted in on the bottom
col_numthe index of the column that will be moved
Returns
byte the row that will be shifted out

Definition at line 82 of file LedController_movement.hpp.

◆ moveDown() [1/4]

template<size_t columns, size_t rows>
sakurajin::ByteRow< columns > sakurajin::LedController< columns, rows >::moveDown
noexcept

moves the data down by one and 0x00 will be shifted in

Returns
sakurajin::ByteRow<columns> This Array contains the bytes that will be shifted out on each Row.

Definition at line 147 of file LedController_movement.hpp.

◆ moveDown() [2/4]

template<size_t columns, size_t rows>
sakurajin::ByteRow< columns > sakurajin::LedController< columns, rows >::moveDown ( const sakurajin::ByteRow< columns > &  shiftedInColumn)
noexcept

moves all columns down.

Parameters
shiftedInColumnThis Array contains what will be shifted in on each Row.
Returns
sakurajin::ByteRow<columns> This Array contains the bytes that will be shifted out on each Row.

Definition at line 194 of file LedController_movement.hpp.

◆ moveDown() [3/4]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::moveDown ( const sakurajin::ByteRow< columns > &  shiftedInRow,
sakurajin::ByteRow< columns > *  shiftedOutRow 
)
noexcept

moves the data down by one

Deprecated:
the function with sakurajin::ByteRow as return type should be used.

Will be removed in version 2.2.0

Todo:
remove function in version 2.2.0
Parameters
shiftedInRowThe row that will be shifted in on the top (default 0x00)
shiftedOutRowThe address of the row that will be shifted out on the bottom

Definition at line 230 of file LedController_movement.hpp.

◆ moveDown() [4/4]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::moveDown ( sakurajin::ByteRow< columns > *  shiftedOutRow)
noexcept

moves the data down by one and 0x00 will be shifted in

Deprecated:
the function with sakurajin::ByteRow as return type should be used.

Will be removed in version 2.2.0

Todo:
remove function in version 2.2.0
Parameters
shiftedOutRowThe address of the row that will be shifted out on the bottom

Definition at line 224 of file LedController_movement.hpp.

◆ moveLeft() [1/4]

template<size_t columns, size_t rows>
sakurajin::ByteRow< rows > sakurajin::LedController< columns, rows >::moveLeft
noexcept

moves the data left by one and 0x00 will be shifted in

Returns
sakurajin::ByteRow<rows> This Array contains the bytes that will be shifted out on each Row.

Definition at line 157 of file LedController_movement.hpp.

◆ moveLeft() [2/4]

template<size_t columns, size_t rows>
byte sakurajin::LedController< columns, rows >::moveLeft ( byte  shiftedInColumn)
noexcept

moves the data left by one

Deprecated:
to be reomoved in version 2.1.0, moveRowLeft should be used
Todo:
remove function in version 2.1.0
Parameters
shiftedInColumnThe column that will be shifted to the right (default 0x00)
Warning
ONLY moves row 0, this function exists for backwards compatibility
Returns
byte The column that gets shifted out on the left

Definition at line 206 of file LedController_movement.hpp.

◆ moveLeft() [3/4]

template<size_t columns, size_t rows>
sakurajin::ByteRow< rows > sakurajin::LedController< columns, rows >::moveLeft ( const sakurajin::ByteRow< rows > &  shiftedInColumn)
noexcept

moves all rows to the left.

Parameters
shiftedInColumnThis Array contains what will be shifted in on each Row.
Returns
sakurajin::ByteRow<rows> This Array contains the bytes that will be shifted out on each Row.

Definition at line 167 of file LedController_movement.hpp.

◆ moveLeft() [4/4]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::moveLeft ( const sakurajin::ByteRow< rows > &  shiftedInColumn,
sakurajin::ByteRow< rows > *  shiftedOutColumn 
)
noexcept

moves all rows to the left. The passed Arrays need to have the same length as the number of rows, or be a nullptr. If shiftedInColumn is a nullptr, 0x00 will be used for all rows.

Deprecated:
the function with sakurajin::ByteRow as return type should be used.

Will be removed in version 2.2.0

Todo:
remove function in version 2.2.0
Parameters
shiftedInColumnThis Array contains what will be shifted in on each Row and needs to be the same size as number of rows or nullptr.
shiftedOutColumnThis pointer to an Array will contain the bytes that will be shifted out on each Row, it should be the same size as the number of rows or nullptr.

Definition at line 250 of file LedController_movement.hpp.

◆ moveRight() [1/4]

template<size_t columns, size_t rows>
sakurajin::ByteRow< rows > sakurajin::LedController< columns, rows >::moveRight
noexcept

moves the data right by one and 0x00 will be shifted in

Returns
sakurajin::ByteRow<rows> This Array contains the bytes that will be shifted out on each Row.

Definition at line 162 of file LedController_movement.hpp.

◆ moveRight() [2/4]

template<size_t columns, size_t rows>
byte sakurajin::LedController< columns, rows >::moveRight ( byte  shiftedInColumn)
noexcept

moves the data left by one

Deprecated:
to be reomoved in version 2.1.0, moveRowLeft should be used
Todo:
remove function in version 2.1.0
Parameters
shiftedInColumnThe column that will be shifted to the left (default 0x00)
Warning
ONLY moves row 0, this function exists for backwards compatibility
Returns
byte The column that gets shifted out on the right

Definition at line 212 of file LedController_movement.hpp.

◆ moveRight() [3/4]

template<size_t columns, size_t rows>
sakurajin::ByteRow< rows > sakurajin::LedController< columns, rows >::moveRight ( const sakurajin::ByteRow< rows > &  shiftedInColumn)
noexcept

moves all rows to the right.

Parameters
shiftedInColumnThis Array contains what will be shifted in on each Row.
Returns
sakurajin::ByteRow<rows> This Array contains the bytes that will be shifted out on each Row.

Definition at line 176 of file LedController_movement.hpp.

◆ moveRight() [4/4]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::moveRight ( const sakurajin::ByteRow< rows > &  shiftedInColumn,
sakurajin::ByteRow< rows > *  shiftedOutColumn 
)
noexcept

moves all rows to the right. The passed Arrays need to have the same length as the number of rows, or be a nullptr. If shiftedInColumn is a nullptr, 0x00 will be used for all rows.

Deprecated:
the function with sakurajin::ByteRow as return type should be used.

Will be removed in version 2.2.0

Todo:
remove function in version 2.2.0
Parameters
shiftedInColumnThis Array contains what will be shifted in on each Row and needs to be the same size as number of rows or nullptr.
shiftedOutColumnThis pointer to an Array will contain the bytes that will be shifted out on each Row, it should be the same size as the number of rows or nullptr.

Definition at line 260 of file LedController_movement.hpp.

◆ moveRowLeft()

template<size_t columns, size_t rows>
byte sakurajin::LedController< columns, rows >::moveRowLeft ( byte  shiftedInColumn = 0x00,
unsigned int  row_num = 0 
)
noexcept

moves the data left by one

Parameters
shiftedInColumnThe column that will be shifted to the right (default 0x00)
row_numThe row that will be shifted to the right
Warning
ONLY moves one row
Returns
byte The column that gets shifted out on the left

Definition at line 49 of file LedController_movement.hpp.

◆ moveRowRight()

template<size_t columns, size_t rows>
byte sakurajin::LedController< columns, rows >::moveRowRight ( byte  shiftedInColumn = 0x00,
unsigned int  row_num = 0 
)
noexcept

moves the data left by one

Parameters
shiftedInColumnThe column that will be shifted to the left (default 0x00)
row_numThe row that will be shifted to the left
Warning
ONLY moves one row
Returns
byte The column that gets shifted out on the right

Definition at line 16 of file LedController_movement.hpp.

◆ moveUp() [1/4]

template<size_t columns, size_t rows>
sakurajin::ByteRow< columns > sakurajin::LedController< columns, rows >::moveUp
noexcept

moves the data up by one and 0x00 will be shifted in

Returns
sakurajin::ByteRow<columns> This Array contains the bytes that will be shifted out on each Row.

Definition at line 152 of file LedController_movement.hpp.

◆ moveUp() [2/4]

template<size_t columns, size_t rows>
sakurajin::ByteRow< columns > sakurajin::LedController< columns, rows >::moveUp ( const sakurajin::ByteRow< columns > &  shiftedInColumn)
noexcept

moves all columns up.

Parameters
shiftedInColumnThis Array contains what will be shifted in on each Row
Returns
sakurajin::ByteRow<columns> This Array contains the bytes that will be shifted out on each Row.

Definition at line 185 of file LedController_movement.hpp.

◆ moveUp() [3/4]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::moveUp ( const sakurajin::ByteRow< columns > &  shiftedInRow,
sakurajin::ByteRow< columns > *  shiftedOutRow 
)
noexcept

moves the data up by one

Deprecated:
the function with sakurajin::ByteRow as return type should be used.

Will be removed in version 2.2.0

Todo:
remove function in version 2.2.0
Parameters
shiftedInRowThe row that will be shifted in on the bottom (default 0x00)
shiftedOutRowThe address of the row that will be shifted out on the bottom

Definition at line 240 of file LedController_movement.hpp.

◆ moveUp() [4/4]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::moveUp ( sakurajin::ByteRow< columns > *  shiftedOutRow)
noexcept

moves the data up by oneand 0x00 will be shifted in

Deprecated:
the function with sakurajin::ByteRow as return type should be used.

Will be removed in version 2.2.0

Todo:
remove function in version 2.2.0
Parameters
shiftedOutRowThe address of the row that will be shifted out on the bottom

Definition at line 218 of file LedController_movement.hpp.

◆ refreshSegment()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::refreshSegment ( unsigned int  segmentNumber)
noexcept

refreshes a given segment by first resetting it and then updating it.

Parameters
segmentNumberthe segment that will be resetted

Definition at line 128 of file LedController_low_level.hpp.

References sakurajin::MAX72XX::OP_DECODEMODE, and sakurajin::MAX72XX::OP_DISPLAYTEST.

◆ refreshSegments()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::refreshSegments
noexcept

refreshes all segments by first resetting them and then updating them.

Definition at line 208 of file LedController_display.hpp.

◆ resetBuffers()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::resetBuffers
protectednoexcept

initilize the internal buffers of the LedController.

Definition at line 18 of file LedController_display.hpp.

References sakurajin::MAX72XX::OP_NOOP.

◆ resetMatrix()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::resetMatrix
noexcept

activates all segments, sets to same intensity and clears them

Definition at line 31 of file LedController_display.hpp.

◆ reverse() [1/3]

template<size_t columns, size_t rows>
byte sakurajin::LedController< columns, rows >::reverse ( byte  input)
noexcept

This function changes to bitorder of a byte (useful to mirror "images" you want to display)

Parameters
inputThe byte that should be reversed
Returns
byte The reversed byte

Definition at line 17 of file LedController_transformation.hpp.

References sakurajin::ByteBlock::reverse().

Here is the call graph for this function:

◆ reverse() [2/3]

template<size_t columns, size_t rows>
sakurajin::ByteBlock sakurajin::LedController< columns, rows >::reverse ( sakurajin::ByteBlock  input)
noexcept

Reverse an sakurajin::ByteBlock of 8 bytes (mirror it)

Parameters
inputThe sakurajin::ByteBlock that should be mirrored
Returns
sakurajin::ByteBlock The reversed sakurajin::ByteBlock

Definition at line 27 of file LedController_transformation.hpp.

◆ reverse() [3/3]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::reverse ( sakurajin::ByteBlock  input,
sakurajin::ByteBlock reversedInput 
)
noexcept

Reverse an array of 8 bytes (mirror it)

Deprecated:
the function with sakurajin::ByteBlock as return type should be used.

Will be removed in version 2.2.0

Todo:
remove function in version 2.2.0
Parameters
inputThe array that should be mirrored
reversedInputThe address where the result will be stored

Definition at line 48 of file LedController_transformation.hpp.

◆ rotate180() [1/2]

template<size_t columns, size_t rows>
sakurajin::ByteBlock sakurajin::LedController< columns, rows >::rotate180 ( sakurajin::ByteBlock  input)
noexcept

rotate an sakurajin::ByteBlock by 180 degrees

Parameters
inputthe sakurajin::ByteBlock that will be rotated
Returns
sakurajin::ByteBlock The rotated sakurajin::ByteBlock

Definition at line 32 of file LedController_transformation.hpp.

References sakurajin::ByteBlock::rotate180().

Here is the call graph for this function:

◆ rotate180() [2/2]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::rotate180 ( sakurajin::ByteBlock  input,
sakurajin::ByteBlock rotatedInput 
)
noexcept

rotate an byte[8] array by 180 degrees

Deprecated:
the function with sakurajin::ByteBlock as return type should be used.

Will be removed in version 2.2.0

Todo:
remove function in version 2.2.0
Parameters
inputthe array that will be rotated
rotatedInputThe address where the result will be stored

Definition at line 58 of file LedController_transformation.hpp.

References sakurajin::ByteBlock::rotate180().

Here is the call graph for this function:

◆ setChar()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::setChar ( unsigned int  segmentNumber,
unsigned int  digit,
char  value,
boolean  dp 
)
noexcept

Set the Display a character on a 7-Segment display.

Note
There are only a few characters that make sense here : '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'A', 'b', 'c', 'd', 'E', 'F', 'H', 'L', 'P', '.', '-', '_', ' '
Parameters
segmentNumberThe number of the desired segment
digitthe position of the character on the segment (0..7)
valuethe character to be displayed.
dpdp if true sets the decimal point

Definition at line 192 of file LedController_display.hpp.

References sakurajin::MAX72XX::getChar().

Here is the call graph for this function:

◆ setColumn()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::setColumn ( unsigned int  segmentNumber,
unsigned int  col,
byte  value 
)
noexcept

Set one column of a given segment.

Parameters
segmentNumberThe desired Segment number
colThe desired column
valueThe value, this column should have

Definition at line 164 of file LedController_display.hpp.

References sakurajin::ByteBlock::transpose().

Here is the call graph for this function:

◆ setDigit()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::setDigit ( unsigned int  segmentNumber,
unsigned int  digit,
byte  value,
boolean  dp 
)
noexcept

Set a hexadecimal digit on a 7-Segment Display.

Parameters
segmentNumberThe number of the desired Segment
digitthe position of the digit on the Segment (0..7)
valuethe value to be displayed. (0x00..0x0F)
dpif true sets the decimal point

Definition at line 177 of file LedController_display.hpp.

References sakurajin::MAX72XX::getChar().

Here is the call graph for this function:

◆ setIntensity() [1/2]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::setIntensity ( unsigned int  newIntesityLevel)
noexcept

Set the Intensity of the whole matrix to the given value.

Note
if you want to save more energy disable segments you don't need or lower the brightness.
Parameters
newIntesityLevelthe new brightness of the matrix. (0..15)

Definition at line 103 of file LedController_low_level.hpp.

◆ setIntensity() [2/2]

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::setIntensity ( unsigned int  segmentNumber,
unsigned int  newIntesityLevel 
)
protectednoexcept

Set the brightness of the segment.

Parameters
segmentNumberthe address of the segment to control
newIntesityLevelthe brightness of the display. (0..15)

Definition at line 117 of file LedController_low_level.hpp.

References sakurajin::MAX72XX::OP_INTENSITY.

◆ setLed()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::setLed ( unsigned int  segmentNumber,
unsigned int  row,
unsigned int  column,
boolean  state 
)
noexcept

Set a single led to a given value.

Parameters
segmentNumberthe segment number of the desired led
rowthe row of the desired led (0..7)
columnthe column of the desired led (0..7)
statetrue if it should be on otherwise false

Definition at line 144 of file LedController_display.hpp.

◆ setRow()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::setRow ( unsigned int  segmentNumber,
unsigned int  row,
byte  value 
)
noexcept

Set one Row of one segment.

Parameters
segmentNumberThe Segment which should be modified
rowThe row which should be modified
valueeach bit set to 1 will light up the corresponding Led.

Definition at line 123 of file LedController_display.hpp.

◆ setScanLimit()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::setScanLimit ( unsigned int  segmentNumber,
unsigned int  limit 
)
noexcept

Set the number of digits (or rows) to be displayed (default: 7).

Warning
See datasheet for sideeffects of the scanlimit on the brightness of the display.
Parameters
segmentNumberThe segment which should be addressed
limitThe number of digits to be displayed (0..7)

Definition at line 92 of file LedController_low_level.hpp.

References sakurajin::MAX72XX::OP_SCANLIMIT.

◆ shutdownAllSegments()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::shutdownAllSegments
noexcept

Set all segments into power-down mode.

Definition at line 89 of file LedController_display.hpp.

◆ shutdownSegment()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::shutdownSegment ( unsigned int  segmentNumber)
noexcept

Set the segment in power-down mode.

Parameters
segmentNumberThe segment to control

Definition at line 71 of file LedController_display.hpp.

References sakurajin::MAX72XX::OP_SHUTDOWN.

◆ spiTransfer()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::spiTransfer ( unsigned int  segment,
byte  opcode,
byte  data 
)
protectednoexcept

This function transfers one command to the attached module.

Parameters
segmentThe segment that should execute this command
opcodeThe command that should be executed
dataThe data needed for that command

Definition at line 17 of file LedController_low_level.hpp.

References sakurajin::MAX72XX::OP_NOOP.

◆ updateSegment()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::updateSegment ( unsigned int  segmentNumber)
noexcept

update a given segment by displaying the internally stored state of the segment.

Parameters
segmentNumberthe segment that will be updated

Definition at line 230 of file LedController_display.hpp.

◆ updateSegments()

template<size_t columns, size_t rows>
void sakurajin::LedController< columns, rows >::updateSegments
noexcept

update all segments by displaying the internally stored state of the segments.

Definition at line 219 of file LedController_display.hpp.

Member Data Documentation

◆ conf

template<size_t columns, size_t rows>
sakurajin::controller_configuration<columns,rows> sakurajin::LedController< columns, rows >::conf
protected

The configuration of the LedController.

Definition at line 61 of file LedController_template.hpp.

◆ initilized

template<size_t columns, size_t rows>
bool sakurajin::LedController< columns, rows >::initilized = false
protected

True if the LedController is fully initilized.

Definition at line 113 of file LedController_template.hpp.

◆ LedStates

template<size_t columns, size_t rows>
sakurajin::ByteBlock sakurajin::LedController< columns, rows >::LedStates[columns *rows]
protected

This array contains the state of all of the LEDs.

Definition at line 51 of file LedController_template.hpp.

◆ spidata

template<size_t columns, size_t rows>
byte sakurajin::LedController< columns, rows >::spidata[rows *columns *2]
protected

The array for shifting the data to the devices.

Definition at line 88 of file LedController_template.hpp.


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