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 <algernon@madhouse-project.org>
pull/389/head^2
Gergely Nagy 8 years ago
parent 70c106fc7d
commit 55f57bdcfe

@ -37,8 +37,8 @@ static const KaleidoscopePlugins::ShapeShifter::dictionary_t shapeShiftDictionar
void setup () { void setup () {
ShapeShifter.configure (shapeShiftDictionary); ShapeShifter.configure (shapeShiftDictionary);
Kaleidoscope.setup (KEYMAP_SIZE); Kaleidoscope.setup ();
Kaleidoscope.use (&ShapeShifter, NULL); 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 > Be aware that the replacement key will be pressed with `Shift` held, so do
> keep that in mind! > 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 ## 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 KaleidoscopePlugins::ShapeShifter::dictionary_t shapeShiftDictionar
void setup () { void setup () {
ShapeShifter.configure (shapeShiftDictionary); ShapeShifter.configure (shapeShiftDictionary);
Kaleidoscope.setup (KEYMAP_SIZE); Kaleidoscope.setup ();
Kaleidoscope.use (&ShapeShifter, NULL); USE_PLUGINS (&ShapeShifter);
} }
void loop () { void loop () {

@ -37,27 +37,6 @@ namespace KaleidoscopePlugins {
dictionary = (const dictionary_t *)dictionary_; 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 void
ShapeShifter::loopHook (bool postClear) { ShapeShifter::loopHook (bool postClear) {
if (postClear) if (postClear)

@ -33,18 +33,12 @@ namespace KaleidoscopePlugins {
static void configure (const dictionary_t dictionary[]); static void configure (const dictionary_t dictionary[]);
void on (void);
void off (void);
private: private:
static const dictionary_t *dictionary; static const dictionary_t *dictionary;
static bool modActive; static bool modActive;
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);
static void loopHook (bool postClear); static void loopHook (bool postClear);
static void noOpLoopHook (bool postClear);
}; };
}; };

Loading…
Cancel
Save