#ifndef SMARTMATRIXPHYSICALMATRIX_H #define SMARTMATRIXPHYSICALMATRIX_H #include "SmartMatrix.h" #include "LEDHAL2D.h" class SmartMatrixPhysicalMatrix : public LEDHAL2D { public: SmartMatrixPhysicalMatrix(SMLayerBackground* _layer, char* ledName, int16_t width, int16_t height): LEDHAL2D(width, height, ledName, true), layer(_layer) {} virtual ~SmartMatrixPhysicalMatrix() {} void drawPixel(int16_t x, int16_t y, CRGB color) { layer->drawPixel(x, y, color); } void setColor(int16_t pixel, CRGB color) { layer->drawPixel(pixel % getHeight(), (int)(pixel / getHeight()), color); } CRGB getColor(int16_t x, int16_t y) { rgb24 value = layer->readPixel(x, y); return CRGB(value.red, value.green, value.blue); } CRGB getColor(int16_t pixel) { rgb24 value = layer->readPixel(pixel % getHeight(), (int)(pixel / getHeight())); return CRGB(value.red, value.green, value.blue); } uint16_t getNumLEDs() { return getWidth() * getHeight(); } protected: void updateLEDs() { layer->swapBuffers(); } private: SMLayerBackground* layer; }; #endif