42 lines
918 B
C++
42 lines
918 B
C++
#ifndef LOGICALSTRIP_H
|
|
#define LOGICALSTRIP_H
|
|
|
|
#include "LEDHAL.h"
|
|
#include "FastLED.h"
|
|
|
|
class LogicalStrip : public LEDHAL {
|
|
public:
|
|
LogicalStrip(char* _ledName, LEDHAL* _parent, int16_t _startPixel,
|
|
uint16_t _stopPixel) : LEDHAL(_ledName, false), parent(_parent),
|
|
startPixel(_startPixel), stopPixel(_stopPixel) {}
|
|
virtual ~LogicalStrip() {}
|
|
|
|
uint16_t getNumLEDs() { return stopPixel - startPixel; }
|
|
|
|
CRGB getColor(int16_t pixel) {
|
|
return parent->getColor(startPixel + pixel);
|
|
}
|
|
|
|
void setColor(uint16_t pixel, CRGB color) {
|
|
parent->setColor(startPixel + pixel, color);
|
|
}
|
|
|
|
void requestShow() {
|
|
parent->requestShow();
|
|
}
|
|
|
|
protected:
|
|
void updateLEDs() {
|
|
//This does nothing, because show should never be called on
|
|
//a logical strip
|
|
}
|
|
|
|
private:
|
|
LEDHAL*
|
|
parent;
|
|
int16_t
|
|
startPixel,
|
|
stopPixel;
|
|
};
|
|
|
|
#endif |