Merge remote-tracking branch 'plugin/LEDEffects/f/monorepo' into f/monorepo-stage2

pull/389/head
Gergely Nagy 6 years ago
commit 3d947c8c1c
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -0,0 +1,71 @@
# Kaleidoscope-LEDEffects
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
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>
KALEIDOSCOPE_INIT_PLUGINS(LEDControl, JukeBoxEffect);
void setup(void) {
Kaleidoscope.setup();
}
```
## Included effects
All of these effects will scan the active layers, and apply effects based on
what keys are active on each position, thus, it needs no hints or configuration
to figure out our layout!
### `MiamiEffect`
Applies a color effect to the keyboard, inspired by the popular Miami keyset:
![Miami](extras/MiamiEffect.png)
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`
Applies a color effect to the keyboard, inspired by the JukeBox keyset:
![Jukebox](extras/JukeboxEffect.png)
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,
where the light green and red colors are swapped.
## Plugin methods
The plugin provides a single method on each of the included effect objects:
### `.activate()`
> When called, immediately activates the effect. Mostly useful in the `setup()`
> method of the Sketch, or in macros that are meant to switch to the selected
> effect, no matter where we are in the list.
## Dependencies
* [Kaleidoscope-LEDControl](LEDControl.md)
## Further reading
Starting from the [example][plugin:example] is the recommended way of getting
started with the plugin.
[plugin:example]: ../../examples/LEDEffects/LEDEffects.ino

