Conform to the latest Kaleidoscope Style Guide

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/389/head
Gergely Nagy 7 years ago
parent b8f47755ab
commit cfd80f3f69

@ -32,12 +32,12 @@ register the `Focus` hooks, and it will do the rest.
#include <Kaleidoscope-Focus.h>
void setup(void) {
Kaleidoscope.setup();
USE_PLUGINS(&ColormapEffect, &Focus);
Kaleidoscope.setup();
USE_PLUGINS(&ColormapEffect, &Focus);
ColormapEffect.max_layers(1);
Focus.addHook(FOCUS_HOOK_LEDPALETTETHEME);
Focus.addHook(FOCUS_HOOK_COLORMAP);
ColormapEffect.max_layers(1);
Focus.addHook(FOCUS_HOOK_LEDPALETTETHEME);
Focus.addHook(FOCUS_HOOK_COLORMAP);
}
```

@ -20,32 +20,32 @@
#include <Kaleidoscope-Colormap.h>
const Key keymaps[][ROWS][COLS] PROGMEM = {
[0] = KEYMAP_STACKED
(Key_LEDEffectNext, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
Key_NoKey,
Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip,
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey),
[0] = KEYMAP_STACKED
(Key_LEDEffectNext, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
Key_NoKey,
Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip,
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey),
};
void setup() {
USE_PLUGINS(&ColormapEffect);
USE_PLUGINS(&ColormapEffect);
Kaleidoscope.setup();
ColormapEffect.max_layers(1);
ColormapEffect.activate();
Kaleidoscope.setup();
ColormapEffect.max_layers(1);
ColormapEffect.activate();
}
void loop() {
Kaleidoscope.loop();
Kaleidoscope.loop();
}

@ -33,31 +33,31 @@ ColormapEffect::ColormapEffect(void) {
}
void ColormapEffect::begin(void) {
LEDMode::begin();
LEDMode::begin();
USE_PLUGINS(&::EEPROMSettings, &::LEDPaletteTheme);
USE_PLUGINS(&::EEPROMSettings, &::LEDPaletteTheme);
}
void ColormapEffect::max_layers(uint8_t max_) {
if (map_base_ != 0)
return;
if (map_base_ != 0)
return;
max_layers_ = max_;
map_base_ = ::LEDPaletteTheme.reserveThemes(max_layers_);
max_layers_ = max_;
map_base_ = ::LEDPaletteTheme.reserveThemes(max_layers_);
}
void ColormapEffect::update(void) {
for (uint8_t l = 0; l < 32; l++) {
if (!Layer.isOn(l))
continue;
for (uint8_t l = 0; l < 32; l++) {
if (!Layer.isOn(l))
continue;
::LEDPaletteTheme.update(map_base_, l);
}
::LEDPaletteTheme.update(map_base_, l);
}
}
bool ColormapEffect::focusHook(const char *command) {
return ::LEDPaletteTheme.themeFocusHandler(command, PSTR("colormap.map"),
map_base_, max_layers_);
return ::LEDPaletteTheme.themeFocusHandler(command, PSTR("colormap.map"),
map_base_, max_layers_);
}
}

@ -23,19 +23,19 @@
namespace kaleidoscope {
class ColormapEffect : public LEDMode {
public:
ColormapEffect(void);
public:
ColormapEffect(void);
void begin(void) final;
void update(void) final;
void begin(void) final;
void update(void) final;
void max_layers(uint8_t max_);
void max_layers(uint8_t max_);
static bool focusHook(const char *command);
static bool focusHook(const char *command);
private:
static uint8_t max_layers_;
static uint16_t map_base_;
private:
static uint8_t max_layers_;
static uint16_t map_base_;
};
}

Loading…
Cancel
Save