Now that we have key masking functionality provided by KeyboardHardware, use
that instead of going with our own.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Refer to modifiers with their new names, and to Kaleidoscope as such (as opposed
to KaleidoscopeFirmware, a remnant of KeyboardioFirmware, I suppose).
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
To make it easier in the future to increase the amount of one-shot
layers available, use a union+struct combo, that allows scaling between
16 and 32 bits. This way we won't have to use all 32 bits, and can make
do with 24 only, still saving us almost a hundred bytes.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Instead of supporting up to 24 one-shot layers, support only 8. This
allows us to fit all state in 16 bits, down from 32, saving us almost
200 bytes of program memory.
Partially addresses #8.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
There are - or will be - better ways to experiment, drop these, lest
anyone starts depending on them.
Fixes#7.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Loop counter depends on the speed of the loop, timers don't. As such, timers are
much more reliable, even at the cost of using more data space.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
When a key interrupts the one-shot, mask the position out until a key release.
This is needed, because even a short tap usually results in a short hold, which
in turn - without the mask - handles the key.
Instead, we now mask the position out until it is released, so no such problems
arise. Fixes#4.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
We want to treat the one-shot keys as active even when they were interrupted -
as long as their state is not cleared. This is because when using isActive from
another plugin, or macro, that is usually in response to a key press that
already sets up `shouldCancel` - yet, the modifier is technically active still!
So `isActive` does not check the to-be-cancelled flag anymore. This makes the
Escape-OneShot plugin much more reliable as a consequence.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Useful when writing an event handler that needs to check if a modifier is
active, but may run before OneShot has a chance to re-register the given
modifier.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
When another one-shot key is pressed, reset the timer, and handle it as if
starting anew, but without cancelling any previous one-shots. This allows one to
chain one-shots together.
Fixes#3.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
The macro needs to check `.keyCode` and `.flags` separately, due to byte
ordering. If it does not, it will easily catch other things.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Cancel the one-shot state when the interruptor is pressed, not when it is
released. Otherwise, when typing fast, other keys pressed while the interruptor
is still releasing, may have the one-shot effect applied too.
For this to work, we need to do the cancellation post-clear, otherwise the
one-shot modifiers are cleared before they register with the interruptor.
Fixes#1, which used to be keyboardio/Akela#121.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>