Convert the plugin to a LEDMode

Fixes #3.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/365/head
Gergely Nagy 8 years ago committed by Gergely Nagy
parent 1dcccb0e37
commit b1c0f1fc1b

@ -22,10 +22,11 @@ To use the plugin, one needs to include the header, and select the effect.
#include <Kaleidoscope-LED-Stalker.h>
void setup () {
Kaleidoscope.setup (KEYMAP_SIZE);
Kaleidoscope.setup ();
StalkerEffect.configure (STALKER (Haunt, {0xff, 0, 0}));
Kaleidoscope.use (&StalkerEffect, NULL);
USE_PLUGINS (&StalkerEffect);
StalkerEffect.activate ();
}
```

@ -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 () {

@ -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;

@ -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 {

Loading…
Cancel
Save