Conform to the latest Kaleidoscope Style Guide

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

@ -32,12 +32,12 @@ register the `Focus` hooks, and it will do the rest.
#include <Kaleidoscope-Focus.h> #include <Kaleidoscope-Focus.h>
void setup(void) { void setup(void) {
Kaleidoscope.setup(); Kaleidoscope.setup();
USE_PLUGINS(&ColormapEffect, &Focus); USE_PLUGINS(&ColormapEffect, &Focus);
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);
} }
``` ```

@ -20,32 +20,32 @@
#include <Kaleidoscope-Colormap.h> #include <Kaleidoscope-Colormap.h>
const Key keymaps[][ROWS][COLS] PROGMEM = { const Key keymaps[][ROWS][COLS] PROGMEM = {
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_LEDEffectNext, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, (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_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_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_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift, Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
Key_NoKey, Key_NoKey,
Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip, 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_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_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_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey), Key_NoKey),
}; };
void setup() { void setup() {
USE_PLUGINS(&ColormapEffect); USE_PLUGINS(&ColormapEffect);
Kaleidoscope.setup(); Kaleidoscope.setup();
ColormapEffect.max_layers(1); ColormapEffect.max_layers(1);
ColormapEffect.activate(); ColormapEffect.activate();
} }
void loop() { void loop() {
Kaleidoscope.loop(); Kaleidoscope.loop();
} }

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

@ -23,19 +23,19 @@
namespace kaleidoscope { namespace kaleidoscope {
class ColormapEffect : public LEDMode { class ColormapEffect : public LEDMode {
public: public:
ColormapEffect(void); ColormapEffect(void);
void begin(void) final; void begin(void) final;
void update(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: private:
static uint8_t max_layers_; static uint8_t max_layers_;
static uint16_t map_base_; static uint16_t map_base_;
}; };
} }

Loading…
Cancel
Save