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

This class is used to handle the configuration of the sakurajin::LedController. More...

#include <LedController_config.hpp>

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

Public Member Functions

controller_configuration< columns, rows > copy () const noexcept
 This function returns a copy of this configuration. More...
 
unsigned int getColumn (unsigned int segmentNumber) const noexcept
 This function returns the column a given segment is in. More...
 
unsigned int getRow (unsigned int segmentNumber) const noexcept
 This function returns the row a given segment is in. More...
 
unsigned int getRowLen () const noexcept
 Get the length each row has. More...
 
unsigned int getSegmentNumber (unsigned int column, unsigned int row) const noexcept
 Calculate the segment Number/index from its coordinates. More...
 
bool isValid () const noexcept
 check of this configuration is valid More...
 
unsigned int SegmentCount () const noexcept
 returns the total number of segments (rows*columns) More...
 

Static Public Member Functions

static bool isValidConfig (const controller_configuration< columns, rows > &conf) noexcept
 check if a given configuragtion is valid More...
 

Public Attributes

bool debug_output = false
 if this is set to true, debug output will be printed. More...
 
unsigned int IntensityLevel = 1
 The current brightness level of the leds. More...
 
bool onlySendOnChange = true
 Only send data if something changed if true. More...
 
unsigned int row_SPI_CS [rows]
 This Arrays specifies which Pin to use for each row. More...
 
unsigned int SPI_CLK = 0
 The pin for the clock signal (CLK). More...
 
unsigned int SPI_CS = 0
 The pin for the chip select signal (CS). More...
 
unsigned int SPI_MOSI = 0
 The pin for the data transfer signal (MOSI on board and DIN on Matrix). More...
 
uint64_t spiTransferSpeed = 8000000
 The speed which with the hardware spi should transfer the data to the matrix. More...
 
