From fe53c4fabeb3f933ba39854dc6fe81ce34fc0e51 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 15 Aug 2017 22:40:55 +0200 Subject: [PATCH] Update to use the new LEDMode/LEDControl API Signed-off-by: Gergely Nagy --- src/Kaleidoscope/FingerPainter.cpp | 15 +++++++-------- src/Kaleidoscope/FingerPainter.h | 10 ++++++---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/Kaleidoscope/FingerPainter.cpp b/src/Kaleidoscope/FingerPainter.cpp index 6b1d13da..ac9aa707 100644 --- a/src/Kaleidoscope/FingerPainter.cpp +++ b/src/Kaleidoscope/FingerPainter.cpp @@ -28,14 +28,9 @@ namespace kaleidoscope { uint16_t FingerPainter::color_base_; bool FingerPainter::edit_mode_; -FingerPainter::FingerPainter(void) { -} - -void FingerPainter::begin(void) { - USE_PLUGINS(&::LEDPaletteTheme); - - LEDMode::begin(); - event_handler_hook_use(eventHandlerHook); +void FingerPainter::setup(void) { + Kaleidoscope.use(&::LEDPaletteTheme); + Kaleidoscope.useEventHandlerHook(eventHandlerHook); color_base_ = ::LEDPaletteTheme.reserveThemes(1); } @@ -44,6 +39,10 @@ void FingerPainter::update(void) { ::LEDPaletteTheme.updateHandler(color_base_, 0); } +void FingerPainter::refreshAt(byte row, byte col) { + ::LEDPaletteTheme.refreshAt(color_base_, 0, row, col); +} + void FingerPainter::toggle(void) { edit_mode_ = !edit_mode_; } diff --git a/src/Kaleidoscope/FingerPainter.h b/src/Kaleidoscope/FingerPainter.h index dbab8189..9e975975 100644 --- a/src/Kaleidoscope/FingerPainter.h +++ b/src/Kaleidoscope/FingerPainter.h @@ -23,14 +23,16 @@ namespace kaleidoscope { class FingerPainter : public LEDMode { public: - FingerPainter(void); - - void begin(void) final; - void update(void) final; + FingerPainter(void) {} static void toggle(void); static bool focusHook(const char *command); + protected: + void setup(void) final; + void update(void) final; + void refreshAt(byte row, byte col) final; + private: static uint16_t color_base_; static bool edit_mode_;