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++
#include <Kaleidoscope.h>
#include <Kaleidoscope-EEPROM-Settings.h>
#include <Kaleidoscope-Colormap.h>
#include <Kaleidoscope-Focus.h>
#include <Kaleidoscope-LED-Palette-Theme.h>
void setup(void) {
Kaleidoscope.use(&ColormapEffect, &Focus);
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings,
LEDPaletteTheme,
ColormapEffect,
Focus);
void setup(void) {
Kaleidoscope.setup();
ColormapEffect.max_layers(1);
Focus.addHook(FOCUS_HOOK_LEDPALETTETHEME);
Focus.addHook(FOCUS_HOOK_COLORMAP);
EEPROMSettings.seal();
}
```

@ -1,6 +1,6 @@
/* -*- mode: c++ -*-
* 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
* it under the terms of the GNU General Public License as published by
@ -17,7 +17,12 @@
*/
#include <Kaleidoscope.h>
#include <Kaleidoscope-EEPROM-Settings.h>
#include <Kaleidoscope-Colormap.h>
#include <Kaleidoscope-Focus.h>
#include <Kaleidoscope-LED-Palette-Theme.h>
// *INDENT-OFF*
const Key keymaps[][ROWS][COLS] PROGMEM = {
[0] = KEYMAP_STACKED
@ -38,12 +43,19 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
Key_NoKey),
};
void setup() {
Kaleidoscope.use(&ColormapEffect);
// *INDENT-ON*
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings,
LEDPaletteTheme,
ColormapEffect,
Focus);
void setup() {
Kaleidoscope.setup();
ColormapEffect.max_layers(1);
ColormapEffect.activate();
EEPROMSettings.seal();
}
void loop() {

@ -1,6 +1,6 @@
/* -*- mode: c++ -*-
* 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
* 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_;
bool ColormapEffect::dirty_ = false;
void ColormapEffect::setup(void) {
Kaleidoscope.use(&::EEPROMSettings, &::LEDPaletteTheme);
}
void ColormapEffect::max_layers(uint8_t max_) {
if (map_base_ != 0)
return;

@ -1,6 +1,6 @@
/* -*- mode: c++ -*-
* 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
* 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);
protected:
void setup(void) final;
void onActivate(void) final;
void update(void) final;
void refreshAt(byte row, byte col) final;

Loading…
Cancel
Save