Rearrange the file layout in preparation of becoming a monorepo

Move the documentation to `doc/plugin/Redial.md`, sources under
`src/kaleidoscope/plugin/` (appropriately namespaced). This is in preparation of
merging plugins into a single monorepo.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/389/head
Gergely Nagy 6 years ago
parent 5bc05f54f3
commit a33f703890
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -5,64 +5,4 @@
[travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-Redial.svg?branch=master [travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-Redial.svg?branch=master
[travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-Redial [travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-Redial
If you ever wanted to just repeat the last key pressed, no matter what it was, See [doc/plugin/Redial.md](doc/plugin/Redial.md) for documentation.
this plugin is made for you. It allows you to configure a key that will repeat
whatever the last previously pressed key was. Of course, one can limit which
keys are remembered...
## Using the plugin
To use the plugin, we'll need to enable it, and configure a key to act as the
"redial" key. This key should be on the keymap too.
```c++
#include <Kaleidoscope.h>
#include <Kaleidoscope-Redial.h>
#include <kaleidoscope-Ranges.h>
enum {
REDIAL = kaleidoscope::ranges::SAFE_START,
};
#define Key_Redial (Key) {.raw = REDIAL}
// Place Key_Redial somewhere on the keymap...
KALEIDOSCOPE_INIT_PLUGINS(Redial);
void setup() {
Kaleidoscope.setup();
Redial.key = Key_Redial;
}
```
## Overrideable plugin methods
### `bool shouldRemember(Key mapped_key)`
> If one wants to change what keys the plugin remembers, simply override the
> `kaleidoscope::Redial::shouldRemember` function. Whenever a key is to be
> remembered, this function will be called with the key as argument. It should
> return `true` if the key should be remembered (and repeated by Redial),
> `false` otherwise.
>
> By default, the plugin will remember alphanumeric keys only.
## Plugin properties
The `Redial` object has only one property, the key to trigger it.
### `.key`
> The key to trigger the redial effect. Be aware that whatever key you specify
> here, will have its action shadowed by the redial functionality. Choose
> something unused, see the example sketch for one way to do that.
>
> There is no default.
## 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-Redial/blob/master/examples/Redial/Redial.ino

@ -0,0 +1,63 @@
# Kaleidoscope-Redial
If you ever wanted to just repeat the last key pressed, no matter what it was,
this plugin is made for you. It allows you to configure a key that will repeat
whatever the last previously pressed key was. Of course, one can limit which
keys are remembered...
## Using the plugin
To use the plugin, we'll need to enable it, and configure a key to act as the
"redial" key. This key should be on the keymap too.
```c++
#include <Kaleidoscope.h>
#include <Kaleidoscope-Redial.h>
#include <kaleidoscope-Ranges.h>
enum {
REDIAL = kaleidoscope::ranges::SAFE_START,
};
#define Key_Redial (Key) {.raw = REDIAL}
// Place Key_Redial somewhere on the keymap...
KALEIDOSCOPE_INIT_PLUGINS(Redial);
void setup() {
Kaleidoscope.setup();
Redial.key = Key_Redial;
}
```
## Overrideable plugin methods
### `bool shouldRemember(Key mapped_key)`
> If one wants to change what keys the plugin remembers, simply override the
> `kaleidoscope::Redial::shouldRemember` function. Whenever a key is to be
> remembered, this function will be called with the key as argument. It should
> return `true` if the key should be remembered (and repeated by Redial),
> `false` otherwise.
>
> By default, the plugin will remember alphanumeric keys only.
## Plugin properties
The `Redial` object has only one property, the key to trigger it.
### `.key`
> The key to trigger the redial effect. Be aware that whatever key you specify
> here, will have its action shadowed by the redial functionality. Choose
> something unused, see the example sketch for one way to do that.
>
> There is no default.
## 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-Redial/blob/master/examples/Redial/Redial.ino

@ -25,7 +25,7 @@ enum {
}; };
#define Key_Redial (Key) {.raw = REDIAL} #define Key_Redial (Key) {.raw = REDIAL}
bool kaleidoscope::Redial::shouldRemember(Key mapped_key) { bool kaleidoscope::plugin::Redial::shouldRemember(Key mapped_key) {
if (mapped_key >= Key_A && mapped_key <= Key_Z) if (mapped_key >= Key_A && mapped_key <= Key_Z)
return true; return true;
return false; return false;

@ -18,4 +18,4 @@
#pragma once #pragma once
#include <Kaleidoscope/Redial.h> #include <kaleidoscope/plugin/Redial.h>

@ -19,6 +19,7 @@
#include <Kaleidoscope-Redial.h> #include <Kaleidoscope-Redial.h>
namespace kaleidoscope { namespace kaleidoscope {
namespace plugin {
Key Redial::key; Key Redial::key;
Key Redial::key_to_redial_; Key Redial::key_to_redial_;
@ -48,6 +49,7 @@ __attribute__((weak)) bool Redial::shouldRemember(Key mapped_key) {
return false; return false;
} }
}
} }
kaleidoscope::Redial Redial; kaleidoscope::plugin::Redial Redial;

@ -21,6 +21,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
namespace kaleidoscope { namespace kaleidoscope {
namespace plugin {
class Redial : public kaleidoscope::Plugin { class Redial : public kaleidoscope::Plugin {
public: public:
@ -36,6 +37,7 @@ class Redial : public kaleidoscope::Plugin {
static Key key_to_redial_; static Key key_to_redial_;
}; };
}
} }
extern kaleidoscope::Redial Redial; extern kaleidoscope::plugin::Redial Redial;
Loading…
Cancel
Save