|
MaxMatrix
Drive chained 8x8 LED dot matrix modules with MAX7219.
|
The lines of text a control page or program sends, carried out on a Matrix. More...
#include <Command.h>
Public Member Functions | |
| Command () | |
| Makes a reader at the start of an empty line. | |
| Result< CommandState > | Feed (Matrix &matrix, char c, Print &answer) |
| Takes the next char of a command line, and carries the line out and answers it at its end. | |
The lines of text a control page or program sends, carried out on a Matrix.
One command per line, as the Windows tool in AndreasBur/Led-Matrix sends them:
| Line | Does |
|---|---|
| text=TEXT | Clears the matrix and shows the text from the left edge, as |
one picture. | | textShift=TEXT | Shifts the text in from the right. | | intensity=0..15 | Sets the brightness. | | speed=MILLISECONDS | Sets the shift interval per column. | | space=COLUMNS | Sets the empty columns between the chars of a text. | | setDot=COLUMN,ROW,VALUE | Lights a dot, with 1, or turns it off, with 0. | | clear | Turns every LED off. | | picture | Asks what the matrix shows. |
Every line is answered with one line: ok, error: and the reason, such as error: out of range for intensity=16, or the answer to picture, picture= and two hex digits per column as the viewer sees it, from the left, bit 0 the top row. A program that shows the matrix asks for it over and over; a board cannot be told what it shows otherwise.
A sketch that does not use it pays nothing. It costs twice MAXMATRIX_COMMAND_LINE_LENGTH bytes of RAM: the line, and the text of textShift=, which Matrix::SetTextWithShift() reads for as long as it shifts while the next line fills the line buffer.
| Result< CommandState > max_matrix::Command::Feed | ( | Matrix & | matrix, |
| char | c, | ||
| Print & | answer ) |
Takes the next char of a command line, and carries the line out and answers it at its end.
The chars are collected up to a line feed. A carriage return is skipped, so that lines may end in \\r\\n as well; an empty line is no command and gets no answer. A line too long for the buffer is dropped whole, rather than carried out cut short.
| [in,out] | matrix | The matrix the command acts on. |
| [in] | c | The next char, as Serial.read() gives it. |
| [out] | answer | Where the answer to a line goes, as a rule Serial. |