bool useHardwareSpi = false
 true if you want to use hardware SPI (view https://www.arduino.cc/en/Reference/SPI for pin config). More...
 
bool virtual_multi_row = true
 set to false if each of your rows has a dedicated CS pin. More...
 

Detailed Description

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

This class is used to handle the configuration of the sakurajin::LedController.

Template Parameters
columnsThe number of columns this configuration has.
rowsThe number of rows this configuration has.

Definition at line 31 of file LedController_config.hpp.

Member Function Documentation

◆ copy()

◆ getColumn()

template<size_t columns, size_t rows>
unsigned int sakurajin::controller_configuration< columns, rows >::getColumn ( unsigned int  segmentNumber) const
inlinenoexcept

This function returns the column a given segment is in.

Parameters
segmentNumberThe index of the segment which you want the column of.
Returns
unsigned int The column the given segment is in.

Definition at line 215 of file LedController_config.hpp.

◆ getRow()

template<size_t columns, size_t rows>
unsigned int sakurajin::controller_configuration< columns, rows >::getRow ( unsigned int  segmentNumber) const
inlinenoexcept

This function returns the row a given segment is in.

Parameters
segmentNumberThe index of the segment which you want the row of.
Returns
unsigned int The row the given segment is in.

Definition at line 189 of file LedController_config.hpp.

◆ getRowLen()

template<size_t columns, size_t rows>
unsigned int sakurajin::controller_configuration< columns, rows >::getRowLen ( ) const
inlinenoexcept

Get the length each row has.

Returns
unsigned int the length of each row

Definition at line 235 of file LedController_config.hpp.

◆ getSegmentNumber()

template<size_t columns, size_t rows>
unsigned int sakurajin::controller_configuration< columns, rows >::getSegmentNumber ( unsigned int  column,
unsigned int  row 
) const
inlinenoexcept

Calculate the segment Number/index from its coordinates.

Parameters
columnThe column the segment is in
rowThe row the segment is in
Returns
unsigned int the segment number of that segment

Definition at line 254 of file LedController_config.hpp.

◆ isValid()

template<size_t columns, size_t rows>
bool sakurajin::controller_configuration< columns, rows >::isValid ( ) const
inlinenoexcept

check of this configuration is valid

Returns
true the configuration is valid
false the configuration is not valid

Definition at line 172 of file LedController_config.hpp.

References sakurajin::controller_configuration< columns, rows >::isValidConfig().

Here is the call graph for this function:

◆ isValidConfig()

template<size_t columns, size_t rows>
static bool sakurajin::controller_configuration< columns, rows >::isValidConfig ( const controller_configuration< columns, rows > &  conf)
inlinestaticnoexcept

check if a given configuragtion is valid

Parameters
confthe configuration that should be checked
Returns
true the configuration is valid
false the configuration is not valid

Definition at line 300 of file LedController_config.hpp.

References PRINTLN_IF.

◆ SegmentCount()

template<size_t columns, size_t rows>
unsigned int sakurajin::controller_configuration< columns, rows >::SegmentCount ( ) const
inlinenoexcept

returns the total number of segments (rows*columns)

Returns
unsigned int the number of segments

Definition at line 154 of file LedController_config.hpp.

Member Data Documentation

◆ debug_output

template<size_t columns, size_t rows>
bool sakurajin::controller_configuration< columns, rows >::debug_output = false

if this is set to true, debug output will be printed.

Definition at line 130 of file LedController_config.hpp.

◆ IntensityLevel

template<size_t columns, size_t rows>
unsigned int sakurajin::controller_configuration< columns, rows >::IntensityLevel = 1

The current brightness level of the leds.

Note
The value needs to be between 0 and 15 (inclusive bounds).

Definition at line 89 of file LedController_config.hpp.

◆ onlySendOnChange

template<size_t columns, size_t rows>
bool sakurajin::controller_configuration< columns, rows >::onlySendOnChange = true

Only send data if something changed if true.

If this is true, new data will only be sent if the data given differes from the data internally stored.

Definition at line 112 of file LedController_config.hpp.

◆ row_SPI_CS

template<size_t columns, size_t rows>
unsigned int sakurajin::controller_configuration< columns, rows >::row_SPI_CS[rows]

This Arrays specifies which Pin to use for each row.

Controlling multiple rows

Warning
Each index should have a unique number or you will encounter strange behaviour.

Definition at line 101 of file LedController_config.hpp.

◆ SPI_CLK

template<size_t columns, size_t rows>
unsigned int sakurajin::controller_configuration< columns, rows >::SPI_CLK = 0

The pin for the clock signal (CLK).

Warning
if this is 0 and useHardwareSpi is false the initilization will fail

Definition at line 65 of file LedController_config.hpp.

◆ SPI_CS

template<size_t columns, size_t rows>
unsigned int sakurajin::controller_configuration< columns, rows >::SPI_CS = 0

The pin for the chip select signal (CS).

Warning
this has to be set if it is 0 the initlization will fail.

Definition at line 54 of file LedController_config.hpp.

◆ SPI_MOSI

template<size_t columns, size_t rows>
unsigned int sakurajin::controller_configuration< columns, rows >::SPI_MOSI = 0

The pin for the data transfer signal (MOSI on board and DIN on Matrix).

Warning
if this is 0 and useHardwareSpi is false the initilization will fail

Definition at line 43 of file LedController_config.hpp.

◆ spiTransferSpeed

template<size_t columns, size_t rows>
uint64_t sakurajin::controller_configuration< columns, rows >::spiTransferSpeed = 8000000

The speed which with the hardware spi should transfer the data to the matrix.

Definition at line 121 of file LedController_config.hpp.

◆ useHardwareSpi

template<size_t columns, size_t rows>
bool sakurajin::controller_configuration< columns, rows >::useHardwareSpi = false

true if you want to use hardware SPI (view https://www.arduino.cc/en/Reference/SPI for pin config).

While this is a lot faster you cannot use every pin for the MOSI and CLK signal. SPI_MOSI and SPI_CLK will be set automatically if this is true.

Definition at line 78 of file LedController_config.hpp.

◆ virtual_multi_row

template<size_t columns, size_t rows>
bool sakurajin::controller_configuration< columns, rows >::virtual_multi_row = true

set to false if each of your rows has a dedicated CS pin.

By default this is true and it is assumed that all Segments are connected in series.

Definition at line 141 of file LedController_config.hpp.


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