|
MaxMatrix
Drive chained 8x8 LED dot matrix modules with MAX7219.
|
The matrix as the viewer sees it: columns, rows and dots in the viewer's coordinates. More...
#include <Panel.h>
Public Member Functions | |
| Panel (uint8_t data_in_pin, uint8_t chip_select_pin, uint8_t clock_pin, span< Byte > buffer) | |
| Makes the panel of the chain at these pins, of modules ModuleType::kDr0Cr0Rr1 in matrix orientation 0. | |
| MAXMATRIX_NODISCARD uint8_t | GetNumberOfModules () const |
| Returns the modules of the chain. | |
| MAXMATRIX_NODISCARD uint8_t | GetNumberOfColumns () const |
| Returns the columns of the panel, eight per module. | |
| Wired & | GetWired () |
| Returns the matrix as it is wired, below this one. | |
| MAXMATRIX_NODISCARD Wired const & | GetWired () const |
| Returns the matrix as it is wired, below this one. | |
| MAXMATRIX_NODISCARD ModuleType | GetModuleType () const |
| Returns how the LEDs of every module are wired. | |
| MAXMATRIX_NODISCARD MatrixOrientation | GetMatrixOrientation () const |
| Returns how the whole matrix is turned. | |
| MAXMATRIX_NODISCARD Result< Byte > | GetColumn (int16_t column) |
| Returns a column of the matrix. | |
| MAXMATRIX_NODISCARD Result< Byte > | GetColumn (uint8_t module, uint8_t column) |
| Returns a column of a module. | |
| MAXMATRIX_NODISCARD Status | GetRow (int16_t row, span< Byte > values) |
| Gives a row of the matrix, one byte per module. | |
| MAXMATRIX_NODISCARD Result< Byte > | GetRow (uint8_t module, uint8_t row) |
| Returns a row of a module. | |
| MAXMATRIX_NODISCARD Result< bool > | GetDot (int16_t column, int16_t row) |
| Returns whether a dot is lit. | |
| void | SetColumn (int16_t column, Byte value) |
| Sets a column of the matrix. | |
| void | SetColumn (uint8_t module, uint8_t column, Byte value) |
| Sets a column of a module. | |
| void | SetRow (int16_t row, span< Byte const > values) |
| Sets a row of the matrix, one byte per module. | |
| void | SetRow (uint8_t module, uint8_t row, Byte value) |
| Sets a row of a module. | |
| void | SetDot (int16_t column, int16_t row, bool value) |
| Lights a dot or turns it off. | |
| void | DrawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, bool value) |
| Draws a straight line from one dot to another, both ends included. | |
| void | DrawRect (int16_t x, int16_t y, int16_t width, int16_t height, bool value) |
| Draws the outline of a rectangle. | |
| void | FillRect (int16_t x, int16_t y, int16_t width, int16_t height, bool value) |
| Draws a rectangle with its inside. | |
| void | DrawCircle (int16_t x, int16_t y, int16_t radius, bool value) |
| Draws the outline of a circle. | |
| void | DrawBitmap (int16_t x, int16_t y, uint8_t height, span< uint8_t const > bitmap) |
| Draws a picture from flash with its top left corner at x, y. | |
| void | DrawColumn (int16_t x, int16_t y, uint8_t height, Byte value) |
| Draws one column of a picture, height rows from y on. | |
| void | SetModuleType (ModuleType module_type) |
| Sets how the LEDs of every module are wired. | |
| void | SetMatrixOrientation (MatrixOrientation matrix_orientation) |
| Sets how the whole matrix is turned. | |
| void | ShiftLeft (ShiftFill fill=ShiftFill::kZero) |
| Shifts the whole picture one column to the left. | |
| Byte | ShiftLeft (Byte shifted_in) |
| Shifts the whole picture one column to the left, with a column of the sketch coming in at the right. | |
| void | ShiftRight (ShiftFill fill=ShiftFill::kZero) |
| Shifts the whole picture one column to the right. | |
| Byte | ShiftRight (Byte shifted_in) |
| Shifts the whole picture one column to the right, with a column of the sketch coming in at the left. | |
| void | ShiftUp (ShiftFill fill=ShiftFill::kZero) |
| Shifts the whole picture one row up. | |
| void | ShiftDown (ShiftFill fill=ShiftFill::kZero) |
| Shifts the whole picture one row down. | |
The matrix as the viewer sees it: columns, rows and dots in the viewer's coordinates.
It turns every coordinate by the matrix orientation and the module type into the buffer of Wired. A sketch reaches it through Matrix, which takes most of its functions over.
| max_matrix::internal::Panel::Panel | ( | uint8_t | data_in_pin, |
| uint8_t | chip_select_pin, | ||
| uint8_t | clock_pin, | ||
| span< Byte > | buffer ) |
Makes the panel of the chain at these pins, of modules ModuleType::kDr0Cr0Rr1 in matrix orientation 0.
| [in] | data_in_pin | The pin DIN of the chain is connected to. |
| [in] | chip_select_pin | The pin CS of the chain is connected to. |
| [in] | clock_pin | The pin CLK of the chain is connected to. |
| [out] | buffer | The buffer, BufferSize() of the modules in the chain, 1 to kMaxNumberOfModules; it has to live as long as the panel. |
| void max_matrix::internal::Panel::DrawBitmap | ( | int16_t | x, |
| int16_t | y, | ||
| uint8_t | height, | ||
| span< uint8_t const > | bitmap ) |
Draws a picture from flash with its top left corner at x, y.
The picture is a column per byte, bit 0 the top row, as a glyph of a font: a 0 bit turns its dot off. Rows below height are left as they are, and what lies off the panel is left out.
The height goes before the bitmap, so that a width after it, as the columns were once given, does not compile: the bitmap brings its width.
| [in] | x | The column of the left edge; it may lie off the panel. |
| [in] | y | The row of the top edge; it may lie off the panel. |
| [in] | height | The rows of the picture, 1 to 8. |
| [in] | bitmap | The columns, in PROGMEM; as many as it holds. |
| void max_matrix::internal::Panel::DrawCircle | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | radius, | ||
| bool | value ) |
Draws the outline of a circle.
What lies off the panel is left out, as for SetDot(). A radius of 0 draws the centre only, a negative one nothing.
| [in] | x | The column of the centre. |
| [in] | y | The row of the centre. |
| [in] | radius | The dots from the centre to the outline; 3 fills the height of the panel. |
| [in] | value | True to light the outline, false to turn it off. |
| void max_matrix::internal::Panel::DrawColumn | ( | int16_t | x, |
| int16_t | y, | ||
| uint8_t | height, | ||
| Byte | value ) |
Draws one column of a picture, height rows from y on.
What lies off the panel is left out; rows below height are left as they are.
| [in] | x | The column; it may lie off the panel. |
| [in] | y | The row of bit 0; it may lie off the panel. |
| [in] | height | The rows to draw, 1 to 8. |
| [in] | value | The column, bit 0 at y. |
| void max_matrix::internal::Panel::DrawLine | ( | int16_t | x0, |
| int16_t | y0, | ||
| int16_t | x1, | ||
| int16_t | y1, | ||
| bool | value ) |
Draws a straight line from one dot to another, both ends included.
What lies off the panel is left out, as for SetDot(); the ends may lie off it.
| [in] | x0 | The column of the first end. |
| [in] | y0 | The row of the first end. |
| [in] | x1 | The column of the second end. |
| [in] | y1 | The row of the second end. |
| [in] | value | True to light the line, false to turn it off. |
| void max_matrix::internal::Panel::DrawRect | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | width, | ||
| int16_t | height, | ||
| bool | value ) |
Draws the outline of a rectangle.
What lies off the panel is left out, as for SetDot(). A width or height of 0 or less draws nothing.
| [in] | x | The column of the left edge. |
| [in] | y | The row of the top edge. |
| [in] | width | The columns it spans. |
| [in] | height | The rows it spans. |
| [in] | value | True to light the outline, false to turn it off. |
| void max_matrix::internal::Panel::FillRect | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | width, | ||
| int16_t | height, | ||
| bool | value ) |
Draws a rectangle with its inside.
What lies off the panel is left out, as for SetDot(). A width or height of 0 or less draws nothing.
| [in] | x | The column of the left edge. |
| [in] | y | The row of the top edge. |
| [in] | width | The columns it spans. |
| [in] | height | The rows it spans. |
| [in] | value | True to light it, false to turn it off. |
| MAXMATRIX_NODISCARD Result< Byte > max_matrix::internal::Panel::GetColumn | ( | int16_t | column | ) |
Returns a column of the matrix.
| [in] | column | The column, from 0 at the left to eight times the modules. |
| MAXMATRIX_NODISCARD Result< Byte > max_matrix::internal::Panel::GetColumn | ( | uint8_t | module, |
| uint8_t | column ) |
Returns a column of a module.
| [in] | module | The module, from 0 at the left. |
| [in] | column | The column within the module, 0 to 7. |
| MAXMATRIX_NODISCARD Result< bool > max_matrix::internal::Panel::GetDot | ( | int16_t | column, |
| int16_t | row ) |
Returns whether a dot is lit.
| [in] | column | The column, negative to the left of the panel. |
| [in] | row | The row, negative above the panel. |
| MAXMATRIX_NODISCARD Status max_matrix::internal::Panel::GetRow | ( | int16_t | row, |
| span< Byte > | values ) |
Gives a row of the matrix, one byte per module.
| [in] | row | The row, from 0 at the top. |
| [out] | values | The row, bit 7 of each byte the leftmost column of its module; left as it was on an error. |
| MAXMATRIX_NODISCARD Result< Byte > max_matrix::internal::Panel::GetRow | ( | uint8_t | module, |
| uint8_t | row ) |
Returns a row of a module.
The leftmost column is in bit 7, so that a row written as a binary literal looks like the dots it stands for.
| [in] | module | The module, from 0 at the left. |
| [in] | row | The row within the module, 0 to 7. |
|
inline |
Returns the matrix as it is wired, below this one.
| void max_matrix::internal::Panel::SetColumn | ( | int16_t | column, |
| Byte | value ) |
Sets a column of the matrix.
A column off the panel is left out, as for SetDot().
| [in] | column | The column, from 0 at the left to eight times the modules. |
| [in] | value | The column, bit 0 the top row. |
| void max_matrix::internal::Panel::SetColumn | ( | uint8_t | module, |
| uint8_t | column, | ||
| Byte | value ) |
Sets a column of a module.
A module or a column that does not exist is left out.
| [in] | module | The module, from 0 at the left. |
| [in] | column | The column within the module, 0 to 7. |
| [in] | value | The column, bit 0 the top row. |
| void max_matrix::internal::Panel::SetDot | ( | int16_t | column, |
| int16_t | row, | ||
| bool | value ) |
Lights a dot or turns it off.
A dot off the panel is left out rather than reported: a sprite, a line or a text that lies partly off the panel is drawn all the time while something moves in or out, and a sketch would only have to clip it itself. Adafruit GFX's drawPixel() and Rust's embedded-graphics do the same.
| [in] | column | The column, negative to the left of the panel. |
| [in] | row | The row, negative above the panel. |
| [in] | value | True to light it. |
| void max_matrix::internal::Panel::SetMatrixOrientation | ( | MatrixOrientation | matrix_orientation | ) |
Sets how the whole matrix is turned.
By 180 degrees for a board mounted upside down, with the module at the input then on the left; in addition to the module type. The picture stays as the viewer sees it; the buffer is turned along.
| [in] | matrix_orientation | 0 or 180 degrees. |
| void max_matrix::internal::Panel::SetModuleType | ( | ModuleType | module_type | ) |
Sets how the LEDs of every module are wired.
The picture stays as the viewer sees it; the buffer is rewritten along.
| [in] | module_type | The type of the modules, as MD_MAX72XX names it. |
Sets a row of the matrix, one byte per module.
A row off the panel is left out, as for SetDot(), and so are the modules beyond the bytes given, or the bytes beyond the modules.
| [in] | row | The row, from 0 at the top. |
| [in] | values | The row, bit 7 of each byte the leftmost column of its module. |
| void max_matrix::internal::Panel::SetRow | ( | uint8_t | module, |
| uint8_t | row, | ||
| Byte | value ) |
Sets a row of a module.
A module or a row that does not exist is left out.
| [in] | module | The module, from 0 at the left. |
| [in] | row | The row within the module, 0 to 7. |
| [in] | value | The row, bit 7 the leftmost column. |
| void max_matrix::internal::Panel::ShiftDown | ( | ShiftFill | fill = ShiftFill::kZero | ) |
Shifts the whole picture one row down.
| [in] | fill | What comes in at the top: an empty row, the bottom one, or the top one as it was. |
Shifts the whole picture one column to the left, with a column of the sketch coming in at the right.
A sketch that feeds a column on every step gets a band of any length, from flash, a sensor or a calculation, and what falls out at the left, to keep or pass on.
| [in] | shifted_in | The column that comes in, bit 0 the top row. |
| void max_matrix::internal::Panel::ShiftLeft | ( | ShiftFill | fill = ShiftFill::kZero | ) |
Shifts the whole picture one column to the left.
| [in] | fill | What comes in at the right: an empty column, the leftmost one, or the rightmost one as it was. |
Shifts the whole picture one column to the right, with a column of the sketch coming in at the left.
| [in] | shifted_in | The column that comes in, bit 0 the top row. |
| void max_matrix::internal::Panel::ShiftRight | ( | ShiftFill | fill = ShiftFill::kZero | ) |
Shifts the whole picture one column to the right.
| [in] | fill | What comes in at the left: an empty column, the rightmost one, or the leftmost one as it was. |
| void max_matrix::internal::Panel::ShiftUp | ( | ShiftFill | fill = ShiftFill::kZero | ) |
Shifts the whole picture one row up.
| [in] | fill | What comes in at the bottom: an empty row, the top one, or the bottom one as it was. |