From e5d176f6f42b7dcaaa587d69092b12a18e8ffe68 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 19 Nov 2021 11:45:07 +0100 Subject: [PATCH 01/10] init first LED --- tasmota/xdsp_19_max7219_matrix.ino | 275 +++++++++++++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 tasmota/xdsp_19_max7219_matrix.ino diff --git a/tasmota/xdsp_19_max7219_matrix.ino b/tasmota/xdsp_19_max7219_matrix.ino new file mode 100644 index 000000000..97c20f00b --- /dev/null +++ b/tasmota/xdsp_19_max7219_matrix.ino @@ -0,0 +1,275 @@ +/* + xdsp_19_max7219_matrix.ino.ino - Support for MAX7219 based dot matrix displays for Tasmota + + Copyright (C) 2021 Michael Beuss + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifdef USE_DISPLAY +#ifdef USE_DISPLAY_MAX7219_MATRIX +/*********************************************************************************************\ + This driver enables the display of ascii text on MAX7219 based LED dot matrix modules. + + Connect the MAX7219 display module's pins to any free GPIOs of the ESP8266 or ESP32 module + and assign the pins as follows from Tasmota's GUI: + + DIN hardware pin --> "MAX7219 DIN" + CS hardware pin --> "MAX7219 CS" + CLK hardware pin --> "MAX7219 CLK" + + Once the GPIO configuration is saved and the ESP8266/ESP32 module restarts, + set the Display Model to 19 and Display Mode to 0 + using the command "Backlog DisplayModel 15 ; DisplayMode 0" + + If your display is a TM1637 with 6 digits, set Display Width to the number of digits your + display has, using the command "DisplayWidth 6". + + After the ESP8266/ESP32 module restarts again, turn ON the display with the command "Power 1" + + Now, the following "Display" commands can be used: + + + DisplayClear + + Clears the display, command: "DisplayClear" + + + DisplayNumber num [,position {0-(Settings->display_width-1))} [,leading_zeros {0|1} [,length {1 to Settings->display_width}]]] + + Clears and then displays number without decimal. command e.g., "DisplayNumber 1234" + Control 'leading zeros', 'length' and 'position' with "DisplayNumber 1234, , , " + 'leading zeros' can be 1 or 0 (default), 'length' can be 1 to Settings->display_width, 'position' can be 0 (left-most) to Settings->display_width (right-most). + See function description below for more details. + + DisplayNumberNC num [,position {0-(Settings->display_width-1))} [,leading_zeros {0|1} [,length {1 to Settings->display_width}]]] + + Display integer number as above, but without clearing first. e.g., "DisplayNumberNC 1234". Usage is same as above. + + + + DisplayFloat num [,position {0-(Settings->display_width-1)} [,precision {0-Settings->display_width} [,length {1 to Settings->display_width}]]] + + Clears and then displays float (with decimal point) command e.g., "DisplayFloat 12.34" + See function description below for more details. + + + + DisplayFloatNC num [,position {0-(Settings->display_width-1)} [,precision {0-Settings->display_width} [,length {1 to Settings->display_width}]]] + + Displays float (with decimal point) as above, but without clearing first. command e.g., "DisplayFloatNC 12.34" + See function description below for more details. + + + + DisplayRaw position {0-(Settings->display_width-1)},length {1 to Settings->display_width}, num1 [, num2[, num3[, num4[, ...upto Settings->display_width numbers]]]]] + + Takes upto Settings->display_width comma-separated integers (0-255) and displays raw segments. Each number represents a + 7-segment digit. Each 8-bit number represents individual segments of a digit. + For example, the command "DisplayRaw 0, 4, 255, 255, 255, 255" would display "[8.8.8.8.]" + + + + DisplayText text [, position {0-(Settings->display_width-1)} [,length {1 to Settings->display_width}]] + + Clears and then displays basic text. command e.g., "DisplayText ajith vasudevan" + Control 'length' and 'position' with "DisplayText , , " + 'length' can be 1 to Settings->display_width, 'position' can be 0 (left-most) to Settings->display_width-1 (right-most) + A caret(^) symbol in the text input is dispayed as the degrees(°) symbol. This is useful for displaying Temperature! + For example, the command "DisplayText 22.5^" will display "22.5°". + + + DisplayTextNC text [, position {0-Settings->display_width-1} [,length {1 to Settings->display_width}]] + + Clears first, then displays text. Usage is same as above. + + + + DisplayScrollText text [, num_loops] + + Displays scrolling text indefinitely, until another Display- command (other than DisplayScrollText + or DisplayScrollDelay is issued). Optionally, stop scrolling after num_loops iterations. + + + + DisplayScrollDelay delay {0-15} // default = 4 + + Sets the speed of text scroll. Smaller delay = faster scrolling. + + + + DisplayLevel num {0-100} + + Display a horizontal bar graph (0-100) command e.g., "DisplayLevel 50" will display [|||| ] + + + + DisplayClock 1|2|0 + + Displays a clock. + Commands "DisplayClock 1" // 12 hr format + "DisplayClock 2" // 24 hr format + "DisplayClock 0" // turn off clock + + +In addition, setting DisplayMode to 1 shows the time, setting it to 2 shows the date +and setting it to 3 alternates between time and date. + + + +\*********************************************************************************************/ + +#define XDSP_19 19 +#define CMD_MAX_LEN 55 + + +#include + +LedControl *max7219_Matrix; +bool max2791Matrix_init_done = false; +byte modulesPerRow = 4; + + +bool MAX7291Matrix_init(void) +{ + if (!PinUsed(GPIO_MAX7219DIN) || !PinUsed(GPIO_MAX7219CLK) || !PinUsed(GPIO_MAX7219CS)) + { + AddLog(LOG_LEVEL_INFO, PSTR("DSP: MAX7291Matrix_init GPIO pins missing DIN, CLK or CS")); + return false; // ensure necessariy pins are configurated + } + + Settings->display_model = XDSP_19; + Settings->display_cols[0] = Settings->display_width; + Settings->display_height = 1; + Settings->display_rows = Settings->display_height; + max7219_Matrix = new LedControl(Pin(GPIO_MAX7219DIN), Pin(GPIO_MAX7219CLK), Pin(GPIO_MAX7219CS), modulesPerRow); + MAX7291Matrix_On(true); + MAX7291Matrix_Clear(); + MAX7291Matrix_Dim(); + AddLog(LOG_LEVEL_INFO, PSTR("DSP: MAX7291Matrix_init")); + max2791Matrix_init_done = true; + + max7219_Matrix->setLed(0, 3, 3, true); + AddLog(LOG_LEVEL_INFO, PSTR("DSP: setLed 3,3")); + return true; +} + +bool MAX7291Matrix_On( bool on ) +{ + for (int addr = 0; addr < modulesPerRow; addr++) + { + max7219_Matrix->shutdown (addr, !on); // false: on, true: off + } + AddLog(LOG_LEVEL_INFO, PSTR("MTX: On %d"), on); + return true; + +} + +bool MAX7291Matrix_Dim(void) +{ + int dim = GetDisplayDimmer16(); + for (int addr = 0; addr < modulesPerRow; addr++) + { + max7219_Matrix->setIntensity(addr, dim); // 1..15 + } + AddLog(LOG_LEVEL_INFO, PSTR("DSP: Dim %d"), dim); + return true; +} + +// /*********************************************************************************************\ +// * Clears the display +// * Command: DisplayClear +// \*********************************************************************************************/ +bool MAX7291Matrix_Clear(void) +{ + for(int addr=0; addrclearDisplay(addr); + } + AddLog(LOG_LEVEL_INFO, PSTR("DSP: Clear")); + return true; +} + +// /*********************************************************************************************\ +// * Clears the display +// * Command: DisplayText +// \*********************************************************************************************/ +bool MAX7291Matrix_Text() +{ + char sString[CMD_MAX_LEN + 1]; + subStr(sString, XdrvMailbox.data, ",", 1); + MAX7291Matrix_Clear; + AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: sString %s"), sString); + + // test + uint8_t length = strlen(sString); + //if(length > modulesPerRow) + length = modulesPerRow; + + for(int addr = 0; addrsetLed(addr, 0, 1, true); + AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: setLed() %d, 0, 1)"), addr); + } + + return true; +} + +bool Xdsp19(uint8_t function) +{ + bool result = false; + + + if (FUNC_DISPLAY_INIT_DRIVER == function) + { + result = MAX7291Matrix_init(); + } + else{ + //if (max2791Matrix_init_done && (XDSP_19 == Settings->display_model)) { + switch (function) { + case FUNC_DISPLAY_MODEL: + result = true; + break; + case FUNC_DISPLAY_CLEAR: + result = MAX7291Matrix_Clear(); + break; + case FUNC_DISPLAY_DIM: + result = MAX7291Matrix_Dim(); + break; + case FUNC_DISPLAY_SEVENSEG_TEXT: + case FUNC_DISPLAY_SEVENSEG_TEXTNC: + case FUNC_DISPLAY_NUMBER: + case FUNC_DISPLAY_NUMBERNC: + case FUNC_DISPLAY_FLOAT: + case FUNC_DISPLAY_FLOATNC: + case FUNC_DISPLAY_RAW: + case FUNC_DISPLAY_LEVEL: + case FUNC_DISPLAY_SCROLLTEXT: + case FUNC_DISPLAY_CLOCK: + case FUNC_DISPLAY_DRAW_STRING: + result = MAX7291Matrix_Text(); + break; + case FUNC_DISPLAY_EVERY_50_MSECOND: + case FUNC_DISPLAY_EVERY_SECOND: + // ignore + return false; + default: + result = false; + } + } + return result; +} + + + +#endif // USE_DISPLAY_MAX7219_MATRIX +#endif // USE_DISPLAY From b3dd33f2488184076eceadaffabaca24f8fd8dd5 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 19 Nov 2021 11:47:00 +0100 Subject: [PATCH 02/10] first init --- tasmota/tasmota_template.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tasmota/tasmota_template.h b/tasmota/tasmota_template.h index 0de887e9c..e3f3256fc 100644 --- a/tasmota/tasmota_template.h +++ b/tasmota/tasmota_template.h @@ -520,6 +520,15 @@ const uint16_t kGpioNiceList[] PROGMEM = { AGPIO(GPIO_SSD1331_CS), AGPIO(GPIO_SSD1331_DC), #endif // USE_DISPLAY_SSD1331 + +#ifdef USE_DISPLAY_MAX7219_MATRIX + #undef USE_DISPLAY_MAX7219 + #undef USE_DISPLAY_TM1637 + AGPIO(GPIO_MAX7219CLK), + AGPIO(GPIO_MAX7219DIN), + AGPIO(GPIO_MAX7219CS), +#endif // USE_DISPLAY_MAX7219_MATRIX + #ifdef USE_DISPLAY_TM1637 AGPIO(GPIO_TM1637CLK), AGPIO(GPIO_TM1637DIO), From 532e5069468f6aff76cf9d8dd2140bdb60b6fab8 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 20 Nov 2021 17:28:38 +0100 Subject: [PATCH 03/10] use LedMatrix 1234 --- lib/lib_display/LedControl/src/LedMatrix.cpp | 186 +++++++++++++++++++ lib/lib_display/LedControl/src/LedMatrix.h | 124 +++++++++++++ tasmota/xdsp_19_max7219_matrix.ino | 152 +++++++-------- 3 files changed, 373 insertions(+), 89 deletions(-) create mode 100644 lib/lib_display/LedControl/src/LedMatrix.cpp create mode 100644 lib/lib_display/LedControl/src/LedMatrix.h diff --git a/lib/lib_display/LedControl/src/LedMatrix.cpp b/lib/lib_display/LedControl/src/LedMatrix.cpp new file mode 100644 index 000000000..427ae8c52 --- /dev/null +++ b/lib/lib_display/LedControl/src/LedMatrix.cpp @@ -0,0 +1,186 @@ +/* + * LedMatrix.h - Extends the Library LedControl for multiple LED dot matrix modules, based on MAX7219/MAX7221 + * Copyright (c) 2021 Michael Beuss + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * This permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "LedMatrix.h" + +// public +LedMatrix::LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, unsigned int rows) +{ + if (colums * rows > MATRIX_MAX_MODULES) + { + // dimension exeeds maximum buffer size + if (colums >= MATRIX_MAX_MODULES) + { + colums = MATRIX_MAX_MODULES; + rows = 1; + } + else + { + rows = MATRIX_MAX_MODULES / colums; + } + } + + modulesPerRow = colums; + modulesPerCol = rows; + width = colums * 8; + height = rows * 8; + modules = colums * rows; + moduleOrientation = ORIENTATION_UPSIDE_DOWN; + ledControl = new LedControl(dataPin, clkPin, csPin, modules); + shutdown(false); // false: on, true: off + clear(); + setIntensity(7); +} + +bool LedMatrix::clear(void) +{ + for (int i = 0; i < MATRIX_BUFFER_SIZE; i++) + { + buffer[i] = 0; + } + for (int addr = 0; addr < modules; addr++) + { + ledControl->clearDisplay(addr); + } + return true; +} + +bool LedMatrix::setIntensity(byte dim) +{ + for (int addr = 0; addr < modules; addr++) + { + ledControl->setIntensity(addr, dim); // 1..15 + } + return true; +} + +bool LedMatrix::setOrientation(ModuleOrientation orientation) +{ + moduleOrientation = orientation; + return true; +} + +bool LedMatrix::setPixel(int x, int y, bool on) +{ + if (x >= width || y >= height) + return false; + + int modul_col = x / 8; // x pos divided by 8 is the index of the modul to the right + int buffer_pos = modul_col + y * width / 8; + byte buffer_byte = 8 >> (x % 8); + if (on) + { + buffer[buffer_pos] |= buffer_byte; // set bit + } + else + { + buffer[buffer_pos] &= ~buffer_byte; // reset bit + } + refreshByteOfBuffer(buffer_pos); + return true; +} + +void LedMatrix::test() +{ + const static byte testMatrix[] PROGMEM = { + B00000010, B00111100, B00111100, B00001000, + B00000110, B01000010, B01000010, B00010000, + B00001010, B00000010, B00000010, B00100000, + B00000010, B00000100, B00001100, B01000100, + B00000010, B00011000, B00000010, B01111110, + B00000010, B00100000, B01000010, B00000100, + B00000000, B11111110, B00111100, B00000100, + B00000000, B00000000, B00000000, B00000000, + }; + for (int i = 0; i < 32; i++) + { + buffer[i] = testMatrix[i]; + } + refresh(); +} + +// private +bool LedMatrix::shutdown(bool b) +{ + for (int addr = 0; addr < modules; addr++) + { + ledControl->shutdown(addr, b); // b: false: on, true: off + } + return true; +} + +void LedMatrix::refresh() +{ + for (int i = 0; i < modulesPerRow * height; i++) + { + refreshByteOfBuffer(i); + } +} + +void LedMatrix::refreshByteOfBuffer(int i) +{ + int line = i / modulesPerRow; + int addr = line / 8 + i % modulesPerRow; + byte b = buffer[i]; + if (moduleOrientation == ORIENTATION_NORMAL || moduleOrientation == ORIENTATION_UPSIDE_DOWN) + { + int rowOfAddr = 0; + if (moduleOrientation == ORIENTATION_NORMAL) + { + rowOfAddr = line % 8; // ORIENTATION_NORMAL + } + else + { + rowOfAddr = 7 - line % 8; // ORIENTATION_UPSIDE_DOWN + b = revereBitorder(b); + } + ledControl->setRow(addr, rowOfAddr, b); + } + else + { + // ORIENTATION_TURN_RIGHT or ORIENTATION_TURN_LEFT + int colOfAddr = 0; + if (moduleOrientation == ORIENTATION_TURN_LEFT) + { + colOfAddr = line % 8; // ORIENTATION_TURN_LEFT + } + else + { + colOfAddr = 7 - line % 8; // ORIENTATION_TURN_RIGHT + b = revereBitorder(b); + } + ledControl->setColumn(addr, colOfAddr, b); + } +} + +byte LedMatrix::revereBitorder (byte b) +{ + const static byte lookup[] PROGMEM = { + 0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe, + 0x1, 0x9, 0x5, 0xd, 0x3, 0xb, 0x7, 0xf, + }; + return (lookup[b & 0b1111] << 4) | lookup[b >> 4]; +} diff --git a/lib/lib_display/LedControl/src/LedMatrix.h b/lib/lib_display/LedControl/src/LedMatrix.h new file mode 100644 index 000000000..f439e5d05 --- /dev/null +++ b/lib/lib_display/LedControl/src/LedMatrix.h @@ -0,0 +1,124 @@ +/* + * LedMatrix.h - Extends the Library LedControl for multiple LED dot matrix modules, based on MAX7219/MAX7221 + * Copyright (c) 2021 Michael Beuss + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * This permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef LedMatrix_h +#define LedMatrix_h + +#include + +#define MATRIX_MAX_MODULES 32 +#define MATRIX_BUFFER_SIZE MATRIX_MAX_MODULES * 8 // 8 bytes per modul. One byte represents 8 LEDs. + + +/** + * @brief LedMatric controls multiple 8x8 LED dot matrx modules. + * All modules in rows and clolums together build a common matrix. + * + */ +class LedMatrix +{ + public: + enum ModuleOrientation // orientation of 8x8 LED dot matrix mdules (first module is top left) + { + ORIENTATION_NORMAL, // first pixel is on top left, no turn is necessary + ORIENTATION_TURN_RIGHT, // first pixel is on bottom left, for correction it has to turn 90° right + ORIENTATION_UPSIDE_DOWN, // first pixel is on bottom right, fpr correction it has to turn 180° + ORIENTATION_TURN_LEFT, // first pixel is on top right, for correction is has to turn 90° left. + }; + + private: + unsigned int modulesPerRow; + unsigned int modulesPerCol; + unsigned int width; // matrix width [pixel] + unsigned int height; // matrix height [pixel] + unsigned int modules; // number of 8x8 mudules + ModuleOrientation moduleOrientation; + byte buffer[MATRIX_BUFFER_SIZE]; + LedControl* ledControl; + + + public: + /** + * @brief Construct a new Led Matrix object + * + * @param colums of 8x8 LED dot matrix modules + * @param rows of 8x8 LED dot matrix modules + */ + LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, unsigned int rows); + + /** + * @brief Set all LEDs off. + * + */ + bool clear(void); + + /** + * @brief Set the brightness of the display + * + * @param dim 0..15 + */ + bool setIntensity(byte dim); + + /** + * @brief Switches the display on or off + * + * @param on true: on false: off + */ + void power( bool on ); + + /** + * @brief Set the orientation of the 8x8 LED dot matrix module + * + * @param orientation + */ + bool setOrientation(ModuleOrientation orientation); + + /** + * @brief Set the Pixel object + * + * @param x horizontal position from left + * @param y vertical position from top + * @param on true: on, false: off + */ + bool setPixel( int x, int y, bool on); + void test(); + + private: + bool shutdown(bool b); + + /** + * @brief sends the changed content of the buffer to the display + * + */ + void refresh(); + + void refreshByteOfBuffer( int i); + + byte revereBitorder (byte b); + +}; + +#endif //LedMatrix_h \ No newline at end of file diff --git a/tasmota/xdsp_19_max7219_matrix.ino b/tasmota/xdsp_19_max7219_matrix.ino index 97c20f00b..da3177f59 100644 --- a/tasmota/xdsp_19_max7219_matrix.ino +++ b/tasmota/xdsp_19_max7219_matrix.ino @@ -133,70 +133,45 @@ and setting it to 3 alternates between time and date. #define XDSP_19 19 #define CMD_MAX_LEN 55 +#include -#include - -LedControl *max7219_Matrix; +LedMatrix *max7219_Matrix; bool max2791Matrix_init_done = false; byte modulesPerRow = 4; - +byte modulesPerCol = 1; bool MAX7291Matrix_init(void) { if (!PinUsed(GPIO_MAX7219DIN) || !PinUsed(GPIO_MAX7219CLK) || !PinUsed(GPIO_MAX7219CS)) { - AddLog(LOG_LEVEL_INFO, PSTR("DSP: MAX7291Matrix_init GPIO pins missing DIN, CLK or CS")); + AddLog(LOG_LEVEL_INFO, PSTR("DSP: MAX7291Matrix_init GPIO pins missing DIN:%d, CLK:%d, CS:%d"), Pin(GPIO_MAX7219DIN), Pin(GPIO_MAX7219CLK), Pin(GPIO_MAX7219CS) ); return false; // ensure necessariy pins are configurated } Settings->display_model = XDSP_19; + if (Settings->display_width) // [pixel] + { + modulesPerRow = (Settings->display_width - 1) / 8 + 1; + } + Settings->display_width = 8 * modulesPerRow; Settings->display_cols[0] = Settings->display_width; - Settings->display_height = 1; + if (Settings->display_height) // [pixel] + { + modulesPerCol = (Settings->display_height - 1) / 8 + 1; + } + Settings->display_height = 8 * modulesPerCol; Settings->display_rows = Settings->display_height; - max7219_Matrix = new LedControl(Pin(GPIO_MAX7219DIN), Pin(GPIO_MAX7219CLK), Pin(GPIO_MAX7219CS), modulesPerRow); - MAX7291Matrix_On(true); - MAX7291Matrix_Clear(); - MAX7291Matrix_Dim(); - AddLog(LOG_LEVEL_INFO, PSTR("DSP: MAX7291Matrix_init")); + Settings->display_cols[1] = Settings->display_height; + max7219_Matrix = new LedMatrix(Pin(GPIO_MAX7219DIN), Pin(GPIO_MAX7219CLK), Pin(GPIO_MAX7219CS), modulesPerRow, modulesPerCol); + int intensity = GetDisplayDimmer16(); // 0..15 + max7219_Matrix->setIntensity(intensity); + int orientation = Settings->display_rotate; + max7219_Matrix->setOrientation((LedMatrix::ModuleOrientation)orientation ); + AddLog(LOG_LEVEL_INFO, PSTR("DSP: MAX7291Matrix_init %dx%d modules, orientation: %d, intensity: %d"), modulesPerRow , modulesPerCol, orientation, intensity); max2791Matrix_init_done = true; - max7219_Matrix->setLed(0, 3, 3, true); - AddLog(LOG_LEVEL_INFO, PSTR("DSP: setLed 3,3")); - return true; -} - -bool MAX7291Matrix_On( bool on ) -{ - for (int addr = 0; addr < modulesPerRow; addr++) - { - max7219_Matrix->shutdown (addr, !on); // false: on, true: off - } - AddLog(LOG_LEVEL_INFO, PSTR("MTX: On %d"), on); - return true; - -} - -bool MAX7291Matrix_Dim(void) -{ - int dim = GetDisplayDimmer16(); - for (int addr = 0; addr < modulesPerRow; addr++) - { - max7219_Matrix->setIntensity(addr, dim); // 1..15 - } - AddLog(LOG_LEVEL_INFO, PSTR("DSP: Dim %d"), dim); - return true; -} - -// /*********************************************************************************************\ -// * Clears the display -// * Command: DisplayClear -// \*********************************************************************************************/ -bool MAX7291Matrix_Clear(void) -{ - for(int addr=0; addrclearDisplay(addr); - } - AddLog(LOG_LEVEL_INFO, PSTR("DSP: Clear")); + max7219_Matrix->test(); + AddLog(LOG_LEVEL_INFO, PSTR("DSP: display test")); return true; } @@ -208,17 +183,18 @@ bool MAX7291Matrix_Text() { char sString[CMD_MAX_LEN + 1]; subStr(sString, XdrvMailbox.data, ",", 1); - MAX7291Matrix_Clear; + max7219_Matrix->clear(); AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: sString %s"), sString); // test uint8_t length = strlen(sString); - //if(length > modulesPerRow) - length = modulesPerRow; + //if(length > modulesPerRow) + length = modulesPerRow; - for(int addr = 0; addrsetLed(addr, 0, 1, true); - AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: setLed() %d, 0, 1)"), addr); + for (int addr = 0; addr < length; addr++) + { + max7219_Matrix->setPixel(addr, addr, true); + AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: setPixel() %d, %d)"), addr, addr); } return true; @@ -226,50 +202,48 @@ bool MAX7291Matrix_Text() bool Xdsp19(uint8_t function) { - bool result = false; - + bool result = false; if (FUNC_DISPLAY_INIT_DRIVER == function) { result = MAX7291Matrix_init(); } - else{ - //if (max2791Matrix_init_done && (XDSP_19 == Settings->display_model)) { - switch (function) { - case FUNC_DISPLAY_MODEL: - result = true; - break; - case FUNC_DISPLAY_CLEAR: - result = MAX7291Matrix_Clear(); - break; - case FUNC_DISPLAY_DIM: - result = MAX7291Matrix_Dim(); - break; - case FUNC_DISPLAY_SEVENSEG_TEXT: - case FUNC_DISPLAY_SEVENSEG_TEXTNC: - case FUNC_DISPLAY_NUMBER: - case FUNC_DISPLAY_NUMBERNC: - case FUNC_DISPLAY_FLOAT: - case FUNC_DISPLAY_FLOATNC: - case FUNC_DISPLAY_RAW: - case FUNC_DISPLAY_LEVEL: - case FUNC_DISPLAY_SCROLLTEXT: - case FUNC_DISPLAY_CLOCK: - case FUNC_DISPLAY_DRAW_STRING: - result = MAX7291Matrix_Text(); - break; - case FUNC_DISPLAY_EVERY_50_MSECOND: - case FUNC_DISPLAY_EVERY_SECOND: - // ignore - return false; - default: - result = false; + else if (max7219_Matrix && (XDSP_19 == Settings->display_model)) + { + switch (function) + { + case FUNC_DISPLAY_MODEL: + result = true; + break; + case FUNC_DISPLAY_CLEAR: + result = max7219_Matrix->clear(); + break; + case FUNC_DISPLAY_DIM: + result = max7219_Matrix->setIntensity(GetDisplayDimmer16()); + break; + case FUNC_DISPLAY_SEVENSEG_TEXT: + case FUNC_DISPLAY_SEVENSEG_TEXTNC: + case FUNC_DISPLAY_NUMBER: + case FUNC_DISPLAY_NUMBERNC: + case FUNC_DISPLAY_FLOAT: + case FUNC_DISPLAY_FLOATNC: + case FUNC_DISPLAY_RAW: + case FUNC_DISPLAY_LEVEL: + case FUNC_DISPLAY_SCROLLTEXT: + case FUNC_DISPLAY_CLOCK: + case FUNC_DISPLAY_DRAW_STRING: + result = MAX7291Matrix_Text(); + break; + case FUNC_DISPLAY_EVERY_50_MSECOND: + case FUNC_DISPLAY_EVERY_SECOND: + // ignore + return false; + default: + result = false; } } return result; } - - #endif // USE_DISPLAY_MAX7219_MATRIX #endif // USE_DISPLAY From 917777d2c50deda43c19c1671c38527b882820bc Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 23 Nov 2021 14:46:19 +0100 Subject: [PATCH 04/10] first scroll --- lib/lib_display/LedControl/src/LedMatrix.cpp | 144 +++++++++- lib/lib_display/LedControl/src/LedMatrix.h | 55 +++- .../LedControl/src/font_5x8_horizontal_MSB.h | 264 ++++++++++++++++++ .../LedControl/src/font_6x8_horizontal_MSB.h | 264 ++++++++++++++++++ tasmota/xdsp_19_max7219_matrix.ino | 36 +-- 5 files changed, 716 insertions(+), 47 deletions(-) create mode 100644 lib/lib_display/LedControl/src/font_5x8_horizontal_MSB.h create mode 100644 lib/lib_display/LedControl/src/font_6x8_horizontal_MSB.h diff --git a/lib/lib_display/LedControl/src/LedMatrix.cpp b/lib/lib_display/LedControl/src/LedMatrix.cpp index 427ae8c52..19ac0dcb2 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.cpp +++ b/lib/lib_display/LedControl/src/LedMatrix.cpp @@ -25,6 +25,7 @@ */ #include "LedMatrix.h" +#include "font_6x8_horizontal_MSB.h" // public LedMatrix::LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, unsigned int rows) @@ -45,22 +46,116 @@ LedMatrix::LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, un modulesPerRow = colums; modulesPerCol = rows; - width = colums * 8; - height = rows * 8; + displayWidth = colums * 8; + displayHeight = rows * 8; modules = colums * rows; moduleOrientation = ORIENTATION_UPSIDE_DOWN; ledControl = new LedControl(dataPin, clkPin, csPin, modules); + textBuf[0] = 0; + textWidth = 0; + textPosX = 0; + textPosY = 0; + appendTextBuf[0] = 0; + setScrollAppendText(" "); shutdown(false); // false: on, true: off clear(); setIntensity(7); } +bool LedMatrix::drawText( const char *str) +{ + strncpy(textBuf, str, TEXT_BUFFER_SIZE -1); + textPosX = 0; + textPosY = 0; + textWidth = strlen(textBuf) * charWidth; + if(textWidth < displayWidth) + { + textPosX = (displayWidth - textWidth) / 2; // center + } + else + { + // The text ist longer than the display width. Scrolling is needed. + // Append a space between end of text and the beginning of the repeting text. + appendSpace(); + } + clear(); + drawTextAt(textBuf, textPosX, textPosY); + refresh(); // refresh display with new string content + return true; +} + +bool LedMatrix::drawTextAt( const char *str, const int x, const int y ) +{ + // draw character by character + unsigned int len = strlen(str); + int xPos = x; + for (unsigned int i = 0; i < len; i++) + { + drawCharAt(str[i], xPos, y); + xPos += charWidth; + } + return true; +} + +bool LedMatrix::scrollText() +{ + if(textWidth < displayWidth) return false; // do not scroll when text fits into the display + + textPosX--; + if(textPosX + textWidth < 0) + { + textPosX = 0; // start from the beginning after text scrolled out of display; + } + drawTextAt(textBuf, textPosX, textPosY); + + int startOfRepeatingTextPos = textPosX + textWidth; + if(startOfRepeatingTextPos < displayWidth) + { + // Draw repeating text. + drawTextAt(textBuf, startOfRepeatingTextPos, textPosY); + } + refresh(); + return true; +} + +bool LedMatrix::drawCharAt( char c, const int x, const int y) +{ + // ignore when the character position is not visible on the display + bool visible = ( + x > 0 - (int)charWidth && x < (int)displayWidth && + y > 0 - (int)charHeight && y < (int)displayHeight + ); + if (!visible) return false; + + // ignore the leading bits above charWidth of the font definition + static const byte charOffset = 8 - charWidth; + + for (byte charY = 0; charY < charHeight; charY++) + { + char pixelRow = (font[c][charY]) << charOffset; // skip the first bits when the character width is smaller than 8 pixel + for (byte charX = 0; charX < charWidth; charX++) + { + bool pixel = (pixelRow & 0x80); // pixel=true when upper bit is set + setPixel(x + charX, y + charY, pixel); + pixelRow = pixelRow << 1; // next pixel + } + } + return true; +} + +bool LedMatrix::clearDisplay(void) +{ + textBuf[0] = 0; + memset(textBuf, 0, TEXT_BUFFER_SIZE); + textWidth = 0; + clear(); + return true; +} + + bool LedMatrix::clear(void) { - for (int i = 0; i < MATRIX_BUFFER_SIZE; i++) - { - buffer[i] = 0; - } + memset(buffer, 0, MATRIX_BUFFER_SIZE); for (int addr = 0; addr < modules; addr++) { ledControl->clearDisplay(addr); @@ -83,14 +178,20 @@ bool LedMatrix::setOrientation(ModuleOrientation orientation) return true; } -bool LedMatrix::setPixel(int x, int y, bool on) +bool LedMatrix::setScrollAppendText(const char* append ) { - if (x >= width || y >= height) + strncpy(appendTextBuf, append, TEXT_APPEND_BUFFER_SIZE -1); + return (strlen(append) < TEXT_APPEND_BUFFER_SIZE); +} + +bool LedMatrix::setPixel(const int x, const int y, bool on) +{ + if (x >= displayWidth || y >= displayHeight) return false; int modul_col = x / 8; // x pos divided by 8 is the index of the modul to the right - int buffer_pos = modul_col + y * width / 8; - byte buffer_byte = 8 >> (x % 8); + int buffer_pos = modul_col + y * modulesPerRow; + byte buffer_byte = 0x80 >> (x % 8); if (on) { buffer[buffer_pos] |= buffer_byte; // set bit @@ -99,12 +200,12 @@ bool LedMatrix::setPixel(int x, int y, bool on) { buffer[buffer_pos] &= ~buffer_byte; // reset bit } - refreshByteOfBuffer(buffer_pos); return true; } void LedMatrix::test() { + /* const static byte testMatrix[] PROGMEM = { B00000010, B00111100, B00111100, B00001000, B00000110, B01000010, B01000010, B00010000, @@ -112,7 +213,7 @@ void LedMatrix::test() B00000010, B00000100, B00001100, B01000100, B00000010, B00011000, B00000010, B01111110, B00000010, B00100000, B01000010, B00000100, - B00000000, B11111110, B00111100, B00000100, + B00000000, B01111110, B00111100, B00000100, B00000000, B00000000, B00000000, B00000000, }; for (int i = 0; i < 32; i++) @@ -120,6 +221,17 @@ void LedMatrix::test() buffer[i] = testMatrix[i]; } refresh(); + */ + drawText("1234567890"); + delay(1000); + for( int i=0; i<320; i++) + { + delay(50); + scrollText(); + } + //drawCharAt(0x31, 1, 0); + //setPixel(1,30); + //refresh(); } // private @@ -134,7 +246,7 @@ bool LedMatrix::shutdown(bool b) void LedMatrix::refresh() { - for (int i = 0; i < modulesPerRow * height; i++) + for (int i = 0; i < modulesPerRow * displayHeight; i++) { refreshByteOfBuffer(i); } @@ -184,3 +296,9 @@ byte LedMatrix::revereBitorder (byte b) }; return (lookup[b & 0b1111] << 4) | lookup[b >> 4]; } + +void LedMatrix::appendSpace() +{ + strncat(textBuf, appendTextBuf, TEXT_BUFFER_SIZE -1); + textWidth = strlen(textBuf) * charWidth; +} diff --git a/lib/lib_display/LedControl/src/LedMatrix.h b/lib/lib_display/LedControl/src/LedMatrix.h index f439e5d05..586a06146 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.h +++ b/lib/lib_display/LedControl/src/LedMatrix.h @@ -31,6 +31,8 @@ #define MATRIX_MAX_MODULES 32 #define MATRIX_BUFFER_SIZE MATRIX_MAX_MODULES * 8 // 8 bytes per modul. One byte represents 8 LEDs. +#define TEXT_BUFFER_SIZE 256 +#define TEXT_APPEND_BUFFER_SIZE 16 /** @@ -52,12 +54,19 @@ class LedMatrix private: unsigned int modulesPerRow; unsigned int modulesPerCol; - unsigned int width; // matrix width [pixel] - unsigned int height; // matrix height [pixel] + unsigned int displayWidth; // matrix width [pixel] + unsigned int displayHeight; // matrix height [pixel] unsigned int modules; // number of 8x8 mudules ModuleOrientation moduleOrientation; byte buffer[MATRIX_BUFFER_SIZE]; LedControl* ledControl; + const unsigned int charWidth = 6; + const unsigned int charHeight = 8; + char textBuf[TEXT_BUFFER_SIZE]; + char appendTextBuf[TEXT_APPEND_BUFFER_SIZE]; + unsigned int textWidth; // width of text [pixel] + int textPosX; // horizontal pixel position of scrolling text + int textPosY; // vertical pixelposition of scrolling text; public: @@ -73,7 +82,7 @@ class LedMatrix * @brief Set all LEDs off. * */ - bool clear(void); + bool clearDisplay(void); /** * @brief Set the brightness of the display @@ -82,6 +91,13 @@ class LedMatrix */ bool setIntensity(byte dim); + /** + * @brief Set the a pending string to the scrolling text to set a distance to te repeating text. Usually some spaces. + * + * @param append text to append to the scrolling text before repeating. + */ + bool setScrollAppendText(const char* append ); + /** * @brief Switches the display on or off * @@ -96,6 +112,32 @@ class LedMatrix */ bool setOrientation(ModuleOrientation orientation); + /** + * @brief draw a string to the display. + * When the text fits into the size of the display, it will be shown in the center. + * When the text is longer than than the display width, it can be scrolled per pixel with function scrollText(). + * + * @param str string to display + */ + bool drawText( const char *str ); + + /** + * @brief dwaws a character string to the display. The position (x,y) is used for the upper left pixtel of the text. + * Existing text before the x position will not be cleared. + * + * @param str string to display + * @param x horizantal pixel position to start with string (default 0) + * @param y vertical pixel position for the top position of the string (default 0) + */ + bool drawTextAt( const char *str, const int x, const int y ); + + /** + * @brief Scroll the current teext one picel to the left. + * Repeat with from start when end of text reached. + * + */ + bool scrollText(); + /** * @brief Set the Pixel object * @@ -103,11 +145,14 @@ class LedMatrix * @param y vertical position from top * @param on true: on, false: off */ - bool setPixel( int x, int y, bool on); + bool setPixel( const int x, const int y, bool on=true); void test(); private: + bool drawCharAt( char c, int x, int y ); + bool shutdown(bool b); + bool clear(void); /** * @brief sends the changed content of the buffer to the display @@ -119,6 +164,8 @@ class LedMatrix byte revereBitorder (byte b); + void appendSpace(); + }; #endif //LedMatrix_h \ No newline at end of file diff --git a/lib/lib_display/LedControl/src/font_5x8_horizontal_MSB.h b/lib/lib_display/LedControl/src/font_5x8_horizontal_MSB.h new file mode 100644 index 000000000..56df774a4 --- /dev/null +++ b/lib/lib_display/LedControl/src/font_5x8_horizontal_MSB.h @@ -0,0 +1,264 @@ +// 5x8 ascii font +#ifndef font_5x8_horizontal_MSB_h +#define font_5x8_horizontal_MSB_h + +const char font[256][8]={ +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x00 +{0x0E,0x11,0x1B,0x11,0x1F,0x0E,0x00,0x00}, // 0x01 +{0x0E,0x15,0x1F,0x11,0x1F,0x0E,0x00,0x00}, // 0x02 +{0x0A,0x1F,0x1F,0x1F,0x0E,0x04,0x00,0x00}, // 0x03 +{0x04,0x04,0x0E,0x1F,0x0E,0x04,0x04,0x00}, // 0x04 +{0x04,0x0E,0x04,0x1F,0x15,0x04,0x0E,0x00}, // 0x05 +{0x04,0x0E,0x1F,0x1F,0x15,0x04,0x0E,0x00}, // 0x06 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x07 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x08 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x09 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0A +{0x03,0x03,0x0E,0x11,0x11,0x11,0x0E,0x00}, // 0x0B +{0x0E,0x11,0x11,0x11,0x0E,0x04,0x0E,0x04}, // 0x0C +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0D +{0x03,0x0F,0x09,0x09,0x0B,0x1B,0x18,0x00}, // 0x0E +{0x00,0x15,0x0E,0x1B,0x0E,0x15,0x00,0x00}, // 0x0F +{0x00,0x10,0x1C,0x1F,0x1C,0x10,0x00,0x00}, // 0x10 +{0x00,0x01,0x07,0x1F,0x07,0x01,0x00,0x00}, // 0x11 +{0x04,0x0E,0x04,0x04,0x04,0x0E,0x04,0x00}, // 0x12 +{0x00,0x0A,0x0A,0x0A,0x00,0x0A,0x00,0x00}, // 0x13 +{0x0E,0x1A,0x1A,0x0A,0x0A,0x0A,0x0A,0x00}, // 0x14 +{0x06,0x08,0x04,0x0A,0x04,0x02,0x0C,0x00}, // 0x15 +{0x00,0x00,0x00,0x0F,0x0F,0x00,0x00,0x00}, // 0x16 +{0x04,0x0E,0x04,0x0E,0x04,0x00,0x0E,0x00}, // 0x17 +{0x04,0x0E,0x04,0x04,0x04,0x04,0x04,0x00}, // 0x18 +{0x04,0x04,0x04,0x04,0x04,0x0E,0x04,0x00}, // 0x19 +{0x00,0x00,0x02,0x0F,0x02,0x00,0x00,0x00}, // 0x1A +{0x00,0x00,0x04,0x0F,0x04,0x00,0x00,0x00}, // 0x1B +{0x00,0x00,0x08,0x08,0x08,0x0F,0x00,0x00}, // 0x1C +{0x00,0x00,0x0A,0x1F,0x0A,0x00,0x00,0x00}, // 0x1D +{0x00,0x04,0x04,0x0E,0x0E,0x1F,0x00,0x00}, // 0x1E +{0x00,0x1F,0x0E,0x0E,0x04,0x04,0x00,0x00}, // 0x1F +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x20 +{0x04,0x04,0x04,0x04,0x00,0x04,0x00,0x00}, // 0x21 +{0x0A,0x0A,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x22 +{0x00,0x05,0x1F,0x0A,0x1F,0x14,0x00,0x00}, // 0x23 +{0x04,0x0E,0x0C,0x04,0x06,0x0E,0x04,0x00}, // 0x24 +{0x09,0x15,0x0E,0x0E,0x15,0x12,0x00,0x00}, // 0x25 +{0x04,0x0A,0x0C,0x15,0x12,0x0D,0x00,0x00}, // 0x26 +{0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x27 +{0x03,0x04,0x08,0x08,0x08,0x04,0x03,0x00}, // 0x28 +{0x18,0x04,0x02,0x02,0x02,0x04,0x18,0x00}, // 0x29 +{0x04,0x0A,0x04,0x0A,0x00,0x00,0x00,0x00}, // 0x2A +{0x00,0x00,0x00,0x04,0x0E,0x04,0x00,0x00}, // 0x2B +{0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x08}, // 0x2C +{0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00}, // 0x2D +{0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00}, // 0x2E +{0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x00}, // 0x2F +{0x06,0x09,0x09,0x09,0x09,0x06,0x00,0x00}, // 0x30 +{0x04,0x0C,0x04,0x04,0x04,0x0E,0x00,0x00}, // 0x31 +{0x0C,0x02,0x02,0x04,0x08,0x0E,0x00,0x00}, // 0x32 +{0x0C,0x02,0x0C,0x02,0x02,0x0C,0x00,0x00}, // 0x33 +{0x02,0x06,0x0A,0x0F,0x02,0x02,0x00,0x00}, // 0x34 +{0x0E,0x08,0x0C,0x02,0x02,0x0C,0x00,0x00}, // 0x35 +{0x06,0x08,0x0E,0x09,0x09,0x06,0x00,0x00}, // 0x36 +{0x0F,0x01,0x02,0x04,0x04,0x04,0x00,0x00}, // 0x37 +{0x06,0x09,0x06,0x09,0x09,0x06,0x00,0x00}, // 0x38 +{0x06,0x09,0x09,0x07,0x01,0x06,0x00,0x00}, // 0x39 +{0x00,0x00,0x04,0x00,0x00,0x04,0x00,0x00}, // 0x3A +{0x00,0x00,0x04,0x00,0x00,0x04,0x04,0x08}, // 0x3B +{0x00,0x01,0x02,0x0C,0x02,0x01,0x00,0x00}, // 0x3C +{0x00,0x00,0x0F,0x00,0x0F,0x00,0x00,0x00}, // 0x3D +{0x00,0x08,0x04,0x03,0x04,0x08,0x00,0x00}, // 0x3E +{0x0E,0x01,0x02,0x04,0x00,0x04,0x00,0x00}, // 0x3F +{0x06,0x09,0x13,0x15,0x17,0x10,0x0F,0x00}, // 0x40 +{0x00,0x04,0x0A,0x0A,0x1F,0x11,0x00,0x00}, // 0x41 +{0x00,0x0E,0x0A,0x0C,0x0A,0x0E,0x00,0x00}, // 0x42 +{0x00,0x07,0x08,0x08,0x08,0x07,0x00,0x00}, // 0x43 +{0x00,0x0E,0x09,0x09,0x09,0x0E,0x00,0x00}, // 0x44 +{0x00,0x0E,0x08,0x0E,0x08,0x0E,0x00,0x00}, // 0x45 +{0x00,0x0E,0x08,0x0E,0x08,0x08,0x00,0x00}, // 0x46 +{0x00,0x07,0x08,0x0B,0x09,0x07,0x00,0x00}, // 0x47 +{0x00,0x09,0x09,0x0F,0x09,0x09,0x00,0x00}, // 0x48 +{0x00,0x0E,0x04,0x04,0x04,0x0E,0x00,0x00}, // 0x49 +{0x00,0x0E,0x02,0x02,0x02,0x0C,0x00,0x00}, // 0x4A +{0x00,0x09,0x0A,0x0C,0x0A,0x09,0x00,0x00}, // 0x4B +{0x00,0x08,0x08,0x08,0x08,0x0F,0x00,0x00}, // 0x4C +{0x00,0x11,0x1B,0x15,0x15,0x11,0x00,0x00}, // 0x4D +{0x00,0x09,0x0D,0x0B,0x09,0x09,0x00,0x00}, // 0x4E +{0x00,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00}, // 0x4F +{0x00,0x0E,0x09,0x0E,0x08,0x08,0x00,0x00}, // 0x50 +{0x00,0x0E,0x11,0x11,0x11,0x0E,0x02,0x01}, // 0x51 +{0x00,0x0C,0x0A,0x0C,0x0A,0x09,0x00,0x00}, // 0x52 +{0x00,0x06,0x08,0x04,0x02,0x0C,0x00,0x00}, // 0x53 +{0x00,0x1F,0x04,0x04,0x04,0x04,0x00,0x00}, // 0x54 +{0x00,0x09,0x09,0x09,0x09,0x06,0x00,0x00}, // 0x55 +{0x00,0x09,0x09,0x09,0x06,0x06,0x00,0x00}, // 0x56 +{0x00,0x11,0x15,0x15,0x0A,0x0A,0x00,0x00}, // 0x57 +{0x00,0x11,0x0A,0x04,0x0A,0x11,0x00,0x00}, // 0x58 +{0x00,0x11,0x0A,0x04,0x04,0x04,0x00,0x00}, // 0x59 +{0x00,0x0F,0x01,0x06,0x08,0x0F,0x00,0x00}, // 0x5A +{0x06,0x04,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x5B +{0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x00}, // 0x5C +{0x0C,0x04,0x04,0x04,0x04,0x04,0x0C,0x00}, // 0x5D +{0x04,0x0A,0x0A,0x11,0x11,0x00,0x00,0x00}, // 0x5E +{0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00}, // 0x5F +{0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x60 +{0x00,0x00,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0x61 +{0x08,0x08,0x0E,0x09,0x09,0x0E,0x00,0x00}, // 0x62 +{0x00,0x00,0x06,0x08,0x08,0x06,0x00,0x00}, // 0x63 +{0x02,0x02,0x0E,0x12,0x12,0x0E,0x00,0x00}, // 0x64 +{0x00,0x00,0x04,0x0E,0x08,0x06,0x00,0x00}, // 0x65 +{0x03,0x04,0x0F,0x04,0x04,0x04,0x00,0x00}, // 0x66 +{0x00,0x00,0x07,0x09,0x0F,0x01,0x0E,0x00}, // 0x67 +{0x08,0x08,0x0A,0x0D,0x09,0x09,0x00,0x00}, // 0x68 +{0x04,0x00,0x0C,0x04,0x04,0x04,0x00,0x00}, // 0x69 +{0x02,0x00,0x0E,0x02,0x02,0x02,0x0C,0x00}, // 0x6A +{0x08,0x08,0x0A,0x0C,0x0A,0x09,0x00,0x00}, // 0x6B +{0x0C,0x04,0x04,0x04,0x04,0x04,0x00,0x00}, // 0x6C +{0x00,0x00,0x15,0x1F,0x15,0x15,0x00,0x00}, // 0x6D +{0x00,0x00,0x0A,0x0D,0x09,0x09,0x00,0x00}, // 0x6E +{0x00,0x00,0x06,0x09,0x09,0x06,0x00,0x00}, // 0x6F +{0x00,0x00,0x0E,0x09,0x09,0x0E,0x08,0x00}, // 0x70 +{0x00,0x00,0x0E,0x12,0x12,0x0E,0x02,0x00}, // 0x71 +{0x00,0x00,0x0A,0x0C,0x08,0x08,0x00,0x00}, // 0x72 +{0x00,0x00,0x06,0x0C,0x02,0x0C,0x00,0x00}, // 0x73 +{0x00,0x04,0x0F,0x04,0x04,0x02,0x00,0x00}, // 0x74 +{0x00,0x00,0x09,0x09,0x0B,0x05,0x00,0x00}, // 0x75 +{0x00,0x00,0x09,0x09,0x06,0x06,0x00,0x00}, // 0x76 +{0x00,0x00,0x15,0x15,0x0E,0x0A,0x00,0x00}, // 0x77 +{0x00,0x00,0x09,0x06,0x06,0x09,0x00,0x00}, // 0x78 +{0x00,0x00,0x09,0x09,0x06,0x06,0x1C,0x00}, // 0x79 +{0x00,0x00,0x0E,0x06,0x08,0x0E,0x00,0x00}, // 0x7A +{0x02,0x04,0x04,0x08,0x04,0x04,0x02,0x00}, // 0x7B +{0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00}, // 0x7C +{0x08,0x04,0x04,0x02,0x04,0x04,0x08,0x00}, // 0x7D +{0x00,0x00,0x00,0x0D,0x12,0x00,0x00,0x00}, // 0x7E +{0x00,0x04,0x0A,0x0A,0x0A,0x0E,0x00,0x00}, // 0x7F +{0x00,0x07,0x08,0x08,0x08,0x07,0x02,0x04}, // 0x80 +{0x09,0x00,0x09,0x09,0x0B,0x05,0x00,0x00}, // 0x81 +{0x01,0x02,0x04,0x0E,0x08,0x06,0x00,0x00}, // 0x82 +{0x06,0x09,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0x83 +{0x0A,0x00,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0x84 +{0x10,0x08,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0x85 +{0x04,0x0A,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0x86 +{0x00,0x00,0x06,0x08,0x08,0x06,0x02,0x04}, // 0x87 +{0x06,0x09,0x04,0x0E,0x08,0x06,0x00,0x00}, // 0x88 +{0x0A,0x00,0x04,0x0E,0x08,0x06,0x00,0x00}, // 0x89 +{0x10,0x08,0x04,0x0E,0x08,0x06,0x00,0x00}, // 0x8A +{0x0A,0x00,0x0C,0x04,0x04,0x04,0x00,0x00}, // 0x8B +{0x06,0x09,0x0C,0x04,0x04,0x04,0x00,0x00}, // 0x8C +{0x10,0x08,0x0C,0x04,0x04,0x04,0x00,0x00}, // 0x8D +{0x0A,0x04,0x0A,0x0A,0x1F,0x11,0x00,0x00}, // 0x8E +{0x04,0x0A,0x04,0x0A,0x1F,0x11,0x00,0x00}, // 0x8F +{0x01,0x0E,0x08,0x0E,0x08,0x0E,0x00,0x00}, // 0x90 +{0x00,0x00,0x1A,0x07,0x1C,0x13,0x00,0x00}, // 0x91 +{0x00,0x07,0x0A,0x0B,0x1E,0x13,0x00,0x00}, // 0x92 +{0x0C,0x12,0x06,0x09,0x09,0x06,0x00,0x00}, // 0x93 +{0x09,0x00,0x06,0x09,0x09,0x06,0x00,0x00}, // 0x94 +{0x10,0x08,0x06,0x09,0x09,0x06,0x00,0x00}, // 0x95 +{0x0C,0x12,0x09,0x09,0x0B,0x05,0x00,0x00}, // 0x96 +{0x08,0x04,0x09,0x09,0x0B,0x05,0x00,0x00}, // 0x97 +{0x09,0x00,0x09,0x09,0x06,0x06,0x1C,0x00}, // 0x98 +{0x11,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00}, // 0x99 +{0x12,0x09,0x09,0x09,0x09,0x06,0x00,0x00}, // 0x9A +{0x00,0x01,0x06,0x0B,0x0D,0x06,0x08,0x00}, // 0x9B +{0x00,0x04,0x08,0x0C,0x18,0x0E,0x00,0x00}, // 0x9C +{0x01,0x0E,0x13,0x15,0x19,0x0E,0x10,0x00}, // 0x9D +{0x00,0x00,0x09,0x06,0x06,0x09,0x00,0x00}, // 0x9E +{0x02,0x04,0x04,0x0E,0x04,0x04,0x08,0x00}, // 0x9F +{0x01,0x02,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0xA0 +{0x01,0x02,0x0C,0x04,0x04,0x04,0x00,0x00}, // 0xA1 +{0x01,0x02,0x06,0x09,0x09,0x06,0x00,0x00}, // 0xA2 +{0x01,0x02,0x09,0x09,0x0B,0x05,0x00,0x00}, // 0xA3 +{0x0F,0x00,0x0A,0x0D,0x09,0x09,0x00,0x00}, // 0xA4 +{0x1F,0x09,0x0D,0x0B,0x09,0x09,0x00,0x00}, // 0xA5 +{0x0C,0x02,0x0E,0x0A,0x0E,0x00,0x00,0x00}, // 0xA6 +{0x04,0x0A,0x0A,0x0A,0x04,0x00,0x00,0x00}, // 0xA7 +{0x00,0x04,0x00,0x04,0x04,0x02,0x0C,0x00}, // 0xA8 +{0x0E,0x17,0x17,0x15,0x17,0x0E,0x00,0x00}, // 0xA9 +{0x00,0x00,0x00,0x0E,0x02,0x02,0x00,0x00}, // 0xAA +{0x19,0x0A,0x0F,0x05,0x0A,0x13,0x00,0x00}, // 0xAB +{0x19,0x0A,0x0A,0x05,0x0B,0x11,0x00,0x00}, // 0xAC +{0x00,0x00,0x04,0x00,0x04,0x04,0x04,0x00}, // 0xAD +{0x00,0x05,0x0A,0x14,0x0A,0x05,0x00,0x00}, // 0xAE +{0x00,0x14,0x0A,0x05,0x0A,0x14,0x00,0x00}, // 0xAF +{0x15,0x00,0x15,0x00,0x15,0x00,0x15,0x00}, // 0xB0 +{0x15,0x0A,0x15,0x0A,0x15,0x0A,0x15,0x0A}, // 0xB1 +{0x1F,0x15,0x1F,0x15,0x1F,0x15,0x1F,0x15}, // 0xB2 +{0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04}, // 0xB3 +{0x04,0x04,0x04,0x1C,0x04,0x04,0x04,0x04}, // 0xB4 +{0x02,0x04,0x0A,0x0A,0x1F,0x11,0x00,0x00}, // 0xB5 +{0x06,0x09,0x04,0x0A,0x1F,0x11,0x00,0x00}, // 0xB6 +{0x08,0x04,0x0A,0x0A,0x1F,0x11,0x00,0x00}, // 0xB7 +{0x0E,0x11,0x17,0x15,0x17,0x11,0x0E,0x00}, // 0xB8 +{0x0A,0x0A,0x1A,0x02,0x1A,0x0A,0x0A,0x0A}, // 0xB9 +{0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A}, // 0xBA +{0x00,0x00,0x1E,0x02,0x1A,0x0A,0x0A,0x0A}, // 0xBB +{0x0A,0x0A,0x1A,0x02,0x1E,0x00,0x00,0x00}, // 0xBC +{0x00,0x04,0x0E,0x08,0x0E,0x04,0x00,0x00}, // 0xBD +{0x00,0x11,0x0A,0x04,0x0E,0x04,0x00,0x00}, // 0xBE +{0x00,0x00,0x00,0x1C,0x04,0x04,0x04,0x04}, // 0xBF +{0x04,0x04,0x04,0x07,0x00,0x00,0x00,0x00}, // 0xC0 +{0x04,0x04,0x04,0x1F,0x00,0x00,0x00,0x00}, // 0xC1 +{0x00,0x00,0x00,0x1F,0x04,0x04,0x04,0x04}, // 0xC2 +{0x04,0x04,0x04,0x07,0x04,0x04,0x04,0x04}, // 0xC3 +{0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00}, // 0xC4 +{0x04,0x04,0x04,0x1F,0x04,0x04,0x04,0x04}, // 0xC5 +{0x0D,0x12,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0xC6 +{0x0D,0x12,0x04,0x0A,0x1F,0x11,0x00,0x00}, // 0xC7 +{0x0A,0x0A,0x0B,0x08,0x0F,0x00,0x00,0x00}, // 0xC8 +{0x00,0x00,0x0F,0x08,0x0B,0x0A,0x0A,0x0A}, // 0xC9 +{0x0A,0x0A,0x1B,0x00,0x1F,0x00,0x00,0x00}, // 0xCA +{0x00,0x00,0x1F,0x00,0x1B,0x0A,0x0A,0x0A}, // 0xCB +{0x0A,0x0A,0x0B,0x08,0x0B,0x0A,0x0A,0x0A}, // 0xCC +{0x00,0x00,0x1F,0x00,0x1F,0x00,0x00,0x00}, // 0xCD +{0x0A,0x0A,0x1B,0x00,0x1B,0x0A,0x0A,0x0A}, // 0xCE +{0x00,0x11,0x0E,0x0A,0x0E,0x11,0x00,0x00}, // 0xCF +{0x1E,0x04,0x0E,0x12,0x12,0x0C,0x00,0x00}, // 0xD0 +{0x00,0x0E,0x09,0x1D,0x09,0x0E,0x00,0x00}, // 0xD1 +{0x0E,0x0E,0x08,0x0E,0x08,0x0E,0x00,0x00}, // 0xD2 +{0x11,0x0E,0x08,0x0E,0x08,0x0E,0x00,0x00}, // 0xD3 +{0x10,0x0E,0x08,0x0E,0x08,0x0E,0x00,0x00}, // 0xD4 +{0x00,0x00,0x0C,0x04,0x04,0x04,0x00,0x00}, // 0xD5 +{0x01,0x0E,0x04,0x04,0x04,0x0E,0x00,0x00}, // 0xD6 +{0x0E,0x0E,0x04,0x04,0x04,0x0E,0x00,0x00}, // 0xD7 +{0x11,0x0E,0x04,0x04,0x04,0x0E,0x00,0x00}, // 0xD8 +{0x04,0x04,0x04,0x1C,0x00,0x00,0x00,0x00}, // 0xD9 +{0x00,0x00,0x00,0x07,0x04,0x04,0x04,0x04}, // 0xDA +{0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F}, // 0xDB +{0x00,0x00,0x00,0x00,0x1F,0x1F,0x1F,0x1F}, // 0xDC +{0x04,0x04,0x04,0x00,0x00,0x04,0x04,0x04}, // 0xDD +{0x10,0x0E,0x04,0x04,0x04,0x0E,0x00,0x00}, // 0xDE +{0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x00}, // 0xDF +{0x01,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00}, // 0xE0 +{0x04,0x0A,0x0A,0x0A,0x09,0x0A,0x00,0x00}, // 0xE1 +{0x0E,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00}, // 0xE2 +{0x10,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00}, // 0xE3 +{0x0D,0x12,0x06,0x09,0x09,0x06,0x00,0x00}, // 0xE4 +{0x1E,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00}, // 0xE5 +{0x00,0x00,0x09,0x09,0x0B,0x0D,0x08,0x00}, // 0xE6 +{0x08,0x08,0x0E,0x09,0x09,0x0E,0x08,0x00}, // 0xE7 +{0x00,0x08,0x0E,0x09,0x0E,0x08,0x00,0x00}, // 0xE8 +{0x01,0x12,0x12,0x12,0x12,0x0C,0x00,0x00}, // 0xE9 +{0x0F,0x09,0x09,0x09,0x09,0x06,0x00,0x00}, // 0xEA +{0x10,0x09,0x09,0x09,0x09,0x06,0x00,0x00}, // 0xEB +{0x01,0x02,0x09,0x09,0x06,0x06,0x18,0x00}, // 0xEC +{0x02,0x15,0x0A,0x04,0x04,0x04,0x00,0x00}, // 0xED +{0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xEE +{0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xEF +{0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00}, // 0xF0 +{0x00,0x00,0x04,0x0E,0x04,0x0E,0x00,0x00}, // 0xF1 +{0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x1F}, // 0xF2 +{0x19,0x1A,0x0A,0x1D,0x0B,0x11,0x00,0x00}, // 0xF3 +{0x0E,0x1A,0x1A,0x0A,0x0A,0x0A,0x0A,0x00}, // 0xF4 +{0x06,0x08,0x04,0x0A,0x04,0x02,0x0C,0x00}, // 0xF5 +{0x00,0x04,0x00,0x0E,0x00,0x04,0x00,0x00}, // 0xF6 +{0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x08}, // 0xF7 +{0x06,0x09,0x09,0x06,0x00,0x00,0x00,0x00}, // 0xF8 +{0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xF9 +{0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00}, // 0xFA +{0x0C,0x04,0x04,0x04,0x0E,0x00,0x00,0x00}, // 0xFB +{0x0C,0x02,0x0C,0x02,0x0C,0x00,0x00,0x00}, // 0xFC +{0x0C,0x02,0x04,0x08,0x0E,0x00,0x00,0x00}, // 0xFD +{0x00,0x00,0x0F,0x0F,0x0F,0x0F,0x00,0x00}, // 0xFE +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // 0xFF +}; + +#endif // font_5x8_horizontal_MSB_h \ No newline at end of file diff --git a/lib/lib_display/LedControl/src/font_6x8_horizontal_MSB.h b/lib/lib_display/LedControl/src/font_6x8_horizontal_MSB.h new file mode 100644 index 000000000..cc3a323cc --- /dev/null +++ b/lib/lib_display/LedControl/src/font_6x8_horizontal_MSB.h @@ -0,0 +1,264 @@ +// 6x8 ascii font +#ifndef font_6x8_horizontal_MSB_h +#define font_6x8_horizontal_MSB_h + +const char font[256][8]={ +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x00 +{0x0E,0x11,0x1B,0x11,0x15,0x11,0x0E,0x00}, // 0x01 +{0x0E,0x1F,0x15,0x1F,0x11,0x1F,0x0E,0x00}, // 0x02 +{0x00,0x0A,0x1F,0x1F,0x1F,0x0E,0x04,0x00}, // 0x03 +{0x00,0x04,0x0E,0x1F,0x1F,0x0E,0x04,0x00}, // 0x04 +{0x04,0x0E,0x0E,0x04,0x1F,0x1F,0x04,0x00}, // 0x05 +{0x00,0x04,0x0E,0x1F,0x1F,0x04,0x0E,0x00}, // 0x06 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x07 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x08 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x09 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0A +{0x00,0x07,0x03,0x0D,0x12,0x12,0x0C,0x00}, // 0x0B +{0x0E,0x11,0x11,0x0E,0x04,0x0E,0x04,0x00}, // 0x0C +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0D +{0x03,0x0D,0x0B,0x0D,0x0B,0x1B,0x18,0x00}, // 0x0E +{0x00,0x15,0x0E,0x1B,0x0E,0x15,0x00,0x00}, // 0x0F +{0x08,0x0C,0x0E,0x0F,0x0E,0x0C,0x08,0x00}, // 0x10 +{0x02,0x06,0x0E,0x1E,0x0E,0x06,0x02,0x00}, // 0x11 +{0x04,0x0E,0x1F,0x04,0x1F,0x0E,0x04,0x00}, // 0x12 +{0x0A,0x0A,0x0A,0x0A,0x0A,0x00,0x0A,0x00}, // 0x13 +{0x0F,0x15,0x15,0x0D,0x05,0x05,0x05,0x00}, // 0x14 +{0x0E,0x11,0x0C,0x0A,0x06,0x11,0x0E,0x00}, // 0x15 +{0x00,0x00,0x00,0x00,0x00,0x1E,0x1E,0x00}, // 0x16 +{0x04,0x0E,0x1F,0x04,0x1F,0x0E,0x04,0x0E}, // 0x17 +{0x04,0x0E,0x1F,0x04,0x04,0x04,0x04,0x00}, // 0x18 +{0x04,0x04,0x04,0x04,0x1F,0x0E,0x04,0x00}, // 0x19 +{0x00,0x04,0x06,0x1F,0x06,0x04,0x00,0x00}, // 0x1A +{0x00,0x04,0x0C,0x1F,0x0C,0x04,0x00,0x00}, // 0x1B +{0x00,0x00,0x00,0x10,0x10,0x10,0x1F,0x00}, // 0x1C +{0x00,0x0A,0x0A,0x1F,0x0A,0x0A,0x00,0x00}, // 0x1D +{0x04,0x04,0x0E,0x0E,0x1F,0x1F,0x00,0x00}, // 0x1E +{0x1F,0x1F,0x0E,0x0E,0x04,0x04,0x00,0x00}, // 0x1F +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x20 +{0x04,0x0E,0x0E,0x04,0x04,0x00,0x04,0x00}, // 0x21 +{0x1B,0x1B,0x12,0x00,0x00,0x00,0x00,0x00}, // 0x22 +{0x00,0x0A,0x1F,0x0A,0x0A,0x1F,0x0A,0x00}, // 0x23 +{0x08,0x0E,0x10,0x0C,0x02,0x1C,0x04,0x00}, // 0x24 +{0x19,0x19,0x02,0x04,0x08,0x13,0x13,0x00}, // 0x25 +{0x08,0x14,0x14,0x08,0x15,0x12,0x0D,0x00}, // 0x26 +{0x0C,0x0C,0x08,0x00,0x00,0x00,0x00,0x00}, // 0x27 +{0x04,0x08,0x08,0x08,0x08,0x08,0x04,0x00}, // 0x28 +{0x08,0x04,0x04,0x04,0x04,0x04,0x08,0x00}, // 0x29 +{0x00,0x0A,0x0E,0x1F,0x0E,0x0A,0x00,0x00}, // 0x2A +{0x00,0x04,0x04,0x1F,0x04,0x04,0x00,0x00}, // 0x2B +{0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x08}, // 0x2C +{0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00}, // 0x2D +{0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x00}, // 0x2E +{0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00}, // 0x2F +{0x0E,0x11,0x13,0x15,0x19,0x11,0x0E,0x00}, // 0x30 +{0x04,0x0C,0x04,0x04,0x04,0x04,0x0E,0x00}, // 0x31 +{0x0E,0x11,0x01,0x06,0x08,0x10,0x1F,0x00}, // 0x32 +{0x0E,0x11,0x01,0x0E,0x01,0x11,0x0E,0x00}, // 0x33 +{0x02,0x06,0x0A,0x12,0x1F,0x02,0x02,0x00}, // 0x34 +{0x1F,0x10,0x10,0x1E,0x01,0x11,0x0E,0x00}, // 0x35 +{0x06,0x08,0x10,0x1E,0x11,0x11,0x0E,0x00}, // 0x36 +{0x1F,0x01,0x02,0x04,0x08,0x08,0x08,0x00}, // 0x37 +{0x0E,0x11,0x11,0x0E,0x11,0x11,0x0E,0x00}, // 0x38 +{0x0E,0x11,0x11,0x0F,0x01,0x02,0x0C,0x00}, // 0x39 +{0x00,0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x00}, // 0x3A +{0x00,0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x08}, // 0x3B +{0x02,0x04,0x08,0x10,0x08,0x04,0x02,0x00}, // 0x3C +{0x00,0x00,0x1F,0x00,0x00,0x1F,0x00,0x00}, // 0x3D +{0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x00}, // 0x3E +{0x0E,0x11,0x01,0x06,0x04,0x00,0x04,0x00}, // 0x3F +{0x0E,0x11,0x17,0x15,0x17,0x10,0x0E,0x00}, // 0x40 +{0x0E,0x11,0x11,0x11,0x1F,0x11,0x11,0x00}, // 0x41 +{0x1E,0x11,0x11,0x1E,0x11,0x11,0x1E,0x00}, // 0x42 +{0x0E,0x11,0x10,0x10,0x10,0x11,0x0E,0x00}, // 0x43 +{0x1E,0x11,0x11,0x11,0x11,0x11,0x1E,0x00}, // 0x44 +{0x1F,0x10,0x10,0x1E,0x10,0x10,0x1F,0x00}, // 0x45 +{0x1F,0x10,0x10,0x1E,0x10,0x10,0x10,0x00}, // 0x46 +{0x0E,0x11,0x10,0x17,0x11,0x11,0x0F,0x00}, // 0x47 +{0x11,0x11,0x11,0x1F,0x11,0x11,0x11,0x00}, // 0x48 +{0x0E,0x04,0x04,0x04,0x04,0x04,0x0E,0x00}, // 0x49 +{0x01,0x01,0x01,0x01,0x11,0x11,0x0E,0x00}, // 0x4A +{0x11,0x12,0x14,0x18,0x14,0x12,0x11,0x00}, // 0x4B +{0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0x00}, // 0x4C +{0x11,0x1B,0x15,0x11,0x11,0x11,0x11,0x00}, // 0x4D +{0x11,0x19,0x15,0x13,0x11,0x11,0x11,0x00}, // 0x4E +{0x0E,0x11,0x11,0x11,0x11,0x11,0x0E,0x00}, // 0x4F +{0x1E,0x11,0x11,0x1E,0x10,0x10,0x10,0x00}, // 0x50 +{0x0E,0x11,0x11,0x11,0x15,0x12,0x0D,0x00}, // 0x51 +{0x1E,0x11,0x11,0x1E,0x12,0x11,0x11,0x00}, // 0x52 +{0x0E,0x11,0x10,0x0E,0x01,0x11,0x0E,0x00}, // 0x53 +{0x1F,0x04,0x04,0x04,0x04,0x04,0x04,0x00}, // 0x54 +{0x11,0x11,0x11,0x11,0x11,0x11,0x0E,0x00}, // 0x55 +{0x11,0x11,0x11,0x11,0x11,0x0A,0x04,0x00}, // 0x56 +{0x11,0x11,0x15,0x15,0x15,0x15,0x0A,0x00}, // 0x57 +{0x11,0x11,0x0A,0x04,0x0A,0x11,0x11,0x00}, // 0x58 +{0x11,0x11,0x11,0x0A,0x04,0x04,0x04,0x00}, // 0x59 +{0x1E,0x02,0x04,0x08,0x10,0x10,0x1E,0x00}, // 0x5A +{0x0E,0x08,0x08,0x08,0x08,0x08,0x0E,0x00}, // 0x5B +{0x00,0x10,0x08,0x04,0x02,0x01,0x00,0x00}, // 0x5C +{0x0E,0x02,0x02,0x02,0x02,0x02,0x0E,0x00}, // 0x5D +{0x04,0x0A,0x11,0x00,0x00,0x00,0x00,0x00}, // 0x5E +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F}, // 0x5F +{0x0C,0x0C,0x04,0x00,0x00,0x00,0x00,0x00}, // 0x60 +{0x00,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x61 +{0x10,0x10,0x1E,0x11,0x11,0x11,0x1E,0x00}, // 0x62 +{0x00,0x00,0x0E,0x11,0x10,0x11,0x0E,0x00}, // 0x63 +{0x01,0x01,0x0F,0x11,0x11,0x11,0x0F,0x00}, // 0x64 +{0x00,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x65 +{0x06,0x08,0x08,0x1E,0x08,0x08,0x08,0x00}, // 0x66 +{0x00,0x00,0x0F,0x11,0x11,0x0F,0x01,0x0E}, // 0x67 +{0x10,0x10,0x1C,0x12,0x12,0x12,0x12,0x00}, // 0x68 +{0x04,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x69 +{0x02,0x00,0x06,0x02,0x02,0x02,0x12,0x0C}, // 0x6A +{0x10,0x10,0x12,0x14,0x18,0x14,0x12,0x00}, // 0x6B +{0x04,0x04,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x6C +{0x00,0x00,0x1A,0x15,0x15,0x11,0x11,0x00}, // 0x6D +{0x00,0x00,0x1C,0x12,0x12,0x12,0x12,0x00}, // 0x6E +{0x00,0x00,0x0E,0x11,0x11,0x11,0x0E,0x00}, // 0x6F +{0x00,0x00,0x1E,0x11,0x11,0x11,0x1E,0x10}, // 0x70 +{0x00,0x00,0x0F,0x11,0x11,0x11,0x0F,0x01}, // 0x71 +{0x00,0x00,0x16,0x09,0x08,0x08,0x1C,0x00}, // 0x72 +{0x00,0x00,0x0E,0x10,0x0E,0x01,0x0E,0x00}, // 0x73 +{0x00,0x08,0x1E,0x08,0x08,0x0A,0x04,0x00}, // 0x74 +{0x00,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x75 +{0x00,0x00,0x11,0x11,0x11,0x0A,0x04,0x00}, // 0x76 +{0x00,0x00,0x11,0x11,0x15,0x1F,0x0A,0x00}, // 0x77 +{0x00,0x00,0x12,0x12,0x0C,0x12,0x12,0x00}, // 0x78 +{0x00,0x00,0x12,0x12,0x12,0x0E,0x04,0x18}, // 0x79 +{0x00,0x00,0x1E,0x02,0x0C,0x10,0x1E,0x00}, // 0x7A +{0x06,0x08,0x08,0x18,0x08,0x08,0x06,0x00}, // 0x7B +{0x04,0x04,0x04,0x00,0x04,0x04,0x04,0x00}, // 0x7C +{0x0C,0x02,0x02,0x03,0x02,0x02,0x0C,0x00}, // 0x7D +{0x0A,0x14,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x7E +{0x04,0x0E,0x1B,0x11,0x11,0x1F,0x00,0x00}, // 0x7F +{0x0E,0x11,0x10,0x10,0x11,0x0E,0x04,0x0C}, // 0x80 +{0x12,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x81 +{0x03,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x82 +{0x0E,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x83 +{0x0A,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x84 +{0x0C,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x85 +{0x0E,0x0A,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x86 +{0x00,0x0E,0x11,0x10,0x11,0x0E,0x04,0x0C}, // 0x87 +{0x0E,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x88 +{0x0A,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x89 +{0x0C,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x8A +{0x0A,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x8B +{0x0E,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x8C +{0x08,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x8D +{0x0A,0x00,0x04,0x0A,0x11,0x1F,0x11,0x00}, // 0x8E +{0x0E,0x0A,0x0E,0x1B,0x11,0x1F,0x11,0x00}, // 0x8F +{0x03,0x00,0x1F,0x10,0x1E,0x10,0x1F,0x00}, // 0x90 +{0x00,0x00,0x1E,0x05,0x1F,0x14,0x0F,0x00}, // 0x91 +{0x0F,0x14,0x14,0x1F,0x14,0x14,0x17,0x00}, // 0x92 +{0x0E,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0x93 +{0x0A,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0x94 +{0x18,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0x95 +{0x0E,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x96 +{0x18,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x97 +{0x0A,0x00,0x12,0x12,0x12,0x0E,0x04,0x18}, // 0x98 +{0x12,0x0C,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0x99 +{0x0A,0x00,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0x9A +{0x00,0x00,0x01,0x0E,0x16,0x1A,0x1C,0x20}, // 0x9B +{0x06,0x09,0x08,0x1E,0x08,0x09,0x17,0x00}, // 0x9C +{0x0F,0x13,0x15,0x15,0x15,0x19,0x1E,0x00}, // 0x9D +{0x00,0x11,0x0A,0x04,0x0A,0x11,0x00,0x00}, // 0x9E +{0x02,0x05,0x04,0x0E,0x04,0x04,0x14,0x08}, // 0x9F +{0x06,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0xA0 +{0x06,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0xA1 +{0x06,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0xA2 +{0x06,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0xA3 +{0x0A,0x14,0x00,0x1C,0x12,0x12,0x12,0x00}, // 0xA4 +{0x0A,0x14,0x00,0x12,0x1A,0x16,0x12,0x00}, // 0xA5 +{0x0E,0x01,0x0F,0x11,0x0F,0x00,0x0F,0x00}, // 0xA6 +{0x0C,0x12,0x12,0x12,0x0C,0x00,0x1E,0x00}, // 0xA7 +{0x04,0x00,0x04,0x0C,0x10,0x11,0x0E,0x00}, // 0xA8 +{0x1E,0x25,0x2B,0x2D,0x2B,0x21,0x1E,0x00}, // 0xA9 +{0x00,0x00,0x3F,0x01,0x01,0x00,0x00,0x00}, // 0xAA +{0x10,0x12,0x14,0x0E,0x11,0x02,0x07,0x00}, // 0xAB +{0x10,0x12,0x14,0x0B,0x15,0x07,0x01,0x00}, // 0xAC +{0x04,0x00,0x04,0x04,0x0E,0x0E,0x04,0x00}, // 0xAD +{0x00,0x00,0x09,0x12,0x09,0x00,0x00,0x00}, // 0xAE +{0x00,0x00,0x12,0x09,0x12,0x00,0x00,0x00}, // 0xAF +{0x15,0x00,0x2A,0x00,0x15,0x00,0x2A,0x00}, // 0xB0 +{0x15,0x2A,0x15,0x2A,0x15,0x2A,0x15,0x2A}, // 0xB1 +{0x2A,0x3F,0x15,0x3F,0x2A,0x3F,0x15,0x3F}, // 0xB2 +{0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04}, // 0xB3 +{0x04,0x04,0x04,0x3C,0x04,0x04,0x04,0x04}, // 0xB4 +{0x06,0x00,0x04,0x0A,0x11,0x1F,0x11,0x00}, // 0xB5 +{0x0E,0x00,0x04,0x0A,0x11,0x1F,0x11,0x00}, // 0xB6 +{0x0C,0x00,0x04,0x0A,0x11,0x1F,0x11,0x00}, // 0xB7 +{0x1E,0x21,0x2D,0x29,0x2D,0x21,0x1E,0x00}, // 0xB8 +{0x14,0x34,0x04,0x34,0x14,0x14,0x14,0x14}, // 0xB9 +{0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14}, // 0xBA +{0x00,0x3C,0x04,0x34,0x14,0x14,0x14,0x14}, // 0xBB +{0x14,0x34,0x04,0x3C,0x00,0x00,0x00,0x00}, // 0xBC +{0x00,0x04,0x0E,0x10,0x10,0x0E,0x04,0x00}, // 0xBD +{0x11,0x0A,0x04,0x1F,0x04,0x1F,0x04,0x00}, // 0xBE +{0x00,0x00,0x00,0x3C,0x04,0x04,0x04,0x04}, // 0xBF +{0x04,0x04,0x04,0x07,0x00,0x00,0x00,0x00}, // 0xC0 +{0x04,0x04,0x04,0x3F,0x00,0x00,0x00,0x00}, // 0xC1 +{0x00,0x00,0x00,0x3F,0x04,0x04,0x04,0x04}, // 0xC2 +{0x04,0x04,0x04,0x07,0x04,0x04,0x04,0x04}, // 0xC3 +{0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00}, // 0xC4 +{0x04,0x04,0x04,0x3F,0x04,0x04,0x04,0x04}, // 0xC5 +{0x05,0x0A,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0xC6 +{0x05,0x0A,0x04,0x0A,0x11,0x1F,0x11,0x00}, // 0xC7 +{0x14,0x17,0x10,0x1F,0x00,0x00,0x00,0x00}, // 0xC8 +{0x00,0x1F,0x10,0x17,0x14,0x14,0x14,0x14}, // 0xC9 +{0x14,0x37,0x00,0x3F,0x00,0x00,0x00,0x00}, // 0xCA +{0x00,0x3F,0x00,0x37,0x14,0x14,0x14,0x14}, // 0xCB +{0x14,0x17,0x10,0x17,0x14,0x14,0x14,0x14}, // 0xCC +{0x00,0x3F,0x00,0x3F,0x00,0x00,0x00,0x00}, // 0xCD +{0x14,0x37,0x00,0x37,0x14,0x14,0x14,0x14}, // 0xCE +{0x11,0x0E,0x11,0x11,0x11,0x0E,0x11,0x00}, // 0xCF +{0x0C,0x10,0x08,0x04,0x0E,0x12,0x0C,0x00}, // 0xD0 +{0x0E,0x09,0x09,0x1D,0x09,0x09,0x0E,0x00}, // 0xD1 +{0x0E,0x00,0x1F,0x10,0x1E,0x10,0x1F,0x00}, // 0xD2 +{0x0A,0x00,0x1F,0x10,0x1E,0x10,0x1F,0x00}, // 0xD3 +{0x0C,0x00,0x1F,0x10,0x1E,0x10,0x1F,0x00}, // 0xD4 +{0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00}, // 0xD5 +{0x06,0x00,0x0E,0x04,0x04,0x04,0x0E,0x00}, // 0xD6 +{0x0E,0x00,0x0E,0x04,0x04,0x04,0x0E,0x00}, // 0xD7 +{0x0A,0x00,0x0E,0x04,0x04,0x04,0x0E,0x00}, // 0xD8 +{0x04,0x04,0x04,0x3C,0x00,0x00,0x00,0x00}, // 0xD9 +{0x00,0x00,0x00,0x07,0x04,0x04,0x04,0x04}, // 0xDA +{0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F}, // 0xDB +{0x00,0x00,0x00,0x00,0x3F,0x3F,0x3F,0x3F}, // 0xDC +{0x04,0x04,0x04,0x00,0x04,0x04,0x04,0x00}, // 0xDD +{0x0C,0x00,0x0E,0x04,0x04,0x04,0x0E,0x00}, // 0xDE +{0x3F,0x3F,0x3F,0x3F,0x00,0x00,0x00,0x00}, // 0xDF +{0x06,0x0C,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0xE0 +{0x00,0x1C,0x12,0x1C,0x12,0x12,0x1C,0x10}, // 0xE1 +{0x0E,0x0C,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0xE2 +{0x18,0x0C,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0xE3 +{0x0A,0x14,0x00,0x0C,0x12,0x12,0x0C,0x00}, // 0xE4 +{0x0A,0x14,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0xE5 +{0x00,0x00,0x12,0x12,0x12,0x1C,0x10,0x10}, // 0xE6 +{0x00,0x18,0x10,0x1C,0x12,0x1C,0x10,0x18}, // 0xE7 +{0x18,0x10,0x1C,0x12,0x12,0x1C,0x10,0x18}, // 0xE8 +{0x06,0x00,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0xE9 +{0x0E,0x00,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0xEA +{0x18,0x00,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0xEB +{0x06,0x00,0x12,0x12,0x12,0x0E,0x04,0x18}, // 0xEC +{0x06,0x00,0x11,0x0A,0x04,0x04,0x04,0x00}, // 0xED +{0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xEE +{0x0C,0x0C,0x08,0x00,0x00,0x00,0x00,0x00}, // 0xEF +{0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00}, // 0xF0 +{0x00,0x04,0x0E,0x04,0x00,0x0E,0x00,0x00}, // 0xF1 +{0x00,0x00,0x1F,0x00,0x00,0x1F,0x00,0x00}, // 0xF2 +{0x30,0x1A,0x34,0x0B,0x15,0x07,0x01,0x00}, // 0xF3 +{0x0F,0x15,0x15,0x0D,0x05,0x05,0x05,0x00}, // 0xF4 +{0x0E,0x11,0x0C,0x0A,0x06,0x11,0x0E,0x00}, // 0xF5 +{0x00,0x04,0x00,0x1F,0x00,0x04,0x00,0x00}, // 0xF6 +{0x00,0x00,0x00,0x0E,0x06,0x00,0x00,0x00}, // 0xF7 +{0x0C,0x12,0x12,0x0C,0x00,0x00,0x00,0x00}, // 0xF8 +{0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x00}, // 0xF9 +{0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00}, // 0xFA +{0x08,0x18,0x08,0x08,0x00,0x00,0x00,0x00}, // 0xFB +{0x1C,0x08,0x0C,0x18,0x00,0x00,0x00,0x00}, // 0xFC +{0x18,0x04,0x08,0x1C,0x00,0x00,0x00,0x00}, // 0xFD +{0x00,0x00,0x1E,0x1E,0x1E,0x1E,0x00,0x00}, // 0xFE +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // 0xFF +}; + +#endif \ No newline at end of file diff --git a/tasmota/xdsp_19_max7219_matrix.ino b/tasmota/xdsp_19_max7219_matrix.ino index da3177f59..bbd0a069d 100644 --- a/tasmota/xdsp_19_max7219_matrix.ino +++ b/tasmota/xdsp_19_max7219_matrix.ino @@ -175,31 +175,6 @@ bool MAX7291Matrix_init(void) return true; } -// /*********************************************************************************************\ -// * Clears the display -// * Command: DisplayText -// \*********************************************************************************************/ -bool MAX7291Matrix_Text() -{ - char sString[CMD_MAX_LEN + 1]; - subStr(sString, XdrvMailbox.data, ",", 1); - max7219_Matrix->clear(); - AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: sString %s"), sString); - - // test - uint8_t length = strlen(sString); - //if(length > modulesPerRow) - length = modulesPerRow; - - for (int addr = 0; addr < length; addr++) - { - max7219_Matrix->setPixel(addr, addr, true); - AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: setPixel() %d, %d)"), addr, addr); - } - - return true; -} - bool Xdsp19(uint8_t function) { bool result = false; @@ -216,7 +191,7 @@ bool Xdsp19(uint8_t function) result = true; break; case FUNC_DISPLAY_CLEAR: - result = max7219_Matrix->clear(); + result = max7219_Matrix->clearDisplay(); break; case FUNC_DISPLAY_DIM: result = max7219_Matrix->setIntensity(GetDisplayDimmer16()); @@ -232,12 +207,13 @@ bool Xdsp19(uint8_t function) case FUNC_DISPLAY_SCROLLTEXT: case FUNC_DISPLAY_CLOCK: case FUNC_DISPLAY_DRAW_STRING: - result = MAX7291Matrix_Text(); + result = max7219_Matrix->drawText(dsp_str); + break; + case FUNC_DISPLAY_EVERY_SECOND: + //result = max7219_Matrix->scrollText(); break; case FUNC_DISPLAY_EVERY_50_MSECOND: - case FUNC_DISPLAY_EVERY_SECOND: - // ignore - return false; + result = max7219_Matrix->scrollText(); default: result = false; } From c4a4bb0ff8ed1cae90237587cbcae0ba091295b8 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 23 Nov 2021 23:08:05 +0100 Subject: [PATCH 05/10] scroll works --- lib/lib_display/LedControl/src/LedMatrix.cpp | 11 +- lib/lib_display/LedControl/src/LedMatrix.h | 6 +- tasmota/tasmota_template.h | 1 + tasmota/xdsp_19_max7219_matrix.ino | 110 +++++++++++++++---- 4 files changed, 102 insertions(+), 26 deletions(-) diff --git a/lib/lib_display/LedControl/src/LedMatrix.cpp b/lib/lib_display/LedControl/src/LedMatrix.cpp index 19ac0dcb2..80ded02e2 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.cpp +++ b/lib/lib_display/LedControl/src/LedMatrix.cpp @@ -62,6 +62,11 @@ LedMatrix::LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, un setIntensity(7); } +void LedMatrix::power(bool on) +{ + shutdown(!on); // shut down on power off +} + bool LedMatrix::drawText( const char *str) { strncpy(textBuf, str, TEXT_BUFFER_SIZE -1); @@ -70,6 +75,7 @@ bool LedMatrix::drawText( const char *str) textWidth = strlen(textBuf) * charWidth; if(textWidth < displayWidth) { + clear(); textPosX = (displayWidth - textWidth) / 2; // center } else @@ -78,7 +84,6 @@ bool LedMatrix::drawText( const char *str) // Append a space between end of text and the beginning of the repeting text. appendSpace(); } - clear(); drawTextAt(textBuf, textPosX, textPosY); refresh(); // refresh display with new string content return true; @@ -102,7 +107,7 @@ bool LedMatrix::scrollText() if(textWidth < displayWidth) return false; // do not scroll when text fits into the display textPosX--; - if(textPosX + textWidth < 0) + if(textPosX + textWidth < (int)0) { textPosX = 0; // start from the beginning after text scrolled out of display; } @@ -255,7 +260,7 @@ void LedMatrix::refresh() void LedMatrix::refreshByteOfBuffer(int i) { int line = i / modulesPerRow; - int addr = line / 8 + i % modulesPerRow; + int addr = (line / 8) * modulesPerRow + i % modulesPerRow; byte b = buffer[i]; if (moduleOrientation == ORIENTATION_NORMAL || moduleOrientation == ORIENTATION_UPSIDE_DOWN) { diff --git a/lib/lib_display/LedControl/src/LedMatrix.h b/lib/lib_display/LedControl/src/LedMatrix.h index 586a06146..1d251030b 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.h +++ b/lib/lib_display/LedControl/src/LedMatrix.h @@ -60,11 +60,11 @@ class LedMatrix ModuleOrientation moduleOrientation; byte buffer[MATRIX_BUFFER_SIZE]; LedControl* ledControl; - const unsigned int charWidth = 6; - const unsigned int charHeight = 8; + const int charWidth = 6; + const int charHeight = 8; char textBuf[TEXT_BUFFER_SIZE]; char appendTextBuf[TEXT_APPEND_BUFFER_SIZE]; - unsigned int textWidth; // width of text [pixel] + int textWidth; // width of text [pixel] int textPosX; // horizontal pixel position of scrolling text int textPosY; // vertical pixelposition of scrolling text; diff --git a/tasmota/tasmota_template.h b/tasmota/tasmota_template.h index e3f3256fc..13fdf23e4 100644 --- a/tasmota/tasmota_template.h +++ b/tasmota/tasmota_template.h @@ -524,6 +524,7 @@ const uint16_t kGpioNiceList[] PROGMEM = { #ifdef USE_DISPLAY_MAX7219_MATRIX #undef USE_DISPLAY_MAX7219 #undef USE_DISPLAY_TM1637 + #define USE_DISPLAY_MODES1TO5 AGPIO(GPIO_MAX7219CLK), AGPIO(GPIO_MAX7219DIN), AGPIO(GPIO_MAX7219CS), diff --git a/tasmota/xdsp_19_max7219_matrix.ino b/tasmota/xdsp_19_max7219_matrix.ino index bbd0a069d..ec82420e2 100644 --- a/tasmota/xdsp_19_max7219_matrix.ino +++ b/tasmota/xdsp_19_max7219_matrix.ino @@ -131,16 +131,22 @@ and setting it to 3 alternates between time and date. \*********************************************************************************************/ #define XDSP_19 19 -#define CMD_MAX_LEN 55 +#include #include -LedMatrix *max7219_Matrix; -bool max2791Matrix_init_done = false; -byte modulesPerRow = 4; -byte modulesPerCol = 1; +LedMatrix *max7219_Matrix = nullptr; +bool max2791Matrix_initDriver_done = false; +struct +{ + byte modulesPerRow = 4; + byte modulesPerCol = 1; + bool show_clock = false; + const char* timeFormat; -bool MAX7291Matrix_init(void) +} LedMatrix_settings; + +bool MAX7291Matrix_initDriver(void) { if (!PinUsed(GPIO_MAX7219DIN) || !PinUsed(GPIO_MAX7219CLK) || !PinUsed(GPIO_MAX7219CS)) { @@ -151,27 +157,79 @@ bool MAX7291Matrix_init(void) Settings->display_model = XDSP_19; if (Settings->display_width) // [pixel] { - modulesPerRow = (Settings->display_width - 1) / 8 + 1; + LedMatrix_settings.modulesPerRow = (Settings->display_width - 1) / 8 + 1; } - Settings->display_width = 8 * modulesPerRow; + Settings->display_width = 8 * LedMatrix_settings.modulesPerRow; Settings->display_cols[0] = Settings->display_width; if (Settings->display_height) // [pixel] { - modulesPerCol = (Settings->display_height - 1) / 8 + 1; + LedMatrix_settings.modulesPerCol = (Settings->display_height - 1) / 8 + 1; } - Settings->display_height = 8 * modulesPerCol; + Settings->display_height = 8 * LedMatrix_settings. modulesPerCol; Settings->display_rows = Settings->display_height; Settings->display_cols[1] = Settings->display_height; - max7219_Matrix = new LedMatrix(Pin(GPIO_MAX7219DIN), Pin(GPIO_MAX7219CLK), Pin(GPIO_MAX7219CS), modulesPerRow, modulesPerCol); + max7219_Matrix = new LedMatrix(Pin(GPIO_MAX7219DIN), Pin(GPIO_MAX7219CLK), Pin(GPIO_MAX7219CS), LedMatrix_settings.modulesPerRow, LedMatrix_settings.modulesPerCol); + max2791Matrix_initDriver_done = true; + + return MAX7291Matrix_init(); +} + +bool MAX7291Matrix_init(void) +{ int intensity = GetDisplayDimmer16(); // 0..15 max7219_Matrix->setIntensity(intensity); int orientation = Settings->display_rotate; max7219_Matrix->setOrientation((LedMatrix::ModuleOrientation)orientation ); - AddLog(LOG_LEVEL_INFO, PSTR("DSP: MAX7291Matrix_init %dx%d modules, orientation: %d, intensity: %d"), modulesPerRow , modulesPerCol, orientation, intensity); - max2791Matrix_init_done = true; + AddLog(LOG_LEVEL_INFO, PSTR("MTX: MAX7291Matrix_init %dx%d modules, orientation: %d, intensity: %d"), LedMatrix_settings.modulesPerRow , LedMatrix_settings.modulesPerCol, orientation, intensity); - max7219_Matrix->test(); - AddLog(LOG_LEVEL_INFO, PSTR("DSP: display test")); + //max7219_Matrix->test(); + AddLog(LOG_LEVEL_INFO, PSTR("MTX: display test")); + return true; +} + +bool MAX7291Matrix_clock(void) +{ + LedMatrix_settings.show_clock = XdrvMailbox.payload; + if (ArgC() == 0) + XdrvMailbox.payload = 1; + if (XdrvMailbox.payload > 1) + { + LedMatrix_settings.timeFormat = "%H:%M"; + if(LedMatrix_settings.modulesPerRow > 6) + { + LedMatrix_settings.timeFormat = "%H:%M:%S"; + } + XdrvMailbox.payload = 2; + } + else + { + LedMatrix_settings.timeFormat = "%I:%M"; + if(LedMatrix_settings.modulesPerRow > 6) + { + LedMatrix_settings.timeFormat = "%I:%M:%S"; + } + XdrvMailbox.payload = 1; + } + + AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: LedMatrix_settings.show_clock %d, timeFormat %s"), LedMatrix_settings.show_clock, LedMatrix_settings.timeFormat); + + //max7219_Matrix->clearDisplay(); + MAX7291Matrix_showTime(); + return true; +} + +bool MAX7291Matrix_showTime() +{ + time_t rawtime; + struct tm *timeinfo; + char timeStr[10]; + + time(&rawtime); + timeinfo = localtime(&rawtime); + strftime(timeStr, 10, LedMatrix_settings.timeFormat, timeinfo); + //AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: showTime:%s"), timeStr); + + max7219_Matrix->drawText(timeStr); return true; } @@ -179,14 +237,20 @@ bool Xdsp19(uint8_t function) { bool result = false; - if (FUNC_DISPLAY_INIT_DRIVER == function) + if (FUNC_DISPLAY_INIT_DRIVER == function && !max2791Matrix_initDriver_done ) { - result = MAX7291Matrix_init(); + result = MAX7291Matrix_initDriver(); } - else if (max7219_Matrix && (XDSP_19 == Settings->display_model)) + else if (max2791Matrix_initDriver_done && max7219_Matrix && (XDSP_19 == Settings->display_model)) { switch (function) { + case FUNC_DISPLAY_INIT: + result = MAX7291Matrix_init(); + break; + case FUNC_DISPLAY_POWER: + max7219_Matrix->power(disp_power!=0); + break; case FUNC_DISPLAY_MODEL: result = true; break; @@ -196,6 +260,9 @@ bool Xdsp19(uint8_t function) case FUNC_DISPLAY_DIM: result = max7219_Matrix->setIntensity(GetDisplayDimmer16()); break; + case FUNC_DISPLAY_CLOCK: + result = MAX7291Matrix_clock(); + break; case FUNC_DISPLAY_SEVENSEG_TEXT: case FUNC_DISPLAY_SEVENSEG_TEXTNC: case FUNC_DISPLAY_NUMBER: @@ -205,12 +272,15 @@ bool Xdsp19(uint8_t function) case FUNC_DISPLAY_RAW: case FUNC_DISPLAY_LEVEL: case FUNC_DISPLAY_SCROLLTEXT: - case FUNC_DISPLAY_CLOCK: case FUNC_DISPLAY_DRAW_STRING: result = max7219_Matrix->drawText(dsp_str); break; case FUNC_DISPLAY_EVERY_SECOND: - //result = max7219_Matrix->scrollText(); + if (LedMatrix_settings.show_clock) + { + result = MAX7291Matrix_showTime(); + } + break; case FUNC_DISPLAY_EVERY_50_MSECOND: result = max7219_Matrix->scrollText(); From f2f6eba00989f03a403f5652d93746ab24adfd9d Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 24 Nov 2021 17:24:40 +0100 Subject: [PATCH 06/10] ready for ESP32 --- lib/lib_display/LedControl/src/LedMatrix.cpp | 119 +++----- lib/lib_display/LedControl/src/LedMatrix.h | 208 +++++++------- .../LedControl/src/font_5x8_horizontal_MSB.h | 3 + .../LedControl/src/font_6x8_horizontal_MSB.h | 3 + .../src/font_8x8_horizontal_latin_MSB.h | 265 ++++++++++++++++++ tasmota/tasmota_template.h | 1 - tasmota/xdsp_19_max7219_matrix.ino | 201 +++++++------ 7 files changed, 515 insertions(+), 285 deletions(-) create mode 100644 lib/lib_display/LedControl/src/font_8x8_horizontal_latin_MSB.h diff --git a/lib/lib_display/LedControl/src/LedMatrix.cpp b/lib/lib_display/LedControl/src/LedMatrix.cpp index 80ded02e2..b4fb8c260 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.cpp +++ b/lib/lib_display/LedControl/src/LedMatrix.cpp @@ -1,5 +1,5 @@ /* - * LedMatrix.h - Extends the Library LedControl for multiple LED dot matrix modules, based on MAX7219/MAX7221 + * LedMatrix.h - Extends the Library LedControl for multiple 8x8 LED dot matrix modules, based on MAX7219/MAX7221 * Copyright (c) 2021 Michael Beuss * * Permission is hereby granted, free of charge, to any person @@ -25,7 +25,9 @@ */ #include "LedMatrix.h" +//#include "font_5x8_horizontal_MSB.h" #include "font_6x8_horizontal_MSB.h" +//#include "font_8x8_horizontal_latin_MSB.h" // public LedMatrix::LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, unsigned int rows) @@ -44,13 +46,15 @@ LedMatrix::LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, un } } + charWidth = font_char_width; // defined in header file of font + charHeight = font_char_height; // defined in header file of font modulesPerRow = colums; modulesPerCol = rows; displayWidth = colums * 8; displayHeight = rows * 8; modules = colums * rows; - moduleOrientation = ORIENTATION_UPSIDE_DOWN; - ledControl = new LedControl(dataPin, clkPin, csPin, modules); + moduleOrientation = ORIENTATION_UPSIDE_DOWN; // use setOrientation() to turn it + ledControl = new LedControl(dataPin, clkPin, csPin, modules); // initializes all connected LED matrix modules textBuf[0] = 0; textWidth = 0; textPosX = 0; @@ -62,11 +66,6 @@ LedMatrix::LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, un setIntensity(7); } -void LedMatrix::power(bool on) -{ - shutdown(!on); // shut down on power off -} - bool LedMatrix::drawText( const char *str) { strncpy(textBuf, str, TEXT_BUFFER_SIZE -1); @@ -75,6 +74,7 @@ bool LedMatrix::drawText( const char *str) textWidth = strlen(textBuf) * charWidth; if(textWidth < displayWidth) { + // text fits into the display, place it into the center clear(); textPosX = (displayWidth - textWidth) / 2; // center } @@ -85,7 +85,7 @@ bool LedMatrix::drawText( const char *str) appendSpace(); } drawTextAt(textBuf, textPosX, textPosY); - refresh(); // refresh display with new string content + refresh(); // refresh display with the new drawed string content return true; } @@ -116,36 +116,16 @@ bool LedMatrix::scrollText() int startOfRepeatingTextPos = textPosX + textWidth; if(startOfRepeatingTextPos < displayWidth) { - // Draw repeating text. + // draw repeating text drawTextAt(textBuf, startOfRepeatingTextPos, textPosY); } refresh(); return true; } -bool LedMatrix::drawCharAt( char c, const int x, const int y) +void LedMatrix::power(bool on) { - // ignore when the character position is not visible on the display - bool visible = ( - x > 0 - (int)charWidth && x < (int)displayWidth && - y > 0 - (int)charHeight && y < (int)displayHeight - ); - if (!visible) return false; - - // ignore the leading bits above charWidth of the font definition - static const byte charOffset = 8 - charWidth; - - for (byte charY = 0; charY < charHeight; charY++) - { - char pixelRow = (font[c][charY]) << charOffset; // skip the first bits when the character width is smaller than 8 pixel - for (byte charX = 0; charX < charWidth; charX++) - { - bool pixel = (pixelRow & 0x80); // pixel=true when upper bit is set - setPixel(x + charX, y + charY, pixel); - pixelRow = pixelRow << 1; // next pixel - } - } - return true; + shutdown(!on); // power(false) shuts down the display with shutdown(true) } bool LedMatrix::clearDisplay(void) @@ -157,17 +137,6 @@ bool LedMatrix::clearDisplay(void) return true; } - -bool LedMatrix::clear(void) -{ - memset(buffer, 0, MATRIX_BUFFER_SIZE); - for (int addr = 0; addr < modules; addr++) - { - ledControl->clearDisplay(addr); - } - return true; -} - bool LedMatrix::setIntensity(byte dim) { for (int addr = 0; addr < modules; addr++) @@ -208,38 +177,40 @@ bool LedMatrix::setPixel(const int x, const int y, bool on) return true; } -void LedMatrix::test() +void LedMatrix::refresh() { - /* - const static byte testMatrix[] PROGMEM = { - B00000010, B00111100, B00111100, B00001000, - B00000110, B01000010, B01000010, B00010000, - B00001010, B00000010, B00000010, B00100000, - B00000010, B00000100, B00001100, B01000100, - B00000010, B00011000, B00000010, B01111110, - B00000010, B00100000, B01000010, B00000100, - B00000000, B01111110, B00111100, B00000100, - B00000000, B00000000, B00000000, B00000000, - }; - for (int i = 0; i < 32; i++) + for (int i = 0; i < modulesPerRow * displayHeight; i++) { - buffer[i] = testMatrix[i]; + refreshByteOfBuffer(i); } - refresh(); - */ - drawText("1234567890"); - delay(1000); - for( int i=0; i<320; i++) - { - delay(50); - scrollText(); - } - //drawCharAt(0x31, 1, 0); - //setPixel(1,30); - //refresh(); } -// private +// private functions +bool LedMatrix::drawCharAt( char c, const int x, const int y) +{ + // ignore when the character position is not visible on the display + bool visible = ( + x > 0 - (int)charWidth && x < (int)displayWidth && + y > 0 - (int)charHeight && y < (int)displayHeight + ); + if (!visible) return false; + + // ignore the leading bits above charWidth of the font definition + static const byte charOffset = 8 - charWidth; + + for (byte charY = 0; charY < charHeight; charY++) + { + char pixelRow = (font[c][charY]) << charOffset; // skip the first bits when the character width is smaller than 8 pixel + for (byte charX = 0; charX < charWidth; charX++) + { + bool pixel = (pixelRow & 0x80); // pixel=true when upper bit is set + setPixel(x + charX, y + charY, pixel); + pixelRow = pixelRow << 1; // next pixel + } + } + return true; +} + bool LedMatrix::shutdown(bool b) { for (int addr = 0; addr < modules; addr++) @@ -249,12 +220,14 @@ bool LedMatrix::shutdown(bool b) return true; } -void LedMatrix::refresh() +bool LedMatrix::clear(void) { - for (int i = 0; i < modulesPerRow * displayHeight; i++) + memset(buffer, 0, MATRIX_BUFFER_SIZE); + for (int addr = 0; addr < modules; addr++) { - refreshByteOfBuffer(i); + ledControl->clearDisplay(addr); } + return true; } void LedMatrix::refreshByteOfBuffer(int i) diff --git a/lib/lib_display/LedControl/src/LedMatrix.h b/lib/lib_display/LedControl/src/LedMatrix.h index 1d251030b..efb50b8e3 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.h +++ b/lib/lib_display/LedControl/src/LedMatrix.h @@ -1,5 +1,5 @@ /* - * LedMatrix.h - Extends the Library LedControl for multiple LED dot matrix modules, based on MAX7219/MAX7221 + * LedMatrix.h - Extends the Library LedControl for multiple 8x8 LED dot matrix modules, based on MAX7219/MAX7221 * Copyright (c) 2021 Michael Beuss * * Permission is hereby granted, free of charge, to any person @@ -29,21 +29,21 @@ #include -#define MATRIX_MAX_MODULES 32 +#define MATRIX_MAX_MODULES 32 // maximum number of modules that can be used #define MATRIX_BUFFER_SIZE MATRIX_MAX_MODULES * 8 // 8 bytes per modul. One byte represents 8 LEDs. -#define TEXT_BUFFER_SIZE 256 -#define TEXT_APPEND_BUFFER_SIZE 16 +#define TEXT_BUFFER_SIZE 256 // maximum text length that can be scrolled +#define TEXT_APPEND_BUFFER_SIZE 16 // used for characters that are appended to the scroll text, before it repeats /** * @brief LedMatric controls multiple 8x8 LED dot matrx modules. - * All modules in rows and clolums together build a common matrix. + * All modules in rows and clolums together build a common display pixel matrix. * */ class LedMatrix { public: - enum ModuleOrientation // orientation of 8x8 LED dot matrix mdules (first module is top left) + enum ModuleOrientation // orientation of 8x8 LED dot matrix mdules (first module starts at top left) { ORIENTATION_NORMAL, // first pixel is on top left, no turn is necessary ORIENTATION_TURN_RIGHT, // first pixel is on bottom left, for correction it has to turn 90° right @@ -51,6 +51,100 @@ class LedMatrix ORIENTATION_TURN_LEFT, // first pixel is on top right, for correction is has to turn 90° left. }; + public: + /** + * @brief Construct a new LED Matrix object + * + * @param colums of 8x8 LED dot matrix modules + * @param rows of 8x8 LED dot matrix modules + */ + LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, unsigned int rows); + + /** + * @brief Draws a string to the display. + * When the text fits into the display, it will be shown in the center. + * When the text is longer than than the display width, it can be scrolled per pixel with function scrollText(). + * + * @param str string to display + */ + bool drawText( const char *str ); + + /** + * @brief Dwaws a character string to a defined display position. The position (x,y) is used for the upper left pixel of the text. + * Existing text before the x position will not be cleared. Use refresh() after all text parts are drawed. + * + * @param str string to display + * @param x horizantal pixel position to start with string (0 is most left) + * @param y vertical pixel position for the top position of the string (0 is top) + */ + bool drawTextAt( const char *str, const int x, const int y ); + + /** + * @brief Scroll the current text one pixel to the left. + * Repeat with from start when end of text reached. This function can be called every 50 ms to get a propper scroll speed. + * + */ + bool scrollText(); + + /** + * @brief switches the display on or off + * + * @param on true: on false: off + */ + + void power( bool on ); + + /** + * @brief cleares the display and text buffer + * + */ + bool clearDisplay(void); + + /** + * @brief Set the brightness of the display + * + * @param dim 0..15 (0: dark .. 15: light) + */ + bool setIntensity(byte dim); + + /** + * @brief Set the orientation of the 8x8 LED dot matrix module + * + * @param orientation + */ + bool setOrientation(ModuleOrientation orientation); + + /** + * @brief Set ap pixel at a defined position. + * After all Pixels are set, call refresh() to send it to the display. + * + * @param x horizontal position from left + * @param y vertical position from top + * @param on true: on, false: off + */ + + /** + * @brief Set the a pending string to the scrolling text to set a distance to the repeating text. Usually some spaces are used. + * + * @param append text to append to the scrolling text before repeating. + */ + bool setScrollAppendText(const char* append ); + + bool setPixel( const int x, const int y, bool on=true); + /** + * @brief sends the changed content of the buffer to the display + * + */ + void refresh(); + + private: + bool drawCharAt( char c, int x, int y ); // Draws a character to a defined position + bool shutdown(bool b); // shutdown(true) switches the display off. Text and pixels can be set while it is off. shutdown(false) switches the display on. + bool clear(void); // clears the display content + void refreshByteOfBuffer( int i); // sends one byte of the buffer to the display. This updates an 8 pixel row of one matrix module. + byte revereBitorder(byte b); // returnes the byte in the reverse bit order. + void appendSpace(); // appends characters to the end of the text to get a distance to the repeating scroll text + private: unsigned int modulesPerRow; unsigned int modulesPerCol; @@ -60,112 +154,14 @@ class LedMatrix ModuleOrientation moduleOrientation; byte buffer[MATRIX_BUFFER_SIZE]; LedControl* ledControl; - const int charWidth = 6; - const int charHeight = 8; + int charWidth; + int charHeight; char textBuf[TEXT_BUFFER_SIZE]; char appendTextBuf[TEXT_APPEND_BUFFER_SIZE]; int textWidth; // width of text [pixel] int textPosX; // horizontal pixel position of scrolling text int textPosY; // vertical pixelposition of scrolling text; - - public: - /** - * @brief Construct a new Led Matrix object - * - * @param colums of 8x8 LED dot matrix modules - * @param rows of 8x8 LED dot matrix modules - */ - LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, unsigned int rows); - - /** - * @brief Set all LEDs off. - * - */ - bool clearDisplay(void); - - /** - * @brief Set the brightness of the display - * - * @param dim 0..15 - */ - bool setIntensity(byte dim); - - /** - * @brief Set the a pending string to the scrolling text to set a distance to te repeating text. Usually some spaces. - * - * @param append text to append to the scrolling text before repeating. - */ - bool setScrollAppendText(const char* append ); - - /** - * @brief Switches the display on or off - * - * @param on true: on false: off - */ - void power( bool on ); - - /** - * @brief Set the orientation of the 8x8 LED dot matrix module - * - * @param orientation - */ - bool setOrientation(ModuleOrientation orientation); - - /** - * @brief draw a string to the display. - * When the text fits into the size of the display, it will be shown in the center. - * When the text is longer than than the display width, it can be scrolled per pixel with function scrollText(). - * - * @param str string to display - */ - bool drawText( const char *str ); - - /** - * @brief dwaws a character string to the display. The position (x,y) is used for the upper left pixtel of the text. - * Existing text before the x position will not be cleared. - * - * @param str string to display - * @param x horizantal pixel position to start with string (default 0) - * @param y vertical pixel position for the top position of the string (default 0) - */ - bool drawTextAt( const char *str, const int x, const int y ); - - /** - * @brief Scroll the current teext one picel to the left. - * Repeat with from start when end of text reached. - * - */ - bool scrollText(); - - /** - * @brief Set the Pixel object - * - * @param x horizontal position from left - * @param y vertical position from top - * @param on true: on, false: off - */ - bool setPixel( const int x, const int y, bool on=true); - void test(); - - private: - bool drawCharAt( char c, int x, int y ); - - bool shutdown(bool b); - bool clear(void); - - /** - * @brief sends the changed content of the buffer to the display - * - */ - void refresh(); - - void refreshByteOfBuffer( int i); - - byte revereBitorder (byte b); - - void appendSpace(); - }; #endif //LedMatrix_h \ No newline at end of file diff --git a/lib/lib_display/LedControl/src/font_5x8_horizontal_MSB.h b/lib/lib_display/LedControl/src/font_5x8_horizontal_MSB.h index 56df774a4..da3becc4e 100644 --- a/lib/lib_display/LedControl/src/font_5x8_horizontal_MSB.h +++ b/lib/lib_display/LedControl/src/font_5x8_horizontal_MSB.h @@ -2,6 +2,9 @@ #ifndef font_5x8_horizontal_MSB_h #define font_5x8_horizontal_MSB_h +const unsigned int font_char_width = 5; +const unsigned int font_char_height = 8; + const char font[256][8]={ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x00 {0x0E,0x11,0x1B,0x11,0x1F,0x0E,0x00,0x00}, // 0x01 diff --git a/lib/lib_display/LedControl/src/font_6x8_horizontal_MSB.h b/lib/lib_display/LedControl/src/font_6x8_horizontal_MSB.h index cc3a323cc..e5c522cd4 100644 --- a/lib/lib_display/LedControl/src/font_6x8_horizontal_MSB.h +++ b/lib/lib_display/LedControl/src/font_6x8_horizontal_MSB.h @@ -2,6 +2,9 @@ #ifndef font_6x8_horizontal_MSB_h #define font_6x8_horizontal_MSB_h +const unsigned int font_char_width = 6; +const unsigned int font_char_height = 8; + const char font[256][8]={ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x00 {0x0E,0x11,0x1B,0x11,0x15,0x11,0x0E,0x00}, // 0x01 diff --git a/lib/lib_display/LedControl/src/font_8x8_horizontal_latin_MSB.h b/lib/lib_display/LedControl/src/font_8x8_horizontal_latin_MSB.h new file mode 100644 index 000000000..e1a8af7ae --- /dev/null +++ b/lib/lib_display/LedControl/src/font_8x8_horizontal_latin_MSB.h @@ -0,0 +1,265 @@ +#ifndef font_8x8_horizontal_latin_MSB_h +#define font_8x8_horizontal_latin_MSB_h + +const unsigned int font_char_width = 8; +const unsigned int font_char_height = 8; + +const char font[256][8]={ +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x00 +{0x0E,0x11,0x1B,0x11,0x15,0x11,0x0E,0x00}, // 0x01 +{0x0E,0x1F,0x15,0x1F,0x11,0x1F,0x0E,0x00}, // 0x02 +{0x00,0x0A,0x1F,0x1F,0x1F,0x0E,0x04,0x00}, // 0x03 +{0x00,0x04,0x0E,0x1F,0x1F,0x0E,0x04,0x00}, // 0x04 +{0x04,0x0E,0x0E,0x04,0x1F,0x1F,0x04,0x00}, // 0x05 +{0x00,0x04,0x0E,0x1F,0x1F,0x04,0x0E,0x00}, // 0x06 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x07 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x08 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x09 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0A +{0x00,0x07,0x03,0x0D,0x12,0x12,0x0C,0x00}, // 0x0B +{0x0E,0x11,0x11,0x0E,0x04,0x0E,0x04,0x00}, // 0x0C +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0D +{0x03,0x0D,0x0B,0x0D,0x0B,0x1B,0x18,0x00}, // 0x0E +{0x00,0x15,0x0E,0x1B,0x0E,0x15,0x00,0x00}, // 0x0F +{0x08,0x0C,0x0E,0x0F,0x0E,0x0C,0x08,0x00}, // 0x10 +{0x02,0x06,0x0E,0x1E,0x0E,0x06,0x02,0x00}, // 0x11 +{0x04,0x0E,0x1F,0x04,0x1F,0x0E,0x04,0x00}, // 0x12 +{0x0A,0x0A,0x0A,0x0A,0x0A,0x00,0x0A,0x00}, // 0x13 +{0x0F,0x15,0x15,0x0D,0x05,0x05,0x05,0x00}, // 0x14 +{0x0E,0x11,0x0C,0x0A,0x06,0x11,0x0E,0x00}, // 0x15 +{0x00,0x00,0x00,0x00,0x00,0x1E,0x1E,0x00}, // 0x16 +{0x04,0x0E,0x1F,0x04,0x1F,0x0E,0x04,0x0E}, // 0x17 +{0x04,0x0E,0x1F,0x04,0x04,0x04,0x04,0x00}, // 0x18 +{0x04,0x04,0x04,0x04,0x1F,0x0E,0x04,0x00}, // 0x19 +{0x00,0x04,0x06,0x1F,0x06,0x04,0x00,0x00}, // 0x1A +{0x00,0x04,0x0C,0x1F,0x0C,0x04,0x00,0x00}, // 0x1B +{0x00,0x00,0x00,0x10,0x10,0x10,0x1F,0x00}, // 0x1C +{0x00,0x0A,0x0A,0x1F,0x0A,0x0A,0x00,0x00}, // 0x1D +{0x04,0x04,0x0E,0x0E,0x1F,0x1F,0x00,0x00}, // 0x1E +{0x1F,0x1F,0x0E,0x0E,0x04,0x04,0x00,0x00}, // 0x1F + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) + { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) + { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") + { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) + { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) + { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) + { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) + { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') + { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() + { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) + { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) + { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) + { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) + { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) + { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) + { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) + { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) + { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) + { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) + { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) + { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) + { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) + { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) + { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) + { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) + { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (;) + { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) + { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) + { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) + { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) + { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) + { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) + { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) + { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) + { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) + { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) + { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) + { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) + { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) + { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) + { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) + { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) + { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) + { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) + { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) + { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) + { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) + { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) + { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) + { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) + { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) + { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) + { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) + { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) + { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) + { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) + { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) + { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) + { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) + { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) + { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) + { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) + { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) + { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) + { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) + { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) + { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) + { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) + { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) + { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) + { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) + { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) + { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) + { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) + { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) + { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) + { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) + { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) + { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) + { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) + { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) + { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) + { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) + { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) + { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) + { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) + { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) + { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) + { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) + { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) + { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) + { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007F{0x0E,0x11,0x10,0x10,0x11,0x0E,0x04,0x0C}, // 0x80 +{0x12,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x81 +{0x03,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x82 +{0x0E,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x83 +{0x0A,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x84 +{0x0C,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x85 +{0x0E,0x0A,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x86 +{0x00,0x0E,0x11,0x10,0x11,0x0E,0x04,0x0C}, // 0x87 +{0x0E,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x88 +{0x0A,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x89 +{0x0C,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x8A +{0x0A,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x8B +{0x0E,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x8C +{0x08,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x8D +{0x0A,0x00,0x04,0x0A,0x11,0x1F,0x11,0x00}, // 0x8E +{0x0E,0x0A,0x0E,0x1B,0x11,0x1F,0x11,0x00}, // 0x8F +{0x03,0x00,0x1F,0x10,0x1E,0x10,0x1F,0x00}, // 0x90 +{0x00,0x00,0x1E,0x05,0x1F,0x14,0x0F,0x00}, // 0x91 +{0x0F,0x14,0x14,0x1F,0x14,0x14,0x17,0x00}, // 0x92 +{0x0E,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0x93 +{0x0A,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0x94 +{0x18,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0x95 +{0x0E,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x96 +{0x18,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x97 +{0x0A,0x00,0x12,0x12,0x12,0x0E,0x04,0x18}, // 0x98 +{0x12,0x0C,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0x99 +{0x0A,0x00,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0x9A +{0x00,0x00,0x01,0x0E,0x16,0x1A,0x1C,0x20}, // 0x9B +{0x06,0x09,0x08,0x1E,0x08,0x09,0x17,0x00}, // 0x9C +{0x0F,0x13,0x15,0x15,0x15,0x19,0x1E,0x00}, // 0x9D +{0x00,0x11,0x0A,0x04,0x0A,0x11,0x00,0x00}, // 0x9E +{0x02,0x05,0x04,0x0E,0x04,0x04,0x14,0x08}, // 0x9F + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+00A0 (no break space) + { 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00}, // U+00A1 (inverted !) + { 0x18, 0x18, 0x7E, 0x03, 0x03, 0x7E, 0x18, 0x18}, // U+00A2 (dollarcents) + { 0x1C, 0x36, 0x26, 0x0F, 0x06, 0x67, 0x3F, 0x00}, // U+00A3 (pound sterling) + { 0x00, 0x00, 0x63, 0x3E, 0x36, 0x3E, 0x63, 0x00}, // U+00A4 (currency mark) + { 0x33, 0x33, 0x1E, 0x3F, 0x0C, 0x3F, 0x0C, 0x0C}, // U+00A5 (yen) + { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+00A6 (broken pipe) + { 0x7C, 0xC6, 0x1C, 0x36, 0x36, 0x1C, 0x33, 0x1E}, // U+00A7 (paragraph) + { 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+00A8 (diaeresis) + { 0x3C, 0x42, 0x99, 0x85, 0x85, 0x99, 0x42, 0x3C}, // U+00A9 (copyright symbol) + { 0x3C, 0x36, 0x36, 0x7C, 0x00, 0x00, 0x00, 0x00}, // U+00AA (superscript a) + { 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00}, // U+00AB (<<) + { 0x00, 0x00, 0x00, 0x3F, 0x30, 0x30, 0x00, 0x00}, // U+00AC (gun pointing left) + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+00AD (soft hyphen) + { 0x3C, 0x42, 0x9D, 0xA5, 0x9D, 0xA5, 0x42, 0x3C}, // U+00AE (registered symbol) + { 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+00AF (macron) + { 0x1C, 0x36, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00}, // U+00B0 (degree) + { 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x7E, 0x00}, // U+00B1 (plusminus) + { 0x1C, 0x30, 0x18, 0x0C, 0x3C, 0x00, 0x00, 0x00}, // U+00B2 (superscript 2) + { 0x1C, 0x30, 0x18, 0x30, 0x1C, 0x00, 0x00, 0x00}, // U+00B2 (superscript 3) + { 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+00B2 (aigu) + { 0x00, 0x00, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x03}, // U+00B5 (mu) + { 0xFE, 0xDB, 0xDB, 0xDE, 0xD8, 0xD8, 0xD8, 0x00}, // U+00B6 (pilcrow) + { 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00}, // U+00B7 (central dot) + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x1E}, // U+00B8 (cedille) + { 0x08, 0x0C, 0x08, 0x1C, 0x00, 0x00, 0x00, 0x00}, // U+00B9 (superscript 1) + { 0x1C, 0x36, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00}, // U+00BA (superscript 0) + { 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00}, // U+00BB (>>) + { 0xC3, 0x63, 0x33, 0xBD, 0xEC, 0xF6, 0xF3, 0x03}, // U+00BC (1/4) + { 0xC3, 0x63, 0x33, 0x7B, 0xCC, 0x66, 0x33, 0xF0}, // U+00BD (1/2) + { 0x03, 0xC4, 0x63, 0xB4, 0xDB, 0xAC, 0xE6, 0x80}, // U+00BE (3/4) + { 0x0C, 0x00, 0x0C, 0x06, 0x03, 0x33, 0x1E, 0x00}, // U+00BF (inverted ?) + { 0x07, 0x00, 0x1C, 0x36, 0x63, 0x7F, 0x63, 0x00}, // U+00C0 (A grave) + { 0x70, 0x00, 0x1C, 0x36, 0x63, 0x7F, 0x63, 0x00}, // U+00C1 (A aigu) + { 0x1C, 0x36, 0x00, 0x3E, 0x63, 0x7F, 0x63, 0x00}, // U+00C2 (A circumflex) + { 0x6E, 0x3B, 0x00, 0x3E, 0x63, 0x7F, 0x63, 0x00}, // U+00C3 (A ~) + { 0x63, 0x1C, 0x36, 0x63, 0x7F, 0x63, 0x63, 0x00}, // U+00C4 (A umlaut) + { 0x0C, 0x0C, 0x00, 0x1E, 0x33, 0x3F, 0x33, 0x00}, // U+00C5 (A ring) + { 0x7C, 0x36, 0x33, 0x7F, 0x33, 0x33, 0x73, 0x00}, // U+00C6 (AE) + { 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x18, 0x30, 0x1E}, // U+00C7 (C cedille) + { 0x07, 0x00, 0x3F, 0x06, 0x1E, 0x06, 0x3F, 0x00}, // U+00C8 (E grave) + { 0x38, 0x00, 0x3F, 0x06, 0x1E, 0x06, 0x3F, 0x00}, // U+00C9 (E aigu) + { 0x0C, 0x12, 0x3F, 0x06, 0x1E, 0x06, 0x3F, 0x00}, // U+00CA (E circumflex) + { 0x36, 0x00, 0x3F, 0x06, 0x1E, 0x06, 0x3F, 0x00}, // U+00CB (E umlaut) + { 0x07, 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00CC (I grave) + { 0x38, 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00CD (I aigu) + { 0x0C, 0x12, 0x00, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+00CE (I circumflex) + { 0x33, 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00CF (I umlaut) + { 0x3F, 0x66, 0x6F, 0x6F, 0x66, 0x66, 0x3F, 0x00}, // U+00D0 (Eth) + { 0x3F, 0x00, 0x33, 0x37, 0x3F, 0x3B, 0x33, 0x00}, // U+00D1 (N ~) + { 0x0E, 0x00, 0x18, 0x3C, 0x66, 0x3C, 0x18, 0x00}, // U+00D2 (O grave) + { 0x70, 0x00, 0x18, 0x3C, 0x66, 0x3C, 0x18, 0x00}, // U+00D3 (O aigu) + { 0x3C, 0x66, 0x18, 0x3C, 0x66, 0x3C, 0x18, 0x00}, // U+00D4 (O circumflex) + { 0x6E, 0x3B, 0x00, 0x3E, 0x63, 0x63, 0x3E, 0x00}, // U+00D5 (O ~) + { 0xC3, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x00}, // U+00D6 (O umlaut) + { 0x00, 0x36, 0x1C, 0x08, 0x1C, 0x36, 0x00, 0x00}, // U+00D7 (multiplicative x) + { 0x5C, 0x36, 0x73, 0x7B, 0x6F, 0x36, 0x1D, 0x00}, // U+00D8 (O stroke) + { 0x0E, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00}, // U+00D9 (U grave) + { 0x70, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00}, // U+00DA (U aigu) + { 0x3C, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x00}, // U+00DB (U circumflex) + { 0x33, 0x00, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+00DC (U umlaut) + { 0x70, 0x00, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x00}, // U+00DD (Y aigu) + { 0x0F, 0x06, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+00DE (Thorn) + { 0x00, 0x1E, 0x33, 0x1F, 0x33, 0x1F, 0x03, 0x03}, // U+00DF (beta) + { 0x07, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E0 (a grave) + { 0x38, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E1 (a aigu) + { 0x7E, 0xC3, 0x3C, 0x60, 0x7C, 0x66, 0xFC, 0x00}, // U+00E2 (a circumflex) + { 0x6E, 0x3B, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E3 (a ~) + { 0x33, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E4 (a umlaut) + { 0x0C, 0x0C, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E5 (a ring) + { 0x00, 0x00, 0xFE, 0x30, 0xFE, 0x33, 0xFE, 0x00}, // U+00E6 (ae) + { 0x00, 0x00, 0x1E, 0x03, 0x03, 0x1E, 0x30, 0x1C}, // U+00E7 (c cedille) + { 0x07, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00}, // U+00E8 (e grave) + { 0x38, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00}, // U+00E9 (e aigu) + { 0x7E, 0xC3, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00}, // U+00EA (e circumflex) + { 0x33, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00}, // U+00EB (e umlaut) + { 0x07, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00EC (i grave) + { 0x1C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00ED (i augu) + { 0x3E, 0x63, 0x1C, 0x18, 0x18, 0x18, 0x3C, 0x00}, // U+00EE (i circumflex) + { 0x33, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00EF (i umlaut) + { 0x1B, 0x0E, 0x1B, 0x30, 0x3E, 0x33, 0x1E, 0x00}, // U+00F0 (eth) + { 0x00, 0x1F, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x00}, // U+00F1 (n ~) + { 0x00, 0x07, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F2 (o grave) + { 0x00, 0x38, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F3 (o aigu) + { 0x1E, 0x33, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F4 (o circumflex) + { 0x6E, 0x3B, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F5 (o ~) + { 0x00, 0x33, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F6 (o umlaut) + { 0x18, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x18, 0x00}, // U+00F7 (division) + { 0x00, 0x60, 0x3C, 0x76, 0x7E, 0x6E, 0x3C, 0x06}, // U+00F8 (o stroke) + { 0x00, 0x07, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00F9 (u grave) + { 0x00, 0x38, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00FA (u aigu) + { 0x1E, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00FB (u circumflex) + { 0x00, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00FC (u umlaut) + { 0x00, 0x38, 0x00, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+00FD (y aigu) + { 0x00, 0x00, 0x06, 0x3E, 0x66, 0x3E, 0x06, 0x00}, // U+00FE (thorn) + { 0x00, 0x33, 0x00, 0x33, 0x33, 0x3E, 0x30, 0x1F} // U+00FF (y umlaut) +}; + +#endif \ No newline at end of file diff --git a/tasmota/tasmota_template.h b/tasmota/tasmota_template.h index 13fdf23e4..e3f3256fc 100644 --- a/tasmota/tasmota_template.h +++ b/tasmota/tasmota_template.h @@ -524,7 +524,6 @@ const uint16_t kGpioNiceList[] PROGMEM = { #ifdef USE_DISPLAY_MAX7219_MATRIX #undef USE_DISPLAY_MAX7219 #undef USE_DISPLAY_TM1637 - #define USE_DISPLAY_MODES1TO5 AGPIO(GPIO_MAX7219CLK), AGPIO(GPIO_MAX7219DIN), AGPIO(GPIO_MAX7219CS), diff --git a/tasmota/xdsp_19_max7219_matrix.ino b/tasmota/xdsp_19_max7219_matrix.ino index ec82420e2..3ec3ac332 100644 --- a/tasmota/xdsp_19_max7219_matrix.ino +++ b/tasmota/xdsp_19_max7219_matrix.ino @@ -1,5 +1,5 @@ /* - xdsp_19_max7219_matrix.ino.ino - Support for MAX7219 based dot matrix displays for Tasmota + xdsp_19_max7219_matrix.ino.ino - Support for MAX7219 based 8x8 dot matrix displays for Tasmota Copyright (C) 2021 Michael Beuss @@ -20,111 +20,63 @@ #ifdef USE_DISPLAY #ifdef USE_DISPLAY_MAX7219_MATRIX /*********************************************************************************************\ - This driver enables the display of ascii text on MAX7219 based LED dot matrix modules. + This driver enables the display of ascii text on MAX7219 based 8x8 LED dot matrix modules (1088AS). - Connect the MAX7219 display module's pins to any free GPIOs of the ESP8266 or ESP32 module - and assign the pins as follows from Tasmota's GUI: + Connect the MAX7219 display module's pins to any free GPIOs of the ESP8266 or ESP32 module. + VCC should be 5V. Depending on the number of used modules and the brightness, the used current can be more than 500 mA. + + Connect the 5 outgoing pins (VCC, GND, DI, CS, CLK) of the first module to the next one. + With this you can connect up to 32 modules. + To extend the display hieght, multiple rows are supported. Each module row starts from left to right. + + Assign the pins as follows from Tasmota's GUI: DIN hardware pin --> "MAX7219 DIN" CS hardware pin --> "MAX7219 CS" CLK hardware pin --> "MAX7219 CLK" + Once the GPIO configuration is saved and the ESP8266/ESP32 module restarts, set the Display Model to 19 and Display Mode to 0 - using the command "Backlog DisplayModel 15 ; DisplayMode 0" - If your display is a TM1637 with 6 digits, set Display Width to the number of digits your - display has, using the command "DisplayWidth 6". + Depending on order oth the wired 8x8 matrix modules you have got a display of size pixel_width x pixel_height. + The size has to be set with the commands "DisplayWidth " and "DisplayHeight " After the ESP8266/ESP32 module restarts again, turn ON the display with the command "Power 1" + Now, the following "Display" commands can be used: + DisplayText text + Sends the text to the display. + If the text fits into the display, it is shown in the center. + Otherwise it scrolls to the left and repeats as long it is cleared or new "DisplayText" overwrites it. + + DisplayDimmer [0..100] + Sets the intensity of the display. + + Power [ON|OFF] + Sitches the display on or off. When "off", the display buffer is not cleared and will be shown again when after "Power ON". + Other display commands are still active when off. DisplayClear + Clears the display - Clears the display, command: "DisplayClear" + DisplayScrollDelay [0..15] // default = 0 + Sets the speed of text scroll. Smaller delay = faster scrolling. + The maximum scroll speed is 50ms per pixel on DisplayScrollDelay 0. + DisplayWidth [8..256] + Sets the pixel width of the display (8x number of modules in a row) - DisplayNumber num [,position {0-(Settings->display_width-1))} [,leading_zeros {0|1} [,length {1 to Settings->display_width}]]] + DisplayHeight [8..256] + Sets the pixel height of the display (8x number of module rows) - Clears and then displays number without decimal. command e.g., "DisplayNumber 1234" - Control 'leading zeros', 'length' and 'position' with "DisplayNumber 1234, , , " - 'leading zeros' can be 1 or 0 (default), 'length' can be 1 to Settings->display_width, 'position' can be 0 (left-most) to Settings->display_width (right-most). - See function description below for more details. - - DisplayNumberNC num [,position {0-(Settings->display_width-1))} [,leading_zeros {0|1} [,length {1 to Settings->display_width}]]] - - Display integer number as above, but without clearing first. e.g., "DisplayNumberNC 1234". Usage is same as above. - - - - DisplayFloat num [,position {0-(Settings->display_width-1)} [,precision {0-Settings->display_width} [,length {1 to Settings->display_width}]]] - - Clears and then displays float (with decimal point) command e.g., "DisplayFloat 12.34" - See function description below for more details. - - - - DisplayFloatNC num [,position {0-(Settings->display_width-1)} [,precision {0-Settings->display_width} [,length {1 to Settings->display_width}]]] - - Displays float (with decimal point) as above, but without clearing first. command e.g., "DisplayFloatNC 12.34" - See function description below for more details. - - - - DisplayRaw position {0-(Settings->display_width-1)},length {1 to Settings->display_width}, num1 [, num2[, num3[, num4[, ...upto Settings->display_width numbers]]]]] - - Takes upto Settings->display_width comma-separated integers (0-255) and displays raw segments. Each number represents a - 7-segment digit. Each 8-bit number represents individual segments of a digit. - For example, the command "DisplayRaw 0, 4, 255, 255, 255, 255" would display "[8.8.8.8.]" - - - - DisplayText text [, position {0-(Settings->display_width-1)} [,length {1 to Settings->display_width}]] - - Clears and then displays basic text. command e.g., "DisplayText ajith vasudevan" - Control 'length' and 'position' with "DisplayText , , " - 'length' can be 1 to Settings->display_width, 'position' can be 0 (left-most) to Settings->display_width-1 (right-most) - A caret(^) symbol in the text input is dispayed as the degrees(°) symbol. This is useful for displaying Temperature! - For example, the command "DisplayText 22.5^" will display "22.5°". - - - DisplayTextNC text [, position {0-Settings->display_width-1} [,length {1 to Settings->display_width}]] - - Clears first, then displays text. Usage is same as above. - - - - DisplayScrollText text [, num_loops] - - Displays scrolling text indefinitely, until another Display- command (other than DisplayScrollText - or DisplayScrollDelay is issued). Optionally, stop scrolling after num_loops iterations. - - - - DisplayScrollDelay delay {0-15} // default = 4 - - Sets the speed of text scroll. Smaller delay = faster scrolling. - - - - DisplayLevel num {0-100} - - Display a horizontal bar graph (0-100) command e.g., "DisplayLevel 50" will display [|||| ] - - - - DisplayClock 1|2|0 - - Displays a clock. - Commands "DisplayClock 1" // 12 hr format - "DisplayClock 2" // 24 hr format - "DisplayClock 0" // turn off clock - - -In addition, setting DisplayMode to 1 shows the time, setting it to 2 shows the date -and setting it to 3 alternates between time and date. + DisplayClock [0|1|2] + Displays a clock. + Commands "DisplayClock 1" // 12 hr format + "DisplayClock 2" // 24 hr format + "DisplayClock 0" // turn off clock @@ -132,20 +84,26 @@ and setting it to 3 alternates between time and date. #define XDSP_19 19 -#include #include +#ifdef USE_DISPLAY_MODES1TO5 +#include +#endif + LedMatrix *max7219_Matrix = nullptr; bool max2791Matrix_initDriver_done = false; struct { byte modulesPerRow = 4; byte modulesPerCol = 1; + byte scroll_delay = 0; + byte scroll_iteration = 0; bool show_clock = false; - const char* timeFormat; + const char *timeFormat; } LedMatrix_settings; +// FUNC_DISPLAY_INIT_DRIVER bool MAX7291Matrix_initDriver(void) { if (!PinUsed(GPIO_MAX7219DIN) || !PinUsed(GPIO_MAX7219CLK) || !PinUsed(GPIO_MAX7219CS)) @@ -174,6 +132,7 @@ bool MAX7291Matrix_initDriver(void) return MAX7291Matrix_init(); } +// FUNC_DISPLAY_INIT bool MAX7291Matrix_init(void) { int intensity = GetDisplayDimmer16(); // 0..15 @@ -187,6 +146,39 @@ bool MAX7291Matrix_init(void) return true; } +// FUNC_DISPLAY_SCROLLDELAY +bool MAX7291Matrix_scrollDelay(void) +{ + if (ArgC() == 0) + { + XdrvMailbox.payload = LedMatrix_settings.scroll_delay; + return true; + } + if (LedMatrix_settings.scroll_delay < 0) + LedMatrix_settings.scroll_delay = 0; + LedMatrix_settings.scroll_delay = XdrvMailbox.payload; + return true; +} + +// FUNC_DISPLAY_EVERY_50_MSECOND +bool MAX7291Matrix_scrollText(void) +{ + // This function is called every 50 ms. + // scroll_delay defines the number of cycles to be ignored until the display scrolls by one pixel to the left. + // e.g. scrall_delay = 4 causes a scroll each 200 ms. + LedMatrix_settings.scroll_iteration++; + if (LedMatrix_settings.scroll_delay) + LedMatrix_settings.scroll_iteration = LedMatrix_settings.scroll_iteration % LedMatrix_settings.scroll_delay; + else + LedMatrix_settings.scroll_iteration = 0; + if (LedMatrix_settings.scroll_iteration) + return false; + + return max7219_Matrix->scrollText(); +} + +#ifdef USE_DISPLAY_MODES1TO5 +// FUNC_DISPLAY_CLOCK bool MAX7291Matrix_clock(void) { LedMatrix_settings.show_clock = XdrvMailbox.payload; @@ -213,11 +205,11 @@ bool MAX7291Matrix_clock(void) AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: LedMatrix_settings.show_clock %d, timeFormat %s"), LedMatrix_settings.show_clock, LedMatrix_settings.timeFormat); - //max7219_Matrix->clearDisplay(); MAX7291Matrix_showTime(); return true; } +// FUNC_DISPLAY_EVERY_SECOND bool MAX7291Matrix_showTime() { time_t rawtime; @@ -227,11 +219,12 @@ bool MAX7291Matrix_showTime() time(&rawtime); timeinfo = localtime(&rawtime); strftime(timeStr, 10, LedMatrix_settings.timeFormat, timeinfo); - //AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: showTime:%s"), timeStr); max7219_Matrix->drawText(timeStr); return true; } +#endif // USE_DISPLAY_MODES1TO5 + bool Xdsp19(uint8_t function) { @@ -260,30 +253,28 @@ bool Xdsp19(uint8_t function) case FUNC_DISPLAY_DIM: result = max7219_Matrix->setIntensity(GetDisplayDimmer16()); break; - case FUNC_DISPLAY_CLOCK: - result = MAX7291Matrix_clock(); - break; - case FUNC_DISPLAY_SEVENSEG_TEXT: - case FUNC_DISPLAY_SEVENSEG_TEXTNC: - case FUNC_DISPLAY_NUMBER: - case FUNC_DISPLAY_NUMBERNC: - case FUNC_DISPLAY_FLOAT: - case FUNC_DISPLAY_FLOATNC: - case FUNC_DISPLAY_RAW: - case FUNC_DISPLAY_LEVEL: - case FUNC_DISPLAY_SCROLLTEXT: case FUNC_DISPLAY_DRAW_STRING: result = max7219_Matrix->drawText(dsp_str); break; + case FUNC_DISPLAY_SCROLLDELAY: + result = MAX7291Matrix_scrollDelay(); + break; + case FUNC_DISPLAY_EVERY_50_MSECOND: + result = MAX7291Matrix_scrollText(); + break; + +#ifdef USE_DISPLAY_MODES1TO5 + case FUNC_DISPLAY_CLOCK: + result = MAX7291Matrix_clock(); + break; case FUNC_DISPLAY_EVERY_SECOND: if (LedMatrix_settings.show_clock) { result = MAX7291Matrix_showTime(); } - break; - case FUNC_DISPLAY_EVERY_50_MSECOND: - result = max7219_Matrix->scrollText(); +#endif // USE_DISPLAY_MODES1TO5 + default: result = false; } From 5b3266e7ca90dfdbe750a6be746b14f6de24f884 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 29 Nov 2021 15:27:55 +0100 Subject: [PATCH 07/10] Support for more than 8 matrix devices --- lib/lib_display/LedControl/src/LedControl.cpp | 37 ++- lib/lib_display/LedControl/src/LedControl.h | 20 +- lib/lib_display/LedControl/src/LedMatrix.cpp | 24 +- lib/lib_display/LedControl/src/LedMatrix.h | 13 +- .../LedControl/src/font_5x8_horizontal_MSB.h | 267 ------------------ .../src/font_8x8_horizontal_latin_MSB.h | 265 ----------------- tasmota/xdsp_19_max7219_matrix.ino | 89 ++++-- 7 files changed, 129 insertions(+), 586 deletions(-) delete mode 100644 lib/lib_display/LedControl/src/font_5x8_horizontal_MSB.h delete mode 100644 lib/lib_display/LedControl/src/font_8x8_horizontal_latin_MSB.h diff --git a/lib/lib_display/LedControl/src/LedControl.cpp b/lib/lib_display/LedControl/src/LedControl.cpp index e43211fd8..11e7a2908 100644 --- a/lib/lib_display/LedControl/src/LedControl.cpp +++ b/lib/lib_display/LedControl/src/LedControl.cpp @@ -47,16 +47,16 @@ LedControl::LedControl(int dataPin, int clkPin, int csPin, int numDevices) { SPI_MOSI=dataPin; SPI_CLK=clkPin; SPI_CS=csPin; - if(numDevices<=0 || numDevices>8 ) - numDevices=8; - maxDevices=numDevices; + if (numDevices <= 0 || numDevices > MAX72XX_MAX_DEVICES) + numDevices = MAX72XX_MAX_DEVICES; + maxDevices = numDevices; pinMode(SPI_MOSI,OUTPUT); pinMode(SPI_CLK,OUTPUT); pinMode(SPI_CS,OUTPUT); digitalWrite(SPI_CS,HIGH); SPI_MOSI=dataPin; - for(int i=0;i<64;i++) - status[i]=0x00; + for (int i = 0; i < 8 * MAX72XX_MAX_DEVICES; i++) + status[i] = 0x00; for(int i=0;i 7) + return; + for (int addr = 0; addr < maxDevices; addr++) + status[addr * 8 + row] = value[addr]; + spiTransferLong(row + 1, value); +} + void LedControl::setColumn(int addr, int col, byte value) { byte val; @@ -195,7 +204,7 @@ void LedControl::spiTransfer(int addr, volatile byte opcode, volatile byte data) int maxbytes=maxDevices*2; for(int i=0;i 0; i--) + shiftOut(SPI_MOSI, SPI_CLK, MSBFIRST, spidata[i - 1]); + //latch the data onto the display + digitalWrite(SPI_CS, HIGH); +} diff --git a/lib/lib_display/LedControl/src/LedControl.h b/lib/lib_display/LedControl/src/LedControl.h index f8180d07d..31fed9ffe 100644 --- a/lib/lib_display/LedControl/src/LedControl.h +++ b/lib/lib_display/LedControl/src/LedControl.h @@ -35,6 +35,10 @@ #include #endif +#ifndef MAX72XX_MAX_DEVICES +#define MAX72XX_MAX_DEVICES 32 // maximum number of devices based on MXA7219/MAX7221 +#endif + /* * Segments to be switched on for characters and digits on * 7-Segment Displays @@ -61,12 +65,14 @@ const static byte charTable [] PROGMEM = { class LedControl { private : /* The array for shifting the data to the devices */ - byte spidata[16]; - /* Send out a single command to the device */ + byte spidata[2 * MAX72XX_MAX_DEVICES]; + /* Send out a single command to one device */ void spiTransfer(int addr, byte opcode, byte data); + /* Send out a command with the same opcode to all devices */ + void spiTransferLong(byte opcode, const byte* data); /* We keep track of the led-status for all 8 devices in this array */ - byte status[64]; + byte status[8 * MAX72XX_MAX_DEVICES]; /* Data is shifted out of this pin*/ int SPI_MOSI; /* The clock is signaled on this pin */ @@ -149,6 +155,14 @@ class LedControl { */ void setRow(int addr, int row, byte value); + /** + * @brief Set data for the same row of all devices + * + * @param row [0..8] + * @param value array of bytes, one for each device + */ + void setRowLong(int row, byte* value); + /* * Set all 8 Led's in a column to a new state * Params: diff --git a/lib/lib_display/LedControl/src/LedMatrix.cpp b/lib/lib_display/LedControl/src/LedMatrix.cpp index b4fb8c260..1579e0852 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.cpp +++ b/lib/lib_display/LedControl/src/LedMatrix.cpp @@ -32,17 +32,17 @@ // public LedMatrix::LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, unsigned int rows) { - if (colums * rows > MATRIX_MAX_MODULES) + if (colums * rows > MAX72XX_MAX_DEVICES) { // dimension exeeds maximum buffer size - if (colums >= MATRIX_MAX_MODULES) + if (colums >= MAX72XX_MAX_DEVICES) { - colums = MATRIX_MAX_MODULES; + colums = MAX72XX_MAX_DEVICES; rows = 1; } else { - rows = MATRIX_MAX_MODULES / colums; + rows = MAX72XX_MAX_DEVICES / colums; } } @@ -66,7 +66,7 @@ LedMatrix::LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, un setIntensity(7); } -bool LedMatrix::drawText( const char *str) +bool LedMatrix::drawText( const char *str, bool clearBefore) { strncpy(textBuf, str, TEXT_BUFFER_SIZE -1); textPosX = 0; @@ -75,7 +75,7 @@ bool LedMatrix::drawText( const char *str) if(textWidth < displayWidth) { // text fits into the display, place it into the center - clear(); + if(clearBefore) clear(); textPosX = (displayWidth - textWidth) / 2; // center } else @@ -146,9 +146,13 @@ bool LedMatrix::setIntensity(byte dim) return true; } -bool LedMatrix::setOrientation(ModuleOrientation orientation) +bool LedMatrix::setOrientation(LedMatrix::ModuleOrientation orientation) { - moduleOrientation = orientation; + if(moduleOrientation != orientation) + { + moduleOrientation = orientation; + refresh(); + } return true; } @@ -268,9 +272,9 @@ void LedMatrix::refreshByteOfBuffer(int i) byte LedMatrix::revereBitorder (byte b) { - const static byte lookup[] PROGMEM = { + static const byte lookup[16] = { 0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe, - 0x1, 0x9, 0x5, 0xd, 0x3, 0xb, 0x7, 0xf, + 0x1, 0x9, 0x5, 0xd, 0x3, 0xb, 0x7, 0xf }; return (lookup[b & 0b1111] << 4) | lookup[b >> 4]; } diff --git a/lib/lib_display/LedControl/src/LedMatrix.h b/lib/lib_display/LedControl/src/LedMatrix.h index efb50b8e3..b369173d0 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.h +++ b/lib/lib_display/LedControl/src/LedMatrix.h @@ -29,8 +29,7 @@ #include -#define MATRIX_MAX_MODULES 32 // maximum number of modules that can be used -#define MATRIX_BUFFER_SIZE MATRIX_MAX_MODULES * 8 // 8 bytes per modul. One byte represents 8 LEDs. +#define MATRIX_BUFFER_SIZE MAX72XX_MAX_DEVICES * 8 // 8 bytes per modul. One byte represents 8 LEDs. #define TEXT_BUFFER_SIZE 256 // maximum text length that can be scrolled #define TEXT_APPEND_BUFFER_SIZE 16 // used for characters that are appended to the scroll text, before it repeats @@ -66,12 +65,14 @@ class LedMatrix * When the text is longer than than the display width, it can be scrolled per pixel with function scrollText(). * * @param str string to display + * @param clearBefore true (default) clears old display content before, false: do not clear display before */ - bool drawText( const char *str ); + bool drawText( const char *str, bool clearBefore = true ); /** * @brief Dwaws a character string to a defined display position. The position (x,y) is used for the upper left pixel of the text. - * Existing text before the x position will not be cleared. Use refresh() after all text parts are drawed. + * Existing content outside the drawing text area will not be cleared. But you can use clearDisplay() before. + * Use refresh() after all text parts are drawed. * * @param str string to display * @param x horizantal pixel position to start with string (0 is most left) @@ -112,7 +113,7 @@ class LedMatrix * * @param orientation */ - bool setOrientation(ModuleOrientation orientation); + bool setOrientation(LedMatrix::ModuleOrientation orientation); /** * @brief Set ap pixel at a defined position. @@ -151,7 +152,7 @@ class LedMatrix unsigned int displayWidth; // matrix width [pixel] unsigned int displayHeight; // matrix height [pixel] unsigned int modules; // number of 8x8 mudules - ModuleOrientation moduleOrientation; + uint8_t moduleOrientation; byte buffer[MATRIX_BUFFER_SIZE]; LedControl* ledControl; int charWidth; diff --git a/lib/lib_display/LedControl/src/font_5x8_horizontal_MSB.h b/lib/lib_display/LedControl/src/font_5x8_horizontal_MSB.h deleted file mode 100644 index da3becc4e..000000000 --- a/lib/lib_display/LedControl/src/font_5x8_horizontal_MSB.h +++ /dev/null @@ -1,267 +0,0 @@ -// 5x8 ascii font -#ifndef font_5x8_horizontal_MSB_h -#define font_5x8_horizontal_MSB_h - -const unsigned int font_char_width = 5; -const unsigned int font_char_height = 8; - -const char font[256][8]={ -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x00 -{0x0E,0x11,0x1B,0x11,0x1F,0x0E,0x00,0x00}, // 0x01 -{0x0E,0x15,0x1F,0x11,0x1F,0x0E,0x00,0x00}, // 0x02 -{0x0A,0x1F,0x1F,0x1F,0x0E,0x04,0x00,0x00}, // 0x03 -{0x04,0x04,0x0E,0x1F,0x0E,0x04,0x04,0x00}, // 0x04 -{0x04,0x0E,0x04,0x1F,0x15,0x04,0x0E,0x00}, // 0x05 -{0x04,0x0E,0x1F,0x1F,0x15,0x04,0x0E,0x00}, // 0x06 -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x07 -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x08 -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x09 -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0A -{0x03,0x03,0x0E,0x11,0x11,0x11,0x0E,0x00}, // 0x0B -{0x0E,0x11,0x11,0x11,0x0E,0x04,0x0E,0x04}, // 0x0C -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0D -{0x03,0x0F,0x09,0x09,0x0B,0x1B,0x18,0x00}, // 0x0E -{0x00,0x15,0x0E,0x1B,0x0E,0x15,0x00,0x00}, // 0x0F -{0x00,0x10,0x1C,0x1F,0x1C,0x10,0x00,0x00}, // 0x10 -{0x00,0x01,0x07,0x1F,0x07,0x01,0x00,0x00}, // 0x11 -{0x04,0x0E,0x04,0x04,0x04,0x0E,0x04,0x00}, // 0x12 -{0x00,0x0A,0x0A,0x0A,0x00,0x0A,0x00,0x00}, // 0x13 -{0x0E,0x1A,0x1A,0x0A,0x0A,0x0A,0x0A,0x00}, // 0x14 -{0x06,0x08,0x04,0x0A,0x04,0x02,0x0C,0x00}, // 0x15 -{0x00,0x00,0x00,0x0F,0x0F,0x00,0x00,0x00}, // 0x16 -{0x04,0x0E,0x04,0x0E,0x04,0x00,0x0E,0x00}, // 0x17 -{0x04,0x0E,0x04,0x04,0x04,0x04,0x04,0x00}, // 0x18 -{0x04,0x04,0x04,0x04,0x04,0x0E,0x04,0x00}, // 0x19 -{0x00,0x00,0x02,0x0F,0x02,0x00,0x00,0x00}, // 0x1A -{0x00,0x00,0x04,0x0F,0x04,0x00,0x00,0x00}, // 0x1B -{0x00,0x00,0x08,0x08,0x08,0x0F,0x00,0x00}, // 0x1C -{0x00,0x00,0x0A,0x1F,0x0A,0x00,0x00,0x00}, // 0x1D -{0x00,0x04,0x04,0x0E,0x0E,0x1F,0x00,0x00}, // 0x1E -{0x00,0x1F,0x0E,0x0E,0x04,0x04,0x00,0x00}, // 0x1F -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x20 -{0x04,0x04,0x04,0x04,0x00,0x04,0x00,0x00}, // 0x21 -{0x0A,0x0A,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x22 -{0x00,0x05,0x1F,0x0A,0x1F,0x14,0x00,0x00}, // 0x23 -{0x04,0x0E,0x0C,0x04,0x06,0x0E,0x04,0x00}, // 0x24 -{0x09,0x15,0x0E,0x0E,0x15,0x12,0x00,0x00}, // 0x25 -{0x04,0x0A,0x0C,0x15,0x12,0x0D,0x00,0x00}, // 0x26 -{0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x27 -{0x03,0x04,0x08,0x08,0x08,0x04,0x03,0x00}, // 0x28 -{0x18,0x04,0x02,0x02,0x02,0x04,0x18,0x00}, // 0x29 -{0x04,0x0A,0x04,0x0A,0x00,0x00,0x00,0x00}, // 0x2A -{0x00,0x00,0x00,0x04,0x0E,0x04,0x00,0x00}, // 0x2B -{0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x08}, // 0x2C -{0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00}, // 0x2D -{0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00}, // 0x2E -{0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x00}, // 0x2F -{0x06,0x09,0x09,0x09,0x09,0x06,0x00,0x00}, // 0x30 -{0x04,0x0C,0x04,0x04,0x04,0x0E,0x00,0x00}, // 0x31 -{0x0C,0x02,0x02,0x04,0x08,0x0E,0x00,0x00}, // 0x32 -{0x0C,0x02,0x0C,0x02,0x02,0x0C,0x00,0x00}, // 0x33 -{0x02,0x06,0x0A,0x0F,0x02,0x02,0x00,0x00}, // 0x34 -{0x0E,0x08,0x0C,0x02,0x02,0x0C,0x00,0x00}, // 0x35 -{0x06,0x08,0x0E,0x09,0x09,0x06,0x00,0x00}, // 0x36 -{0x0F,0x01,0x02,0x04,0x04,0x04,0x00,0x00}, // 0x37 -{0x06,0x09,0x06,0x09,0x09,0x06,0x00,0x00}, // 0x38 -{0x06,0x09,0x09,0x07,0x01,0x06,0x00,0x00}, // 0x39 -{0x00,0x00,0x04,0x00,0x00,0x04,0x00,0x00}, // 0x3A -{0x00,0x00,0x04,0x00,0x00,0x04,0x04,0x08}, // 0x3B -{0x00,0x01,0x02,0x0C,0x02,0x01,0x00,0x00}, // 0x3C -{0x00,0x00,0x0F,0x00,0x0F,0x00,0x00,0x00}, // 0x3D -{0x00,0x08,0x04,0x03,0x04,0x08,0x00,0x00}, // 0x3E -{0x0E,0x01,0x02,0x04,0x00,0x04,0x00,0x00}, // 0x3F -{0x06,0x09,0x13,0x15,0x17,0x10,0x0F,0x00}, // 0x40 -{0x00,0x04,0x0A,0x0A,0x1F,0x11,0x00,0x00}, // 0x41 -{0x00,0x0E,0x0A,0x0C,0x0A,0x0E,0x00,0x00}, // 0x42 -{0x00,0x07,0x08,0x08,0x08,0x07,0x00,0x00}, // 0x43 -{0x00,0x0E,0x09,0x09,0x09,0x0E,0x00,0x00}, // 0x44 -{0x00,0x0E,0x08,0x0E,0x08,0x0E,0x00,0x00}, // 0x45 -{0x00,0x0E,0x08,0x0E,0x08,0x08,0x00,0x00}, // 0x46 -{0x00,0x07,0x08,0x0B,0x09,0x07,0x00,0x00}, // 0x47 -{0x00,0x09,0x09,0x0F,0x09,0x09,0x00,0x00}, // 0x48 -{0x00,0x0E,0x04,0x04,0x04,0x0E,0x00,0x00}, // 0x49 -{0x00,0x0E,0x02,0x02,0x02,0x0C,0x00,0x00}, // 0x4A -{0x00,0x09,0x0A,0x0C,0x0A,0x09,0x00,0x00}, // 0x4B -{0x00,0x08,0x08,0x08,0x08,0x0F,0x00,0x00}, // 0x4C -{0x00,0x11,0x1B,0x15,0x15,0x11,0x00,0x00}, // 0x4D -{0x00,0x09,0x0D,0x0B,0x09,0x09,0x00,0x00}, // 0x4E -{0x00,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00}, // 0x4F -{0x00,0x0E,0x09,0x0E,0x08,0x08,0x00,0x00}, // 0x50 -{0x00,0x0E,0x11,0x11,0x11,0x0E,0x02,0x01}, // 0x51 -{0x00,0x0C,0x0A,0x0C,0x0A,0x09,0x00,0x00}, // 0x52 -{0x00,0x06,0x08,0x04,0x02,0x0C,0x00,0x00}, // 0x53 -{0x00,0x1F,0x04,0x04,0x04,0x04,0x00,0x00}, // 0x54 -{0x00,0x09,0x09,0x09,0x09,0x06,0x00,0x00}, // 0x55 -{0x00,0x09,0x09,0x09,0x06,0x06,0x00,0x00}, // 0x56 -{0x00,0x11,0x15,0x15,0x0A,0x0A,0x00,0x00}, // 0x57 -{0x00,0x11,0x0A,0x04,0x0A,0x11,0x00,0x00}, // 0x58 -{0x00,0x11,0x0A,0x04,0x04,0x04,0x00,0x00}, // 0x59 -{0x00,0x0F,0x01,0x06,0x08,0x0F,0x00,0x00}, // 0x5A -{0x06,0x04,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x5B -{0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x00}, // 0x5C -{0x0C,0x04,0x04,0x04,0x04,0x04,0x0C,0x00}, // 0x5D -{0x04,0x0A,0x0A,0x11,0x11,0x00,0x00,0x00}, // 0x5E -{0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00}, // 0x5F -{0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x60 -{0x00,0x00,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0x61 -{0x08,0x08,0x0E,0x09,0x09,0x0E,0x00,0x00}, // 0x62 -{0x00,0x00,0x06,0x08,0x08,0x06,0x00,0x00}, // 0x63 -{0x02,0x02,0x0E,0x12,0x12,0x0E,0x00,0x00}, // 0x64 -{0x00,0x00,0x04,0x0E,0x08,0x06,0x00,0x00}, // 0x65 -{0x03,0x04,0x0F,0x04,0x04,0x04,0x00,0x00}, // 0x66 -{0x00,0x00,0x07,0x09,0x0F,0x01,0x0E,0x00}, // 0x67 -{0x08,0x08,0x0A,0x0D,0x09,0x09,0x00,0x00}, // 0x68 -{0x04,0x00,0x0C,0x04,0x04,0x04,0x00,0x00}, // 0x69 -{0x02,0x00,0x0E,0x02,0x02,0x02,0x0C,0x00}, // 0x6A -{0x08,0x08,0x0A,0x0C,0x0A,0x09,0x00,0x00}, // 0x6B -{0x0C,0x04,0x04,0x04,0x04,0x04,0x00,0x00}, // 0x6C -{0x00,0x00,0x15,0x1F,0x15,0x15,0x00,0x00}, // 0x6D -{0x00,0x00,0x0A,0x0D,0x09,0x09,0x00,0x00}, // 0x6E -{0x00,0x00,0x06,0x09,0x09,0x06,0x00,0x00}, // 0x6F -{0x00,0x00,0x0E,0x09,0x09,0x0E,0x08,0x00}, // 0x70 -{0x00,0x00,0x0E,0x12,0x12,0x0E,0x02,0x00}, // 0x71 -{0x00,0x00,0x0A,0x0C,0x08,0x08,0x00,0x00}, // 0x72 -{0x00,0x00,0x06,0x0C,0x02,0x0C,0x00,0x00}, // 0x73 -{0x00,0x04,0x0F,0x04,0x04,0x02,0x00,0x00}, // 0x74 -{0x00,0x00,0x09,0x09,0x0B,0x05,0x00,0x00}, // 0x75 -{0x00,0x00,0x09,0x09,0x06,0x06,0x00,0x00}, // 0x76 -{0x00,0x00,0x15,0x15,0x0E,0x0A,0x00,0x00}, // 0x77 -{0x00,0x00,0x09,0x06,0x06,0x09,0x00,0x00}, // 0x78 -{0x00,0x00,0x09,0x09,0x06,0x06,0x1C,0x00}, // 0x79 -{0x00,0x00,0x0E,0x06,0x08,0x0E,0x00,0x00}, // 0x7A -{0x02,0x04,0x04,0x08,0x04,0x04,0x02,0x00}, // 0x7B -{0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00}, // 0x7C -{0x08,0x04,0x04,0x02,0x04,0x04,0x08,0x00}, // 0x7D -{0x00,0x00,0x00,0x0D,0x12,0x00,0x00,0x00}, // 0x7E -{0x00,0x04,0x0A,0x0A,0x0A,0x0E,0x00,0x00}, // 0x7F -{0x00,0x07,0x08,0x08,0x08,0x07,0x02,0x04}, // 0x80 -{0x09,0x00,0x09,0x09,0x0B,0x05,0x00,0x00}, // 0x81 -{0x01,0x02,0x04,0x0E,0x08,0x06,0x00,0x00}, // 0x82 -{0x06,0x09,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0x83 -{0x0A,0x00,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0x84 -{0x10,0x08,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0x85 -{0x04,0x0A,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0x86 -{0x00,0x00,0x06,0x08,0x08,0x06,0x02,0x04}, // 0x87 -{0x06,0x09,0x04,0x0E,0x08,0x06,0x00,0x00}, // 0x88 -{0x0A,0x00,0x04,0x0E,0x08,0x06,0x00,0x00}, // 0x89 -{0x10,0x08,0x04,0x0E,0x08,0x06,0x00,0x00}, // 0x8A -{0x0A,0x00,0x0C,0x04,0x04,0x04,0x00,0x00}, // 0x8B -{0x06,0x09,0x0C,0x04,0x04,0x04,0x00,0x00}, // 0x8C -{0x10,0x08,0x0C,0x04,0x04,0x04,0x00,0x00}, // 0x8D -{0x0A,0x04,0x0A,0x0A,0x1F,0x11,0x00,0x00}, // 0x8E -{0x04,0x0A,0x04,0x0A,0x1F,0x11,0x00,0x00}, // 0x8F -{0x01,0x0E,0x08,0x0E,0x08,0x0E,0x00,0x00}, // 0x90 -{0x00,0x00,0x1A,0x07,0x1C,0x13,0x00,0x00}, // 0x91 -{0x00,0x07,0x0A,0x0B,0x1E,0x13,0x00,0x00}, // 0x92 -{0x0C,0x12,0x06,0x09,0x09,0x06,0x00,0x00}, // 0x93 -{0x09,0x00,0x06,0x09,0x09,0x06,0x00,0x00}, // 0x94 -{0x10,0x08,0x06,0x09,0x09,0x06,0x00,0x00}, // 0x95 -{0x0C,0x12,0x09,0x09,0x0B,0x05,0x00,0x00}, // 0x96 -{0x08,0x04,0x09,0x09,0x0B,0x05,0x00,0x00}, // 0x97 -{0x09,0x00,0x09,0x09,0x06,0x06,0x1C,0x00}, // 0x98 -{0x11,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00}, // 0x99 -{0x12,0x09,0x09,0x09,0x09,0x06,0x00,0x00}, // 0x9A -{0x00,0x01,0x06,0x0B,0x0D,0x06,0x08,0x00}, // 0x9B -{0x00,0x04,0x08,0x0C,0x18,0x0E,0x00,0x00}, // 0x9C -{0x01,0x0E,0x13,0x15,0x19,0x0E,0x10,0x00}, // 0x9D -{0x00,0x00,0x09,0x06,0x06,0x09,0x00,0x00}, // 0x9E -{0x02,0x04,0x04,0x0E,0x04,0x04,0x08,0x00}, // 0x9F -{0x01,0x02,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0xA0 -{0x01,0x02,0x0C,0x04,0x04,0x04,0x00,0x00}, // 0xA1 -{0x01,0x02,0x06,0x09,0x09,0x06,0x00,0x00}, // 0xA2 -{0x01,0x02,0x09,0x09,0x0B,0x05,0x00,0x00}, // 0xA3 -{0x0F,0x00,0x0A,0x0D,0x09,0x09,0x00,0x00}, // 0xA4 -{0x1F,0x09,0x0D,0x0B,0x09,0x09,0x00,0x00}, // 0xA5 -{0x0C,0x02,0x0E,0x0A,0x0E,0x00,0x00,0x00}, // 0xA6 -{0x04,0x0A,0x0A,0x0A,0x04,0x00,0x00,0x00}, // 0xA7 -{0x00,0x04,0x00,0x04,0x04,0x02,0x0C,0x00}, // 0xA8 -{0x0E,0x17,0x17,0x15,0x17,0x0E,0x00,0x00}, // 0xA9 -{0x00,0x00,0x00,0x0E,0x02,0x02,0x00,0x00}, // 0xAA -{0x19,0x0A,0x0F,0x05,0x0A,0x13,0x00,0x00}, // 0xAB -{0x19,0x0A,0x0A,0x05,0x0B,0x11,0x00,0x00}, // 0xAC -{0x00,0x00,0x04,0x00,0x04,0x04,0x04,0x00}, // 0xAD -{0x00,0x05,0x0A,0x14,0x0A,0x05,0x00,0x00}, // 0xAE -{0x00,0x14,0x0A,0x05,0x0A,0x14,0x00,0x00}, // 0xAF -{0x15,0x00,0x15,0x00,0x15,0x00,0x15,0x00}, // 0xB0 -{0x15,0x0A,0x15,0x0A,0x15,0x0A,0x15,0x0A}, // 0xB1 -{0x1F,0x15,0x1F,0x15,0x1F,0x15,0x1F,0x15}, // 0xB2 -{0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04}, // 0xB3 -{0x04,0x04,0x04,0x1C,0x04,0x04,0x04,0x04}, // 0xB4 -{0x02,0x04,0x0A,0x0A,0x1F,0x11,0x00,0x00}, // 0xB5 -{0x06,0x09,0x04,0x0A,0x1F,0x11,0x00,0x00}, // 0xB6 -{0x08,0x04,0x0A,0x0A,0x1F,0x11,0x00,0x00}, // 0xB7 -{0x0E,0x11,0x17,0x15,0x17,0x11,0x0E,0x00}, // 0xB8 -{0x0A,0x0A,0x1A,0x02,0x1A,0x0A,0x0A,0x0A}, // 0xB9 -{0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A}, // 0xBA -{0x00,0x00,0x1E,0x02,0x1A,0x0A,0x0A,0x0A}, // 0xBB -{0x0A,0x0A,0x1A,0x02,0x1E,0x00,0x00,0x00}, // 0xBC -{0x00,0x04,0x0E,0x08,0x0E,0x04,0x00,0x00}, // 0xBD -{0x00,0x11,0x0A,0x04,0x0E,0x04,0x00,0x00}, // 0xBE -{0x00,0x00,0x00,0x1C,0x04,0x04,0x04,0x04}, // 0xBF -{0x04,0x04,0x04,0x07,0x00,0x00,0x00,0x00}, // 0xC0 -{0x04,0x04,0x04,0x1F,0x00,0x00,0x00,0x00}, // 0xC1 -{0x00,0x00,0x00,0x1F,0x04,0x04,0x04,0x04}, // 0xC2 -{0x04,0x04,0x04,0x07,0x04,0x04,0x04,0x04}, // 0xC3 -{0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00}, // 0xC4 -{0x04,0x04,0x04,0x1F,0x04,0x04,0x04,0x04}, // 0xC5 -{0x0D,0x12,0x0C,0x02,0x0E,0x0F,0x00,0x00}, // 0xC6 -{0x0D,0x12,0x04,0x0A,0x1F,0x11,0x00,0x00}, // 0xC7 -{0x0A,0x0A,0x0B,0x08,0x0F,0x00,0x00,0x00}, // 0xC8 -{0x00,0x00,0x0F,0x08,0x0B,0x0A,0x0A,0x0A}, // 0xC9 -{0x0A,0x0A,0x1B,0x00,0x1F,0x00,0x00,0x00}, // 0xCA -{0x00,0x00,0x1F,0x00,0x1B,0x0A,0x0A,0x0A}, // 0xCB -{0x0A,0x0A,0x0B,0x08,0x0B,0x0A,0x0A,0x0A}, // 0xCC -{0x00,0x00,0x1F,0x00,0x1F,0x00,0x00,0x00}, // 0xCD -{0x0A,0x0A,0x1B,0x00,0x1B,0x0A,0x0A,0x0A}, // 0xCE -{0x00,0x11,0x0E,0x0A,0x0E,0x11,0x00,0x00}, // 0xCF -{0x1E,0x04,0x0E,0x12,0x12,0x0C,0x00,0x00}, // 0xD0 -{0x00,0x0E,0x09,0x1D,0x09,0x0E,0x00,0x00}, // 0xD1 -{0x0E,0x0E,0x08,0x0E,0x08,0x0E,0x00,0x00}, // 0xD2 -{0x11,0x0E,0x08,0x0E,0x08,0x0E,0x00,0x00}, // 0xD3 -{0x10,0x0E,0x08,0x0E,0x08,0x0E,0x00,0x00}, // 0xD4 -{0x00,0x00,0x0C,0x04,0x04,0x04,0x00,0x00}, // 0xD5 -{0x01,0x0E,0x04,0x04,0x04,0x0E,0x00,0x00}, // 0xD6 -{0x0E,0x0E,0x04,0x04,0x04,0x0E,0x00,0x00}, // 0xD7 -{0x11,0x0E,0x04,0x04,0x04,0x0E,0x00,0x00}, // 0xD8 -{0x04,0x04,0x04,0x1C,0x00,0x00,0x00,0x00}, // 0xD9 -{0x00,0x00,0x00,0x07,0x04,0x04,0x04,0x04}, // 0xDA -{0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F}, // 0xDB -{0x00,0x00,0x00,0x00,0x1F,0x1F,0x1F,0x1F}, // 0xDC -{0x04,0x04,0x04,0x00,0x00,0x04,0x04,0x04}, // 0xDD -{0x10,0x0E,0x04,0x04,0x04,0x0E,0x00,0x00}, // 0xDE -{0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x00}, // 0xDF -{0x01,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00}, // 0xE0 -{0x04,0x0A,0x0A,0x0A,0x09,0x0A,0x00,0x00}, // 0xE1 -{0x0E,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00}, // 0xE2 -{0x10,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00}, // 0xE3 -{0x0D,0x12,0x06,0x09,0x09,0x06,0x00,0x00}, // 0xE4 -{0x1E,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00}, // 0xE5 -{0x00,0x00,0x09,0x09,0x0B,0x0D,0x08,0x00}, // 0xE6 -{0x08,0x08,0x0E,0x09,0x09,0x0E,0x08,0x00}, // 0xE7 -{0x00,0x08,0x0E,0x09,0x0E,0x08,0x00,0x00}, // 0xE8 -{0x01,0x12,0x12,0x12,0x12,0x0C,0x00,0x00}, // 0xE9 -{0x0F,0x09,0x09,0x09,0x09,0x06,0x00,0x00}, // 0xEA -{0x10,0x09,0x09,0x09,0x09,0x06,0x00,0x00}, // 0xEB -{0x01,0x02,0x09,0x09,0x06,0x06,0x18,0x00}, // 0xEC -{0x02,0x15,0x0A,0x04,0x04,0x04,0x00,0x00}, // 0xED -{0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xEE -{0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xEF -{0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00}, // 0xF0 -{0x00,0x00,0x04,0x0E,0x04,0x0E,0x00,0x00}, // 0xF1 -{0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x1F}, // 0xF2 -{0x19,0x1A,0x0A,0x1D,0x0B,0x11,0x00,0x00}, // 0xF3 -{0x0E,0x1A,0x1A,0x0A,0x0A,0x0A,0x0A,0x00}, // 0xF4 -{0x06,0x08,0x04,0x0A,0x04,0x02,0x0C,0x00}, // 0xF5 -{0x00,0x04,0x00,0x0E,0x00,0x04,0x00,0x00}, // 0xF6 -{0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x08}, // 0xF7 -{0x06,0x09,0x09,0x06,0x00,0x00,0x00,0x00}, // 0xF8 -{0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xF9 -{0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00}, // 0xFA -{0x0C,0x04,0x04,0x04,0x0E,0x00,0x00,0x00}, // 0xFB -{0x0C,0x02,0x0C,0x02,0x0C,0x00,0x00,0x00}, // 0xFC -{0x0C,0x02,0x04,0x08,0x0E,0x00,0x00,0x00}, // 0xFD -{0x00,0x00,0x0F,0x0F,0x0F,0x0F,0x00,0x00}, // 0xFE -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // 0xFF -}; - -#endif // font_5x8_horizontal_MSB_h \ No newline at end of file diff --git a/lib/lib_display/LedControl/src/font_8x8_horizontal_latin_MSB.h b/lib/lib_display/LedControl/src/font_8x8_horizontal_latin_MSB.h deleted file mode 100644 index e1a8af7ae..000000000 --- a/lib/lib_display/LedControl/src/font_8x8_horizontal_latin_MSB.h +++ /dev/null @@ -1,265 +0,0 @@ -#ifndef font_8x8_horizontal_latin_MSB_h -#define font_8x8_horizontal_latin_MSB_h - -const unsigned int font_char_width = 8; -const unsigned int font_char_height = 8; - -const char font[256][8]={ -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x00 -{0x0E,0x11,0x1B,0x11,0x15,0x11,0x0E,0x00}, // 0x01 -{0x0E,0x1F,0x15,0x1F,0x11,0x1F,0x0E,0x00}, // 0x02 -{0x00,0x0A,0x1F,0x1F,0x1F,0x0E,0x04,0x00}, // 0x03 -{0x00,0x04,0x0E,0x1F,0x1F,0x0E,0x04,0x00}, // 0x04 -{0x04,0x0E,0x0E,0x04,0x1F,0x1F,0x04,0x00}, // 0x05 -{0x00,0x04,0x0E,0x1F,0x1F,0x04,0x0E,0x00}, // 0x06 -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x07 -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x08 -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x09 -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0A -{0x00,0x07,0x03,0x0D,0x12,0x12,0x0C,0x00}, // 0x0B -{0x0E,0x11,0x11,0x0E,0x04,0x0E,0x04,0x00}, // 0x0C -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0D -{0x03,0x0D,0x0B,0x0D,0x0B,0x1B,0x18,0x00}, // 0x0E -{0x00,0x15,0x0E,0x1B,0x0E,0x15,0x00,0x00}, // 0x0F -{0x08,0x0C,0x0E,0x0F,0x0E,0x0C,0x08,0x00}, // 0x10 -{0x02,0x06,0x0E,0x1E,0x0E,0x06,0x02,0x00}, // 0x11 -{0x04,0x0E,0x1F,0x04,0x1F,0x0E,0x04,0x00}, // 0x12 -{0x0A,0x0A,0x0A,0x0A,0x0A,0x00,0x0A,0x00}, // 0x13 -{0x0F,0x15,0x15,0x0D,0x05,0x05,0x05,0x00}, // 0x14 -{0x0E,0x11,0x0C,0x0A,0x06,0x11,0x0E,0x00}, // 0x15 -{0x00,0x00,0x00,0x00,0x00,0x1E,0x1E,0x00}, // 0x16 -{0x04,0x0E,0x1F,0x04,0x1F,0x0E,0x04,0x0E}, // 0x17 -{0x04,0x0E,0x1F,0x04,0x04,0x04,0x04,0x00}, // 0x18 -{0x04,0x04,0x04,0x04,0x1F,0x0E,0x04,0x00}, // 0x19 -{0x00,0x04,0x06,0x1F,0x06,0x04,0x00,0x00}, // 0x1A -{0x00,0x04,0x0C,0x1F,0x0C,0x04,0x00,0x00}, // 0x1B -{0x00,0x00,0x00,0x10,0x10,0x10,0x1F,0x00}, // 0x1C -{0x00,0x0A,0x0A,0x1F,0x0A,0x0A,0x00,0x00}, // 0x1D -{0x04,0x04,0x0E,0x0E,0x1F,0x1F,0x00,0x00}, // 0x1E -{0x1F,0x1F,0x0E,0x0E,0x04,0x04,0x00,0x00}, // 0x1F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - { 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - { 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - { 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - { 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - { 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - { 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - { 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - { 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - { 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - { 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - { 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - { 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - { 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - { 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - { 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - { 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - { 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - { 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - { 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - { 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - { 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - { 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - { 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (;) - { 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - { 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - { 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - { 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - { 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - { 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - { 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - { 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - { 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - { 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - { 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - { 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - { 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - { 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - { 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - { 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - { 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - { 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - { 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - { 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - { 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - { 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - { 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - { 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - { 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - { 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - { 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - { 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - { 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - { 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - { 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - { 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - { 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - { 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - { 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - { 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - { 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - { 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - { 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - { 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - { 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - { 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - { 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - { 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - { 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - { 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - { 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - { 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - { 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - { 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - { 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - { 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - { 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - { 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - { 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - { 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - { 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - { 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - { 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - { 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007F{0x0E,0x11,0x10,0x10,0x11,0x0E,0x04,0x0C}, // 0x80 -{0x12,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x81 -{0x03,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x82 -{0x0E,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x83 -{0x0A,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x84 -{0x0C,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x85 -{0x0E,0x0A,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x86 -{0x00,0x0E,0x11,0x10,0x11,0x0E,0x04,0x0C}, // 0x87 -{0x0E,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x88 -{0x0A,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x89 -{0x0C,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x8A -{0x0A,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x8B -{0x0E,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x8C -{0x08,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x8D -{0x0A,0x00,0x04,0x0A,0x11,0x1F,0x11,0x00}, // 0x8E -{0x0E,0x0A,0x0E,0x1B,0x11,0x1F,0x11,0x00}, // 0x8F -{0x03,0x00,0x1F,0x10,0x1E,0x10,0x1F,0x00}, // 0x90 -{0x00,0x00,0x1E,0x05,0x1F,0x14,0x0F,0x00}, // 0x91 -{0x0F,0x14,0x14,0x1F,0x14,0x14,0x17,0x00}, // 0x92 -{0x0E,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0x93 -{0x0A,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0x94 -{0x18,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0x95 -{0x0E,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x96 -{0x18,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x97 -{0x0A,0x00,0x12,0x12,0x12,0x0E,0x04,0x18}, // 0x98 -{0x12,0x0C,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0x99 -{0x0A,0x00,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0x9A -{0x00,0x00,0x01,0x0E,0x16,0x1A,0x1C,0x20}, // 0x9B -{0x06,0x09,0x08,0x1E,0x08,0x09,0x17,0x00}, // 0x9C -{0x0F,0x13,0x15,0x15,0x15,0x19,0x1E,0x00}, // 0x9D -{0x00,0x11,0x0A,0x04,0x0A,0x11,0x00,0x00}, // 0x9E -{0x02,0x05,0x04,0x0E,0x04,0x04,0x14,0x08}, // 0x9F - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+00A0 (no break space) - { 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00}, // U+00A1 (inverted !) - { 0x18, 0x18, 0x7E, 0x03, 0x03, 0x7E, 0x18, 0x18}, // U+00A2 (dollarcents) - { 0x1C, 0x36, 0x26, 0x0F, 0x06, 0x67, 0x3F, 0x00}, // U+00A3 (pound sterling) - { 0x00, 0x00, 0x63, 0x3E, 0x36, 0x3E, 0x63, 0x00}, // U+00A4 (currency mark) - { 0x33, 0x33, 0x1E, 0x3F, 0x0C, 0x3F, 0x0C, 0x0C}, // U+00A5 (yen) - { 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+00A6 (broken pipe) - { 0x7C, 0xC6, 0x1C, 0x36, 0x36, 0x1C, 0x33, 0x1E}, // U+00A7 (paragraph) - { 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+00A8 (diaeresis) - { 0x3C, 0x42, 0x99, 0x85, 0x85, 0x99, 0x42, 0x3C}, // U+00A9 (copyright symbol) - { 0x3C, 0x36, 0x36, 0x7C, 0x00, 0x00, 0x00, 0x00}, // U+00AA (superscript a) - { 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00}, // U+00AB (<<) - { 0x00, 0x00, 0x00, 0x3F, 0x30, 0x30, 0x00, 0x00}, // U+00AC (gun pointing left) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+00AD (soft hyphen) - { 0x3C, 0x42, 0x9D, 0xA5, 0x9D, 0xA5, 0x42, 0x3C}, // U+00AE (registered symbol) - { 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+00AF (macron) - { 0x1C, 0x36, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00}, // U+00B0 (degree) - { 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x7E, 0x00}, // U+00B1 (plusminus) - { 0x1C, 0x30, 0x18, 0x0C, 0x3C, 0x00, 0x00, 0x00}, // U+00B2 (superscript 2) - { 0x1C, 0x30, 0x18, 0x30, 0x1C, 0x00, 0x00, 0x00}, // U+00B2 (superscript 3) - { 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+00B2 (aigu) - { 0x00, 0x00, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x03}, // U+00B5 (mu) - { 0xFE, 0xDB, 0xDB, 0xDE, 0xD8, 0xD8, 0xD8, 0x00}, // U+00B6 (pilcrow) - { 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00}, // U+00B7 (central dot) - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x1E}, // U+00B8 (cedille) - { 0x08, 0x0C, 0x08, 0x1C, 0x00, 0x00, 0x00, 0x00}, // U+00B9 (superscript 1) - { 0x1C, 0x36, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00}, // U+00BA (superscript 0) - { 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00}, // U+00BB (>>) - { 0xC3, 0x63, 0x33, 0xBD, 0xEC, 0xF6, 0xF3, 0x03}, // U+00BC (1/4) - { 0xC3, 0x63, 0x33, 0x7B, 0xCC, 0x66, 0x33, 0xF0}, // U+00BD (1/2) - { 0x03, 0xC4, 0x63, 0xB4, 0xDB, 0xAC, 0xE6, 0x80}, // U+00BE (3/4) - { 0x0C, 0x00, 0x0C, 0x06, 0x03, 0x33, 0x1E, 0x00}, // U+00BF (inverted ?) - { 0x07, 0x00, 0x1C, 0x36, 0x63, 0x7F, 0x63, 0x00}, // U+00C0 (A grave) - { 0x70, 0x00, 0x1C, 0x36, 0x63, 0x7F, 0x63, 0x00}, // U+00C1 (A aigu) - { 0x1C, 0x36, 0x00, 0x3E, 0x63, 0x7F, 0x63, 0x00}, // U+00C2 (A circumflex) - { 0x6E, 0x3B, 0x00, 0x3E, 0x63, 0x7F, 0x63, 0x00}, // U+00C3 (A ~) - { 0x63, 0x1C, 0x36, 0x63, 0x7F, 0x63, 0x63, 0x00}, // U+00C4 (A umlaut) - { 0x0C, 0x0C, 0x00, 0x1E, 0x33, 0x3F, 0x33, 0x00}, // U+00C5 (A ring) - { 0x7C, 0x36, 0x33, 0x7F, 0x33, 0x33, 0x73, 0x00}, // U+00C6 (AE) - { 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x18, 0x30, 0x1E}, // U+00C7 (C cedille) - { 0x07, 0x00, 0x3F, 0x06, 0x1E, 0x06, 0x3F, 0x00}, // U+00C8 (E grave) - { 0x38, 0x00, 0x3F, 0x06, 0x1E, 0x06, 0x3F, 0x00}, // U+00C9 (E aigu) - { 0x0C, 0x12, 0x3F, 0x06, 0x1E, 0x06, 0x3F, 0x00}, // U+00CA (E circumflex) - { 0x36, 0x00, 0x3F, 0x06, 0x1E, 0x06, 0x3F, 0x00}, // U+00CB (E umlaut) - { 0x07, 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00CC (I grave) - { 0x38, 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00CD (I aigu) - { 0x0C, 0x12, 0x00, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+00CE (I circumflex) - { 0x33, 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00CF (I umlaut) - { 0x3F, 0x66, 0x6F, 0x6F, 0x66, 0x66, 0x3F, 0x00}, // U+00D0 (Eth) - { 0x3F, 0x00, 0x33, 0x37, 0x3F, 0x3B, 0x33, 0x00}, // U+00D1 (N ~) - { 0x0E, 0x00, 0x18, 0x3C, 0x66, 0x3C, 0x18, 0x00}, // U+00D2 (O grave) - { 0x70, 0x00, 0x18, 0x3C, 0x66, 0x3C, 0x18, 0x00}, // U+00D3 (O aigu) - { 0x3C, 0x66, 0x18, 0x3C, 0x66, 0x3C, 0x18, 0x00}, // U+00D4 (O circumflex) - { 0x6E, 0x3B, 0x00, 0x3E, 0x63, 0x63, 0x3E, 0x00}, // U+00D5 (O ~) - { 0xC3, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x00}, // U+00D6 (O umlaut) - { 0x00, 0x36, 0x1C, 0x08, 0x1C, 0x36, 0x00, 0x00}, // U+00D7 (multiplicative x) - { 0x5C, 0x36, 0x73, 0x7B, 0x6F, 0x36, 0x1D, 0x00}, // U+00D8 (O stroke) - { 0x0E, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00}, // U+00D9 (U grave) - { 0x70, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00}, // U+00DA (U aigu) - { 0x3C, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x00}, // U+00DB (U circumflex) - { 0x33, 0x00, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+00DC (U umlaut) - { 0x70, 0x00, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x00}, // U+00DD (Y aigu) - { 0x0F, 0x06, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+00DE (Thorn) - { 0x00, 0x1E, 0x33, 0x1F, 0x33, 0x1F, 0x03, 0x03}, // U+00DF (beta) - { 0x07, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E0 (a grave) - { 0x38, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E1 (a aigu) - { 0x7E, 0xC3, 0x3C, 0x60, 0x7C, 0x66, 0xFC, 0x00}, // U+00E2 (a circumflex) - { 0x6E, 0x3B, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E3 (a ~) - { 0x33, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E4 (a umlaut) - { 0x0C, 0x0C, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E5 (a ring) - { 0x00, 0x00, 0xFE, 0x30, 0xFE, 0x33, 0xFE, 0x00}, // U+00E6 (ae) - { 0x00, 0x00, 0x1E, 0x03, 0x03, 0x1E, 0x30, 0x1C}, // U+00E7 (c cedille) - { 0x07, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00}, // U+00E8 (e grave) - { 0x38, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00}, // U+00E9 (e aigu) - { 0x7E, 0xC3, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00}, // U+00EA (e circumflex) - { 0x33, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00}, // U+00EB (e umlaut) - { 0x07, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00EC (i grave) - { 0x1C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00ED (i augu) - { 0x3E, 0x63, 0x1C, 0x18, 0x18, 0x18, 0x3C, 0x00}, // U+00EE (i circumflex) - { 0x33, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00EF (i umlaut) - { 0x1B, 0x0E, 0x1B, 0x30, 0x3E, 0x33, 0x1E, 0x00}, // U+00F0 (eth) - { 0x00, 0x1F, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x00}, // U+00F1 (n ~) - { 0x00, 0x07, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F2 (o grave) - { 0x00, 0x38, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F3 (o aigu) - { 0x1E, 0x33, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F4 (o circumflex) - { 0x6E, 0x3B, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F5 (o ~) - { 0x00, 0x33, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F6 (o umlaut) - { 0x18, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x18, 0x00}, // U+00F7 (division) - { 0x00, 0x60, 0x3C, 0x76, 0x7E, 0x6E, 0x3C, 0x06}, // U+00F8 (o stroke) - { 0x00, 0x07, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00F9 (u grave) - { 0x00, 0x38, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00FA (u aigu) - { 0x1E, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00FB (u circumflex) - { 0x00, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00FC (u umlaut) - { 0x00, 0x38, 0x00, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+00FD (y aigu) - { 0x00, 0x00, 0x06, 0x3E, 0x66, 0x3E, 0x06, 0x00}, // U+00FE (thorn) - { 0x00, 0x33, 0x00, 0x33, 0x33, 0x3E, 0x30, 0x1F} // U+00FF (y umlaut) -}; - -#endif \ No newline at end of file diff --git a/tasmota/xdsp_19_max7219_matrix.ino b/tasmota/xdsp_19_max7219_matrix.ino index 3ec3ac332..82a4a24bb 100644 --- a/tasmota/xdsp_19_max7219_matrix.ino +++ b/tasmota/xdsp_19_max7219_matrix.ino @@ -113,22 +113,31 @@ bool MAX7291Matrix_initDriver(void) } Settings->display_model = XDSP_19; + renderer = nullptr; // renderer not yet used if (Settings->display_width) // [pixel] { LedMatrix_settings.modulesPerRow = (Settings->display_width - 1) / 8 + 1; } Settings->display_width = 8 * LedMatrix_settings.modulesPerRow; - Settings->display_cols[0] = Settings->display_width; + Settings->display_cols[0] = LedMatrix_settings.modulesPerRow; if (Settings->display_height) // [pixel] { LedMatrix_settings.modulesPerCol = (Settings->display_height - 1) / 8 + 1; } - Settings->display_height = 8 * LedMatrix_settings. modulesPerCol; - Settings->display_rows = Settings->display_height; - Settings->display_cols[1] = Settings->display_height; + Settings->display_height = 8 * LedMatrix_settings.modulesPerCol; + Settings->display_rows = LedMatrix_settings.modulesPerCol; + Settings->display_cols[1] = LedMatrix_settings.modulesPerCol; max7219_Matrix = new LedMatrix(Pin(GPIO_MAX7219DIN), Pin(GPIO_MAX7219CLK), Pin(GPIO_MAX7219CS), LedMatrix_settings.modulesPerRow, LedMatrix_settings.modulesPerCol); + if( LedMatrix_settings.show_clock == 0) + { + Settings->display_mode = 0; // text mode + } + else{ + Settings->display_mode = 1; // clock mode + } max2791Matrix_initDriver_done = true; + AddLog(LOG_LEVEL_INFO, PSTR("MTX: MAX7291Matrix_initDriver DIN:%d CLK:%d CS:%d size(%dx%d)"), Pin(GPIO_MAX7219DIN), Pin(GPIO_MAX7219CLK), Pin(GPIO_MAX7219CS), LedMatrix_settings.modulesPerRow, LedMatrix_settings.modulesPerCol); return MAX7291Matrix_init(); } @@ -137,12 +146,17 @@ bool MAX7291Matrix_init(void) { int intensity = GetDisplayDimmer16(); // 0..15 max7219_Matrix->setIntensity(intensity); - int orientation = Settings->display_rotate; - max7219_Matrix->setOrientation((LedMatrix::ModuleOrientation)orientation ); - AddLog(LOG_LEVEL_INFO, PSTR("MTX: MAX7291Matrix_init %dx%d modules, orientation: %d, intensity: %d"), LedMatrix_settings.modulesPerRow , LedMatrix_settings.modulesPerCol, orientation, intensity); - - //max7219_Matrix->test(); - AddLog(LOG_LEVEL_INFO, PSTR("MTX: display test")); + if(Settings->display_rotate <= 3) + { + max7219_Matrix->setOrientation((LedMatrix::ModuleOrientation)Settings->display_rotate ); + } + else + { + // default for most 32x8 modules + Settings->display_rotate = LedMatrix::ORIENTATION_UPSIDE_DOWN; + max7219_Matrix->setOrientation( LedMatrix::ORIENTATION_UPSIDE_DOWN ); + } + AddLog(LOG_LEVEL_INFO, PSTR("MTX: MAX7291Matrix_init orientation: %d, intensity: %d"), Settings->display_rotate, intensity); return true; } @@ -183,28 +197,38 @@ bool MAX7291Matrix_clock(void) { LedMatrix_settings.show_clock = XdrvMailbox.payload; if (ArgC() == 0) - XdrvMailbox.payload = 1; - if (XdrvMailbox.payload > 1) - { - LedMatrix_settings.timeFormat = "%H:%M"; - if(LedMatrix_settings.modulesPerRow > 6) - { - LedMatrix_settings.timeFormat = "%H:%M:%S"; - } XdrvMailbox.payload = 2; - } - else - { - LedMatrix_settings.timeFormat = "%I:%M"; - if(LedMatrix_settings.modulesPerRow > 6) + switch(XdrvMailbox.payload) { - LedMatrix_settings.timeFormat = "%I:%M:%S"; + case 0: + // no clock, switch to text mode + Settings->display_mode = 0; + return true; + case 1: + // 12 h clock + LedMatrix_settings.timeFormat = "%I:%M"; + if(LedMatrix_settings.modulesPerRow > 6) + { + LedMatrix_settings.timeFormat = "%I:%M:%S"; + } + Settings->display_mode = 1; + break; + case 2: + // 24 h clock + LedMatrix_settings.timeFormat = "%H:%M"; + if(LedMatrix_settings.modulesPerRow > 6) + { + LedMatrix_settings.timeFormat = "%H:%M:%S"; + } + Settings->display_mode = 1; + break; + default: + return false; } - XdrvMailbox.payload = 1; - } AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: LedMatrix_settings.show_clock %d, timeFormat %s"), LedMatrix_settings.show_clock, LedMatrix_settings.timeFormat); + max7219_Matrix->clearDisplay(); MAX7291Matrix_showTime(); return true; } @@ -220,7 +244,7 @@ bool MAX7291Matrix_showTime() timeinfo = localtime(&rawtime); strftime(timeStr, 10, LedMatrix_settings.timeFormat, timeinfo); - max7219_Matrix->drawText(timeStr); + max7219_Matrix->drawText(timeStr, false); // false: do not clear desplay on update to prevent flicker return true; } #endif // USE_DISPLAY_MODES1TO5 @@ -254,7 +278,16 @@ bool Xdsp19(uint8_t function) result = max7219_Matrix->setIntensity(GetDisplayDimmer16()); break; case FUNC_DISPLAY_DRAW_STRING: - result = max7219_Matrix->drawText(dsp_str); + case FUNC_DISPLAY_SCROLLTEXT: + case FUNC_DISPLAY_SEVENSEG_TEXT: + Settings->display_mode = 0; // text mode + LedMatrix_settings.show_clock = 0; // disable clock mode + result = max7219_Matrix->drawText(XdrvMailbox.data, true); // true: clears display before drawing text + break; + case FUNC_DISPLAY_SEVENSEG_TEXTNC: + Settings->display_mode = 0; // text mode + LedMatrix_settings.show_clock = 0; // disable clock mode + result = max7219_Matrix->drawText(XdrvMailbox.data, false); // false: does not clear display before drawing text break; case FUNC_DISPLAY_SCROLLDELAY: result = MAX7291Matrix_scrollDelay(); From 09974f8873fa1ffdb8eeb19f4568e6dec31b7ed1 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 30 Nov 2021 14:18:26 +0100 Subject: [PATCH 08/10] Command for all Modules at once --- lib/lib_display/LedControl/src/LedControl.cpp | 67 ++++++++++++++----- lib/lib_display/LedControl/src/LedControl.h | 9 ++- lib/lib_display/LedControl/src/LedMatrix.cpp | 56 +++++++++++++--- lib/lib_display/LedControl/src/LedMatrix.h | 1 + 4 files changed, 104 insertions(+), 29 deletions(-) diff --git a/lib/lib_display/LedControl/src/LedControl.cpp b/lib/lib_display/LedControl/src/LedControl.cpp index 11e7a2908..baaa3802c 100644 --- a/lib/lib_display/LedControl/src/LedControl.cpp +++ b/lib/lib_display/LedControl/src/LedControl.cpp @@ -55,18 +55,20 @@ LedControl::LedControl(int dataPin, int clkPin, int csPin, int numDevices) { pinMode(SPI_CS,OUTPUT); digitalWrite(SPI_CS,HIGH); SPI_MOSI=dataPin; - for (int i = 0; i < 8 * MAX72XX_MAX_DEVICES; i++) - status[i] = 0x00; - for(int i=0;i=maxDevices) return; @@ -89,6 +96,13 @@ void LedControl::setScanLimit(int addr, int limit) { spiTransfer(addr, OP_SCANLIMIT,limit); } +void LedControl::setScanLimit_allDevices(int limit) { + if(limit <0 || limit>8) return; + + memset(deviceDataBuff, (byte)limit, maxDevices); + spiTransfer_allDevices(OP_SCANLIMIT,deviceDataBuff); +} + void LedControl::setIntensity(int addr, int intensity) { if(addr<0 || addr>=maxDevices) return; @@ -96,6 +110,15 @@ void LedControl::setIntensity(int addr, int intensity) { spiTransfer(addr, OP_INTENSITY,intensity); } +void LedControl::setIntensity_allDevices(int intensity) +{ + if (intensity < 0 | intensity > 15) + return; + + memset(deviceDataBuff, (byte)intensity, maxDevices); + spiTransfer_allDevices(OP_INTENSITY, deviceDataBuff); +} + void LedControl::clearDisplay(int addr) { int offset; @@ -108,6 +131,16 @@ void LedControl::clearDisplay(int addr) { } } +void LedControl::clearDisplay_allDevices() +{ + memset(status, (byte)0, 8 * maxDevices); + memset(deviceDataBuff, (byte)0, maxDevices); + for (int row = 0; row < 8; row++) + { + spiTransfer_allDevices(row + 1, deviceDataBuff); + } +} + void LedControl::setLed(int addr, int row, int column, boolean state) { int offset; byte val=0x00; @@ -138,13 +171,13 @@ void LedControl::setRow(int addr, int row, byte value) { spiTransfer(addr, row+1,status[offset+row]); } -void LedControl::setRowLong(int row, byte *value) +void LedControl::setRow_allDevices(int row, byte *value) { if (row < 0 || row > 7) return; for (int addr = 0; addr < maxDevices; addr++) status[addr * 8 + row] = value[addr]; - spiTransferLong(row + 1, value); + spiTransfer_allDevices(row + 1, value); } void LedControl::setColumn(int addr, int col, byte value) { @@ -217,7 +250,7 @@ void LedControl::spiTransfer(int addr, volatile byte opcode, volatile byte data) digitalWrite(SPI_CS,HIGH); } -void LedControl::spiTransferLong(byte opcode, const byte* data) { +void LedControl::spiTransfer_allDevices(byte opcode, const byte* data) { //Create an array with the data to shift out for (int addr = 0; addr < maxDevices; addr++) { @@ -227,8 +260,8 @@ void LedControl::spiTransferLong(byte opcode, const byte* data) { //enable the line digitalWrite(SPI_CS, LOW); //Now shift out the data - for (int i = maxDevices * 2; i > 0; i--) - shiftOut(SPI_MOSI, SPI_CLK, MSBFIRST, spidata[i - 1]); + for (int i = maxDevices * 2 -1; i >= 0; i--) + shiftOut(SPI_MOSI, SPI_CLK, MSBFIRST, spidata[i]); //latch the data onto the display digitalWrite(SPI_CS, HIGH); } diff --git a/lib/lib_display/LedControl/src/LedControl.h b/lib/lib_display/LedControl/src/LedControl.h index 31fed9ffe..4fc7523df 100644 --- a/lib/lib_display/LedControl/src/LedControl.h +++ b/lib/lib_display/LedControl/src/LedControl.h @@ -69,10 +69,11 @@ class LedControl { /* Send out a single command to one device */ void spiTransfer(int addr, byte opcode, byte data); /* Send out a command with the same opcode to all devices */ - void spiTransferLong(byte opcode, const byte* data); + void spiTransfer_allDevices(byte opcode, const byte* data); /* We keep track of the led-status for all 8 devices in this array */ byte status[8 * MAX72XX_MAX_DEVICES]; + byte deviceDataBuff[MAX72XX_MAX_DEVICES]; /* Data is shifted out of this pin*/ int SPI_MOSI; /* The clock is signaled on this pin */ @@ -108,6 +109,7 @@ class LedControl { * for normal operation. */ void shutdown(int addr, bool status); + void shutdown_allDevices( bool status); /* * Set the number of digits (or rows) to be displayed. @@ -118,6 +120,7 @@ class LedControl { * limit number of digits to be displayed (1..8) */ void setScanLimit(int addr, int limit); + void setScanLimit_allDevices(int limit); /* * Set the brightness of the display. @@ -126,6 +129,7 @@ class LedControl { * intensity the brightness of the display. (0..15) */ void setIntensity(int addr, int intensity); + void setIntensity_allDevices(int intensity); /* * Switch all Leds on the display off. @@ -133,6 +137,7 @@ class LedControl { * addr address of the display to control */ void clearDisplay(int addr); + void clearDisplay_allDevices(); /* * Set the status of a single Led. @@ -161,7 +166,7 @@ class LedControl { * @param row [0..8] * @param value array of bytes, one for each device */ - void setRowLong(int row, byte* value); + void setRow_allDevices(int row, byte* value); /* * Set all 8 Led's in a column to a new state diff --git a/lib/lib_display/LedControl/src/LedMatrix.cpp b/lib/lib_display/LedControl/src/LedMatrix.cpp index 1579e0852..59882cd15 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.cpp +++ b/lib/lib_display/LedControl/src/LedMatrix.cpp @@ -139,10 +139,7 @@ bool LedMatrix::clearDisplay(void) bool LedMatrix::setIntensity(byte dim) { - for (int addr = 0; addr < modules; addr++) - { - ledControl->setIntensity(addr, dim); // 1..15 - } + ledControl->setIntensity_allDevices(dim); // 1..15 return true; } @@ -183,9 +180,51 @@ bool LedMatrix::setPixel(const int x, const int y, bool on) void LedMatrix::refresh() { - for (int i = 0; i < modulesPerRow * displayHeight; i++) + int col = 0; + int pixelRow = 0; + int bufPos = 0; + int deviceRow = 0; + for(int ledRow = 7; ledRow >= 0; ledRow--) // refresh from buttom to top { - refreshByteOfBuffer(i); + for( int addr = 0; addr < modules; addr++) + { + switch(moduleOrientation) + { + case ORIENTATION_NORMAL: + col = addr % modulesPerRow; + pixelRow = (addr / modulesPerRow) * 8 + ledRow; + bufPos = pixelRow * modulesPerRow + col; + deviceDataBuff[addr] = buffer[bufPos]; + deviceRow = ledRow; + break; + case ORIENTATION_UPSIDE_DOWN: + col = addr % modulesPerRow; + pixelRow = (addr / modulesPerRow) * 8 + deviceRow; + bufPos = pixelRow * modulesPerRow + col; + deviceDataBuff[addr] = revereBitorder(buffer[bufPos]); // mirror + deviceRow = 7 - ledRow; // upside down + break; + } + if(moduleOrientation == ORIENTATION_NORMAL || moduleOrientation == ORIENTATION_UPSIDE_DOWN) + { + col = addr % modulesPerRow; + pixelRow = (addr / modulesPerRow) * 8 + ledRow; + bufPos = pixelRow * modulesPerRow + col; + if(moduleOrientation == ORIENTATION_NORMAL) + { + // ORIENTATION_NORMAL + deviceDataBuff[addr] = buffer[bufPos]; + deviceRow = ledRow; + } + else + { + // ORIENTATION_UPSIDE_DOWN + deviceDataBuff[addr] = revereBitorder(buffer[bufPos]); // mirror + deviceRow = 7 - ledRow; // upside down + } + } + } + ledControl->setRow_allDevices(deviceRow, deviceDataBuff); // upside down } } @@ -227,10 +266,7 @@ bool LedMatrix::shutdown(bool b) bool LedMatrix::clear(void) { memset(buffer, 0, MATRIX_BUFFER_SIZE); - for (int addr = 0; addr < modules; addr++) - { - ledControl->clearDisplay(addr); - } + ledControl->clearDisplay_allDevices(); return true; } diff --git a/lib/lib_display/LedControl/src/LedMatrix.h b/lib/lib_display/LedControl/src/LedMatrix.h index b369173d0..9fee69a5f 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.h +++ b/lib/lib_display/LedControl/src/LedMatrix.h @@ -154,6 +154,7 @@ class LedMatrix unsigned int modules; // number of 8x8 mudules uint8_t moduleOrientation; byte buffer[MATRIX_BUFFER_SIZE]; + byte deviceDataBuff[MAX72XX_MAX_DEVICES]; LedControl* ledControl; int charWidth; int charHeight; From 306ed0d2dd8040f7f56eaba24a9ea3cf8b0925cc Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 3 Dec 2021 16:50:55 +0100 Subject: [PATCH 09/10] max7219 dot matrix ready for pull request --- lib/lib_display/LedControl/src/LedControl.cpp | 82 ++------- lib/lib_display/LedControl/src/LedControl.h | 25 +-- lib/lib_display/LedControl/src/LedMatrix.cpp | 173 +++++++++--------- lib/lib_display/LedControl/src/LedMatrix.h | 59 ++++-- tasmota/xdsp_19_max7219_matrix.ino | 20 +- 5 files changed, 162 insertions(+), 197 deletions(-) diff --git a/lib/lib_display/LedControl/src/LedControl.cpp b/lib/lib_display/LedControl/src/LedControl.cpp index baaa3802c..5807aa6af 100644 --- a/lib/lib_display/LedControl/src/LedControl.cpp +++ b/lib/lib_display/LedControl/src/LedControl.cpp @@ -47,28 +47,26 @@ LedControl::LedControl(int dataPin, int clkPin, int csPin, int numDevices) { SPI_MOSI=dataPin; SPI_CLK=clkPin; SPI_CS=csPin; - if (numDevices <= 0 || numDevices > MAX72XX_MAX_DEVICES) - numDevices = MAX72XX_MAX_DEVICES; + if(numDevices<=0 || numDevices>8 ) + numDevices=8; maxDevices = numDevices; pinMode(SPI_MOSI,OUTPUT); pinMode(SPI_CLK,OUTPUT); pinMode(SPI_CS,OUTPUT); digitalWrite(SPI_CS,HIGH); SPI_MOSI=dataPin; - - memset(status, (byte)0, 8 * MAX72XX_MAX_DEVICES); - memset(deviceDataBuff, (byte)0, MAX72XX_MAX_DEVICES); - - // display test - spiTransfer_allDevices(OP_DISPLAYTEST, deviceDataBuff); + for(int i=0;i<64;i++) + status[i]=0x00; + for(int i=0;i=maxDevices) return; @@ -96,13 +89,6 @@ void LedControl::setScanLimit(int addr, int limit) { spiTransfer(addr, OP_SCANLIMIT,limit); } -void LedControl::setScanLimit_allDevices(int limit) { - if(limit <0 || limit>8) return; - - memset(deviceDataBuff, (byte)limit, maxDevices); - spiTransfer_allDevices(OP_SCANLIMIT,deviceDataBuff); -} - void LedControl::setIntensity(int addr, int intensity) { if(addr<0 || addr>=maxDevices) return; @@ -110,15 +96,6 @@ void LedControl::setIntensity(int addr, int intensity) { spiTransfer(addr, OP_INTENSITY,intensity); } -void LedControl::setIntensity_allDevices(int intensity) -{ - if (intensity < 0 | intensity > 15) - return; - - memset(deviceDataBuff, (byte)intensity, maxDevices); - spiTransfer_allDevices(OP_INTENSITY, deviceDataBuff); -} - void LedControl::clearDisplay(int addr) { int offset; @@ -131,16 +108,6 @@ void LedControl::clearDisplay(int addr) { } } -void LedControl::clearDisplay_allDevices() -{ - memset(status, (byte)0, 8 * maxDevices); - memset(deviceDataBuff, (byte)0, maxDevices); - for (int row = 0; row < 8; row++) - { - spiTransfer_allDevices(row + 1, deviceDataBuff); - } -} - void LedControl::setLed(int addr, int row, int column, boolean state) { int offset; byte val=0x00; @@ -171,15 +138,6 @@ void LedControl::setRow(int addr, int row, byte value) { spiTransfer(addr, row+1,status[offset+row]); } -void LedControl::setRow_allDevices(int row, byte *value) -{ - if (row < 0 || row > 7) - return; - for (int addr = 0; addr < maxDevices; addr++) - status[addr * 8 + row] = value[addr]; - spiTransfer_allDevices(row + 1, value); -} - void LedControl::setColumn(int addr, int col, byte value) { byte val; @@ -237,7 +195,7 @@ void LedControl::spiTransfer(int addr, volatile byte opcode, volatile byte data) int maxbytes=maxDevices*2; for(int i=0;i= 0; i--) - shiftOut(SPI_MOSI, SPI_CLK, MSBFIRST, spidata[i]); - //latch the data onto the display - digitalWrite(SPI_CS, HIGH); -} + diff --git a/lib/lib_display/LedControl/src/LedControl.h b/lib/lib_display/LedControl/src/LedControl.h index 4fc7523df..f8180d07d 100644 --- a/lib/lib_display/LedControl/src/LedControl.h +++ b/lib/lib_display/LedControl/src/LedControl.h @@ -35,10 +35,6 @@ #include #endif -#ifndef MAX72XX_MAX_DEVICES -#define MAX72XX_MAX_DEVICES 32 // maximum number of devices based on MXA7219/MAX7221 -#endif - /* * Segments to be switched on for characters and digits on * 7-Segment Displays @@ -65,15 +61,12 @@ const static byte charTable [] PROGMEM = { class LedControl { private : /* The array for shifting the data to the devices */ - byte spidata[2 * MAX72XX_MAX_DEVICES]; - /* Send out a single command to one device */ + byte spidata[16]; + /* Send out a single command to the device */ void spiTransfer(int addr, byte opcode, byte data); - /* Send out a command with the same opcode to all devices */ - void spiTransfer_allDevices(byte opcode, const byte* data); /* We keep track of the led-status for all 8 devices in this array */ - byte status[8 * MAX72XX_MAX_DEVICES]; - byte deviceDataBuff[MAX72XX_MAX_DEVICES]; + byte status[64]; /* Data is shifted out of this pin*/ int SPI_MOSI; /* The clock is signaled on this pin */ @@ -109,7 +102,6 @@ class LedControl { * for normal operation. */ void shutdown(int addr, bool status); - void shutdown_allDevices( bool status); /* * Set the number of digits (or rows) to be displayed. @@ -120,7 +112,6 @@ class LedControl { * limit number of digits to be displayed (1..8) */ void setScanLimit(int addr, int limit); - void setScanLimit_allDevices(int limit); /* * Set the brightness of the display. @@ -129,7 +120,6 @@ class LedControl { * intensity the brightness of the display. (0..15) */ void setIntensity(int addr, int intensity); - void setIntensity_allDevices(int intensity); /* * Switch all Leds on the display off. @@ -137,7 +127,6 @@ class LedControl { * addr address of the display to control */ void clearDisplay(int addr); - void clearDisplay_allDevices(); /* * Set the status of a single Led. @@ -160,14 +149,6 @@ class LedControl { */ void setRow(int addr, int row, byte value); - /** - * @brief Set data for the same row of all devices - * - * @param row [0..8] - * @param value array of bytes, one for each device - */ - void setRow_allDevices(int row, byte* value); - /* * Set all 8 Led's in a column to a new state * Params: diff --git a/lib/lib_display/LedControl/src/LedMatrix.cpp b/lib/lib_display/LedControl/src/LedMatrix.cpp index 59882cd15..929a09418 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.cpp +++ b/lib/lib_display/LedControl/src/LedMatrix.cpp @@ -1,5 +1,5 @@ /* - * LedMatrix.h - Extends the Library LedControl for multiple 8x8 LED dot matrix modules, based on MAX7219/MAX7221 + * LedMatrix.h - Extends the Library LedControl for multiple 8x8 LED dot matrix maxDevices, based on MAX7219/MAX7221 * Copyright (c) 2021 Michael Beuss * * Permission is hereby granted, free of charge, to any person @@ -29,7 +29,26 @@ #include "font_6x8_horizontal_MSB.h" //#include "font_8x8_horizontal_latin_MSB.h" -// public +//the opcodes for the MAX7221 and MAX7219 +#define OP_NOOP 0 +#define OP_DIGIT0 1 +#define OP_DIGIT1 2 +#define OP_DIGIT2 3 +#define OP_DIGIT3 4 +#define OP_DIGIT4 5 +#define OP_DIGIT5 6 +#define OP_DIGIT6 7 +#define OP_DIGIT7 8 +#define OP_DECODEMODE 9 +#define OP_INTENSITY 10 +#define OP_SCANLIMIT 11 +#define OP_SHUTDOWN 12 +#define OP_DISPLAYTEST 15 + +// test +#include "LedControl.h" +LedControl* ledControl = nullptr; +// end text LedMatrix::LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, unsigned int rows) { if (colums * rows > MAX72XX_MAX_DEVICES) @@ -52,22 +71,36 @@ LedMatrix::LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, un modulesPerCol = rows; displayWidth = colums * 8; displayHeight = rows * 8; - modules = colums * rows; + maxDevices = colums * rows; moduleOrientation = ORIENTATION_UPSIDE_DOWN; // use setOrientation() to turn it - ledControl = new LedControl(dataPin, clkPin, csPin, modules); // initializes all connected LED matrix modules textBuf[0] = 0; textWidth = 0; textPosX = 0; textPosY = 0; appendTextBuf[0] = 0; setScrollAppendText(" "); - shutdown(false); // false: on, true: off - clear(); - setIntensity(7); + + // initialize all connected MAX7219/MAX7221 devices + SPI_MOSI = dataPin; + SPI_CLK = clkPin; + SPI_CS = csPin; + pinMode(SPI_MOSI, OUTPUT); + pinMode(SPI_CLK, OUTPUT); + pinMode(SPI_CS, OUTPUT); + SPI_MOSI = dataPin; + + //spiTransfer_value(OP_DISPLAYTEST, 0); // display test + spiTransfer_value(OP_SCANLIMIT, 7); // scanlimit is set to max on startup + spiTransfer_value(OP_DECODEMODE, 0); // decode is done in source + clearDisplay(); + //spiTransfer_value(OP_SHUTDOWN, 0); //we go into shutdown-mode (LEDs off) on startup + setIntensity(7); // initialize with the half of the maximum intensity [0..15] + power(true); // power on; } bool LedMatrix::drawText( const char *str, bool clearBefore) { + if(clearBefore) clearDisplay(); strncpy(textBuf, str, TEXT_BUFFER_SIZE -1); textPosX = 0; textPosY = 0; @@ -75,7 +108,6 @@ bool LedMatrix::drawText( const char *str, bool clearBefore) if(textWidth < displayWidth) { // text fits into the display, place it into the center - if(clearBefore) clear(); textPosX = (displayWidth - textWidth) / 2; // center } else @@ -125,21 +157,29 @@ bool LedMatrix::scrollText() void LedMatrix::power(bool on) { - shutdown(!on); // power(false) shuts down the display with shutdown(true) + byte value = 0; // 0: shutdown + if(on) value = 1; // 1: power on + spiTransfer_value(OP_SHUTDOWN, value); // power(false) shuts down the display } bool LedMatrix::clearDisplay(void) { - textBuf[0] = 0; memset(textBuf, 0, TEXT_BUFFER_SIZE); textWidth = 0; - clear(); + memset(buffer, 0, MATRIX_BUFFER_SIZE); + for (int row = 0; row < 8; row++) + { + spiTransfer_value(row + 1, 0); + } return true; } -bool LedMatrix::setIntensity(byte dim) +bool LedMatrix::setIntensity(byte intensity) { - ledControl->setIntensity_allDevices(dim); // 1..15 + if (intensity < 0 || intensity > 15) + return false; + + spiTransfer_value(OP_INTENSITY, intensity); return true; } @@ -186,25 +226,8 @@ void LedMatrix::refresh() int deviceRow = 0; for(int ledRow = 7; ledRow >= 0; ledRow--) // refresh from buttom to top { - for( int addr = 0; addr < modules; addr++) + for( int addr = 0; addr < maxDevices; addr++) { - switch(moduleOrientation) - { - case ORIENTATION_NORMAL: - col = addr % modulesPerRow; - pixelRow = (addr / modulesPerRow) * 8 + ledRow; - bufPos = pixelRow * modulesPerRow + col; - deviceDataBuff[addr] = buffer[bufPos]; - deviceRow = ledRow; - break; - case ORIENTATION_UPSIDE_DOWN: - col = addr % modulesPerRow; - pixelRow = (addr / modulesPerRow) * 8 + deviceRow; - bufPos = pixelRow * modulesPerRow + col; - deviceDataBuff[addr] = revereBitorder(buffer[bufPos]); // mirror - deviceRow = 7 - ledRow; // upside down - break; - } if(moduleOrientation == ORIENTATION_NORMAL || moduleOrientation == ORIENTATION_UPSIDE_DOWN) { col = addr % modulesPerRow; @@ -224,7 +247,7 @@ void LedMatrix::refresh() } } } - ledControl->setRow_allDevices(deviceRow, deviceDataBuff); // upside down + setRow_allDevices(deviceRow, deviceDataBuff); } } @@ -254,58 +277,6 @@ bool LedMatrix::drawCharAt( char c, const int x, const int y) return true; } -bool LedMatrix::shutdown(bool b) -{ - for (int addr = 0; addr < modules; addr++) - { - ledControl->shutdown(addr, b); // b: false: on, true: off - } - return true; -} - -bool LedMatrix::clear(void) -{ - memset(buffer, 0, MATRIX_BUFFER_SIZE); - ledControl->clearDisplay_allDevices(); - return true; -} - -void LedMatrix::refreshByteOfBuffer(int i) -{ - int line = i / modulesPerRow; - int addr = (line / 8) * modulesPerRow + i % modulesPerRow; - byte b = buffer[i]; - if (moduleOrientation == ORIENTATION_NORMAL || moduleOrientation == ORIENTATION_UPSIDE_DOWN) - { - int rowOfAddr = 0; - if (moduleOrientation == ORIENTATION_NORMAL) - { - rowOfAddr = line % 8; // ORIENTATION_NORMAL - } - else - { - rowOfAddr = 7 - line % 8; // ORIENTATION_UPSIDE_DOWN - b = revereBitorder(b); - } - ledControl->setRow(addr, rowOfAddr, b); - } - else - { - // ORIENTATION_TURN_RIGHT or ORIENTATION_TURN_LEFT - int colOfAddr = 0; - if (moduleOrientation == ORIENTATION_TURN_LEFT) - { - colOfAddr = line % 8; // ORIENTATION_TURN_LEFT - } - else - { - colOfAddr = 7 - line % 8; // ORIENTATION_TURN_RIGHT - b = revereBitorder(b); - } - ledControl->setColumn(addr, colOfAddr, b); - } -} - byte LedMatrix::revereBitorder (byte b) { static const byte lookup[16] = { @@ -320,3 +291,37 @@ void LedMatrix::appendSpace() strncat(textBuf, appendTextBuf, TEXT_BUFFER_SIZE -1); textWidth = strlen(textBuf) * charWidth; } + +void LedMatrix::setRow_allDevices(int row, byte *data) +{ + if (row < 0 || row > 7) + return; + spiTransfer_array(row + 1, data); +} + +void LedMatrix::spiTransfer_array(byte opcode, const byte* data) { + // create an array with the data to shift out + for (int addr = 0; addr < maxDevices; addr++) + { + spidata[addr * 2 + 1] = opcode; + spidata[addr * 2] = data[addr]; + } + // enable the line + digitalWrite(SPI_CS, LOW); + // shift out the data + for (int i = maxDevices * 2 -1; i >= 0; i--) + { + shiftOut(SPI_MOSI, SPI_CLK, MSBFIRST, spidata[i]); + } + // latch the data onto the display + digitalWrite(SPI_CS, HIGH); +} + +void LedMatrix::spiTransfer_value(byte opcode, byte value) +{ + memset(deviceDataBuff, (byte)value, maxDevices); + spiTransfer_array(opcode, deviceDataBuff); +} + + + diff --git a/lib/lib_display/LedControl/src/LedMatrix.h b/lib/lib_display/LedControl/src/LedMatrix.h index 9fee69a5f..aec15d052 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.h +++ b/lib/lib_display/LedControl/src/LedMatrix.h @@ -1,5 +1,5 @@ /* - * LedMatrix.h - Extends the Library LedControl for multiple 8x8 LED dot matrix modules, based on MAX7219/MAX7221 + * LedMatrix.h - Extends the Library LedControl for multiple 8x8 LED dot matrix devices, based on MAX7219/MAX7221 * Copyright (c) 2021 Michael Beuss * * Permission is hereby granted, free of charge, to any person @@ -27,16 +27,27 @@ #ifndef LedMatrix_h #define LedMatrix_h -#include +#include + +#if (ARDUINO >= 100) +#include +#else +#include +#endif + +#ifndef MAX72XX_MAX_DEVICES +#define MAX72XX_MAX_DEVICES 32 // maximum number of devices based on MXA7219/MAX7221 +#endif #define MATRIX_BUFFER_SIZE MAX72XX_MAX_DEVICES * 8 // 8 bytes per modul. One byte represents 8 LEDs. #define TEXT_BUFFER_SIZE 256 // maximum text length that can be scrolled #define TEXT_APPEND_BUFFER_SIZE 16 // used for characters that are appended to the scroll text, before it repeats +#define SPI_BUFFER_SIZE MAX72XX_MAX_DEVICES * 2 // buffer size fort shifting commands to all devices (2 bytes each) /** - * @brief LedMatric controls multiple 8x8 LED dot matrx modules. - * All modules in rows and clolums together build a common display pixel matrix. + * @brief LedMatrix controls multiple 8x8 LED dot matrx devices. + * All devices in rows and clolums together build a common display pixel matrix. * */ class LedMatrix @@ -54,8 +65,8 @@ class LedMatrix /** * @brief Construct a new LED Matrix object * - * @param colums of 8x8 LED dot matrix modules - * @param rows of 8x8 LED dot matrix modules + * @param colums of 8x8 LED dot matrix devices + * @param rows of 8x8 LED dot matrix devices */ LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, unsigned int rows); @@ -139,23 +150,48 @@ class LedMatrix void refresh(); private: + bool drawCharAt( char c, int x, int y ); // Draws a character to a defined position - bool shutdown(bool b); // shutdown(true) switches the display off. Text and pixels can be set while it is off. shutdown(false) switches the display on. - bool clear(void); // clears the display content - void refreshByteOfBuffer( int i); // sends one byte of the buffer to the display. This updates an 8 pixel row of one matrix module. byte revereBitorder(byte b); // returnes the byte in the reverse bit order. void appendSpace(); // appends characters to the end of the text to get a distance to the repeating scroll text + // device contrl MAX7219/MAX7221 + /** + * @brief Set data for the same row of all devices + * + * @param row [0..8] + * @param value array of bytes, one for each device + */ + void setRow_allDevices(int row, byte* value); + + /* Send out a command with the same opcode to all devices */ + /** + * @brief sends opcode with specific data values to each device + * + * @param opcode + * @param data array of byte values (data[0] is the value for the first device) + */ + void spiTransfer_array(byte opcode, const byte* data); + + /** + * @brief sends opcode with same value to all devices + */ + void spiTransfer_value(byte opcode, byte value); + + private: + int SPI_MOSI; // Data is shifted out of this pin + int SPI_CLK; // The clock is signaled on this pin + int SPI_CS; // This one is driven LOW for chip selectzion + unsigned int modulesPerRow; unsigned int modulesPerCol; unsigned int displayWidth; // matrix width [pixel] unsigned int displayHeight; // matrix height [pixel] - unsigned int modules; // number of 8x8 mudules + int maxDevices; // number of used 8x8 devices uint8_t moduleOrientation; byte buffer[MATRIX_BUFFER_SIZE]; byte deviceDataBuff[MAX72XX_MAX_DEVICES]; - LedControl* ledControl; int charWidth; int charHeight; char textBuf[TEXT_BUFFER_SIZE]; @@ -163,6 +199,7 @@ class LedMatrix int textWidth; // width of text [pixel] int textPosX; // horizontal pixel position of scrolling text int textPosY; // vertical pixelposition of scrolling text; + byte spidata[SPI_BUFFER_SIZE]; // The array for shifting the data to the devices }; diff --git a/tasmota/xdsp_19_max7219_matrix.ino b/tasmota/xdsp_19_max7219_matrix.ino index 82a4a24bb..ecf500670 100644 --- a/tasmota/xdsp_19_max7219_matrix.ino +++ b/tasmota/xdsp_19_max7219_matrix.ino @@ -128,13 +128,6 @@ bool MAX7291Matrix_initDriver(void) Settings->display_rows = LedMatrix_settings.modulesPerCol; Settings->display_cols[1] = LedMatrix_settings.modulesPerCol; max7219_Matrix = new LedMatrix(Pin(GPIO_MAX7219DIN), Pin(GPIO_MAX7219CLK), Pin(GPIO_MAX7219CS), LedMatrix_settings.modulesPerRow, LedMatrix_settings.modulesPerCol); - if( LedMatrix_settings.show_clock == 0) - { - Settings->display_mode = 0; // text mode - } - else{ - Settings->display_mode = 1; // clock mode - } max2791Matrix_initDriver_done = true; AddLog(LOG_LEVEL_INFO, PSTR("MTX: MAX7291Matrix_initDriver DIN:%d CLK:%d CS:%d size(%dx%d)"), Pin(GPIO_MAX7219DIN), Pin(GPIO_MAX7219CLK), Pin(GPIO_MAX7219CS), LedMatrix_settings.modulesPerRow, LedMatrix_settings.modulesPerCol); @@ -144,8 +137,13 @@ bool MAX7291Matrix_initDriver(void) // FUNC_DISPLAY_INIT bool MAX7291Matrix_init(void) { + Settings->display_mode = 0; // text mode + LedMatrix_settings.show_clock = 0; // no clock + int intensity = GetDisplayDimmer16(); // 0..15 max7219_Matrix->setIntensity(intensity); + + max7219_Matrix->power(true); // power on if(Settings->display_rotate <= 3) { max7219_Matrix->setOrientation((LedMatrix::ModuleOrientation)Settings->display_rotate ); @@ -223,6 +221,8 @@ bool MAX7291Matrix_clock(void) Settings->display_mode = 1; break; default: + //LedMatrix_settings.timeFormat = XdrvMailbox.payload; + //Settings->display_mode = 1; return false; } @@ -280,13 +280,11 @@ bool Xdsp19(uint8_t function) case FUNC_DISPLAY_DRAW_STRING: case FUNC_DISPLAY_SCROLLTEXT: case FUNC_DISPLAY_SEVENSEG_TEXT: - Settings->display_mode = 0; // text mode - LedMatrix_settings.show_clock = 0; // disable clock mode + if(Settings->display_mode != 0) MAX7291Matrix_init(); result = max7219_Matrix->drawText(XdrvMailbox.data, true); // true: clears display before drawing text break; case FUNC_DISPLAY_SEVENSEG_TEXTNC: - Settings->display_mode = 0; // text mode - LedMatrix_settings.show_clock = 0; // disable clock mode + if(Settings->display_mode != 0) MAX7291Matrix_init(); result = max7219_Matrix->drawText(XdrvMailbox.data, false); // false: does not clear display before drawing text break; case FUNC_DISPLAY_SCROLLDELAY: From 7b7913e8f32389b383b68ee0a9433d07c1ac74a1 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 18 Dec 2021 15:14:47 +0100 Subject: [PATCH 10/10] merged, ready for PR2 --- lib/lib_display/LedControl/src/LedControl.cpp | 11 +- lib/lib_display/LedControl/src/LedControl.h | 1 - lib/lib_display/LedControl/src/LedMatrix.cpp | 141 ++- lib/lib_display/LedControl/src/LedMatrix.h | 11 +- .../LedControl/src/font_6x8_UTF8_C2.h | 340 ++++++ .../LedControl/src/font_6x8_UTF8_C3.h | 678 ++++++++++++ .../LedControl/src/font_6x8_base.h | 986 ++++++++++++++++++ .../LedControl/src/font_6x8_horizontal_MSB.h | 267 ----- tasmota/xdsp_19_max7219_matrix.ino | 123 ++- 9 files changed, 2226 insertions(+), 332 deletions(-) create mode 100644 lib/lib_display/LedControl/src/font_6x8_UTF8_C2.h create mode 100644 lib/lib_display/LedControl/src/font_6x8_UTF8_C3.h create mode 100644 lib/lib_display/LedControl/src/font_6x8_base.h delete mode 100644 lib/lib_display/LedControl/src/font_6x8_horizontal_MSB.h diff --git a/lib/lib_display/LedControl/src/LedControl.cpp b/lib/lib_display/LedControl/src/LedControl.cpp index 5807aa6af..e2230944c 100644 --- a/lib/lib_display/LedControl/src/LedControl.cpp +++ b/lib/lib_display/LedControl/src/LedControl.cpp @@ -49,7 +49,7 @@ LedControl::LedControl(int dataPin, int clkPin, int csPin, int numDevices) { SPI_CS=csPin; if(numDevices<=0 || numDevices>8 ) numDevices=8; - maxDevices = numDevices; + maxDevices=numDevices; pinMode(SPI_MOSI,OUTPUT); pinMode(SPI_CLK,OUTPUT); pinMode(SPI_CS,OUTPUT); @@ -59,14 +59,14 @@ LedControl::LedControl(int dataPin, int clkPin, int csPin, int numDevices) { status[i]=0x00; for(int i=0;i MAX72XX_MAX_DEVICES) @@ -79,6 +81,7 @@ LedMatrix::LedMatrix(int dataPin, int clkPin, int csPin, unsigned int colums, un textPosY = 0; appendTextBuf[0] = 0; setScrollAppendText(" "); + powerIsOn = false; // initialize all connected MAX7219/MAX7221 devices SPI_MOSI = dataPin; @@ -104,8 +107,9 @@ bool LedMatrix::drawText( const char *str, bool clearBefore) strncpy(textBuf, str, TEXT_BUFFER_SIZE -1); textPosX = 0; textPosY = 0; - textWidth = strlen(textBuf) * charWidth; - if(textWidth < displayWidth) + textLen = countChars(str); + textWidth = textLen * charWidth; + if(textWidth <= displayWidth) { // text fits into the display, place it into the center textPosX = (displayWidth - textWidth) / 2; // center @@ -113,8 +117,8 @@ bool LedMatrix::drawText( const char *str, bool clearBefore) else { // The text ist longer than the display width. Scrolling is needed. - // Append a space between end of text and the beginning of the repeting text. - appendSpace(); + // Add a space in front of text to have a distance to the pervious scroll text. + addSpace(); } drawTextAt(textBuf, textPosX, textPosY); refresh(); // refresh display with the new drawed string content @@ -124,19 +128,90 @@ bool LedMatrix::drawText( const char *str, bool clearBefore) bool LedMatrix::drawTextAt( const char *str, const int x, const int y ) { // draw character by character - unsigned int len = strlen(str); int xPos = x; - for (unsigned int i = 0; i < len; i++) + const char* fontChar = nullptr; + for (unsigned int i = 0; (i= 0x20 && c < 0x80) // basic font + { + fontChar = font_20_7F[c-0x20]; + } + +#ifdef font_6x8_UTF8_C2_h + else if(c == 0xC2) // UTF special characters + { + i++; + c= str[i]; + if(c>= 0xA0 && c < 0xC0) + { + fontChar = font_UTF_C2_A0_BF[c - 0xA0]; + } + } +#endif // font_6x8_UTF8_C2_h + +#ifdef font_6x8_UTF8_C3_h + else if(c == 0xC3) // UTF latin1 + { + i++; + c= str[i]; + if(c>= 0x80 && c < 0xC0) + { + fontChar = font_UTF_C3_80_BF[c - 0x80]; + } + } +#endif // font_6x8_UTF8_C3_h + + else if(c>= 0xC0 && c <= 0xDF) + { + i += 1; // 2 byte UTF sequence + } + else if(c>= 0xE0 && c <= 0xEF) + { + i += 2; // 3 byte UTF sequence + } + else if(c>= 0xF0 && c <= 0xF7) + { + i += 3; // 4 byte UTF sequence + } + + drawCharAt(fontChar, xPos, y); xPos += charWidth; } return true; } +int LedMatrix::countChars( const char* utfText) +{ + int len = 0; + for( int i = 0; (i> 4]; } -void LedMatrix::appendSpace() +void LedMatrix::addSpace() { strncat(textBuf, appendTextBuf, TEXT_BUFFER_SIZE -1); - textWidth = strlen(textBuf) * charWidth; + textPosX = strlen(appendTextBuf) * charWidth; // start scrolling with space + textLen = countChars(textBuf); + textWidth = countChars(textBuf) * charWidth; } void LedMatrix::setRow_allDevices(int row, byte *data) diff --git a/lib/lib_display/LedControl/src/LedMatrix.h b/lib/lib_display/LedControl/src/LedMatrix.h index aec15d052..b77038ecc 100644 --- a/lib/lib_display/LedControl/src/LedMatrix.h +++ b/lib/lib_display/LedControl/src/LedMatrix.h @@ -106,6 +106,8 @@ class LedMatrix void power( bool on ); + bool isPowerOn(); + /** * @brief cleares the display and text buffer * @@ -136,7 +138,7 @@ class LedMatrix */ /** - * @brief Set the a pending string to the scrolling text to set a distance to the repeating text. Usually some spaces are used. + * @brief Adds a string before the scrolling text to set a distance. Usually some spaces are used. * * @param append text to append to the scrolling text before repeating. */ @@ -151,9 +153,10 @@ class LedMatrix private: - bool drawCharAt( char c, int x, int y ); // Draws a character to a defined position + bool drawCharAt( const char* fontChar, int x, int y ); // Draws a character to a defined position + int countChars( const char* utfText); // count the characters of an UTF8 string. To be uesd instead of strlen(). byte revereBitorder(byte b); // returnes the byte in the reverse bit order. - void appendSpace(); // appends characters to the end of the text to get a distance to the repeating scroll text + void addSpace(); // adds characters in front of the text to get a distance to the repeating scroll text // device contrl MAX7219/MAX7221 /** @@ -196,10 +199,12 @@ class LedMatrix int charHeight; char textBuf[TEXT_BUFFER_SIZE]; char appendTextBuf[TEXT_APPEND_BUFFER_SIZE]; + int textLen; // number of UTF8 characters int textWidth; // width of text [pixel] int textPosX; // horizontal pixel position of scrolling text int textPosY; // vertical pixelposition of scrolling text; byte spidata[SPI_BUFFER_SIZE]; // The array for shifting the data to the devices + bool powerIsOn; }; diff --git a/lib/lib_display/LedControl/src/font_6x8_UTF8_C2.h b/lib/lib_display/LedControl/src/font_6x8_UTF8_C2.h new file mode 100644 index 000000000..72854b4da --- /dev/null +++ b/lib/lib_display/LedControl/src/font_6x8_UTF8_C2.h @@ -0,0 +1,340 @@ +// 6x8 ascii font +#ifndef font_6x8_UTF8_C2_h +#define font_6x8_UTF8_C2_h +/** + * additional characters to font_6x8_base.h + * 256 bytes + * + */ + +/* +UTF8 after 0xC2 + …0 …1 …2 …3 …4 …5 …6 …7 …8 …9 …A …B …C …D …E …F +A… NBSP¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ SHY ® ¯ +B… ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ +*/ +const char font_UTF_C2_A0_BF[0xC0-0xA0][8] = { + + { + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x80 NBSP + { + 0b00000100, + 0b00000000, + 0b00000100, + 0b00000100, + 0b00001110, + 0b00001110, + 0b00000100, + 0b00000000, + }, // 0x81 ¡ + { + 0b00000000, + 0b00000100, + 0b00001110, + 0b00010000, + 0b00010000, + 0b00001110, + 0b00000100, + 0b00000000, + }, // 0x82 ¢ + { + 0b00000110, + 0b00001001, + 0b00001000, + 0b00011110, + 0b00001000, + 0b00001001, + 0b00010111, + 0b00000000, + }, // 0x83 £ + { + 0b00010001, + 0b00001110, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00001110, + 0b00010001, + 0b00000000, + }, // 0x84 ¤ + { + 0b00010001, + 0b00001010, + 0b00000100, + 0b00011111, + 0b00000100, + 0b00011111, + 0b00000100, + 0b00000000, + }, // 0x85 ¥ + { + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000000, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000000, + }, // 0x86 ¦ + { + 0b00001110, + 0b00010001, + 0b00001100, + 0b00001010, + 0b00000110, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x87 § + { + 0b00000000, + 0b00000000, + 0b00000000, + 0b00001010, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x88 ¨ + { + 0b00011110, + 0b00100001, + 0b00101101, + 0b00101001, + 0b00101101, + 0b00100001, + 0b00011110, + 0b00000000, + }, // 0x89 © + { + 0b00001110, + 0b00000001, + 0b00001111, + 0b00010001, + 0b00001111, + 0b00000000, + 0b00001111, + 0b00000000, + }, // 0x8A ª + { + 0b00000000, + 0b00000000, + 0b00001001, + 0b00010010, + 0b00001001, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x8B « + { + 0b00000000, + 0b00000000, + 0b00111111, + 0b00000001, + 0b00000001, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x8C ¬ + { + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000001, + 0b00000001, + 0b00000000, + 0b11111111, + 0b00000000, + }, // 0x8D SHY + { + 0b00011110, + 0b00100101, + 0b00101011, + 0b00101101, + 0b00101011, + 0b00100001, + 0b00011110, + 0b00000000, + }, // 0x8E ® + { + 0b00000000, + 0b00001110, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x8F ¯ + { + 0b00001100, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x90 ° + { + 0b00000000, + 0b00000100, + 0b00001110, + 0b00000100, + 0b00000000, + 0b00001110, + 0b00000000, + 0b00000000, + }, // 0x91 ± + { + 0b00011000, + 0b00000100, + 0b00001000, + 0b00011100, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x92 ² + { + 0b00011100, + 0b00001000, + 0b00001100, + 0b00011000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x93 ³ + { + 0b00001100, + 0b00001100, + 0b00001000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x94 ´ + { + 0b00000000, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00011100, + 0b00010000, + 0b00010000, + }, // 0x95 µ + { + 0b00001111, + 0b00010101, + 0b00010101, + 0b00001101, + 0b00000101, + 0b00000101, + 0b00000101, + 0b00000000, + }, // 0x96 ¶ + { + 0b00000000, + 0b00000000, + 0b00000000, + 0b00001000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x97 · + { + 0b00000000, + 0b00000000, + 0b00000000, + 0b00001110, + 0b00000110, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x98 ¸ + { + 0b00001000, + 0b00011000, + 0b00001000, + 0b00001000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x99 ¹ + { + 0b00001100, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + 0b00011110, + 0b00000000, + }, // 0x9A º + { + 0b00000000, + 0b00000000, + 0b00010010, + 0b00001001, + 0b00010010, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x9B » + { + 0b00010000, + 0b00010010, + 0b00010100, + 0b00001011, + 0b00010101, + 0b00000111, + 0b00000001, + 0b00000000, + }, // 0x9C ¼ + { + 0b00010000, + 0b00010010, + 0b00010100, + 0b00001110, + 0b00010001, + 0b00000010, + 0b00000111, + 0b00000000, + }, // 0x9D ½ + { + 0b00110000, + 0b00011010, + 0b00110100, + 0b00001011, + 0b00010101, + 0b00000111, + 0b00000001, + 0b00000000, + }, // 0x9E ¾ + { + 0b00000100, + 0b00000000, + 0b00000100, + 0b00001100, + 0b00010000, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x9F ¿ +}; + +#endif // font_6x8_UTF8_C2_h \ No newline at end of file diff --git a/lib/lib_display/LedControl/src/font_6x8_UTF8_C3.h b/lib/lib_display/LedControl/src/font_6x8_UTF8_C3.h new file mode 100644 index 000000000..aa32f434a --- /dev/null +++ b/lib/lib_display/LedControl/src/font_6x8_UTF8_C3.h @@ -0,0 +1,678 @@ +// 6x8 ascii font +#ifndef font_6x8_UTF8_C3_h +#define font_6x8_UTF8_C3_h +/** + * additional characters to font_6x8_base.h + * 512 bytes + * + */ + +/* +UTF8 after 0xC3 + …0 …1 …2 …3 …4 …5 …6 …7 …8 …9 …A …B …C …D …E …F +8… À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï +9… Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß +A… à á â ã ä å æ ç è é ê ë ì í î ï +B… ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ +*/ +const char font_UTF_C3_80_BF[0xC0-0x80][8] = { + + { + 0b00001100, + 0b00000000, + 0b00000100, + 0b00001010, + 0b00010001, + 0b00011111, + 0b00010001, + 0b00000000, + }, // 0x80 À + { + 0b00000110, + 0b00000000, + 0b00000100, + 0b00001010, + 0b00010001, + 0b00011111, + 0b00010001, + 0b00000000, + }, // 0x81 Á + { + 0b00001110, + 0b00000000, + 0b00000100, + 0b00001010, + 0b00010001, + 0b00011111, + 0b00010001, + 0b00000000, + }, // 0x82 Â + { + 0b00000101, + 0b00001010, + 0b00000100, + 0b00001010, + 0b00010001, + 0b00011111, + 0b00010001, + 0b00000000, + }, // 0x83 Ã + { + 0b00001010, + 0b00000000, + 0b00000100, + 0b00001010, + 0b00010001, + 0b00011111, + 0b00010001, + 0b00000000, + }, // 0x84 Ä + { + 0b00001110, + 0b00001010, + 0b00001110, + 0b00011011, + 0b00010001, + 0b00011111, + 0b00010001, + 0b00000000, + }, // 0x85 Å + { + 0b00000111, + 0b00001100, + 0b00010100, + 0b00010111, + 0b00011100, + 0b00010100, + 0b00010111, + 0b00000000, + }, // 0x86 Æ + { + 0b00001110, + 0b00010001, + 0b00010000, + 0b00010000, + 0b00010001, + 0b00001110, + 0b00000100, + 0b00001100, + }, // 0x87 Ç + { + 0b00001100, + 0b00000000, + 0b00011111, + 0b00010000, + 0b00011110, + 0b00010000, + 0b00011111, + 0b00000000, + }, // 0x88 È + + { + 0b00000011, + 0b00000000, + 0b00011111, + 0b00010000, + 0b00011110, + 0b00010000, + 0b00011111, + 0b00000000, + }, // 0x89 É + { + 0b00001110, + 0b00000000, + 0b00011111, + 0b00010000, + 0b00011110, + 0b00010000, + 0b00011111, + 0b00000000, + }, // 0x8A Ê + { + 0b00001010, + 0b00000000, + 0b00011111, + 0b00010000, + 0b00011110, + 0b00010000, + 0b00011111, + 0b00000000, + }, // 0x8B Ë + { + 0b00001100, + 0b00000000, + 0b00001110, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00001110, + 0b00000000, + }, // 0x8C Ì + { + 0b00000110, + 0b00000000, + 0b00001110, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00001110, + 0b00000000, + }, // 0x8D Í + { + 0b00001110, + 0b00000000, + 0b00001110, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00001110, + 0b00000000, + }, // 0x8E Î + { + 0b00001010, + 0b00000000, + 0b00001110, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00001110, + 0b00000000, + }, // 0x8F Ï + + { + 0b00001110, + 0b00001001, + 0b00001001, + 0b00011101, + 0b00001001, + 0b00001001, + 0b00001110, + 0b00000000, + }, // 0x90 Ð + { + 0b00001010, + 0b00010100, + 0b00000000, + 0b00010010, + 0b00011010, + 0b00010110, + 0b00010010, + 0b00000000, + }, // 0x91 Ñ + { + 0b00011000, + 0b00001100, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0x92 Ò + { + 0b00000110, + 0b00001100, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0x93 Ó + { + 0b00001110, + 0b00001100, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0x94 Ô + { + 0b00001010, + 0b00010100, + 0b00001100, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0x95 Õ + { + 0b00010010, + 0b00001100, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0x96 Ö + { + 0b00000000, + 0b00010001, + 0b00001010, + 0b00000100, + 0b00001010, + 0b00010001, + 0b00000000, + 0b00000000, + }, // 0x97 × + { + 0b00001111, + 0b00010011, + 0b00010101, + 0b00010101, + 0b00010101, + 0b00011001, + 0b00011110, + 0b00000000, + }, // 0x98 Ø + + { + 0b00011000, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0x99 Ù + { + 0b00000110, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0x9A Ú + { + 0b00001110, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0x9B Û + { + 0b00001010, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0x9C Ü + { + 0b00000110, + 0b00000000, + 0b00010001, + 0b00001010, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000000, + }, // 0x9D Ý + { + 0b00011000, + 0b00010000, + 0b00011100, + 0b00010010, + 0b00010010, + 0b00011100, + 0b00010000, + 0b00011000, + }, // 0x9E Þ + { + 0b00000000, + 0b00011100, + 0b00010010, + 0b00011100, + 0b00010010, + 0b00010010, + 0b00011100, + 0b00010000, + }, // 0x9F ß + + { + 0b00001100, + 0b00000000, + 0b00001110, + 0b00000001, + 0b00001111, + 0b00010001, + 0b00001111, + 0b00000000, + }, // 0xA0 à + { + 0b00000110, + 0b00000000, + 0b00001110, + 0b00000001, + 0b00001111, + 0b00010001, + 0b00001111, + 0b00000000, + }, // 0xA1 á + { + 0b00001110, + 0b00000000, + 0b00001110, + 0b00000001, + 0b00001111, + 0b00010001, + 0b00001111, + 0b00000000, + }, // 0xA2 â + { + 0b00000101, + 0b00001010, + 0b00001110, + 0b00000001, + 0b00001111, + 0b00010001, + 0b00001111, + 0b00000000, + }, // 0xA3 ã + { + 0b00001010, + 0b00000000, + 0b00001110, + 0b00000001, + 0b00001111, + 0b00010001, + 0b00001111, + 0b00000000, + }, // 0xA4 ä + { + 0b00001110, + 0b00001010, + 0b00001110, + 0b00000001, + 0b00001111, + 0b00010001, + 0b00001111, + 0b00000000, + }, // 0xA5 å + { + 0b00000000, + 0b00000000, + 0b00011110, + 0b00000101, + 0b00011111, + 0b00010100, + 0b00001111, + 0b00000000, + }, // 0xA6 æ + { + 0b00000000, + 0b00001110, + 0b00010001, + 0b00010000, + 0b00010001, + 0b00001110, + 0b00000100, + 0b00001100, + }, // 0xA7 ç + { + 0b00001100, + 0b00000000, + 0b00001110, + 0b00010001, + 0b00011110, + 0b00010000, + 0b00001110, + 0b00000000, + }, // 0xA8 è + { + 0b00000011, + 0b00000000, + 0b00001110, + 0b00010001, + 0b00011110, + 0b00010000, + 0b00001110, + 0b00000000, + }, // 0xA9 é + { + 0b00001110, + 0b00000000, + 0b00001110, + 0b00010001, + 0b00011110, + 0b00010000, + 0b00001110, + 0b00000000, + }, // 0xAA ê + { + 0b00001010, + 0b00000000, + 0b00001110, + 0b00010001, + 0b00011110, + 0b00010000, + 0b00001110, + 0b00000000, + }, // 0xAB ë + { + 0b00001000, + 0b00000000, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000110, + 0b00000000, + }, // 0xAC ì + { + 0b00000110, + 0b00000000, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000110, + 0b00000000, + }, // 0xAD í + { + 0b00000110, + 0b00000000, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000110, + 0b00000000, + }, // 0xAE î + { + 0b00001010, + 0b00000000, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000110, + 0b00000000, + }, // 0xAF ï + + { + 0b00001100, + 0b00010000, + 0b00001000, + 0b00000100, + 0b00001110, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0xB0 ð + { + 0b00001010, + 0b00010100, + 0b00000000, + 0b00011100, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00000000, + }, // 0xB1 ñ + { + 0b00011000, + 0b00000000, + 0b00001100, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0xB2 ò + { + 0b00000110, + 0b00000000, + 0b00001100, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0xB3 ó + { + 0b00001110, + 0b00000000, + 0b00001100, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0xB4 ô + { + 0b00001010, + 0b00010100, + 0b00000000, + 0b00001100, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0xB5 õ + { + 0b00001010, + 0b00000000, + 0b00001100, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00000000, + }, // 0xB6 ö + { + 0b00000000, + 0b00000100, + 0b00000000, + 0b00011111, + 0b00000000, + 0b00000100, + 0b00000000, + 0b00000000, + }, // 0xB7 ÷ + { + 0b00000000, + 0b00000000, + 0b00000001, + 0b00001110, + 0b00010110, + 0b00011010, + 0b00011100, + 0b00100000, + }, // 0xB8 ø + { + 0b00011000, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010110, + 0b00001010, + 0b00000000, + }, // 0xB9 ù + { + 0b00000110, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010110, + 0b00001010, + 0b00000000, + }, // 0xBA ú + { + 0b00001110, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010110, + 0b00001010, + 0b00000000, + }, // 0xBB û + { + 0b00010010, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010110, + 0b00001010, + 0b00000000, + }, // 0xBC ü + { + 0b00000110, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001110, + 0b00000100, + 0b00011000, + }, // 0xBD ý + { + 0b00000000, + 0b00011000, + 0b00010000, + 0b00011100, + 0b00010010, + 0b00011100, + 0b00010000, + 0b00011000, + }, // 0xBE þ + { + 0b00001010, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001110, + 0b00000100, + 0b00011000, + }, // 0xBF ÿ +}; + +/* +ISO/IEC 8859-1 (latin1) + …0 …1 …2 …3 …4 …5 …6 …7 …8 …9 …A …B …C …D …E …F +A… NBSP ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ SHY ® ¯ +B… ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ +C… À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï +D… Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß +E… à á â ã ä å æ ç è é ê ë ì í î ï +F… ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ +*/ + +#endif // font_6x8_UTF8_C3_h \ No newline at end of file diff --git a/lib/lib_display/LedControl/src/font_6x8_base.h b/lib/lib_display/LedControl/src/font_6x8_base.h new file mode 100644 index 000000000..084b28c00 --- /dev/null +++ b/lib/lib_display/LedControl/src/font_6x8_base.h @@ -0,0 +1,986 @@ +// 6x8 ascii font +#ifndef font_6x8_base_h +#define font_6x8_base_h +/** + * Momory size of basic ascii font: 768 bytes + * + */ + +/* + …0 …1 …2 …3 …4 …5 …6 …7 …8 …9 …A …B …C …D …E …F +2… SP ! " # $ % & ' ( ) * + , - . / +3… 0 1 2 3 4 5 6 7 8 9 : ; < = > ? +4… @ A B C D E F G H I J K L M N O +5… P Q R S T U V W X Y Z [ \ ] ^ _ +6… ` a b c d e f g h i j k l m n o +7… p q r s t u v w x y z { | } ~ +*/ + +const unsigned int font_char_width = 6; +const unsigned int font_char_height = 8; + +const char font_20_7F[0x80-0x20][8] = { + { + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x20 + { + 0b00000100, + 0b00001110, + 0b00001110, + 0b00000100, + 0b00000100, + 0b00000000, + 0b00000100, + 0b00000000, + }, // 0x21 ! + { + 0b00011011, + 0b00011011, + 0b00010010, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x22 " + { + 0b00000000, + 0b00001010, + 0b00011111, + 0b00001010, + 0b00001010, + 0b00011111, + 0b00001010, + 0b00000000, + }, // 0x23 # + { + 0b00001000, + 0b00001110, + 0b00010000, + 0b00001100, + 0b00000010, + 0b00011100, + 0b00000100, + 0b00000000, + }, // 0x24 $ + { + 0b00011001, + 0b00011001, + 0b00000010, + 0b00000100, + 0b00001000, + 0b00010011, + 0b00010011, + 0b00000000, + }, // 0x25 % + { + 0b00001000, + 0b00010100, + 0b00010100, + 0b00001000, + 0b00010101, + 0b00010010, + 0b00001101, + 0b00000000, + }, // 0x26 & + { + 0b00001100, + 0b00001100, + 0b00001000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x27 ' + { + 0b00000100, + 0b00001000, + 0b00001000, + 0b00001000, + 0b00001000, + 0b00001000, + 0b00000100, + 0b00000000, + }, // 0x28 ( + { + 0b00001000, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00001000, + 0b00000000, + }, // 0x29 ) + { + 0b00000000, + 0b00001010, + 0b00001110, + 0b00011111, + 0b00001110, + 0b00001010, + 0b00000000, + 0b00000000, + }, // 0x2A * + { + 0b00000000, + 0b00000100, + 0b00000100, + 0b00011111, + 0b00000100, + 0b00000100, + 0b00000000, + 0b00000000, + }, // 0x2B + + { + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00001100, + 0b00001100, + 0b00001000, + }, // 0x2C , + { + 0b00000000, + 0b00000000, + 0b00000000, + 0b00011111, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x2D - + { + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00001100, + 0b00001100, + 0b00000000, + }, // 0x2E . + { + 0b00000000, + 0b00000001, + 0b00000010, + 0b00000100, + 0b00001000, + 0b00010000, + 0b00000000, + 0b00000000, + }, // 0x2F / + { + 0b00001110, + 0b00010001, + 0b00010011, + 0b00010101, + 0b00011001, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x30 0 + { + 0b00000100, + 0b00001100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00001110, + 0b00000000, + }, // 0x31 1 + { + 0b00001110, + 0b00010001, + 0b00000001, + 0b00000110, + 0b00001000, + 0b00010000, + 0b00011111, + 0b00000000, + }, // 0x32 2 + { + 0b00001110, + 0b00010001, + 0b00000001, + 0b00001110, + 0b00000001, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x33 3 + { + 0b00000010, + 0b00000110, + 0b00001010, + 0b00010010, + 0b00011111, + 0b00000010, + 0b00000010, + 0b00000000, + }, // 0x34 4 + { + 0b00011111, + 0b00010000, + 0b00010000, + 0b00011110, + 0b00000001, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x35 5 + { + 0b00000110, + 0b00001000, + 0b00010000, + 0b00011110, + 0b00010001, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x36 6 + { + 0b00011111, + 0b00000001, + 0b00000010, + 0b00000100, + 0b00001000, + 0b00001000, + 0b00001000, + 0b00000000, + }, // 0x37 7 + { + 0b00001110, + 0b00010001, + 0b00010001, + 0b00001110, + 0b00010001, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x38 8 + { + 0b00001110, + 0b00010001, + 0b00010001, + 0b00001111, + 0b00000001, + 0b00000010, + 0b00001100, + 0b00000000, + }, // 0x39 9 + { + 0b00000000, + 0b00000000, + 0b00001100, + 0b00001100, + 0b00000000, + 0b00001100, + 0b00001100, + 0b00000000, + }, // 0x3A : + { + 0b00000000, + 0b00000000, + 0b00001100, + 0b00001100, + 0b00000000, + 0b00001100, + 0b00001100, + 0b00001000, + }, // 0x3B ; + { + 0b00000010, + 0b00000100, + 0b00001000, + 0b00010000, + 0b00001000, + 0b00000100, + 0b00000010, + 0b00000000, + }, // 0x3C < + { + 0b00000000, + 0b00000000, + 0b00011111, + 0b00000000, + 0b00000000, + 0b00011111, + 0b00000000, + 0b00000000, + }, // 0x3D = + { + 0b00001000, + 0b00000100, + 0b00000010, + 0b00000001, + 0b00000010, + 0b00000100, + 0b00001000, + 0b00000000, + }, // 0x3E > + { + 0b00001110, + 0b00010001, + 0b00000001, + 0b00000110, + 0b00000100, + 0b00000000, + 0b00000100, + 0b00000000, + }, // 0x3F ? + + { + 0b00001110, + 0b00010001, + 0b00010111, + 0b00010101, + 0b00010111, + 0b00010000, + 0b00001110, + 0b00000000, + }, // 0x40 @ + { + 0b00001110, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00011111, + 0b00010001, + 0b00010001, + 0b00000000, + }, // 0x41 A + { + 0b00011110, + 0b00010001, + 0b00010001, + 0b00011110, + 0b00010001, + 0b00010001, + 0b00011110, + 0b00000000, + }, // 0x42 B + { + 0b00001110, + 0b00010001, + 0b00010000, + 0b00010000, + 0b00010000, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x43 C + { + 0b00011110, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00011110, + 0b00000000, + }, // 0x44 D + { + 0b00011111, + 0b00010000, + 0b00010000, + 0b00011110, + 0b00010000, + 0b00010000, + 0b00011111, + 0b00000000, + }, // 0x45 E + { + 0b00011111, + 0b00010000, + 0b00010000, + 0b00011110, + 0b00010000, + 0b00010000, + 0b00010000, + 0b00000000, + }, // 0x46 F + { + 0b00001110, + 0b00010001, + 0b00010000, + 0b00010111, + 0b00010001, + 0b00010001, + 0b00001111, + 0b00000000, + }, // 0x47 G + { + 0b00010001, + 0b00010001, + 0b00010001, + 0b00011111, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00000000, + }, // 0x48 H + { + 0b00001110, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00001110, + 0b00000000, + }, // 0x49 I + { + 0b00000001, + 0b00000001, + 0b00000001, + 0b00000001, + 0b00010001, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x4A J + { + 0b00010001, + 0b00010010, + 0b00010100, + 0b00011000, + 0b00010100, + 0b00010010, + 0b00010001, + 0b00000000, + }, // 0x4B K + { + 0b00010000, + 0b00010000, + 0b00010000, + 0b00010000, + 0b00010000, + 0b00010000, + 0b00011111, + 0b00000000, + }, // 0x4C L + { + 0b00010001, + 0b00011011, + 0b00010101, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00000000, + }, // 0x4D M + { + 0b00010001, + 0b00011001, + 0b00010101, + 0b00010011, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00000000, + }, // 0x4E N + { + 0b00001110, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x4F O + { + 0b00011110, + 0b00010001, + 0b00010001, + 0b00011110, + 0b00010000, + 0b00010000, + 0b00010000, + 0b00000000, + }, // 0x50 P + { + 0b00001110, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00010101, + 0b00010010, + 0b00001101, + 0b00000000, + }, // 0x51 Q + { + 0b00011110, + 0b00010001, + 0b00010001, + 0b00011110, + 0b00010010, + 0b00010001, + 0b00010001, + 0b00000000, + }, // 0x52 R + { + 0b00001110, + 0b00010001, + 0b00010000, + 0b00001110, + 0b00000001, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x53 S + { + 0b00011111, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000000, + }, // 0x54 T + { + 0b00010001, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x55 U + { + 0b00010001, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00001010, + 0b00000100, + 0b00000000, + }, // 0x56 V + { + 0b00010001, + 0b00010001, + 0b00010101, + 0b00010101, + 0b00010101, + 0b00010101, + 0b00001010, + 0b00000000, + }, // 0x57 W + { + 0b00010001, + 0b00010001, + 0b00001010, + 0b00000100, + 0b00001010, + 0b00010001, + 0b00010001, + 0b00000000, + }, // 0x58 X + { + 0b00010001, + 0b00010001, + 0b00010001, + 0b00001010, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000000, + }, // 0x59 Y + { + 0b00011110, + 0b00000010, + 0b00000100, + 0b00001000, + 0b00010000, + 0b00010000, + 0b00011110, + 0b00000000, + }, // 0x5A Z + { + 0b00001110, + 0b00001000, + 0b00001000, + 0b00001000, + 0b00001000, + 0b00001000, + 0b00001110, + 0b00000000, + }, // 0x5B [ + { + 0b00000000, + 0b00010000, + 0b00001000, + 0b00000100, + 0b00000010, + 0b00000001, + 0b00000000, + 0b00000000, + }, // 0x5C backslash + { + 0b00001110, + 0b00000010, + 0b00000010, + 0b00000010, + 0b00000010, + 0b00000010, + 0b00001110, + 0b00000000, + }, // 0x5D ] + { + 0b00000100, + 0b00001010, + 0b00010001, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x5E ^ + { + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00111111, + }, // 0x5F _ + { + 0b00001100, + 0b00001100, + 0b00000100, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x60 ` + { + 0b00000000, + 0b00000000, + 0b00001110, + 0b00000001, + 0b00001111, + 0b00010001, + 0b00001111, + 0b00000000, + }, // 0x61 a + { + 0b00010000, + 0b00010000, + 0b00011110, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00011110, + 0b00000000, + }, // 0x62 b + { + 0b00000000, + 0b00000000, + 0b00001110, + 0b00010001, + 0b00010000, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x63 c + { + 0b00000001, + 0b00000001, + 0b00001111, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00001111, + 0b00000000, + }, // 0x64 d + { + 0b00000000, + 0b00000000, + 0b00001110, + 0b00010001, + 0b00011110, + 0b00010000, + 0b00001110, + 0b00000000, + }, // 0x65 e + { + 0b00000110, + 0b00001000, + 0b00001000, + 0b00011110, + 0b00001000, + 0b00001000, + 0b00001000, + 0b00000000, + }, // 0x66 f + { + 0b00000000, + 0b00000000, + 0b00001111, + 0b00010001, + 0b00010001, + 0b00001111, + 0b00000001, + 0b00001110, + }, // 0x67 g + { + 0b00010000, + 0b00010000, + 0b00011100, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00000000, + }, // 0x68 h + { + 0b00000100, + 0b00000000, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000110, + 0b00000000, + }, // 0x69 i + { + 0b00000010, + 0b00000000, + 0b00000110, + 0b00000010, + 0b00000010, + 0b00000010, + 0b00010010, + 0b00001100, + }, // 0x6A j + { + 0b00010000, + 0b00010000, + 0b00010010, + 0b00010100, + 0b00011000, + 0b00010100, + 0b00010010, + 0b00000000, + }, // 0x6B k + { + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000110, + 0b00000000, + }, // 0x6C l + { + 0b00000000, + 0b00000000, + 0b00011010, + 0b00010101, + 0b00010101, + 0b00010001, + 0b00010001, + 0b00000000, + }, // 0x6D m + { + 0b00000000, + 0b00000000, + 0b00011100, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00000000, + }, // 0x6E n + { + 0b00000000, + 0b00000000, + 0b00001110, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00001110, + 0b00000000, + }, // 0x6F o + { + 0b00000000, + 0b00000000, + 0b00011110, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00011110, + 0b00010000, + }, // 0x70 p + { + 0b00000000, + 0b00000000, + 0b00001111, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00001111, + 0b00000001, + }, // 0x71 q + { + 0b00000000, + 0b00000000, + 0b00010110, + 0b00001001, + 0b00001000, + 0b00001000, + 0b00011100, + 0b00000000, + }, // 0x72 r + { + 0b00000000, + 0b00000000, + 0b00001110, + 0b00010000, + 0b00001110, + 0b00000001, + 0b00001110, + 0b00000000, + }, // 0x73 s + { + 0b00000000, + 0b00001000, + 0b00011110, + 0b00001000, + 0b00001000, + 0b00001010, + 0b00000100, + 0b00000000, + }, // 0x74 t + { + 0b00000000, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00010110, + 0b00001010, + 0b00000000, + }, // 0x75 u + { + 0b00000000, + 0b00000000, + 0b00010001, + 0b00010001, + 0b00010001, + 0b00001010, + 0b00000100, + 0b00000000, + }, // 0x76 v + { + 0b00000000, + 0b00000000, + 0b00010001, + 0b00010001, + 0b00010101, + 0b00011111, + 0b00001010, + 0b00000000, + }, // 0x77 w + { + 0b00000000, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00001100, + 0b00010010, + 0b00010010, + 0b00000000, + }, // 0x78 x + { + 0b00000000, + 0b00000000, + 0b00010010, + 0b00010010, + 0b00010010, + 0b00001110, + 0b00000100, + 0b00011000, + }, // 0x79 y + { + 0b00000000, + 0b00000000, + 0b00011110, + 0b00000010, + 0b00001100, + 0b00010000, + 0b00011110, + 0b00000000, + }, // 0x7A z + { + 0b00000110, + 0b00001000, + 0b00001000, + 0b00011000, + 0b00001000, + 0b00001000, + 0b00000110, + 0b00000000, + }, // 0x7B { + { + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000000, + 0b00000100, + 0b00000100, + 0b00000100, + 0b00000000, + }, // 0x7C | + { + 0b00001100, + 0b00000010, + 0b00000010, + 0b00000011, + 0b00000010, + 0b00000010, + 0b00001100, + 0b00000000, + }, // 0x7D } + { + 0b00001010, + 0b00010100, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + }, // 0x7E ~ + { + 0b00000100, + 0b00001110, + 0b00011011, + 0b00010001, + 0b00010001, + 0b00011111, + 0b00000000, + 0b00000000, + }, // 0x7F ␡ +}; + +#endif // font_6x8_base_h \ No newline at end of file diff --git a/lib/lib_display/LedControl/src/font_6x8_horizontal_MSB.h b/lib/lib_display/LedControl/src/font_6x8_horizontal_MSB.h deleted file mode 100644 index e5c522cd4..000000000 --- a/lib/lib_display/LedControl/src/font_6x8_horizontal_MSB.h +++ /dev/null @@ -1,267 +0,0 @@ -// 6x8 ascii font -#ifndef font_6x8_horizontal_MSB_h -#define font_6x8_horizontal_MSB_h - -const unsigned int font_char_width = 6; -const unsigned int font_char_height = 8; - -const char font[256][8]={ -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x00 -{0x0E,0x11,0x1B,0x11,0x15,0x11,0x0E,0x00}, // 0x01 -{0x0E,0x1F,0x15,0x1F,0x11,0x1F,0x0E,0x00}, // 0x02 -{0x00,0x0A,0x1F,0x1F,0x1F,0x0E,0x04,0x00}, // 0x03 -{0x00,0x04,0x0E,0x1F,0x1F,0x0E,0x04,0x00}, // 0x04 -{0x04,0x0E,0x0E,0x04,0x1F,0x1F,0x04,0x00}, // 0x05 -{0x00,0x04,0x0E,0x1F,0x1F,0x04,0x0E,0x00}, // 0x06 -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x07 -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x08 -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x09 -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0A -{0x00,0x07,0x03,0x0D,0x12,0x12,0x0C,0x00}, // 0x0B -{0x0E,0x11,0x11,0x0E,0x04,0x0E,0x04,0x00}, // 0x0C -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0D -{0x03,0x0D,0x0B,0x0D,0x0B,0x1B,0x18,0x00}, // 0x0E -{0x00,0x15,0x0E,0x1B,0x0E,0x15,0x00,0x00}, // 0x0F -{0x08,0x0C,0x0E,0x0F,0x0E,0x0C,0x08,0x00}, // 0x10 -{0x02,0x06,0x0E,0x1E,0x0E,0x06,0x02,0x00}, // 0x11 -{0x04,0x0E,0x1F,0x04,0x1F,0x0E,0x04,0x00}, // 0x12 -{0x0A,0x0A,0x0A,0x0A,0x0A,0x00,0x0A,0x00}, // 0x13 -{0x0F,0x15,0x15,0x0D,0x05,0x05,0x05,0x00}, // 0x14 -{0x0E,0x11,0x0C,0x0A,0x06,0x11,0x0E,0x00}, // 0x15 -{0x00,0x00,0x00,0x00,0x00,0x1E,0x1E,0x00}, // 0x16 -{0x04,0x0E,0x1F,0x04,0x1F,0x0E,0x04,0x0E}, // 0x17 -{0x04,0x0E,0x1F,0x04,0x04,0x04,0x04,0x00}, // 0x18 -{0x04,0x04,0x04,0x04,0x1F,0x0E,0x04,0x00}, // 0x19 -{0x00,0x04,0x06,0x1F,0x06,0x04,0x00,0x00}, // 0x1A -{0x00,0x04,0x0C,0x1F,0x0C,0x04,0x00,0x00}, // 0x1B -{0x00,0x00,0x00,0x10,0x10,0x10,0x1F,0x00}, // 0x1C -{0x00,0x0A,0x0A,0x1F,0x0A,0x0A,0x00,0x00}, // 0x1D -{0x04,0x04,0x0E,0x0E,0x1F,0x1F,0x00,0x00}, // 0x1E -{0x1F,0x1F,0x0E,0x0E,0x04,0x04,0x00,0x00}, // 0x1F -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x20 -{0x04,0x0E,0x0E,0x04,0x04,0x00,0x04,0x00}, // 0x21 -{0x1B,0x1B,0x12,0x00,0x00,0x00,0x00,0x00}, // 0x22 -{0x00,0x0A,0x1F,0x0A,0x0A,0x1F,0x0A,0x00}, // 0x23 -{0x08,0x0E,0x10,0x0C,0x02,0x1C,0x04,0x00}, // 0x24 -{0x19,0x19,0x02,0x04,0x08,0x13,0x13,0x00}, // 0x25 -{0x08,0x14,0x14,0x08,0x15,0x12,0x0D,0x00}, // 0x26 -{0x0C,0x0C,0x08,0x00,0x00,0x00,0x00,0x00}, // 0x27 -{0x04,0x08,0x08,0x08,0x08,0x08,0x04,0x00}, // 0x28 -{0x08,0x04,0x04,0x04,0x04,0x04,0x08,0x00}, // 0x29 -{0x00,0x0A,0x0E,0x1F,0x0E,0x0A,0x00,0x00}, // 0x2A -{0x00,0x04,0x04,0x1F,0x04,0x04,0x00,0x00}, // 0x2B -{0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x08}, // 0x2C -{0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00}, // 0x2D -{0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x00}, // 0x2E -{0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00}, // 0x2F -{0x0E,0x11,0x13,0x15,0x19,0x11,0x0E,0x00}, // 0x30 -{0x04,0x0C,0x04,0x04,0x04,0x04,0x0E,0x00}, // 0x31 -{0x0E,0x11,0x01,0x06,0x08,0x10,0x1F,0x00}, // 0x32 -{0x0E,0x11,0x01,0x0E,0x01,0x11,0x0E,0x00}, // 0x33 -{0x02,0x06,0x0A,0x12,0x1F,0x02,0x02,0x00}, // 0x34 -{0x1F,0x10,0x10,0x1E,0x01,0x11,0x0E,0x00}, // 0x35 -{0x06,0x08,0x10,0x1E,0x11,0x11,0x0E,0x00}, // 0x36 -{0x1F,0x01,0x02,0x04,0x08,0x08,0x08,0x00}, // 0x37 -{0x0E,0x11,0x11,0x0E,0x11,0x11,0x0E,0x00}, // 0x38 -{0x0E,0x11,0x11,0x0F,0x01,0x02,0x0C,0x00}, // 0x39 -{0x00,0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x00}, // 0x3A -{0x00,0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x08}, // 0x3B -{0x02,0x04,0x08,0x10,0x08,0x04,0x02,0x00}, // 0x3C -{0x00,0x00,0x1F,0x00,0x00,0x1F,0x00,0x00}, // 0x3D -{0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x00}, // 0x3E -{0x0E,0x11,0x01,0x06,0x04,0x00,0x04,0x00}, // 0x3F -{0x0E,0x11,0x17,0x15,0x17,0x10,0x0E,0x00}, // 0x40 -{0x0E,0x11,0x11,0x11,0x1F,0x11,0x11,0x00}, // 0x41 -{0x1E,0x11,0x11,0x1E,0x11,0x11,0x1E,0x00}, // 0x42 -{0x0E,0x11,0x10,0x10,0x10,0x11,0x0E,0x00}, // 0x43 -{0x1E,0x11,0x11,0x11,0x11,0x11,0x1E,0x00}, // 0x44 -{0x1F,0x10,0x10,0x1E,0x10,0x10,0x1F,0x00}, // 0x45 -{0x1F,0x10,0x10,0x1E,0x10,0x10,0x10,0x00}, // 0x46 -{0x0E,0x11,0x10,0x17,0x11,0x11,0x0F,0x00}, // 0x47 -{0x11,0x11,0x11,0x1F,0x11,0x11,0x11,0x00}, // 0x48 -{0x0E,0x04,0x04,0x04,0x04,0x04,0x0E,0x00}, // 0x49 -{0x01,0x01,0x01,0x01,0x11,0x11,0x0E,0x00}, // 0x4A -{0x11,0x12,0x14,0x18,0x14,0x12,0x11,0x00}, // 0x4B -{0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0x00}, // 0x4C -{0x11,0x1B,0x15,0x11,0x11,0x11,0x11,0x00}, // 0x4D -{0x11,0x19,0x15,0x13,0x11,0x11,0x11,0x00}, // 0x4E -{0x0E,0x11,0x11,0x11,0x11,0x11,0x0E,0x00}, // 0x4F -{0x1E,0x11,0x11,0x1E,0x10,0x10,0x10,0x00}, // 0x50 -{0x0E,0x11,0x11,0x11,0x15,0x12,0x0D,0x00}, // 0x51 -{0x1E,0x11,0x11,0x1E,0x12,0x11,0x11,0x00}, // 0x52 -{0x0E,0x11,0x10,0x0E,0x01,0x11,0x0E,0x00}, // 0x53 -{0x1F,0x04,0x04,0x04,0x04,0x04,0x04,0x00}, // 0x54 -{0x11,0x11,0x11,0x11,0x11,0x11,0x0E,0x00}, // 0x55 -{0x11,0x11,0x11,0x11,0x11,0x0A,0x04,0x00}, // 0x56 -{0x11,0x11,0x15,0x15,0x15,0x15,0x0A,0x00}, // 0x57 -{0x11,0x11,0x0A,0x04,0x0A,0x11,0x11,0x00}, // 0x58 -{0x11,0x11,0x11,0x0A,0x04,0x04,0x04,0x00}, // 0x59 -{0x1E,0x02,0x04,0x08,0x10,0x10,0x1E,0x00}, // 0x5A -{0x0E,0x08,0x08,0x08,0x08,0x08,0x0E,0x00}, // 0x5B -{0x00,0x10,0x08,0x04,0x02,0x01,0x00,0x00}, // 0x5C -{0x0E,0x02,0x02,0x02,0x02,0x02,0x0E,0x00}, // 0x5D -{0x04,0x0A,0x11,0x00,0x00,0x00,0x00,0x00}, // 0x5E -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F}, // 0x5F -{0x0C,0x0C,0x04,0x00,0x00,0x00,0x00,0x00}, // 0x60 -{0x00,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x61 -{0x10,0x10,0x1E,0x11,0x11,0x11,0x1E,0x00}, // 0x62 -{0x00,0x00,0x0E,0x11,0x10,0x11,0x0E,0x00}, // 0x63 -{0x01,0x01,0x0F,0x11,0x11,0x11,0x0F,0x00}, // 0x64 -{0x00,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x65 -{0x06,0x08,0x08,0x1E,0x08,0x08,0x08,0x00}, // 0x66 -{0x00,0x00,0x0F,0x11,0x11,0x0F,0x01,0x0E}, // 0x67 -{0x10,0x10,0x1C,0x12,0x12,0x12,0x12,0x00}, // 0x68 -{0x04,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x69 -{0x02,0x00,0x06,0x02,0x02,0x02,0x12,0x0C}, // 0x6A -{0x10,0x10,0x12,0x14,0x18,0x14,0x12,0x00}, // 0x6B -{0x04,0x04,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x6C -{0x00,0x00,0x1A,0x15,0x15,0x11,0x11,0x00}, // 0x6D -{0x00,0x00,0x1C,0x12,0x12,0x12,0x12,0x00}, // 0x6E -{0x00,0x00,0x0E,0x11,0x11,0x11,0x0E,0x00}, // 0x6F -{0x00,0x00,0x1E,0x11,0x11,0x11,0x1E,0x10}, // 0x70 -{0x00,0x00,0x0F,0x11,0x11,0x11,0x0F,0x01}, // 0x71 -{0x00,0x00,0x16,0x09,0x08,0x08,0x1C,0x00}, // 0x72 -{0x00,0x00,0x0E,0x10,0x0E,0x01,0x0E,0x00}, // 0x73 -{0x00,0x08,0x1E,0x08,0x08,0x0A,0x04,0x00}, // 0x74 -{0x00,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x75 -{0x00,0x00,0x11,0x11,0x11,0x0A,0x04,0x00}, // 0x76 -{0x00,0x00,0x11,0x11,0x15,0x1F,0x0A,0x00}, // 0x77 -{0x00,0x00,0x12,0x12,0x0C,0x12,0x12,0x00}, // 0x78 -{0x00,0x00,0x12,0x12,0x12,0x0E,0x04,0x18}, // 0x79 -{0x00,0x00,0x1E,0x02,0x0C,0x10,0x1E,0x00}, // 0x7A -{0x06,0x08,0x08,0x18,0x08,0x08,0x06,0x00}, // 0x7B -{0x04,0x04,0x04,0x00,0x04,0x04,0x04,0x00}, // 0x7C -{0x0C,0x02,0x02,0x03,0x02,0x02,0x0C,0x00}, // 0x7D -{0x0A,0x14,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x7E -{0x04,0x0E,0x1B,0x11,0x11,0x1F,0x00,0x00}, // 0x7F -{0x0E,0x11,0x10,0x10,0x11,0x0E,0x04,0x0C}, // 0x80 -{0x12,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x81 -{0x03,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x82 -{0x0E,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x83 -{0x0A,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x84 -{0x0C,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x85 -{0x0E,0x0A,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0x86 -{0x00,0x0E,0x11,0x10,0x11,0x0E,0x04,0x0C}, // 0x87 -{0x0E,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x88 -{0x0A,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x89 -{0x0C,0x00,0x0E,0x11,0x1E,0x10,0x0E,0x00}, // 0x8A -{0x0A,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x8B -{0x0E,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x8C -{0x08,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0x8D -{0x0A,0x00,0x04,0x0A,0x11,0x1F,0x11,0x00}, // 0x8E -{0x0E,0x0A,0x0E,0x1B,0x11,0x1F,0x11,0x00}, // 0x8F -{0x03,0x00,0x1F,0x10,0x1E,0x10,0x1F,0x00}, // 0x90 -{0x00,0x00,0x1E,0x05,0x1F,0x14,0x0F,0x00}, // 0x91 -{0x0F,0x14,0x14,0x1F,0x14,0x14,0x17,0x00}, // 0x92 -{0x0E,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0x93 -{0x0A,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0x94 -{0x18,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0x95 -{0x0E,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x96 -{0x18,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0x97 -{0x0A,0x00,0x12,0x12,0x12,0x0E,0x04,0x18}, // 0x98 -{0x12,0x0C,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0x99 -{0x0A,0x00,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0x9A -{0x00,0x00,0x01,0x0E,0x16,0x1A,0x1C,0x20}, // 0x9B -{0x06,0x09,0x08,0x1E,0x08,0x09,0x17,0x00}, // 0x9C -{0x0F,0x13,0x15,0x15,0x15,0x19,0x1E,0x00}, // 0x9D -{0x00,0x11,0x0A,0x04,0x0A,0x11,0x00,0x00}, // 0x9E -{0x02,0x05,0x04,0x0E,0x04,0x04,0x14,0x08}, // 0x9F -{0x06,0x00,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0xA0 -{0x06,0x00,0x04,0x04,0x04,0x04,0x06,0x00}, // 0xA1 -{0x06,0x00,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0xA2 -{0x06,0x00,0x12,0x12,0x12,0x16,0x0A,0x00}, // 0xA3 -{0x0A,0x14,0x00,0x1C,0x12,0x12,0x12,0x00}, // 0xA4 -{0x0A,0x14,0x00,0x12,0x1A,0x16,0x12,0x00}, // 0xA5 -{0x0E,0x01,0x0F,0x11,0x0F,0x00,0x0F,0x00}, // 0xA6 -{0x0C,0x12,0x12,0x12,0x0C,0x00,0x1E,0x00}, // 0xA7 -{0x04,0x00,0x04,0x0C,0x10,0x11,0x0E,0x00}, // 0xA8 -{0x1E,0x25,0x2B,0x2D,0x2B,0x21,0x1E,0x00}, // 0xA9 -{0x00,0x00,0x3F,0x01,0x01,0x00,0x00,0x00}, // 0xAA -{0x10,0x12,0x14,0x0E,0x11,0x02,0x07,0x00}, // 0xAB -{0x10,0x12,0x14,0x0B,0x15,0x07,0x01,0x00}, // 0xAC -{0x04,0x00,0x04,0x04,0x0E,0x0E,0x04,0x00}, // 0xAD -{0x00,0x00,0x09,0x12,0x09,0x00,0x00,0x00}, // 0xAE -{0x00,0x00,0x12,0x09,0x12,0x00,0x00,0x00}, // 0xAF -{0x15,0x00,0x2A,0x00,0x15,0x00,0x2A,0x00}, // 0xB0 -{0x15,0x2A,0x15,0x2A,0x15,0x2A,0x15,0x2A}, // 0xB1 -{0x2A,0x3F,0x15,0x3F,0x2A,0x3F,0x15,0x3F}, // 0xB2 -{0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04}, // 0xB3 -{0x04,0x04,0x04,0x3C,0x04,0x04,0x04,0x04}, // 0xB4 -{0x06,0x00,0x04,0x0A,0x11,0x1F,0x11,0x00}, // 0xB5 -{0x0E,0x00,0x04,0x0A,0x11,0x1F,0x11,0x00}, // 0xB6 -{0x0C,0x00,0x04,0x0A,0x11,0x1F,0x11,0x00}, // 0xB7 -{0x1E,0x21,0x2D,0x29,0x2D,0x21,0x1E,0x00}, // 0xB8 -{0x14,0x34,0x04,0x34,0x14,0x14,0x14,0x14}, // 0xB9 -{0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14}, // 0xBA -{0x00,0x3C,0x04,0x34,0x14,0x14,0x14,0x14}, // 0xBB -{0x14,0x34,0x04,0x3C,0x00,0x00,0x00,0x00}, // 0xBC -{0x00,0x04,0x0E,0x10,0x10,0x0E,0x04,0x00}, // 0xBD -{0x11,0x0A,0x04,0x1F,0x04,0x1F,0x04,0x00}, // 0xBE -{0x00,0x00,0x00,0x3C,0x04,0x04,0x04,0x04}, // 0xBF -{0x04,0x04,0x04,0x07,0x00,0x00,0x00,0x00}, // 0xC0 -{0x04,0x04,0x04,0x3F,0x00,0x00,0x00,0x00}, // 0xC1 -{0x00,0x00,0x00,0x3F,0x04,0x04,0x04,0x04}, // 0xC2 -{0x04,0x04,0x04,0x07,0x04,0x04,0x04,0x04}, // 0xC3 -{0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00}, // 0xC4 -{0x04,0x04,0x04,0x3F,0x04,0x04,0x04,0x04}, // 0xC5 -{0x05,0x0A,0x0E,0x01,0x0F,0x11,0x0F,0x00}, // 0xC6 -{0x05,0x0A,0x04,0x0A,0x11,0x1F,0x11,0x00}, // 0xC7 -{0x14,0x17,0x10,0x1F,0x00,0x00,0x00,0x00}, // 0xC8 -{0x00,0x1F,0x10,0x17,0x14,0x14,0x14,0x14}, // 0xC9 -{0x14,0x37,0x00,0x3F,0x00,0x00,0x00,0x00}, // 0xCA -{0x00,0x3F,0x00,0x37,0x14,0x14,0x14,0x14}, // 0xCB -{0x14,0x17,0x10,0x17,0x14,0x14,0x14,0x14}, // 0xCC -{0x00,0x3F,0x00,0x3F,0x00,0x00,0x00,0x00}, // 0xCD -{0x14,0x37,0x00,0x37,0x14,0x14,0x14,0x14}, // 0xCE -{0x11,0x0E,0x11,0x11,0x11,0x0E,0x11,0x00}, // 0xCF -{0x0C,0x10,0x08,0x04,0x0E,0x12,0x0C,0x00}, // 0xD0 -{0x0E,0x09,0x09,0x1D,0x09,0x09,0x0E,0x00}, // 0xD1 -{0x0E,0x00,0x1F,0x10,0x1E,0x10,0x1F,0x00}, // 0xD2 -{0x0A,0x00,0x1F,0x10,0x1E,0x10,0x1F,0x00}, // 0xD3 -{0x0C,0x00,0x1F,0x10,0x1E,0x10,0x1F,0x00}, // 0xD4 -{0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00}, // 0xD5 -{0x06,0x00,0x0E,0x04,0x04,0x04,0x0E,0x00}, // 0xD6 -{0x0E,0x00,0x0E,0x04,0x04,0x04,0x0E,0x00}, // 0xD7 -{0x0A,0x00,0x0E,0x04,0x04,0x04,0x0E,0x00}, // 0xD8 -{0x04,0x04,0x04,0x3C,0x00,0x00,0x00,0x00}, // 0xD9 -{0x00,0x00,0x00,0x07,0x04,0x04,0x04,0x04}, // 0xDA -{0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F}, // 0xDB -{0x00,0x00,0x00,0x00,0x3F,0x3F,0x3F,0x3F}, // 0xDC -{0x04,0x04,0x04,0x00,0x04,0x04,0x04,0x00}, // 0xDD -{0x0C,0x00,0x0E,0x04,0x04,0x04,0x0E,0x00}, // 0xDE -{0x3F,0x3F,0x3F,0x3F,0x00,0x00,0x00,0x00}, // 0xDF -{0x06,0x0C,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0xE0 -{0x00,0x1C,0x12,0x1C,0x12,0x12,0x1C,0x10}, // 0xE1 -{0x0E,0x0C,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0xE2 -{0x18,0x0C,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0xE3 -{0x0A,0x14,0x00,0x0C,0x12,0x12,0x0C,0x00}, // 0xE4 -{0x0A,0x14,0x0C,0x12,0x12,0x12,0x0C,0x00}, // 0xE5 -{0x00,0x00,0x12,0x12,0x12,0x1C,0x10,0x10}, // 0xE6 -{0x00,0x18,0x10,0x1C,0x12,0x1C,0x10,0x18}, // 0xE7 -{0x18,0x10,0x1C,0x12,0x12,0x1C,0x10,0x18}, // 0xE8 -{0x06,0x00,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0xE9 -{0x0E,0x00,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0xEA -{0x18,0x00,0x12,0x12,0x12,0x12,0x0C,0x00}, // 0xEB -{0x06,0x00,0x12,0x12,0x12,0x0E,0x04,0x18}, // 0xEC -{0x06,0x00,0x11,0x0A,0x04,0x04,0x04,0x00}, // 0xED -{0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xEE -{0x0C,0x0C,0x08,0x00,0x00,0x00,0x00,0x00}, // 0xEF -{0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00}, // 0xF0 -{0x00,0x04,0x0E,0x04,0x00,0x0E,0x00,0x00}, // 0xF1 -{0x00,0x00,0x1F,0x00,0x00,0x1F,0x00,0x00}, // 0xF2 -{0x30,0x1A,0x34,0x0B,0x15,0x07,0x01,0x00}, // 0xF3 -{0x0F,0x15,0x15,0x0D,0x05,0x05,0x05,0x00}, // 0xF4 -{0x0E,0x11,0x0C,0x0A,0x06,0x11,0x0E,0x00}, // 0xF5 -{0x00,0x04,0x00,0x1F,0x00,0x04,0x00,0x00}, // 0xF6 -{0x00,0x00,0x00,0x0E,0x06,0x00,0x00,0x00}, // 0xF7 -{0x0C,0x12,0x12,0x0C,0x00,0x00,0x00,0x00}, // 0xF8 -{0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x00}, // 0xF9 -{0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00}, // 0xFA -{0x08,0x18,0x08,0x08,0x00,0x00,0x00,0x00}, // 0xFB -{0x1C,0x08,0x0C,0x18,0x00,0x00,0x00,0x00}, // 0xFC -{0x18,0x04,0x08,0x1C,0x00,0x00,0x00,0x00}, // 0xFD -{0x00,0x00,0x1E,0x1E,0x1E,0x1E,0x00,0x00}, // 0xFE -{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // 0xFF -}; - -#endif \ No newline at end of file diff --git a/tasmota/xdsp_19_max7219_matrix.ino b/tasmota/xdsp_19_max7219_matrix.ino index ecf500670..3e1a5c258 100644 --- a/tasmota/xdsp_19_max7219_matrix.ino +++ b/tasmota/xdsp_19_max7219_matrix.ino @@ -39,7 +39,7 @@ Once the GPIO configuration is saved and the ESP8266/ESP32 module restarts, set the Display Model to 19 and Display Mode to 0 - Depending on order oth the wired 8x8 matrix modules you have got a display of size pixel_width x pixel_height. + Depending on order of the wired 8x8 matrix modules you have got a display of size pixel_width x pixel_height. The size has to be set with the commands "DisplayWidth " and "DisplayHeight " After the ESP8266/ESP32 module restarts again, turn ON the display with the command "Power 1" @@ -55,6 +55,10 @@ DisplayDimmer [0..100] Sets the intensity of the display. + DisplayBlinkrate [0..3] + 0: not blinking + 1: slow, 2: medium 3: fast blinking + Power [ON|OFF] Sitches the display on or off. When "off", the display buffer is not cleared and will be shown again when after "Power ON". Other display commands are still active when off. @@ -72,13 +76,18 @@ DisplayHeight [8..256] Sets the pixel height of the display (8x number of module rows) + DisplayRotate [0|2] + 0: normal orientation; devide 0 starts at top left + 2: upside down; device 0 starts at bottom right + DisplayClock [0|1|2] Displays a clock. Commands "DisplayClock 1" // 12 hr format "DisplayClock 2" // 24 hr format - "DisplayClock 0" // turn off clock - + "DisplayClock 0" // turn off clock; please use additional cammand: DisplayMode 0 + If you would like to use the UTF8 latin1 character set, it cam be added by copile option: + #define USE_UTF8_LATIN1 \*********************************************************************************************/ @@ -86,10 +95,6 @@ #include -#ifdef USE_DISPLAY_MODES1TO5 -#include -#endif - LedMatrix *max7219_Matrix = nullptr; bool max2791Matrix_initDriver_done = false; struct @@ -99,7 +104,9 @@ struct byte scroll_delay = 0; byte scroll_iteration = 0; bool show_clock = false; - const char *timeFormat; + bool timeFormat24 = true; + byte blink_delay = 0; // 0: not blinking + byte blink_iteration = 0; } LedMatrix_settings; @@ -138,7 +145,8 @@ bool MAX7291Matrix_initDriver(void) bool MAX7291Matrix_init(void) { Settings->display_mode = 0; // text mode - LedMatrix_settings.show_clock = 0; // no clock + LedMatrix_settings.show_clock = 0; // no + LedMatrix_settings.blink_delay = 0; // no blinking int intensity = GetDisplayDimmer16(); // 0..15 max7219_Matrix->setIntensity(intensity); @@ -158,6 +166,13 @@ bool MAX7291Matrix_init(void) return true; } +bool MAX7291Matrix_setText(bool clearBefore=true) +{ + if(Settings->display_mode != 0) MAX7291Matrix_init(); + LedMatrix_settings.blink_delay = 0; // no blinking + return max7219_Matrix->drawText(XdrvMailbox.data, clearBefore); +} + // FUNC_DISPLAY_SCROLLDELAY bool MAX7291Matrix_scrollDelay(void) { @@ -178,6 +193,8 @@ bool MAX7291Matrix_scrollText(void) // This function is called every 50 ms. // scroll_delay defines the number of cycles to be ignored until the display scrolls by one pixel to the left. // e.g. scrall_delay = 4 causes a scroll each 200 ms. + + if(!max7219_Matrix->isPowerOn()) return false; // do not scroll on power off LedMatrix_settings.scroll_iteration++; if (LedMatrix_settings.scroll_delay) LedMatrix_settings.scroll_iteration = LedMatrix_settings.scroll_iteration % LedMatrix_settings.scroll_delay; @@ -189,6 +206,41 @@ bool MAX7291Matrix_scrollText(void) return max7219_Matrix->scrollText(); } +bool MAX7291Matrix_blink(void) +{ + // This function is called every 50 ms. + // blink_delay defines the number of cycles to be ignored until the blinkstate changes. + if(LedMatrix_settings.blink_delay == 0) return false; + + LedMatrix_settings.blink_iteration++; + if(LedMatrix_settings.blink_iteration == LedMatrix_settings.blink_delay) + { + max7219_Matrix->power(false); + } + else if(LedMatrix_settings.blink_iteration == 2* LedMatrix_settings.blink_delay ) + { + LedMatrix_settings.blink_iteration = 0; + max7219_Matrix->power(true); + } + return true; +} + + +bool MAX7291Matrix_setBlinkRate() +{ + LedMatrix_settings.blink_iteration = 0; + max7219_Matrix->power(true); + if (ArgC() == 0) + { + XdrvMailbox.payload = 0; + } + if (XdrvMailbox.payload) + LedMatrix_settings.blink_delay = 20 / XdrvMailbox.payload; // 1: once per second; 2: twice per second; 3: three times per second + else + LedMatrix_settings.blink_delay = 0; // do not blink + return true; +} + #ifdef USE_DISPLAY_MODES1TO5 // FUNC_DISPLAY_CLOCK bool MAX7291Matrix_clock(void) @@ -204,29 +256,19 @@ bool MAX7291Matrix_clock(void) return true; case 1: // 12 h clock - LedMatrix_settings.timeFormat = "%I:%M"; - if(LedMatrix_settings.modulesPerRow > 6) - { - LedMatrix_settings.timeFormat = "%I:%M:%S"; - } + LedMatrix_settings.timeFormat24 = false; Settings->display_mode = 1; break; case 2: // 24 h clock - LedMatrix_settings.timeFormat = "%H:%M"; - if(LedMatrix_settings.modulesPerRow > 6) - { - LedMatrix_settings.timeFormat = "%H:%M:%S"; - } + LedMatrix_settings.timeFormat24 = true; Settings->display_mode = 1; break; default: - //LedMatrix_settings.timeFormat = XdrvMailbox.payload; - //Settings->display_mode = 1; return false; } - AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: LedMatrix_settings.show_clock %d, timeFormat %s"), LedMatrix_settings.show_clock, LedMatrix_settings.timeFormat); + AddLog(LOG_LEVEL_DEBUG, PSTR("MTX: LedMatrix_settings.show_clock %d, 24h: %b"), LedMatrix_settings.show_clock, LedMatrix_settings.timeFormat24); max7219_Matrix->clearDisplay(); MAX7291Matrix_showTime(); @@ -236,17 +278,30 @@ bool MAX7291Matrix_clock(void) // FUNC_DISPLAY_EVERY_SECOND bool MAX7291Matrix_showTime() { - time_t rawtime; - struct tm *timeinfo; + if(!LedMatrix_settings.show_clock) return false; + + uint8_t hr = RtcTime.hour; + uint8_t mn = RtcTime.minute; + uint8_t sc = RtcTime.second; char timeStr[10]; + if(!LedMatrix_settings.timeFormat24) + { + if(hr == 0) hr = 12; + if(hr > 12 ) hr -= 12; + } - time(&rawtime); - timeinfo = localtime(&rawtime); - strftime(timeStr, 10, LedMatrix_settings.timeFormat, timeinfo); - + if(LedMatrix_settings.modulesPerRow >= 6) + { + snprintf(timeStr, 10, "%02d:%02d:%02d", hr , mn, sc); + } + else + { + snprintf(timeStr, 10, "%02d:%02d", hr , mn); + } max7219_Matrix->drawText(timeStr, false); // false: do not clear desplay on update to prevent flicker return true; } + #endif // USE_DISPLAY_MODES1TO5 @@ -280,17 +335,21 @@ bool Xdsp19(uint8_t function) case FUNC_DISPLAY_DRAW_STRING: case FUNC_DISPLAY_SCROLLTEXT: case FUNC_DISPLAY_SEVENSEG_TEXT: - if(Settings->display_mode != 0) MAX7291Matrix_init(); - result = max7219_Matrix->drawText(XdrvMailbox.data, true); // true: clears display before drawing text + result = MAX7291Matrix_setText(true); // true: clears display before drawing text break; case FUNC_DISPLAY_SEVENSEG_TEXTNC: - if(Settings->display_mode != 0) MAX7291Matrix_init(); - result = max7219_Matrix->drawText(XdrvMailbox.data, false); // false: does not clear display before drawing text + result = MAX7291Matrix_setText(false); // false: does not clear display before drawing text break; case FUNC_DISPLAY_SCROLLDELAY: result = MAX7291Matrix_scrollDelay(); break; + case FUNC_DISPLAY_BLINKRATE: + { + result = MAX7291Matrix_setBlinkRate(); + break; + } case FUNC_DISPLAY_EVERY_50_MSECOND: + MAX7291Matrix_blink(); result = MAX7291Matrix_scrollText(); break;