MaxMatrix
Drive chained 8x8 LED dot matrix modules with MAX7219.
Loading...
Searching...
No Matches
max_matrix::internal::Wired Class Reference

The matrix as it is wired: the buffer of what the LEDs show, and what of it changed. More...

#include <Wired.h>

Public Member Functions

 Wired (uint8_t data_in_pin, uint8_t chip_select_pin, uint8_t clock_pin, span< Byte > buffer)
 Makes the matrix of the chain at these pins, and empties its buffer.
Chain & GetChain ()
 Returns the chain the matrix sends to.
MAXMATRIX_NODISCARD Chain const & GetChain () const
 Returns the chain the matrix sends to.
MAXMATRIX_NODISCARD uint8_t GetNumberOfColumns () const
 Returns the columns of the chain, eight per module.
MAXMATRIX_NODISCARD uint8_t GetNumberOfModules () const
 Returns the modules in the chain, one per eight bytes of buffer.
Byte GetColumn (uint8_t column)
 Returns a column of the buffer, unchecked.
void StoreBit (uint8_t column, uint8_t bit, bool value)
 Sets one bit of the buffer.
void Clear ()
 Turns every LED off in the buffer, and marks every column as changed.
void Send ()
 Sends what has changed.

Detailed Description

The matrix as it is wired: the buffer of what the LEDs show, and what of it changed.

The buffer mirrors the LEDs, one byte per column, columns of all modules in a row, module 0 first. Drawing only changes the buffer; Send() brings what changed to the chain.

Constructor & Destructor Documentation

◆ Wired()

max_matrix::internal::Wired::Wired ( uint8_t data_in_pin,
uint8_t chip_select_pin,
uint8_t clock_pin,
span< Byte > buffer )

Makes the matrix of the chain at these pins, and empties its buffer.

Parameters
[in]data_in_pinThe pin DIN of the chain is connected to.
[in]chip_select_pinThe pin CS of the chain is connected to.
[in]clock_pinThe pin CLK of the chain is connected to.
[out]bufferThe buffer, BufferSize() of the modules in the chain, 1 to kMaxNumberOfModules; it has to live as long as the matrix.

Member Function Documentation

◆ Clear()

void max_matrix::internal::Wired::Clear ( )

Turns every LED off in the buffer, and marks every column as changed.

Even a column that was empty already is marked: after power-up the registers of the MAX7219 hold anything, and Matrix::Init() clears them this way.

◆ GetChain()

MAXMATRIX_NODISCARD Chain const & max_matrix::internal::Wired::GetChain ( ) const
inline

Returns the chain the matrix sends to.

◆ GetColumn()

Byte max_matrix::internal::Wired::GetColumn ( uint8_t column)
inline

Returns a column of the buffer, unchecked.

For Panel, whose coordinates are checked and mapped already.

Parameters
[in]columnThe column in the buffer.

◆ Send()

void max_matrix::internal::Wired::Send ( )

Sends what has changed.

Every changed column of a module goes out in one frame for all modules; nothing goes out when nothing has changed.

◆ StoreBit()

void max_matrix::internal::Wired::StoreBit ( uint8_t column,
uint8_t bit,
bool value )

Sets one bit of the buffer.

Send() brings the change to the chain. The column is marked as changed only when its value changes, so that drawing what is shown already sends nothing.

Parameters
[in]columnThe column in the buffer.
[in]bitThe bit in the column, the row as wired.
[in]valueTrue for a lit LED.
Precondition
column lies within the buffer and bit within a byte: Panel has checked and mapped them.

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