Kaleidoscope Style Guide conformance

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

@ -5,27 +5,29 @@
[travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-LEDEffects.svg?branch=master [travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-LEDEffects.svg?branch=master
[travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-LEDEffects [travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-LEDEffects
[st:stable]: https://img.shields.io/badge/stable-✔-black.png?style=flat&colorA=44cc11&colorB=494e52 [st:stable]: https://img.shields.io/badge/stable-✔-black.svg?style=flat&colorA=44cc11&colorB=494e52
[st:broken]: https://img.shields.io/badge/broken-X-black.png?style=flat&colorA=e05d44&colorB=494e52 [st:broken]: https://img.shields.io/badge/broken-X-black.svg?style=flat&colorA=e05d44&colorB=494e52
[st:experimental]: https://img.shields.io/badge/experimental----black.png?style=flat&colorA=dfb317&colorB=494e52 [st:experimental]: https://img.shields.io/badge/experimental----black.svg?style=flat&colorA=dfb317&colorB=494e52
The `LEDEffects` plugin provides a selection of LED effects, each of them fairly The `LEDEffects` plugin provides a selection of LED effects, each of them fairly
simple, simple enough to not need a plugin of their own. simple, simple enough to not need a plugin of their own.
## Using the plugin ## Using the plugin
Because of containing a number of different effects, and not wanting to force There are a number of different effects included in the package, all of them are
all of them on the user, the plugin behaves differently than most others: it available once including the header, and one's free to choose any number of
does not enable anything by default, and we will have to selectively enable the them.
effects we are interested in.
```c++ ```c++
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-LEDEffects.h> #include <Kaleidoscope-LEDEffects.h>
```
Then, in the `setup()` method of our Sketch, we will call `Kaleidoscope.use()`, void setup(void) {
with the selected effect objects. USE_PLUGINS(&JukeBoxEffect);
Kaleidoscope.setup();
}
```
## Included effects ## Included effects
@ -43,7 +45,7 @@ Alphas, punctuation, numbers, the space bar, the numbers and the dot on the
keypad, and half the function keys will be in a cyan-ish color, the rest in keypad, and half the function keys will be in a cyan-ish color, the rest in
magenta. magenta.
### `JukeBoxEffect` ### `JukeboxEffect`
Applies a color effect to the keyboard, inspired by the JukeBox keyset: Applies a color effect to the keyboard, inspired by the JukeBox keyset:
@ -53,7 +55,7 @@ Alphas, punctuation, numbers, the space bar, the numbers and the dot on the
keypad, and half the function keys will be in a beige-ish color, the rest in keypad, and half the function keys will be in a beige-ish color, the rest in
light green, except for the `Esc` key, which will be in red. light green, except for the `Esc` key, which will be in red.
An alternative color scheme exists under the `JukeBoxAlternateEffect` name, An alternative color scheme exists under the `JukeboxAlternateEffect` name,
where the light green and red colors are swapped. where the light green and red colors are swapped.
## Plugin methods ## Plugin methods

@ -2,9 +2,9 @@
![status][st:stable] ![status][st:stable]
[st:stable]: https://img.shields.io/badge/stable-✔-black.png?style=flat&colorA=44cc11&colorB=494e52 [st:stable]: https://img.shields.io/badge/stable-✔-black.svg?style=flat&colorA=44cc11&colorB=494e52
[st:broken]: https://img.shields.io/badge/broken-X-black.png?style=flat&colorA=e05d44&colorB=494e52 [st:broken]: https://img.shields.io/badge/broken-X-black.svg?style=flat&colorA=e05d44&colorB=494e52
[st:experimental]: https://img.shields.io/badge/experimental----black.png?style=flat&colorA=dfb317&colorB=494e52 [st:experimental]: https://img.shields.io/badge/experimental----black.svg?style=flat&colorA=dfb317&colorB=494e52
The `TriColor` effect extension is a part of The `TriColor` effect extension is a part of
the [`LEDEffects`][plugin:ledeffects] library, not a stand-alone base library of the [`LEDEffects`][plugin:ledeffects] library, not a stand-alone base library of
@ -31,9 +31,9 @@ Then, we simply create a new instance of the `TriColor` class, with appropriate
colors set for the constructor: colors set for the constructor:
```c++ ```c++
KaleidoscopePlugins::LEDEffects::TriColor BlackAndWhiteEffect ((cRGB){0x00, 0x00, 0x00}, kaleidoscope::TriColor BlackAndWhiteEffect (CRGB(0x00, 0x00, 0x00),
(cRGB){0xff, 0xff, 0xff}, CRGB(0xff, 0xff, 0xff),
(cRGB){0x80, 0x80, 0x80}); CRGB(0x80, 0x80, 0x80));
``` ```
The first argument is the base color, the second is for modifiers and special The first argument is the base color, the second is for modifiers and special

@ -39,14 +39,14 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
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() {
Kaleidoscope.setup(KEYMAP_SIZE); USE_PLUGINS(&LEDOff, &MiamiEffect, &JukeboxEffect, &JukeboxAlternateEffect);
Kaleidoscope.use(&LEDControl, &LEDOff, &MiamiEffect, &JukeboxEffect, &JukeboxAlternateEffect, NULL);
Kaleidoscope.setup();
MiamiEffect.activate(); MiamiEffect.activate();
} }

@ -18,22 +18,10 @@
#include <Kaleidoscope-LEDEffects.h> #include <Kaleidoscope-LEDEffects.h>
KaleidoscopePlugins::LEDEffects::TriColor JukeboxEffect((cRGB) { kaleidoscope::TriColor JukeboxEffect(CRGB(0xc8, 0xe8, 0xee), /* TM */
0xc8, 0xe8, 0xee CRGB(0xc3, 0xee, 0x8c), /* VCO */
} /* TM */, CRGB(0x21, 0x38, 0xd7)); /* RN */
(cRGB) {
0xc3, 0xee, 0x8c
} /* VCO */,
(cRGB) {
0x21, 0x38, 0xd7
} /* RN */);
KaleidoscopePlugins::LEDEffects::TriColor JukeboxAlternateEffect((cRGB) { kaleidoscope::TriColor JukeboxAlternateEffect(CRGB(0xc8, 0xe8, 0xee), /* TM */
0xc8, 0xe8, 0xee CRGB(0x21, 0x38, 0xd7), /* RN */
} /* TM */, CRGB(0xc3, 0xee, 0x8c)); /* VCO */
(cRGB) {
0x21, 0x38, 0xd7
} /* RN */,
(cRGB) {
0xc3, 0xee, 0x8c
} /* VCO */);

@ -20,5 +20,5 @@
#include <Kaleidoscope/TriColor.h> #include <Kaleidoscope/TriColor.h>
extern KaleidoscopePlugins::LEDEffects::TriColor JukeboxEffect; extern kaleidoscope::TriColor JukeboxEffect;
extern KaleidoscopePlugins::LEDEffects::TriColor JukeboxAlternateEffect; extern kaleidoscope::TriColor JukeboxAlternateEffect;

@ -18,9 +18,5 @@
#include <Kaleidoscope-LEDEffects.h> #include <Kaleidoscope-LEDEffects.h>
KaleidoscopePlugins::LEDEffects::TriColor MiamiEffect((cRGB) { kaleidoscope::TriColor MiamiEffect(CRGB(0xd6, 0xd6, 0x4e), /* Cyan */
0xd6, 0xd6, 0x4e CRGB(0xaf, 0x67, 0xfa)); /* Magenta */
} /* Cyan */,
(cRGB) {
0xaf, 0x67, 0xfa
} /* Magenta */);

@ -20,4 +20,4 @@
#include <Kaleidoscope/TriColor.h> #include <Kaleidoscope/TriColor.h>
extern KaleidoscopePlugins::LEDEffects::TriColor MiamiEffect; extern kaleidoscope::TriColor MiamiEffect;

@ -18,13 +18,12 @@
#include <Kaleidoscope-LEDEffects.h> #include <Kaleidoscope-LEDEffects.h>
namespace KaleidoscopePlugins { namespace kaleidoscope {
namespace LEDEffects {
TriColor::TriColor(cRGB baseColor, cRGB modColor, cRGB escColor) { TriColor::TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color) {
this->baseColor = baseColor; base_color_ = base_color;
this->modColor = modColor; mod_color_ = mod_color;
this->escColor = escColor; esc_color_ = esc_color;
} }
void void
@ -33,13 +32,13 @@ TriColor::update(void) {
for (uint8_t c = 0; c < COLS; c++) { for (uint8_t c = 0; c < COLS; c++) {
Key k = Layer.lookup(r, c); Key k = Layer.lookup(r, c);
// Special keys are always modColor // Special keys are always mod_color
if (k.flags != 0) { if (k.flags != 0) {
LEDControl.led_set_crgb_at(r, c, modColor); LEDControl.led_set_crgb_at(r, c, mod_color_);
continue; continue;
} }
cRGB color = modColor; cRGB color = mod_color_;
switch (k.keyCode) { switch (k.keyCode) {
case Key_A.keyCode ... Key_0.keyCode: case Key_A.keyCode ... Key_0.keyCode:
@ -48,10 +47,10 @@ TriColor::update(void) {
case Key_Keypad1.keyCode ... Key_KeypadDot.keyCode: case Key_Keypad1.keyCode ... Key_KeypadDot.keyCode:
case Key_F1.keyCode ... Key_F4.keyCode: case Key_F1.keyCode ... Key_F4.keyCode:
case Key_F9.keyCode ... Key_F12.keyCode: case Key_F9.keyCode ... Key_F12.keyCode:
color = baseColor; color = base_color_;
break; break;
case Key_Escape.keyCode: case Key_Escape.keyCode:
color = escColor; color = esc_color_;
break; break;
} }
@ -59,5 +58,5 @@ TriColor::update(void) {
} }
} }
} }
};
}; }

@ -21,19 +21,17 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-LEDControl.h> #include <Kaleidoscope-LEDControl.h>
namespace KaleidoscopePlugins { namespace kaleidoscope {
namespace LEDEffects {
class TriColor : public LEDMode { class TriColor : public LEDMode {
public: public:
TriColor(cRGB baseColor, cRGB modColor, cRGB escColor); TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color);
TriColor(cRGB baseColor, cRGB modColor) : TriColor(baseColor, modColor, modColor) {}; TriColor(cRGB base_color, cRGB mod_color) : TriColor(base_color, mod_color, mod_color) {};
virtual void update(void) final; virtual void update(void) final;
private: private:
cRGB baseColor; cRGB base_color_;
cRGB modColor; cRGB mod_color_;
cRGB escColor; cRGB esc_color_;
};
};
}; };
}

Loading…
Cancel
Save