A project that aims at making a LED based light system controlled by microcontroller and with BLE (soon) with smooth color transitions.
Diff: LEDManager.h
- Revision:
- 3:25af55580ef6
- Parent:
- 2:0bbd4fc5e202
diff -r 0bbd4fc5e202 -r 25af55580ef6 LEDManager.h --- a/LEDManager.h Fri Aug 18 11:26:01 2017 +0000 +++ b/LEDManager.h Tue Feb 13 15:36:17 2018 +0000 @@ -15,8 +15,9 @@ this->lowTime = this->period_us - this->highTime; this->fadeFactor = 100; this->situation = 1; - this->fadeUpdatePeriod = 10000; + this->fadeUpdatePeriod = 40000; this->prevFadeUpdate = 0; + this->isActive = true; } LEDManager(DigitalOut *io, int period_us) @@ -33,6 +34,10 @@ void processLED(int time) { + if(!this->isActive) + { + return; + } if(situation == 1){ if((time - prevUpdate) < highTime){ io->write(1); @@ -66,18 +71,14 @@ } } - /*void setFadeUpdatePeriod(int period) - { - this->fadeUpdatePeriod = period; - } - void setFadeFactor(int fadeFactor) - { - this->fadeFactor = fadeFactor; - }*/ - int getHighTime() - { - return this->highTime; - } + void setFadeUpdatePeriod(int period){ this->fadeUpdatePeriod = period;} + int getFadeUpdatePeriod(){ return this->fadeUpdatePeriod;} + void setFadeFactor(int fadeFactor){ this->fadeFactor = fadeFactor;} + int getFadeFactor(){ return this->fadeFactor;} + int getHighTime(){ return this->highTime;} + void setActive(bool state){ this->isActive = state;} + bool getActiveness(){ return this->isActive;} + private: DigitalOut *io; @@ -90,6 +91,7 @@ int prevFadeUpdate; int fadeFactor; int fadeUpdatePeriod; + bool isActive; }; #endif