diff options
Diffstat (limited to 'lib/rgb')
| -rw-r--r-- | lib/rgb/rgb.cpp | 6 | ||||
| -rw-r--r-- | lib/rgb/rgb.h | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/rgb/rgb.cpp b/lib/rgb/rgb.cpp index 249e7f0..e66d264 100644 --- a/lib/rgb/rgb.cpp +++ b/lib/rgb/rgb.cpp @@ -14,8 +14,12 @@ int RGB::scaleColor(uint8_t val) { return map(val, 0, 255, 0, (1 << PWM_RES) - 1); } - RGB::RGB() + : currentR(0), currentG(0), currentB(0) +{ +} + +void RGB::init() { ledcSetup(RED_CHANNEL, PWM_FREQ, PWM_RES); ledcAttachPin(RED_PIN, RED_CHANNEL); diff --git a/lib/rgb/rgb.h b/lib/rgb/rgb.h index 3850f0a..fddeae8 100644 --- a/lib/rgb/rgb.h +++ b/lib/rgb/rgb.h @@ -11,6 +11,7 @@ public: uint8_t currentB; RGB(); + void init(); void setColorRGB(uint8_t red, uint8_t green, uint8_t blue, bool saveColor); void fadeColor(uint8_t red, uint8_t green, uint8_t blue, int duration); void blink(int cycles, int interval); |