Rearrange the file layout in preparation of becoming a monorepo

Move the documentation to `doc/plugin/USB-Quirks.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/365/head
Gergely Nagy 6 years ago
parent 4fe501c935
commit f8587d3505
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -5,40 +5,4 @@
[travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-USB-Quirks.svg?branch=master [travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-USB-Quirks.svg?branch=master
[travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-USB-Quirks [travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-USB-Quirks
USB-Quirks provides a few methods to deal with more obscure parts of the USB spec, such as changing between `Boot` and `Report` protocols. These are in a separate plugin, because these features are not part of the USB spec, and are often workarounds for various issues. See the provided methods for more information about what they're useful for. See [doc/plugin/USB-Quirks.md](doc/plugin/USB-Quirks.md) for documentation.
## Using the plugin
```c++
#include <Kaleidoscope.h>
#include <Kaleidoscope-Macros.h>
#include <Kaleidoscope-USB-Quirks.h>
KALEIDOSCOPE_INIT_PLUGINS(USBQuirks, Macros);
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
if (macroIndex == 0) {
USBQuirks.toggleKeyboardProtocol();
}
return MACRO_NONE;
}
void setup() {
Kaleidoscope.setup();
}
```
## Plugin methods
The plugin provides one object, `USBQuirks`, which provides the following method:
### `.toggleKeyboardProtocol()`
> Toggle between `Boot` and `Report` protocol by detaching, and then
> re-attaching the USB devices, and setting the `BootKeyboard` protocol
> inbetween.
>
> This is most useful when one needs to have a boot keyboard, when one's in a
> BIOS, boot loader, or early password prompt or the like, and the host does not
> explicitly request the boot protocol for one reason or the other. With this
> toggle, we can switch between the two on-demand.

@ -0,0 +1,39 @@
# Kaleidoscope-USB-Quirks
USB-Quirks provides a few methods to deal with more obscure parts of the USB spec, such as changing between `Boot` and `Report` protocols. These are in a separate plugin, because these features are not part of the USB spec, and are often workarounds for various issues. See the provided methods for more information about what they're useful for.
## Using the plugin
```c++
#include <Kaleidoscope.h>
#include <Kaleidoscope-Macros.h>
#include <Kaleidoscope-USB-Quirks.h>
KALEIDOSCOPE_INIT_PLUGINS(USBQuirks, Macros);
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
if (macroIndex == 0) {
USBQuirks.toggleKeyboardProtocol();
}
return MACRO_NONE;
}
void setup() {
Kaleidoscope.setup();
}
```
## Plugin methods
The plugin provides one object, `USBQuirks`, which provides the following method:
### `.toggleKeyboardProtocol()`
> Toggle between `Boot` and `Report` protocol by detaching, and then
> re-attaching the USB devices, and setting the `BootKeyboard` protocol
> inbetween.
>
> This is most useful when one needs to have a boot keyboard, when one's in a
> BIOS, boot loader, or early password prompt or the like, and the host does not
> explicitly request the boot protocol for one reason or the other. With this
> toggle, we can switch between the two on-demand.

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

@ -19,6 +19,7 @@
#include <Kaleidoscope-USB-Quirks.h> #include <Kaleidoscope-USB-Quirks.h>
namespace kaleidoscope { namespace kaleidoscope {
namespace plugin {
void USBQuirks::toggleKeyboardProtocol() { void USBQuirks::toggleKeyboardProtocol() {
@ -34,6 +35,7 @@ void USBQuirks::toggleKeyboardProtocol() {
} }
}
} }
kaleidoscope::USBQuirks USBQuirks; kaleidoscope::plugin::USBQuirks USBQuirks;

@ -21,6 +21,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
namespace kaleidoscope { namespace kaleidoscope {
namespace plugin {
class USBQuirks: public kaleidoscope::Plugin { class USBQuirks: public kaleidoscope::Plugin {
public: public:
USBQuirks() {} USBQuirks() {}
@ -28,5 +29,6 @@ class USBQuirks: public kaleidoscope::Plugin {
void toggleKeyboardProtocol(); void toggleKeyboardProtocol();
}; };
} }
}
extern kaleidoscope::USBQuirks USBQuirks; extern kaleidoscope::plugin::USBQuirks USBQuirks;
Loading…
Cancel
Save