Instead of always iterating through all layers, which slows us down
considerably, keep track of the highest active one, and start from there.
This has a VERY noticeable impact on the speed at which we finish a scan cycle.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Momentary layer switchers were broken, because they had the flags/keyCode parts
swapped. Apparently, I missed these when swapping the rest.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
The function is broken, and does not belong here in the first place. It was a
remnant of how Akela was set up, but makes no sense in general.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
It had the COLS & ROWS defines, which are hardware-specific, and were moved to
the hardware lib.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Moved all of the hardware-specific code to a separate library. As such, use the
special `KEYBOARDIO_HARDWARE_H` define to include the appropriate header, as set
by the board's `boards.txt`.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Instead of just switching to a layer, make it a macro. The macro will toggle the
layer and the LED effect.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
All of the plugins have been updated, there is no need to keep the deprecated
functions around anymore.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
When toggling a layer, the same keycode should toggle the layer off, too.
Without this, toggling layers won't work at all, because the target layer will
never be turned off.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Turn the `event_handler_hook_add` and `loop_hook_add` aliases into real
functions, that emit a deprecation warning during compilation. This makes it a
little bit easier to see what needs to be updated still.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
In most cases, one only wants a single copy of a hook. On the other hand,
plugins that depend on other plugins, may want to make it easier for the
end-user to use the plugin, and call the setup function of the dependent plugins
too. In case the end-user calls the same setup function, we'd end up with hooks
registered multiple times.
To avoid this, protection against double-registration has been introduced. The
new `event_handler_hook_use` and `loop_hook_use` functions will only allow one
copy of the hook. The `event_handler_hook_append` and `loop_hook_append`
functions will, on the other hand, just append the hooks, and not care about
protection.
The `event_handler_hook_add` and `loop_hook_add` functions are gone, but for the
time being, they are aliases to the `_use` functions, until all plugins have
been updated, and the aliases can be removed.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Moves the LED control code, along with the built-in effects into the
Keyboardio-LEDControl plugin.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
I forgot to update the `LCTRL`, `LALT`, etc macros, and they still assumed the
previous order. This little patch fixes that.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
With the swap, using `raw` becomes more straightforward, because the flags will
occupy the higher bits, and the keyCode the lower ones. This makes range checks
much more intuitive.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
The text of the GPL-2 in LICENSE was old, had the old FSF address, and referred
to the LGPL as the "Library GPL" (it's been "Lesser GPL" for a while now). This
simply updates the text with the latest text of the GPL-2. Apart from
formatting, the FSF address change, and the Library->Lesser GPL, there are no
other changes.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
There is no `libraries/` in the core firmware anymore, do not add that to the
library search path.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>