diff --git a/README.md b/README.md index 6220ee78..8f6b9e75 100644 --- a/README.md +++ b/README.md @@ -5,42 +5,4 @@ [travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-Escape-OneShot.svg?branch=master [travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-Escape-OneShot -Turn the `Esc` key into a special key, that can cancel any active `OneShot` -effect - or act as the normal `Esc` key if none are active, or if any of them -are still held. For those times when one accidentally presses a one-shot key, or -change their minds. - -## Using the plugin - -To use the plugin, one needs to include the header, and activate it. No further -configuration is necessary. - -```c++ -#include -#include -#include - -KALEIDOSCOPE_INIT_PLUGINS(OneShot, - EscapeOneShot); - -void setup () { - Kaleidoscope.setup (); -} -``` - -The plugin only makes sense when using one-shot keys. - -## Plugin methods - -The plugin provides the `EscapeOneShot` object, which has no public methods. - -## Dependencies - -* [Kaleidoscope-OneShot](https://github.com/keyboardio/Kaleidoscope-OneShot) - -## Further reading - -Starting from the [example][plugin:example] is the recommended way of getting -started with the plugin. - - [plugin:example]: https://github.com/keyboardio/Kaleidoscope-Escape-OneShot/blob/master/examples/Escape-OneShot/Escape-OneShot.ino +See [doc/plugin/Escape-OneShot.md](doc/plugin/Escape-OneShot.md) for documentation. diff --git a/doc/plugin/Escape-OneShot.md b/doc/plugin/Escape-OneShot.md new file mode 100644 index 00000000..a532dfa8 --- /dev/null +++ b/doc/plugin/Escape-OneShot.md @@ -0,0 +1,41 @@ +# Kaleidoscope-Escape-OneShot + +Turn the `Esc` key into a special key, that can cancel any active `OneShot` +effect - or act as the normal `Esc` key if none are active, or if any of them +are still held. For those times when one accidentally presses a one-shot key, or +change their minds. + +## Using the plugin + +To use the plugin, one needs to include the header, and activate it. No further +configuration is necessary. + +```c++ +#include +#include +#include + +KALEIDOSCOPE_INIT_PLUGINS(OneShot, + EscapeOneShot); + +void setup () { + Kaleidoscope.setup (); +} +``` + +The plugin only makes sense when using one-shot keys. + +## Plugin methods + +The plugin provides the `EscapeOneShot` object, which has no public methods. + +## Dependencies + +* [Kaleidoscope-OneShot](https://github.com/keyboardio/Kaleidoscope-OneShot) + +## Further reading + +Starting from the [example][plugin:example] is the recommended way of getting +started with the plugin. + + [plugin:example]: https://github.com/keyboardio/Kaleidoscope-Escape-OneShot/blob/master/examples/Escape-OneShot/Escape-OneShot.ino diff --git a/src/Kaleidoscope-Escape-OneShot.h b/src/Kaleidoscope-Escape-OneShot.h index c98d91a9..c17d595a 100644 --- a/src/Kaleidoscope-Escape-OneShot.h +++ b/src/Kaleidoscope-Escape-OneShot.h @@ -17,4 +17,4 @@ #pragma once -#include +#include diff --git a/src/Kaleidoscope/Escape-OneShot.cpp b/src/kaleidoscope/plugin/Escape-OneShot.cpp similarity index 94% rename from src/Kaleidoscope/Escape-OneShot.cpp rename to src/kaleidoscope/plugin/Escape-OneShot.cpp index c86fde3c..965d3f7c 100644 --- a/src/Kaleidoscope/Escape-OneShot.cpp +++ b/src/kaleidoscope/plugin/Escape-OneShot.cpp @@ -20,6 +20,7 @@ #include namespace kaleidoscope { +namespace plugin { EventHandlerResult EscapeOneShot::onKeyswitchEvent(Key &mapped_key, byte row, byte col, uint8_t keyState) { if (mapped_key.raw != Key_Escape.raw || @@ -36,6 +37,7 @@ EventHandlerResult EscapeOneShot::onKeyswitchEvent(Key &mapped_key, byte row, by return EventHandlerResult::EVENT_CONSUMED; } +} } -kaleidoscope::EscapeOneShot EscapeOneShot; +kaleidoscope::plugin::EscapeOneShot EscapeOneShot; diff --git a/src/Kaleidoscope/Escape-OneShot.h b/src/kaleidoscope/plugin/Escape-OneShot.h similarity index 92% rename from src/Kaleidoscope/Escape-OneShot.h rename to src/kaleidoscope/plugin/Escape-OneShot.h index 7775772b..558d707f 100644 --- a/src/Kaleidoscope/Escape-OneShot.h +++ b/src/kaleidoscope/plugin/Escape-OneShot.h @@ -20,6 +20,7 @@ #include namespace kaleidoscope { +namespace plugin { class EscapeOneShot : public kaleidoscope::Plugin { public: EscapeOneShot(void) {} @@ -27,5 +28,6 @@ class EscapeOneShot : public kaleidoscope::Plugin { EventHandlerResult onKeyswitchEvent(Key &mapped_key, byte row, byte col, uint8_t keyState); }; } +} -extern kaleidoscope::EscapeOneShot EscapeOneShot; +extern kaleidoscope::plugin::EscapeOneShot EscapeOneShot;