#ifndef DISPLAY_MATRIX_H #define DISPLAY_MATRIX_H #include #include "DisplayMatrix_FontCommon.h" template class DisplayMatrix { Adafruit_NeoPixel leds; RGB matrix[H][W] = {}; bool dirty = true; public: RGBA foreground = White; RGBA background = Transparent; uint8_t brightness = 10; uint8_t alpha = 255; int cursorX = 0; int cursorY = 0; // basic ---------------------------------------------------------------------------------------- explicit DisplayMatrix(const int pin): leds(W * H, pin) { // } void setup() { leds.begin(); leds.setBrightness(brightness); clear(); } void loop() { if (dirty) { for (auto y = 0; y < H; y++) { for (auto x = 0; x < W; x++) { auto rgb = matrix[y][x]; leds.setPixelColor(y * W + x, rgb.r, rgb.g, rgb.b); } } leds.show(); dirty = false; } } void setBrightness(const uint8_t brightness) { if (leds.getBrightness() != brightness) { leds.setBrightness(brightness); dirty = true; } } // draw ----------------------------------------------------------------------------------------- void clear(); void fillRect(int w = W, int h = H); void drawLine(int w, int h, int thickness = 1); // print ---------------------------------------------------------------------------------------- void printf(const char *format, ...); void print(const char *str); void print(const char **cPP); void print(Symbol1 s); void print(Symbol2 s); void print(Symbol3 s); void print(Symbol4 s); void print(Symbol5 s); void print(bool **s, size_t w, size_t h); void print(SymbolRGBA8x8 s); void print(RGBA **s, size_t w, size_t h); }; // ReSharper disable once CppUnusedIncludeDirective #include // ReSharper disable once CppUnusedIncludeDirective #include #endif