G.U.L.L.S. rebuilt to use PlatformIO
This commit is contained in:
46
include/SmartMatrixPhysicalMatrix.h
Normal file
46
include/SmartMatrixPhysicalMatrix.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef SMARTMATRIXPHYSICALMATRIX_H
|
||||
#define SMARTMATRIXPHYSICALMATRIX_H
|
||||
|
||||
#include "SmartMatrix.h"
|
||||
#include "LEDHAL2D.h"
|
||||
|
||||
class SmartMatrixPhysicalMatrix : public LEDHAL2D {
|
||||
public:
|
||||
SmartMatrixPhysicalMatrix(SMLayerBackground<rgb24, 0>* _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<rgb24, 0>* layer;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user