@ -0,0 +1,35 @@
# Kaleidoscope-TriColor
The `TriColor` effect extension is a part of
the [`LEDEffects`][plugin:ledeffects] library, not a stand-alone base library of
its own. It is used to implement the effects in that library.
[plugin:ledeffects]: LEDEffects.md
It is a class that can be used to create LED effects that all follow a similar
pattern: alphas and similar in one color; modifiers, special keys, and half the
function keys in another, and `Esc` in a third (this latter being optional). If
we have a color scheme that follows this pattern, the `TriColor` extension can
make it a lot easier to implement it.
## Using the extension
Because the extension is part of the [`LEDEffects`][plugin:ledeffects] library,
we need to include that header:
```c++
#include <Kaleidoscope-LEDEffects.h>
```
Then, we simply create a new instance of the `TriColor` class, with appropriate
colors set for the constructor:
```c++
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
keys, the last one is for the `Esc` key. If the last one is omitted, the
extension will use the modifier color for it.

@ -0,0 +1,59 @@
/* -*- mode: c++ -*-
* Kaleidoscope-LEDEffects -- An assorted collection of LED effects for Kaleidoscope
* Copyright (C) 2016, 2017, 2018 Keyboard.io, Inc
*
* 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 the Free Software
* Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Kaleidoscope.h>
#include <Kaleidoscope-LEDEffects.h>
#include "LED-Off.h"
// *INDENT-OFF*
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),
};
// *INDENT-ON*
KALEIDOSCOPE_INIT_PLUGINS(LEDControl,
LEDOff,
MiamiEffect,
JukeboxEffect,
JukeboxAlternateEffect);
void setup() {
Kaleidoscope.setup();
MiamiEffect.activate();
}
void loop() {
Kaleidoscope.loop();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

@ -0,0 +1,22 @@
/* -*- mode: c++ -*-
* Kaleidoscope-LEDEffects -- An assorted collection of LED effects for Kaleidoscope
* Copyright (C) 2016, 2017 Keyboard.io, Inc
*
* 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 the Free Software
* Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <kaleidoscope/plugin/TriColor.h>
#include <kaleidoscope/plugin/Miami.h>
#include <kaleidoscope/plugin/Jukebox.h>

@ -0,0 +1,26 @@
/* -*- mode: c++ -*-
* Kaleidoscope-LEDEffects -- An assorted collection of LED effects for Kaleidoscope
* Copyright (C) 2016 Keyboard.io, Inc
*
* 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 the Free Software
* Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Kaleidoscope-LEDEffects.h>
kaleidoscope::plugin::TriColor JukeboxEffect(CRGB(0xc8, 0xe8, 0xee), /* TM */
CRGB(0xc3, 0xee, 0x8c), /* VCO */
CRGB(0x21, 0x38, 0xd7)); /* RN */
kaleidoscope::plugin::TriColor JukeboxAlternateEffect(CRGB(0xc8, 0xe8, 0xee), /* TM */
CRGB(0x21, 0x38, 0xd7), /* RN */
CRGB(0xc3, 0xee, 0x8c)); /* VCO */

@ -0,0 +1,23 @@
/* -*- mode: c++ -*-
* Kaleidoscope-LEDEffects -- An assorted collection of LED effects for Kaleidoscope
* Copyright (C) 2016, 2017 Keyboard.io, Inc
*
* 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 the Free Software
* Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <kaleidoscope/plugin/TriColor.h>
extern kaleidoscope::plugin::TriColor JukeboxEffect;
extern kaleidoscope::plugin::TriColor JukeboxAlternateEffect;

@ -0,0 +1,21 @@
/* -*- mode: c++ -*-
* Kaleidoscope-LEDEffects -- An assorted collection of LED effects for Kaleidoscope
* Copyright (C) 2016, 2017 Keyboard.io, Inc
*
* 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 the Free Software
* Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Kaleidoscope-LEDEffects.h>
kaleidoscope::plugin::TriColor MiamiEffect(CRGB(0x4e, 0xd6, 0xd6), /* Cyan */
CRGB(0xaf, 0x67, 0xfa)); /* Magenta */

@ -0,0 +1,22 @@
/* -*- mode: c++ -*-
* Kaleidoscope-LEDEffects -- An assorted collection of LED effects for Kaleidoscope
* Copyright (C) 2016, 2017 Keyboard.io, Inc
*
* 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 the Free Software
* Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <kaleidoscope/plugin/TriColor.h>
extern kaleidoscope::plugin::TriColor MiamiEffect;

@ -0,0 +1,62 @@
/* -*- mode: c++ -*-
* Kaleidoscope-LEDEffects -- An assorted collection of LED effects for Kaleidoscope
* Copyright (C) 2016, 2017 Keyboard.io, Inc
*
* 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 the Free Software
* Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Kaleidoscope-LEDEffects.h>
namespace kaleidoscope {
namespace plugin {
TriColor::TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color) {
base_color_ = base_color;
mod_color_ = mod_color;
esc_color_ = esc_color;
}
void TriColor::update(void) {
for (uint8_t r = 0; r < ROWS; r++) {
for (uint8_t c = 0; c < COLS; c++) {
Key k = Layer.lookup(r, c);
// Special keys are always mod_color
if (k.flags != 0) {
::LEDControl.setCrgbAt(r, c, mod_color_);
continue;
}
cRGB color = mod_color_;
switch (k.keyCode) {
case Key_A.keyCode ... Key_0.keyCode:
case Key_Spacebar.keyCode:
case Key_KeypadDivide.keyCode ... Key_KeypadSubtract.keyCode:
case Key_Keypad1.keyCode ... Key_KeypadDot.keyCode:
case Key_F1.keyCode ... Key_F4.keyCode:
case Key_F9.keyCode ... Key_F12.keyCode:
color = base_color_;
break;
case Key_Escape.keyCode:
color = esc_color_;
break;
}
::LEDControl.setCrgbAt(r, c, color);
}
}
}
}
}

@ -0,0 +1,39 @@
/* -*- mode: c++ -*-
* Kaleidoscope-LEDEffects -- An assorted collection of LED effects for Kaleidoscope
* Copyright (C) 2016, 2017 Keyboard.io, Inc
*
* 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 the Free Software
* Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <Kaleidoscope.h>
#include <Kaleidoscope-LEDControl.h>
namespace kaleidoscope {
namespace plugin {
class TriColor : public LEDMode {
public:
TriColor(cRGB base_color, cRGB mod_color, cRGB esc_color);
TriColor(cRGB base_color, cRGB mod_color) : TriColor(base_color, mod_color, mod_color) {}
protected:
void update(void) final;
private:
cRGB base_color_;
cRGB mod_color_;
cRGB esc_color_;
};
}
}
Loading…
Cancel
Save