Drop the on/off functions

Having function to turn a plugin on and off is not the right way, remove
them.

Fixes #3.

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

@ -32,8 +32,8 @@ static const Key topsyTurvyList[] PROGMEM = {
void setup () { void setup () {
TopsyTurvy.configure (topsyTurvyList); TopsyTurvy.configure (topsyTurvyList);
Kaleidoscope.setup (KEYMAP_SIZE); Kaleidoscope.setup ();
Kaleidoscope.use (&TopsyTurvy, NULL); USE_PLUGINS (&TopsyTurvy);
} }
``` ```
@ -48,16 +48,6 @@ The plugin provides the `TopsyTurvy` object, with the following methods:
> Tells `TopsyTurvy` to use the specified list of keys. > Tells `TopsyTurvy` to use the specified list of keys.
### `.on()`
> Turns the shift-inversion functionality on.
### `.off()`
> Turns the shift-inversion functionality off. In this case, no transformations
> will be applied, and even if keys pressed appear in the list, they will be
> ignored until the plugin is turned back on.
## Further reading ## Further reading
Starting from the [example][plugin:example] is the recommended way of getting Starting from the [example][plugin:example] is the recommended way of getting

@ -49,8 +49,8 @@ static const Key topsyTurvyList[] PROGMEM = {
void setup () { void setup () {
TopsyTurvy.configure (topsyTurvyList); TopsyTurvy.configure (topsyTurvyList);
Kaleidoscope.setup (KEYMAP_SIZE); Kaleidoscope.setup ();
Kaleidoscope.use (&TopsyTurvy, NULL); USE_PLUGINS (&TopsyTurvy);
} }
void loop () { void loop () {

@ -38,21 +38,6 @@ namespace KaleidoscopePlugins {
topsyTurvyList = (const Key *)list; topsyTurvyList = (const Key *)list;
} }
void
TopsyTurvy::on (void) {
event_handler_hook_replace (this->noOpHook, this->eventHandlerHook);
}
void
TopsyTurvy::off (void) {
event_handler_hook_replace (this->eventHandlerHook, this->noOpHook);
}
Key
TopsyTurvy::noOpHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
return mappedKey;
}
Key Key
TopsyTurvy::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) { TopsyTurvy::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
if (keyState & TOPSYTURVY) if (keyState & TOPSYTURVY)

@ -29,15 +29,11 @@ namespace KaleidoscopePlugins {
static void configure (const Key topsyTurvyList[]); static void configure (const Key topsyTurvyList[]);
void on (void);
void off (void);
private: private:
static const Key *topsyTurvyList; static const Key *topsyTurvyList;
static uint8_t topsyTurvyModState; static uint8_t topsyTurvyModState;
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