Library to control NeoPixel strings of RGB leds
Dependents: NeoPixelI2cSlave NeoPixelI2cSlave
Diff: Effects/effect.cpp
- Revision:
- 3:7d32f46a38d3
- Parent:
- 1:f544810b6598
diff -r bb9ebad05691 -r 7d32f46a38d3 Effects/effect.cpp --- a/Effects/effect.cpp Mon Nov 23 21:32:24 2015 +0000 +++ b/Effects/effect.cpp Fri Apr 15 14:38:13 2016 +0000 @@ -2,37 +2,38 @@ namespace Effects { - Effect::Effect(NeoPixelString * pixelstring, int delay_ms) { + Effect::Effect(NeoPixelString * pixelstring, neopixel::Pixel color) { this->pixelstring = pixelstring; - this->delay_ms = delay_ms; + this->color = color; + doExecute = false; + } - execute_effect = false; + void Effect::start(void) { + doExecute = false; + } + + void Effect::stop(void) { + doExecute = false; } NeoPixelString * Effect::getPixelString(void) { return this->pixelstring; } - - void Effect::start(void) { - execute_effect = false; - ticker.attach(this, &Effect::tick, delay_ms/1000.0); + + neopixel::Pixel Effect::getColor(void) { + return color; } - - void Effect::stop(void) { - ticker.detach(); - execute_effect = false; + + void Effect::requestExecute(void) { + doExecute = true; } - - void Effect::tick(void) { - execute_effect = true; + + void Effect::clearExecute(void) { + doExecute = false; } - - void Effect::execute(void) { - execute_effect = false; - } - - bool Effect::needsExecutionTime(void) { - return execute_effect; + + bool Effect::shouldExecute(void) { + return doExecute; } }; \ No newline at end of file