Drop the on/off functions

There are - and will be - better ways to turn a plugin on and off, than
having to implement on/off methods on the plugin itself. As such, remove
them.

Fixes #3.

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

@ -37,8 +37,8 @@ enabling the plugin:
#include <Kaleidoscope-SpaceCadet.h> #include <Kaleidoscope-SpaceCadet.h>
void setup () { void setup () {
Kaleidoscope.setup (KEYMAP_SIZE); Kaleidoscope.setup ();
Kaleidoscope.use (&SpaceCadetShift, NULL); USE_PLUGINS (&SpaceCadetShift);
} }
``` ```
@ -63,19 +63,10 @@ The plugin has a number of methods available on the `SpaceCadetShift` object:
```c++ ```c++
void setup () { void setup () {
SpaceCadetShift.configure(Key_8, Key_9); SpaceCadetShift.configure(Key_8, Key_9);
Kaleidoscope.setup (KEYMAP_SIZE); Kaleidoscope.setup ();
} }
``` ```
### `.on()`
> This method turns the SpaceCadet Shift behaviour on, if it was turned off.
### `.off()`
> Turns the SpaceCadet Shift behaviour off, making the `Shift` keys work as they
> did before, without the additional behaviour.
### `.timeOut` ### `.timeOut`
> The number of milliseconds to wait before considering a held key in isolation > The number of milliseconds to wait before considering a held key in isolation

@ -41,8 +41,8 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
}; };
void setup () { void setup () {
Kaleidoscope.setup (KEYMAP_SIZE); Kaleidoscope.setup ();
Kaleidoscope.use (&SpaceCadetShift, NULL); USE_PLUGINS (&SpaceCadetShift);
} }
void loop () { void loop () {

@ -41,21 +41,6 @@ namespace KaleidoscopePlugins {
rightParen = right; rightParen = right;
} }
void
SpaceCadetShift::on (void) {
event_handler_hook_replace (this->noOpHook, this->eventHandlerHook);
}
void
SpaceCadetShift::off (void) {
event_handler_hook_replace (this->eventHandlerHook, this->noOpHook);
}
Key
SpaceCadetShift::noOpHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
return mappedKey;
}
Key Key
SpaceCadetShift::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) { SpaceCadetShift::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
// If nothing happened, bail out fast. // If nothing happened, bail out fast.

@ -30,15 +30,12 @@ namespace KaleidoscopePlugins {
static void configure (Key left, Key right); static void configure (Key left, Key right);
static uint16_t timeOut; static uint16_t timeOut;
void on (void);
void off (void);
private: private:
static uint8_t parenNeeded; static uint8_t parenNeeded;
static uint32_t startTime; static uint32_t startTime;
static Key leftParen, rightParen; static Key leftParen, rightParen;
static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState); static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState);
static Key noOpHook (Key, byte row, byte col, uint8_t keyState);
}; };
}; };

Loading…
Cancel
Save