diff --git a/README.md b/README.md index b9ef6a71..f03a1e73 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,11 @@ To use the plugin, one needs to include the header, and select the effect. #include void setup () { - Kaleidoscope.setup (KEYMAP_SIZE); + Kaleidoscope.setup (); StalkerEffect.configure (STALKER (Haunt, {0xff, 0, 0})); - Kaleidoscope.use (&StalkerEffect, NULL); + USE_PLUGINS (&StalkerEffect); + StalkerEffect.activate (); } ``` diff --git a/examples/LED-Stalker/LED-Stalker.ino b/examples/LED-Stalker/LED-Stalker.ino index 1f835dcc..e051bfad 100644 --- a/examples/LED-Stalker/LED-Stalker.ino +++ b/examples/LED-Stalker/LED-Stalker.ino @@ -41,10 +41,12 @@ const Key keymaps[][ROWS][COLS] PROGMEM = { }; void setup () { - Kaleidoscope.setup (KEYMAP_SIZE); + Kaleidoscope.setup (); StalkerEffect.configure (STALKER (BlazingTrail, NULL)); - Kaleidoscope.use (&LEDControl, &StalkerEffect, NULL); + USE_PLUGINS (&StalkerEffect); + + StalkerEffect.activate (); } void loop () { diff --git a/src/Kaleidoscope/LED-Stalker.cpp b/src/Kaleidoscope/LED-Stalker.cpp index 7c0fa655..db067099 100644 --- a/src/Kaleidoscope/LED-Stalker.cpp +++ b/src/Kaleidoscope/LED-Stalker.cpp @@ -36,7 +36,7 @@ namespace KaleidoscopePlugins { void StalkerEffect::begin (void) { event_handler_hook_use (eventHandlerHook); - loop_hook_use (loopHook); + LEDMode::begin (); } Key @@ -52,10 +52,7 @@ namespace KaleidoscopePlugins { } void - StalkerEffect::loopHook (bool postClear) { - if (postClear) - return; - + StalkerEffect::update (void) { if (!colorComputer) return; diff --git a/src/Kaleidoscope/LED-Stalker.h b/src/Kaleidoscope/LED-Stalker.h index 7b670aaf..0f6c41ac 100644 --- a/src/Kaleidoscope/LED-Stalker.h +++ b/src/Kaleidoscope/LED-Stalker.h @@ -23,7 +23,7 @@ namespace KaleidoscopePlugins { namespace LEDEffects { - class StalkerEffect : public KaleidoscopePlugin { + class StalkerEffect : public LEDMode { public: class ColorComputer { public: @@ -33,6 +33,8 @@ namespace KaleidoscopePlugins { StalkerEffect (void); virtual void begin (void) final; + virtual void update (void) final; + static void configure (ColorComputer *colorComputer); static uint16_t stepLength; @@ -42,7 +44,6 @@ namespace KaleidoscopePlugins { static uint8_t map[ROWS][COLS]; static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState); - static void loopHook (bool postClear); }; namespace Stalker {