While the code became shorter with the previous commit, it did not become much
easier to understand and follow. Some of the choices made weren't self
explanatory. For that reason, lets put comments around the relevant parts, that
explain why we've done it that way.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
The `kaleidoscope::Device` aliases are there for use-cases that need to be
device agnostic, we do not need to use them in the hardware plugin itself,
because that plugin _is_ very much tied to the device. We can just use the
device specific original names.
To make things shorter, we can also set up a pair of aliases for
`KeyScannerProps` and `KeyScanner`, to make the declarations even shorter.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
We use 100kHZ for flashing, because that's more reliable. Use the same for
normal operation, for similar reasons. This appears to fix a frequent crash
issue.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
If LEDControl is used without any LEDMode plugin, `cur_led_mode_` is
an unitialized pointer. This initializes it to `nullptr` and guards
against accessing it.
Signed-off-by: Johannes Becker <alfalfasprossen@gmail.com>
This has been deprecated in March, 2019, has been a no-op since. While no
removal schedule was posted at the time, I believe it is safe to drop it now.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Originally scheduled for removal by mid-March. This also removes the similarly
deprecated named hardware object aliases.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Handling of the respective keys is moved to `beforeReportingState`
as the state of shift is only then available. Usage together with
OneShot requires OneShot to be initialized before LEDControl.
Signed-off-by: Johannes Becker <alfalfasprossen@gmail.com>
This reverts commit c917acb8a1, because that
introduced breaking changes, and we want to address the problem in a different
way instead.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
This introduces a new plugin - `FlashHelper` - to aid with firmware-assisted
flashing. During the flashing process, this plugin can temporarily disable the
`Prog` key.
Addresses the firmware part of keyboardio/Chrysalis#509.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
In ConsumerControlWrapper, accept a 10-bit value for the keycode.
Use uint16_t since that is the type KeyboardioHID uses.
Signed-off-by: Chris White <cxwembedded@gmail.com>
It seems the red component in the LEDs is a tiny bit stronger than the others,
so lets adjust the component's value a little on the firmware side to make
colors come out right.
This is not the best solution, it should eventually be configurable, but until
then, this is the best workaround we could come up with.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Instead of scanning during the interrupt, do so in the main context, and only
use the interrupt for signaling that we need to scan. This resolves a problem
where scanning took too long, and we ended up missing events.
Fixes#812.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
While `ShiftToLayer` and `LockLayer` activate the given layer, and keep all
others active as well, `MoveToLayer` activates the given layer, and deactivates
all others. This allows one to have discrete layers that stand on their own,
without any other layers interfering.
Basically, this is a different way to work with layers, a less powerful, but
also simpler one.
Fixes#564.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
`Layer.move()` relied on `activate()` to update the caches, but `activate()`
worked under the assumption that we also `deactivate()` layers - which we did
not in `move()`, as we directly modified the state. Since we directly modify the
state, we can't rely on `activate()` either, and have to update the caches
ourselves.
Unlike `activate()`, we do this unconditionally, because there isn't a case
where we do not want to update them.
This makes `MoveToLayer()` play well with `Colormap`, and any other plugin that
rely on cached layer information, such as the topmost active layer.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
This reverts commit 47c1e23fed, because changing
the order in the struct just made things worse. Looks like they _do_ need to be
RGB, but the CRGB macro still puts them in BGR order. This is consistent with
the Raise factory firmware, so lets stick with that.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
By means of this macro, headers can check if they are compiled
in the sketch compilation unit or in any other compilation unit.
Signed-off-by: Florian Fleissner <florian.fleissner@inpartik.de>
The new plugin exposes some layer control functions over Focus, to be able to
control layers from the host side.
Fixes#780.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
When setting the idle timeout to zero, stop checking for idleness, and never
turn the LEDs off. Setting the timeout to a higher value again will resume the
plugin's functionality.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Even though the HID facade is deprecated in favour of the HID driver, to
maintain backwards compatibility, we should include `kaleidoscope/hid.h` by
default.
Fixes#793.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
When handling the `led.brightness` command, we forgot to break out of the switch
statement, thus executing the `setall` branch too. This resulted in very slow
operations, because we had to wait for a read to timeout.
Adding a break fixes all that.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>