From 55f57bdcfe2dc19e38013ca7aff00b7ff68f7195 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 7 Mar 2017 13:58:22 +0100 Subject: [PATCH] Drop the on/off functions The on/off functions were meant to make it easier to experiment, but there are - and will be - better ways to achieve the same thing. So remove them, lest anyone ends up using them. Fixes #2. Signed-off-by: Gergely Nagy --- README.md | 15 ++------------- examples/ShapeShifter/ShapeShifter.ino | 4 ++-- src/Kaleidoscope/ShapeShifter.cpp | 21 --------------------- src/Kaleidoscope/ShapeShifter.h | 6 ------ 4 files changed, 4 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index f9cb1d37..4d857a41 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ static const KaleidoscopePlugins::ShapeShifter::dictionary_t shapeShiftDictionar void setup () { ShapeShifter.configure (shapeShiftDictionary); - Kaleidoscope.setup (KEYMAP_SIZE); - Kaleidoscope.use (&ShapeShifter, NULL); + Kaleidoscope.setup (); + USE_PLUGINS (&ShapeShifter); } ``` @@ -60,17 +60,6 @@ The plugin provides the `ShapeShifter` object, with the following methods: > Be aware that the replacement key will be pressed with `Shift` held, so do > keep that in mind! -### `.on()` - -> Turns the shape shifting functionality on. Requires that the plugin -> be [configured](#configuredictionary) first. - -### `.off()` - -> Turns the shape shifting functionality off. In this case, no transformations -> will be applied, and even if symbols appear in the dictionary, 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/ShapeShifter/ShapeShifter.ino b/examples/ShapeShifter/ShapeShifter.ino index 1c008f92..c4e9d00e 100644 --- a/examples/ShapeShifter/ShapeShifter.ino +++ b/examples/ShapeShifter/ShapeShifter.ino @@ -49,8 +49,8 @@ static const KaleidoscopePlugins::ShapeShifter::dictionary_t shapeShiftDictionar void setup () { ShapeShifter.configure (shapeShiftDictionary); - Kaleidoscope.setup (KEYMAP_SIZE); - Kaleidoscope.use (&ShapeShifter, NULL); + Kaleidoscope.setup (); + USE_PLUGINS (&ShapeShifter); } void loop () { diff --git a/src/Kaleidoscope/ShapeShifter.cpp b/src/Kaleidoscope/ShapeShifter.cpp index 53b14a7a..68a0d544 100644 --- a/src/Kaleidoscope/ShapeShifter.cpp +++ b/src/Kaleidoscope/ShapeShifter.cpp @@ -37,27 +37,6 @@ namespace KaleidoscopePlugins { dictionary = (const dictionary_t *)dictionary_; } - void - ShapeShifter::on (void) { - event_handler_hook_replace (this->noOpHook, this->eventHandlerHook); - loop_hook_replace (this->noOpLoopHook, this->loopHook); - } - - void - ShapeShifter::off (void) { - event_handler_hook_replace (this->eventHandlerHook, this->noOpHook); - loop_hook_replace (this->loopHook, this->noOpLoopHook); - } - - Key - ShapeShifter::noOpHook (Key mappedKey, byte row, byte col, uint8_t keyState) { - return mappedKey; - } - - void - ShapeShifter::noOpLoopHook (bool postClear) { - } - void ShapeShifter::loopHook (bool postClear) { if (postClear) diff --git a/src/Kaleidoscope/ShapeShifter.h b/src/Kaleidoscope/ShapeShifter.h index 70bef330..246ce252 100644 --- a/src/Kaleidoscope/ShapeShifter.h +++ b/src/Kaleidoscope/ShapeShifter.h @@ -33,18 +33,12 @@ namespace KaleidoscopePlugins { static void configure (const dictionary_t dictionary[]); - void on (void); - void off (void); - private: static const dictionary_t *dictionary; static bool modActive; static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState); - static Key noOpHook (Key, byte row, byte col, uint8_t keyState); - static void loopHook (bool postClear); - static void noOpLoopHook (bool postClear); }; };