Expose a way to set the timeOut

Fixes #6.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/389/head
Gergely Nagy 8 years ago
parent 5394fc834f
commit da2bc4d656

@ -122,6 +122,15 @@ modifiers and one-shot layer keys. It has the following methods:
> momentary layer switchers. As `on()`, this method is idempotent, and can be
> called at any time, from anywhere.
### `.timeOut`
> The number of loop iterations to wait before timing out and cancelling the
> one-shot effect, unless interrupted or cancelled before by any other means.
>
> Not strictly a method, it is a variable one can assign a new value to.
>
> Defaults to 40.
## Further reading
Starting from the [example][plugin:example] is the recommended way of getting

@ -24,7 +24,7 @@ namespace Akela {
// ---- state ---------
uint8_t OneShot::Timer = 0;
uint8_t OneShot::TimeOut = DEFAULT_TIMEOUT;
uint8_t OneShot::timeOut = 40;
uint32_t OneShot::State = 0;
uint32_t OneShot::stickyState = 0;
uint32_t OneShot::pressedState = 0;
@ -57,7 +57,7 @@ namespace Akela {
#define toNormalMod(key, idx) {key.flags = 0; key.keyCode = Key_LCtrl.keyCode + idx;}
#define toNormalMT(key, idx) { key.raw = Key_NoKey.raw; Layer.on (idx - 8); }
#define hasTimedOut() (Timer >= TimeOut)
#define hasTimedOut() (Timer >= timeOut)
// ----- passthrough ------
@ -255,7 +255,7 @@ namespace Akela {
return;
if (postClear) {
if (Timer < TimeOut)
if (Timer < timeOut)
Timer++;
if (hasTimedOut ())

@ -36,6 +36,7 @@ namespace Akela {
static bool isActive (void);
static void cancel (bool withStickies);
static void cancel (void) { cancel (false); };
static uint8_t timeOut;
static bool isModifierActive (Key key);
@ -43,7 +44,6 @@ namespace Akela {
private:
static uint8_t Timer;
static uint8_t TimeOut;
static uint32_t State;
static uint32_t stickyState;
static uint32_t pressedState;

Loading…
Cancel
Save