From a91048b8c6800150ad59f959778f8cc0faae9788 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 7 Mar 2017 14:10:12 +0100 Subject: [PATCH] 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 --- README.md | 14 ++------------ examples/TopsyTurvy/TopsyTurvy.ino | 4 ++-- src/Kaleidoscope/TopsyTurvy.cpp | 15 --------------- src/Kaleidoscope/TopsyTurvy.h | 4 ---- 4 files changed, 4 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 41a36557..957e3365 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ static const Key topsyTurvyList[] PROGMEM = { void setup () { TopsyTurvy.configure (topsyTurvyList); - Kaleidoscope.setup (KEYMAP_SIZE); - Kaleidoscope.use (&TopsyTurvy, NULL); + Kaleidoscope.setup (); + 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. -### `.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 Starting from the [example][plugin:example] is the recommended way of getting diff --git a/examples/TopsyTurvy/TopsyTurvy.ino b/examples/TopsyTurvy/TopsyTurvy.ino index 6648eab4..872fc711 100644 --- a/examples/TopsyTurvy/TopsyTurvy.ino +++ b/examples/TopsyTurvy/TopsyTurvy.ino @@ -49,8 +49,8 @@ static const Key topsyTurvyList[] PROGMEM = { void setup () { TopsyTurvy.configure (topsyTurvyList); - Kaleidoscope.setup (KEYMAP_SIZE); - Kaleidoscope.use (&TopsyTurvy, NULL); + Kaleidoscope.setup (); + USE_PLUGINS (&TopsyTurvy); } void loop () { diff --git a/src/Kaleidoscope/TopsyTurvy.cpp b/src/Kaleidoscope/TopsyTurvy.cpp index 9ec1094c..9adf5100 100644 --- a/src/Kaleidoscope/TopsyTurvy.cpp +++ b/src/Kaleidoscope/TopsyTurvy.cpp @@ -38,21 +38,6 @@ namespace KaleidoscopePlugins { 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 TopsyTurvy::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) { if (keyState & TOPSYTURVY) diff --git a/src/Kaleidoscope/TopsyTurvy.h b/src/Kaleidoscope/TopsyTurvy.h index 40a8a02d..8de71d36 100644 --- a/src/Kaleidoscope/TopsyTurvy.h +++ b/src/Kaleidoscope/TopsyTurvy.h @@ -29,15 +29,11 @@ namespace KaleidoscopePlugins { static void configure (const Key topsyTurvyList[]); - void on (void); - void off (void); - private: static const Key *topsyTurvyList; static uint8_t topsyTurvyModState; static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState); - static Key noOpHook (Key, byte row, byte col, uint8_t keyState); }; };