Updated to use the new plugin APIs

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/389/head
Gergely Nagy 7 years ago
parent b4dd6706df
commit 8e4bfac703

@ -27,17 +27,24 @@ register the `Focus` hooks, and it will do the rest.
```c++ ```c++
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-EEPROM-Settings.h>
#include <Kaleidoscope-Colormap.h> #include <Kaleidoscope-Colormap.h>
#include <Kaleidoscope-Focus.h> #include <Kaleidoscope-Focus.h>
#include <Kaleidoscope-LED-Palette-Theme.h>
void setup(void) { KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings,
Kaleidoscope.use(&ColormapEffect, &Focus); LEDPaletteTheme,
ColormapEffect,
Focus);
void setup(void) {
Kaleidoscope.setup(); Kaleidoscope.setup();
ColormapEffect.max_layers(1); ColormapEffect.max_layers(1);
Focus.addHook(FOCUS_HOOK_LEDPALETTETHEME); Focus.addHook(FOCUS_HOOK_LEDPALETTETHEME);
Focus.addHook(FOCUS_HOOK_COLORMAP); Focus.addHook(FOCUS_HOOK_COLORMAP);
EEPROMSettings.seal();
} }
``` ```

@ -1,6 +1,6 @@
/* -*- mode: c++ -*- /* -*- mode: c++ -*-
* Kaleidoscope-EEPROM-Colormap -- Per-layer colormap effect * Kaleidoscope-EEPROM-Colormap -- Per-layer colormap effect
* Copyright (C) 2017 Gergely Nagy * Copyright (C) 2017, 2018 Gergely Nagy
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -17,7 +17,12 @@
*/ */
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-EEPROM-Settings.h>
#include <Kaleidoscope-Colormap.h> #include <Kaleidoscope-Colormap.h>
#include <Kaleidoscope-Focus.h>
#include <Kaleidoscope-LED-Palette-Theme.h>
// *INDENT-OFF*
const Key keymaps[][ROWS][COLS] PROGMEM = { const Key keymaps[][ROWS][COLS] PROGMEM = {
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
@ -38,12 +43,19 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
Key_NoKey), Key_NoKey),
}; };
void setup() { // *INDENT-ON*
Kaleidoscope.use(&ColormapEffect);
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings,
LEDPaletteTheme,
ColormapEffect,
Focus);
void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();
ColormapEffect.max_layers(1); ColormapEffect.max_layers(1);
ColormapEffect.activate(); ColormapEffect.activate();
EEPROMSettings.seal();
} }
void loop() { void loop() {

@ -1,6 +1,6 @@
/* -*- mode: c++ -*- /* -*- mode: c++ -*-
* Kaleidoscope-Colormap -- Per-layer colormap effect * Kaleidoscope-Colormap -- Per-layer colormap effect
* Copyright (C) 2016, 2017 Gergely Nagy * Copyright (C) 2016, 2017, 2018 Gergely Nagy
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,10 +31,6 @@ uint8_t ColormapEffect::max_layers_;
uint8_t ColormapEffect::last_highest_layer_; uint8_t ColormapEffect::last_highest_layer_;
bool ColormapEffect::dirty_ = false; bool ColormapEffect::dirty_ = false;
void ColormapEffect::setup(void) {
Kaleidoscope.use(&::EEPROMSettings, &::LEDPaletteTheme);
}
void ColormapEffect::max_layers(uint8_t max_) { void ColormapEffect::max_layers(uint8_t max_) {
if (map_base_ != 0) if (map_base_ != 0)
return; return;

@ -1,6 +1,6 @@
/* -*- mode: c++ -*- /* -*- mode: c++ -*-
* Kaleidoscope-Colormap -- Per-layer colormap effect * Kaleidoscope-Colormap -- Per-layer colormap effect
* Copyright (C) 2016, 2017 Gergely Nagy * Copyright (C) 2016, 2017, 2018 Gergely Nagy
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -32,7 +32,6 @@ class ColormapEffect : public LEDMode {
static bool focusHookLayerwise(const char *command); static bool focusHookLayerwise(const char *command);
protected: protected:
void setup(void) final;
void onActivate(void) final; void onActivate(void) final;
void update(void) final; void update(void) final;
void refreshAt(byte row, byte col) final; void refreshAt(byte row, byte col) final;

Loading…
Cancel
Save