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: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:broken]: https://img.shields.io/badge/broken-X-black.png?style=flat&colorA=e05d44&colorB=494e52
[st:experimental]: https://img.shields.io/badge/experimental----black.png?style=flat&colorA=dfb317&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.svg?style=flat&colorA=e05d44&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
simple, simple enough to not need a plugin of their own.
## Using the plugin
Because of containing a number of different effects, and not wanting to force
all of them on the user, the plugin behaves differently than most others: it
does not enable anything by default, and we will have to selectively enable the
effects we are interested in.
There are a number of different effects included in the package, all of them are
available once including the header, and one's free to choose any number of
them.
```c++
#include <Kaleidoscope.h>
#include <Kaleidoscope-LEDEffects.h>
```
Then, in the `setup()` method of our Sketch, we will call `Kaleidoscope.use()`,
with the selected effect objects.
void setup(void) {
USE_PLUGINS(&JukeBoxEffect);
Kaleidoscope.setup();
}
```
## 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
magenta.
### `JukeBoxEffect`
### `JukeboxEffect`
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
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.
## Plugin methods

@ -2,9 +2,9 @@
![status][st:stable]
[st:stable]: https://img.shields.io/badge/stable-✔-black.png?style=flat&colorA=44cc11&colorB=494e52
[st:broken]: https://img.shields.io/badge/broken-X-black.png?style=flat&colorA=e05d44&colorB=494e52
[st:experimental]: https://img.shields.io/badge/experimental----black.png?style=flat&colorA=dfb317&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.svg?style=flat&colorA=e05d44&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 [`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:
```c++
KaleidoscopePlugins::LEDEffects::TriColor BlackAndWhiteEffect ((cRGB){0x00, 0x00, 0x00},
(cRGB){0xff, 0xff, 0xff},
(cRGB){0x80, 0x80, 0x80});
kaleidoscope::TriColor BlackAndWhiteEffect (CRGB(0x00, 0x00, 0x00),
CRGB(0xff, 0xff, 0xff),
CRGB(0x80, 0x80, 0x80));
```
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_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey
),
Key_NoKey),
};
void setup() {
Kaleidoscope.setup(KEYMAP_SIZE);
Kaleidoscope.use(&LEDControl, &LEDOff, &MiamiEffect, &JukeboxEffect, &JukeboxAlternateEffect, NULL);
USE_PLUGINS(&LEDOff, &MiamiEffect, &JukeboxEffect, &JukeboxAlternateEffect);
Kaleidoscope.setup();
MiamiEffect.activate();
}

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

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

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

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

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

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

Loading…
Cancel
Save