Library to control NeoPixel strings of RGB leds

Dependencies:   PixelArray

Dependents:   NeoPixelI2cSlave NeoPixelI2cSlave

Effects/effect.cpp

Committer:
dwini
Date:
2015-11-23
Revision:
1:f544810b6598
Child:
3:7d32f46a38d3

File content as of revision 1:f544810b6598:

#include "effect.h"

namespace Effects {
    
    Effect::Effect(NeoPixelString * pixelstring, int delay_ms) {
        this->pixelstring = pixelstring;
        this->delay_ms = delay_ms;
    
        execute_effect = false;
    }
    
    NeoPixelString * Effect::getPixelString(void) {
        return this->pixelstring;
    }
    
    void Effect::start(void) {
        execute_effect = false;
        ticker.attach(this, &Effect::tick, delay_ms/1000.0);
    }
    
    void Effect::stop(void) {
        ticker.detach();
        execute_effect = false;
    }
    
    void Effect::tick(void) {
        execute_effect = true;
    }
    
    void Effect::execute(void) {
        execute_effect = false;
    }
    
    bool Effect::needsExecutionTime(void) {
        return execute_effect;
    }

};