|
|
@ -1,17 +1,14 @@
|
|
|
|
# Kaleidoscope-MyOldFriend
|
|
|
|
# Kaleidoscope-HostPowerManagement
|
|
|
|
|
|
|
|
|
|
|
|
![status][st:experimental] [![Build Status][travis:image]][travis:status]
|
|
|
|
![status][st:experimental] [![Build Status][travis:image]][travis:status]
|
|
|
|
|
|
|
|
|
|
|
|
[travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-MyOldFriend.svg?branch=master
|
|
|
|
[travis:image]: https://travis-ci.org/keyboardio/Kaleidoscope-HostPowerManagement.svg?branch=master
|
|
|
|
[travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-MyOldFriend
|
|
|
|
[travis:status]: https://travis-ci.org/keyboardio/Kaleidoscope-HostPowerManagement
|
|
|
|
|
|
|
|
|
|
|
|
[st:stable]: https://img.shields.io/badge/stable-✔-black.svg?style=flat&colorA=44cc11&colorB=494e52
|
|
|
|
[st:stable]: https://img.shields.io/badge/stable-✔-black.svg?style=flat&colorA=44cc11&colorB=494e52
|
|
|
|
[st:broken]: https://img.shields.io/badge/broken-X-black.svg?style=flat&colorA=e05d44&colorB=494e52
|
|
|
|
[st:broken]: https://img.shields.io/badge/broken-X-black.svg?style=flat&colorA=e05d44&colorB=494e52
|
|
|
|
[st:experimental]: https://img.shields.io/badge/experimental----black.svg?style=flat&colorA=dfb317&colorB=494e52
|
|
|
|
[st:experimental]: https://img.shields.io/badge/experimental----black.svg?style=flat&colorA=dfb317&colorB=494e52
|
|
|
|
|
|
|
|
|
|
|
|
> Hello darkness, my old friend
|
|
|
|
|
|
|
|
> I've come to talk with you again
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Support performing custom actions whenever the host suspends, resumes, or is
|
|
|
|
Support performing custom actions whenever the host suspends, resumes, or is
|
|
|
|
sleeping. By default, the LEDs will be turned off on suspend, and the previous
|
|
|
|
sleeping. By default, the LEDs will be turned off on suspend, and the previous
|
|
|
|
LED mode restored on resume.
|
|
|
|
LED mode restored on resume.
|
|
|
@ -23,18 +20,19 @@ configuration is necessary, unless one wants to perform custom actions.
|
|
|
|
|
|
|
|
|
|
|
|
```c++
|
|
|
|
```c++
|
|
|
|
#include <Kaleidoscope.h>
|
|
|
|
#include <Kaleidoscope.h>
|
|
|
|
#include <Kaleidoscope-MyOldFriend.h>
|
|
|
|
#include <Kaleidoscope-HostPowerManagement.h>
|
|
|
|
|
|
|
|
|
|
|
|
void setup () {
|
|
|
|
void setup () {
|
|
|
|
Kaleidoscope.setup ();
|
|
|
|
Kaleidoscope.setup ();
|
|
|
|
|
|
|
|
|
|
|
|
Kaleidoscope.use(&MyOldFriend);
|
|
|
|
Kaleidoscope.use(&HostPowerManagement);
|
|
|
|
|
|
|
|
HostPowerManagement.enableWakeup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Plugin methods
|
|
|
|
## Plugin methods
|
|
|
|
|
|
|
|
|
|
|
|
The plugin provides the `MyOldFriend` object, which has the following methods:
|
|
|
|
The plugin provides the `HostPowerManagement` object, which has the following methods:
|
|
|
|
|
|
|
|
|
|
|
|
### `.enableWakeup()`
|
|
|
|
### `.enableWakeup()`
|
|
|
|
|
|
|
|
|
|
|
@ -46,21 +44,21 @@ The plugin provides the `MyOldFriend` object, which has the following methods:
|
|
|
|
### `.toggleLEDs(event)`
|
|
|
|
### `.toggleLEDs(event)`
|
|
|
|
|
|
|
|
|
|
|
|
> Turns LEDs off on suspend, restores the previous LED mode on resume. This is
|
|
|
|
> Turns LEDs off on suspend, restores the previous LED mode on resume. This is
|
|
|
|
> called by `myOldFriendEventHandler()` by default.
|
|
|
|
> called by `hostPowerManagementEventHandler()` by default.
|
|
|
|
|
|
|
|
|
|
|
|
## Overrideable methods
|
|
|
|
## Overrideable methods
|
|
|
|
|
|
|
|
|
|
|
|
### `myOldFriendEventHandler(event)`
|
|
|
|
### `hostPowerManagementEventHandler(event)`
|
|
|
|
|
|
|
|
|
|
|
|
> The `myOldFriendEventHandler` method is the brain of the plugin: this function
|
|
|
|
> The `hostPowerManagementEventHandler` method is the brain of the plugin: this function
|
|
|
|
> tells it what action to perform in response to the various events.
|
|
|
|
> tells it what action to perform in response to the various events.
|
|
|
|
>
|
|
|
|
>
|
|
|
|
> Currently supported events are: `kaleidoscope::MyOldFriend::Suspend` is fired
|
|
|
|
> Currently supported events are: `kaleidoscope::HostPowerManagement::Suspend` is fired
|
|
|
|
> once when the host suspends; `kaleidoscope::MyOldFriend::Sleep` is fired every
|
|
|
|
> once when the host suspends; `kaleidoscope::HostPowerManagement::Sleep` is fired every
|
|
|
|
> cycle while the host is suspended; `kaleidoscope::MyOldFriend::Resume` is
|
|
|
|
> cycle while the host is suspended; `kaleidoscope::HostPowerManagement::Resume` is
|
|
|
|
> fired once when the host wakes up.
|
|
|
|
> fired once when the host wakes up.
|
|
|
|
>
|
|
|
|
>
|
|
|
|
> The default implementation calls `MyOldFriend.toggleLEDs`. When overriding the
|
|
|
|
> The default implementation calls `HostPowerManagement.toggleLEDs`. When overriding the
|
|
|
|
> function, the default is lost.
|
|
|
|
> function, the default is lost.
|
|
|
|
|
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
## Dependencies
|
|
|
@ -72,4 +70,4 @@ The plugin provides the `MyOldFriend` object, which has the following methods:
|
|
|
|
Starting from the [example][plugin:example] is the recommended way of getting
|
|
|
|
Starting from the [example][plugin:example] is the recommended way of getting
|
|
|
|
started with the plugin.
|
|
|
|
started with the plugin.
|
|
|
|
|
|
|
|
|
|
|
|
[plugin:example]: https://github.com/keyboardio/Kaleidoscope-MyOldFriend/blob/master/examples/MyOldFriend/MyOldFriend.ino
|
|
|
|
[plugin:example]: https://github.com/keyboardio/Kaleidoscope-HostPowerManagement/blob/master/examples/HostPowerManagement/HostPowerManagement.ino
|
|
|
|