LedController  2.0.2
A library for the MAX7219 and the MAX7221 Led display drivers.
sakurajin::ByteBlock Class Reference

A block of bytes used to represent all of the data in a Segment. More...

#include <LedController_byteblock.hpp>

Inheritance diagram for sakurajin::ByteBlock:
Inheritance graph
Collaboration diagram for sakurajin::ByteBlock:
Collaboration graph

Public Member Functions

 ByteBlock () noexcept
 Construct a new Byte Block object with 0s. More...
 
 ByteBlock (byte n0, byte n1, byte n2, byte n3, byte n4, byte n5, byte n6, byte n7) noexcept
 Construct a new Byte Block object from a list of values. More...
 
 ByteBlock (byte newdata[8]) noexcept
 Construct a new Byte Block object from an array. More...
 
 ByteBlock (const ByteRow< 8 > &data) noexcept
 Construct a new Byte Block object from a byteRow. More...
 
ByteBlock makeColumns () const noexcept
 Turns an ByteBlock of rows into an ByteBlock of columns. More...
 
ByteBlock reverse () const noexcept
 Reverse an ByteBlock of 8 bytes (mirror it) More...
 
ByteBlock rotate180 () const noexcept
 rotate an ByteBlock by 180 degrees More...
 
ByteBlock transpose () const noexcept
 Turns an ByteBlock of rows into an ByteBlock of columns. More...
 
- Public Member Functions inherited from sakurajin::ByteRow< 8 >
byte at (uint64_t index) const noexcept
 Access the class just like the underlying array. More...
 
 ByteRow () noexcept
 Construct a new Byte Row object with 0s. More...
 
 ByteRow (byte newdata[SIZE]) noexcept
 Construct a new Byte Row object from an array. More...
 
virtual bool operator!= (const ByteRow< SIZE > &other) const noexcept
 checks if two byteRows do not have identical data More...
 
virtual ByteRow operator& (const ByteRow< SIZE > &other) const noexcept
 Overlaps two ByteRows (bitwise or). More...
 
virtual ByteRow operator++ () const noexcept
 Moves all data of the ByteRow to the up by one. More...
 
virtual ByteRow operator-- () const noexcept
 Moves all data of the ByteRow to the down by one. More...
 
virtual ByteRow operator<< (unsigned int distance) const noexcept
 Moves all data of the ByteRow to the left by a given distance. More...
 
ByteRowoperator= (byte newdata[SIZE]) noexcept
 Assign an array to this object. More...
 
virtual bool operator== (const ByteRow< SIZE > &other) const noexcept
 checks if two byteRows have identical data More...
 
virtual ByteRow operator>> (unsigned int distance) const noexcept
 Moves all data of the ByteRow to the right by a given distance. More...
 
const byte & operator[] (uint64_t index) const noexcept
 Access the class just like the underlying array. More...
 
byte & operator[] (uint64_t index) noexcept
 Access the class just like the underlying array. More...
 
 ~ByteRow () noexcept
 Destroy the Byte Row object. More...
 

Static Public Member Functions

static ByteBlock makeColumns (ByteBlock rowArray) noexcept
 Turns an ByteBlock of rows into an ByteBlock of columns. More...
 
static byte reverse (byte input) noexcept
 This function changes to bitorder of a byte (useful to mirror "images" you want to display) More...
 
static ByteBlock reverse (ByteBlock input) noexcept
 Reverse an ByteBlock of 8 bytes (mirror it) More...
 
static ByteBlock rotate180 (ByteBlock input) noexcept
 rotate an ByteBlock by 180 degrees More...
 
static ByteBlock transpose (ByteBlock rowArray) noexcept
 Turns an ByteBlock of rows into an ByteBlock of columns. More...
 

Additional Inherited Members

- Protected Attributes inherited from sakurajin::ByteRow< 8 >
byte _data [SIZE]
 The internal array where the actual data is. More...
 

Detailed Description

A block of bytes used to represent all of the data in a Segment.

It is simply a ByteRow with size 8 but useful regardless.

Definition at line 26 of file LedController_byteblock.hpp.

Constructor & Destructor Documentation

◆ ByteBlock() [1/4]

sakurajin::ByteBlock::ByteBlock ( byte  newdata[8])
inlinenoexcept

