Added sunrise suport
This commit is contained in:
13
rgbled.h
13
rgbled.h
@ -1,3 +1,4 @@
|
||||
#include <util/delay.h>
|
||||
#include "pwm.h"
|
||||
|
||||
class RgbLed
|
||||
@ -11,6 +12,11 @@ private:
|
||||
uint16_t _counter = 0;
|
||||
bool _stroke = false;
|
||||
|
||||
uint8_t _targetR = 0;
|
||||
uint8_t _targetG = 0;
|
||||
uint8_t _targetB = 0;
|
||||
bool _fade = true;
|
||||
uint8_t _fadeSpeed = 7;
|
||||
|
||||
void patternStep();
|
||||
|
||||
@ -24,9 +30,16 @@ public:
|
||||
void on();
|
||||
void off();
|
||||
|
||||
void setFade(bool fade = true);
|
||||
|
||||
void logic();
|
||||
uint8_t getR();
|
||||
uint8_t getB();
|
||||
uint8_t getG();
|
||||
|
||||
};
|
||||
|
||||
template <typename T> T sgn(T val)
|
||||
{
|
||||
return (T(0) < val) - (val < T(0));
|
||||
}
|
||||
|
Reference in New Issue
Block a user