Move the documentation to `doc/plugin/NumPad.md`, sources under `src/kaleidoscope/plugin/` (appropriately namespaced). This is in preparation of merging plugins into a single monorepo. Signed-off-by: Gergely Nagy <algernon@keyboard.io>pull/365/head
parent
f2c65cb175
commit
09c48b8da2
@ -1,39 +1,8 @@
|
|||||||
# Kaleidoscope-NumPad
|
# Kaleidoscope-NumPad
|
||||||
|
|
||||||
This is a plugin for [Kaleidoscope][fw], that adds a NumPad-specific LED
|
[![Build Status][travis:image]][travis:status]
|
||||||
effect, along with a way to toggle to a numpad layer, and apply the effect.
|
|
||||||
|
|
||||||
## Using the extension
|
[travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-NumPad.svg?branch=master
|
||||||
|
[travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-NumPad
|
||||||
|
|
||||||
To use the plugin, include the header, and tell the firmware to use it:
|
See [doc/plugin/NumPad.md](doc/plugin/NumPad.md) for documentation.
|
||||||
|
|
||||||
```c++
|
|
||||||
#include "Kaleidoscope-NumPad.h"
|
|
||||||
|
|
||||||
KALEIDOSCOPE_INIT_PLUGINS(NumPad);
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Kaleidoscope.setup();
|
|
||||||
|
|
||||||
NumPad.color = CRGB(0, 0, 160); // a blue color
|
|
||||||
NumPad.lock_hue = 85; // green
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Plugin methods
|
|
||||||
|
|
||||||
The plugin provides the `NumPad` object, with the following properties:
|
|
||||||
|
|
||||||
### `.color`
|
|
||||||
|
|
||||||
> This property sets the color that the NumPad keys are highlighted in.
|
|
||||||
>
|
|
||||||
> The default is `CRGB(160, 0, 0)`, a red color.
|
|
||||||
|
|
||||||
### `.lock_hue`
|
|
||||||
|
|
||||||
> This property sets the color hue that the NumLock LED breathes in.
|
|
||||||
>
|
|
||||||
> The default is `170`, a blue hue.
|
|
||||||
|
|
||||||
[fw]: https://github.com/keyboardio/Kaleidoscope
|
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
# Kaleidoscope-NumPad
|
||||||
|
|
||||||
|
This is a plugin for [Kaleidoscope][fw], that adds a NumPad-specific LED
|
||||||
|
effect, along with a way to toggle to a numpad layer, and apply the effect.
|
||||||
|
|
||||||
|
## Using the extension
|
||||||
|
|
||||||
|
To use the plugin, include the header, and tell the firmware to use it:
|
||||||
|
|
||||||
|
```c++
|
||||||
|
#include "Kaleidoscope-NumPad.h"
|
||||||
|
|
||||||
|
KALEIDOSCOPE_INIT_PLUGINS(NumPad);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Kaleidoscope.setup();
|
||||||
|
|
||||||
|
NumPad.color = CRGB(0, 0, 160); // a blue color
|
||||||
|
NumPad.lock_hue = 85; // green
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Plugin methods
|
||||||
|
|
||||||
|
The plugin provides the `NumPad` object, with the following properties:
|
||||||
|
|
||||||
|
### `.color`
|
||||||
|
|
||||||
|
> This property sets the color that the NumPad keys are highlighted in.
|
||||||
|
>
|
||||||
|
> The default is `CRGB(160, 0, 0)`, a red color.
|
||||||
|
|
||||||
|
### `.lock_hue`
|
||||||
|
|
||||||
|
> This property sets the color hue that the NumLock LED breathes in.
|
||||||
|
>
|
||||||
|
> The default is `170`, a blue hue.
|
||||||
|
|
||||||
|
[fw]: https://github.com/keyboardio/Kaleidoscope
|
@ -0,0 +1,50 @@
|
|||||||
|
/* Kaleidoscope-NumPad - A NumPad plugin for Kaleidoscope.
|
||||||
|
* Copyright (C) 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Kaleidoscope-LEDControl.h"
|
||||||
|
|
||||||
|
namespace kaleidoscope {
|
||||||
|
namespace plugin {
|
||||||
|
|
||||||
|
class NumPad : public kaleidoscope::Plugin {
|
||||||
|
public:
|
||||||
|
NumPad(void) {}
|
||||||
|
|
||||||
|
static uint8_t numPadLayer;
|
||||||
|
static cRGB color;
|
||||||
|
static uint8_t lock_hue;
|
||||||
|
|
||||||
|
EventHandlerResult onSetup(void);
|
||||||
|
EventHandlerResult afterEachCycle();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void cleanupNumlockState(void);
|
||||||
|
void setKeyboardLEDColors(void);
|
||||||
|
bool getNumlockState(void);
|
||||||
|
void syncNumlockState(bool);
|
||||||
|
|
||||||
|
static uint8_t numpadLayerToggleKeyRow;
|
||||||
|
static uint8_t numpadLayerToggleKeyCol;
|
||||||
|
static bool numlockUnsynced;
|
||||||
|
static bool originalNumLockState;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern kaleidoscope::plugin::NumPad NumPad;
|
Loading…
Reference in new issue