Construct a new Byte Block object from an array.

Parameters
newdataThe array which should be used to initilize the row.

Definition at line 40 of file LedController_byteblock.hpp.

◆ ByteBlock() [2/4]

sakurajin::ByteBlock::ByteBlock ( byte  n0,
byte  n1,
byte  n2,
byte  n3,
byte  n4,
byte  n5,
byte  n6,
byte  n7 
)
inlinenoexcept

Construct a new Byte Block object from a list of values.

This way {0,0,0,0,0,0,0,0} can be used as copy-assignement.

Definition at line 51 of file LedController_byteblock.hpp.

References sakurajin::ByteRow< 8 >::_data.

◆ ByteBlock() [3/4]

sakurajin::ByteBlock::ByteBlock ( )
inlinenoexcept

Construct a new Byte Block object with 0s.

Definition at line 69 of file LedController_byteblock.hpp.

◆ ByteBlock() [4/4]

sakurajin::ByteBlock::ByteBlock ( const ByteRow< 8 > &  data)
inlinenoexcept

Construct a new Byte Block object from a byteRow.

Note
This constructor mainly exists for automatic casting.
Parameters
datathe data that should be assigned

Definition at line 82 of file LedController_byteblock.hpp.

Member Function Documentation

◆ makeColumns() [1/2]

ByteBlock sakurajin::ByteBlock::makeColumns ( ) const
inlinenoexcept

Turns an ByteBlock of rows into an ByteBlock of columns.

Returns
ByteBlock The Columns of the given ByteBlock

Definition at line 110 of file LedController_byteblock.hpp.

References transpose().

Here is the call graph for this function:

◆ makeColumns() [2/2]

static ByteBlock sakurajin::ByteBlock::makeColumns ( ByteBlock  rowArray)
inlinestaticnoexcept

Turns an ByteBlock of rows into an ByteBlock of columns.

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

Definition at line 227 of file LedController_byteblock.hpp.

References ByteBlock(), and reverse().

Here is the call graph for this function:

◆ reverse() [1/3]

ByteBlock sakurajin::ByteBlock::reverse ( ) const
inlinenoexcept

Reverse an ByteBlock of 8 bytes (mirror it)

Returns
ByteBlock The reversed ByteBlock

Definition at line 125 of file LedController_byteblock.hpp.

◆ reverse() [2/3]

static byte sakurajin::ByteBlock::reverse ( byte  input)
inlinestaticnoexcept

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 158 of file LedController_byteblock.hpp.

◆ reverse() [3/3]

static ByteBlock sakurajin::ByteBlock::reverse ( ByteBlock  input)
inlinestaticnoexcept

Reverse an ByteBlock of 8 bytes (mirror it)

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

Definition at line 181 of file LedController_byteblock.hpp.

References ByteBlock(), and reverse().

Here is the call graph for this function:

◆ rotate180() [1/2]

ByteBlock sakurajin::ByteBlock::rotate180 ( ) const
inlinenoexcept

rotate an ByteBlock by 180 degrees

Returns
ByteBlock The rotated ByteBlock

Definition at line 140 of file LedController_byteblock.hpp.

◆ rotate180() [2/2]

static ByteBlock sakurajin::ByteBlock::rotate180 ( ByteBlock  input)
inlinestaticnoexcept

rotate an ByteBlock by 180 degrees

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

Definition at line 204 of file LedController_byteblock.hpp.

References ByteBlock(), and reverse().

Here is the call graph for this function:

◆ transpose() [1/2]

ByteBlock sakurajin::ByteBlock::transpose ( ) const
inlinenoexcept

Turns an ByteBlock of rows into an ByteBlock of columns.

Returns
ByteBlock The Columns of the given ByteBlock

Definition at line 95 of file LedController_byteblock.hpp.

References makeColumns().

Here is the call graph for this function:

◆ transpose() [2/2]

static ByteBlock sakurajin::ByteBlock::transpose ( ByteBlock  rowArray)
inlinestaticnoexcept

Turns an ByteBlock of rows into an ByteBlock of columns.

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

Definition at line 252 of file LedController_byteblock.hpp.

References makeColumns().

Here is the call graph for this function:

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