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

The chain of MAX7219s: the pins, and the frames sent to them. More...

#include <Chain.h>

Public Member Functions

 Chain (uint8_t data_in_pin, uint8_t chip_select_pin, uint8_t clock_pin)
 Makes the chain at these pins; nothing is sent until Init().
MAXMATRIX_NODISCARD uint8_t GetDataInPin () const
 Returns the pin DIN of the chain is connected to.
MAXMATRIX_NODISCARD uint8_t GetChipSelectPin () const
 Returns the pin CS of the chain is connected to.
MAXMATRIX_NODISCARD uint8_t GetClockPin () const
 Returns the pin CLK of the chain is connected to.
void SetDataInPin (uint8_t data_in_pin)
 Sets the pin DIN of the chain is connected to.
void SetChipSelectPin (uint8_t chip_select_pin)
 Sets the pin CS of the chain is connected to.
void SetClockPin (uint8_t clock_pin)
 Sets the pin CLK of the chain is connected to.
void Init (uint8_t number_of_modules)
 Sets the pins up, and every MAX7219 to drive an 8x8 matrix.
void WriteRegisterAll (uint8_t register_address, uint8_t register_value, uint8_t number_of_modules)
 Writes the same register of every MAX7219, with the same value.
void WriteRegisterEach (uint8_t register_address, span< Byte const > buffer, uint8_t column)
 Writes the same register of every MAX7219, each with its own value: one column of every module, straight from the matrix buffer.

Detailed Description

The chain of MAX7219s: the pins, and the frames sent to them.

A frame carries one address and value per module. Only this class touches the pins; bit banging or SPI is chosen with MAXMATRIX_USE_SPI.

Constructor & Destructor Documentation

◆ Chain()

max_matrix::internal::Chain::Chain ( uint8_t data_in_pin,
uint8_t chip_select_pin,
uint8_t clock_pin )

Makes the chain at these pins; nothing is sent until Init().

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.

Member Function Documentation

◆ Init()

void max_matrix::internal::Chain::Init ( uint8_t number_of_modules)

Sets the pins up, and every MAX7219 to drive an 8x8 matrix.

All eight digits, no decoding, normal operation, no display test.

Parameters
[in]number_of_modulesThe MAX7219s in the chain.

◆ SetChipSelectPin()

void max_matrix::internal::Chain::SetChipSelectPin ( uint8_t chip_select_pin)
inline

Sets the pin CS of the chain is connected to.

Parameters
[in]chip_select_pinThe pin; the next Init() makes it an output and takes it.

◆ SetClockPin()

void max_matrix::internal::Chain::SetClockPin ( uint8_t clock_pin)
inline

Sets the pin CLK of the chain is connected to.

Parameters
[in]clock_pinThe pin; the next Init() makes it an output and takes it.

◆ SetDataInPin()

void max_matrix::internal::Chain::SetDataInPin ( uint8_t data_in_pin)
inline

Sets the pin DIN of the chain is connected to.

Parameters
[in]data_in_pinThe pin; the next Init() makes it an output and takes it.

◆ WriteRegisterAll()

void max_matrix::internal::Chain::WriteRegisterAll ( uint8_t register_address,
uint8_t register_value,
uint8_t number_of_modules )

Writes the same register of every MAX7219, with the same value.

One frame, with the same address and value for every module.

Parameters
[in]register_addressThe address of the register, one of MAX7219_REG_..._ADDRESS.
[in]register_valueThe value.
[in]number_of_modulesThe MAX7219s in the chain.

◆ WriteRegisterEach()

void max_matrix::internal::Chain::WriteRegisterEach ( uint8_t register_address,
span< Byte const > buffer,
uint8_t column )

Writes the same register of every MAX7219, each with its own value: one column of every module, straight from the matrix buffer.

One frame, with the same address and one value per module. The values of a column lie a module's columns apart in the buffer.

Parameters
[in]register_addressThe address of the register, one of MAX7219_REG_..._ADDRESS.
[in]bufferThe matrix buffer, BufferSize() of the modules in the chain, module 0 first.
[in]columnThe column of a module to write, 0 to 7.

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