From 75edd6425e1f13a19f866152733ea6cce3b138db Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 15 Aug 2017 23:00:30 +0200 Subject: [PATCH] Updated to use the new LEDMode/LEDControl API Signed-off-by: Gergely Nagy --- src/Kaleidoscope-LEDEffect-SolidColor.cpp | 11 ++++++++--- src/Kaleidoscope-LEDEffect-SolidColor.h | 6 +++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Kaleidoscope-LEDEffect-SolidColor.cpp b/src/Kaleidoscope-LEDEffect-SolidColor.cpp index 9dc62dc7..94d98470 100644 --- a/src/Kaleidoscope-LEDEffect-SolidColor.cpp +++ b/src/Kaleidoscope-LEDEffect-SolidColor.cpp @@ -1,12 +1,17 @@ #include "Kaleidoscope-LEDEffect-SolidColor.h" +namespace kaleidoscope { LEDSolidColor::LEDSolidColor(uint8_t r, uint8_t g, uint8_t b) { this->r = r; this->g = g; this->b = b; } -void -LEDSolidColor::init(void) { - LEDControl.set_all_leds_to(r, g, b); +void LEDSolidColor::onActivate(void) { + ::LEDControl.set_all_leds_to(r, g, b); +} + +void LEDSolidColor::refreshAt(byte row, byte col) { + ::LEDControl.setCrgbAt(row, col, CRGB(r, g, b)); +} } diff --git a/src/Kaleidoscope-LEDEffect-SolidColor.h b/src/Kaleidoscope-LEDEffect-SolidColor.h index 88b0706c..1590caf3 100644 --- a/src/Kaleidoscope-LEDEffect-SolidColor.h +++ b/src/Kaleidoscope-LEDEffect-SolidColor.h @@ -2,12 +2,16 @@ #include "Kaleidoscope-LEDControl.h" +namespace kaleidoscope { class LEDSolidColor : public LEDMode { public: LEDSolidColor(uint8_t r, uint8_t g, uint8_t b); - void init(void) final; + protected: + void onActivate(void) final; + void refreshAt(byte row, byte col) final; private: uint8_t r, g, b; }; +}