Move the documentation to `doc/plugin/HostPowerManagement.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
parent
403754f915
commit
5099d8ebb9
@ -0,0 +1,47 @@
|
|||||||
|
# Kaleidoscope-HostPowerManagement
|
||||||
|
|
||||||
|
Support performing custom actions whenever the host suspends, resumes, or is
|
||||||
|
sleeping.
|
||||||
|
|
||||||
|
## Using the plugin
|
||||||
|
|
||||||
|
To use the plugin, one needs to include the header, and activate it. No further
|
||||||
|
configuration is necessary, unless one wants to perform custom actions.
|
||||||
|
|
||||||
|
```c++
|
||||||
|
#include <Kaleidoscope.h>
|
||||||
|
#include <Kaleidoscope-HostPowerManagement.h>
|
||||||
|
|
||||||
|
KALEIDOSCOPE_INIT_PLUGINS(HostPowerManagement);
|
||||||
|
|
||||||
|
void setup () {
|
||||||
|
Kaleidoscope.setup ();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Plugin methods
|
||||||
|
|
||||||
|
The plugin provides the `HostPowerManagement` object, with no public methods.
|
||||||
|
|
||||||
|
## Overrideable methods
|
||||||
|
|
||||||
|
### `hostPowerManagementEventHandler(event)`
|
||||||
|
|
||||||
|
> The `hostPowerManagementEventHandler` method is the brain of the plugin: this function
|
||||||
|
> tells it what action to perform in response to the various events.
|
||||||
|
>
|
||||||
|
> Currently supported events are:
|
||||||
|
> `kaleidoscope::plugin::HostPowerManagement::Suspend` is fired once when the
|
||||||
|
> host suspends; `kaleidoscope::plugin::HostPowerManagement::Sleep` is fired
|
||||||
|
> every cycle while the host is suspended;
|
||||||
|
> `kaleidoscope::plugin::HostPowerManagement::Resume` is fired once when the
|
||||||
|
> host wakes up.
|
||||||
|
>
|
||||||
|
> The default implementation is empty.
|
||||||
|
|
||||||
|
## 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-HostPowerManagement/blob/master/examples/HostPowerManagement/HostPowerManagement.ino
|
Loading…
Reference in new issue