G.U.L.L.S. rebuilt to use PlatformIO
This commit is contained in:
50
include/LEDHAL.h
Normal file
50
include/LEDHAL.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#ifndef LEDHAL_H
|
||||
#define LEDHAL_H
|
||||
|
||||
#include "FastLED.h"
|
||||
|
||||
class LEDHAL {
|
||||
public:
|
||||
LEDHAL(char* _ledName, bool _isPhysical) :
|
||||
ledName(_ledName), isPhysical(_isPhysical), showRequested(false) {}
|
||||
virtual ~LEDHAL() { delete ledName; }
|
||||
|
||||
virtual char* getLEDName() { return ledName; }
|
||||
|
||||
virtual uint16_t getNumLEDs() = 0;
|
||||
|
||||
virtual bool getIsPhysical() { return isPhysical; }
|
||||
|
||||
virtual CRGB getColor(int16_t pixel) = 0;
|
||||
|
||||
virtual void setColor(int16_t pixel, CRGB color) = 0;
|
||||
|
||||
virtual void requestShow() { showRequested = true; }
|
||||
|
||||
//TODO UnifiedColor should have constants
|
||||
virtual void clearLEDs() {
|
||||
for(uint16_t i = 0; i < getNumLEDs(); i++) {
|
||||
setColor(i, CRGB(0, 0, 0));
|
||||
}
|
||||
};
|
||||
|
||||
void show() {
|
||||
if(showRequested) {
|
||||
updateLEDs();
|
||||
|
||||
showRequested = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void updateLEDs() {};
|
||||
|
||||
private:
|
||||
char*
|
||||
ledName;
|
||||
bool
|
||||
isPhysical,
|
||||
showRequested;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user