When switching layers, light up the appropriate LED on the display. For this
purpose, start led_display.[ch], which as a start, has a function to set the
brightness of a layer led.
The function will also turn all other LEDs off, and turn all of them off when on
the base layer.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
And while there, also drop the helper functions, and just do the activation in
the handler function. This simplifies the code a bit, as there is little point
in lifting out an assignment into a function at this time.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This helps with formatting sources to be closer to the coding style
explained in CONTRIBUTING.md. It's not perfect, but provides a
reasonable base.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This does a lot of things - all of this together, because it would have been
much harder to split them up into many small commits.
We get rid of the helper macros used in default_layout.c, drop the .raw member
of uhk_key_t, use a singleton keymap, and prepare the prevKeyStates to handle
all slots. Also drops the TRNS macro.
With these changes, default_layout.h became obsolete, and was deleted too.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
We need to store the previous state of the keys, to figure out when a specific
key is released, as opposed to simply not being pressed. This is required for
layer keys such as `Mod` and `Fn` to work properly when there are more than one
of them on the keymap.
Without being able to tell when a key is released, we would not be able to turn
a layer off only when no layer key is held. Not easily, anyway: we'd have to
track the state of all layer keys... but then it is easier to just track them
all.
Thankfully, the memcpy at the end is fast, as it only needs to copy 70 bytes.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This changes the keymap layout to be as described in #17, and updates the
default layout to follow. (Also adds the missing Space and Mod keys on the two
keys below the bottom row)
The layout itself was considerably simplified by introducing a few local macros
to hide some of the uglier details.
Fixes#17.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
We now use a 32-bit structure to describe each key, and an `uhk_key_t` type that
wraps all the supported things into a union. But this is not the only change: to
be able to move the Fn/Mod keys anywhere, instead of hardcoding their location,
they are now proper layer keys. To make it easier to handle turning a layer off,
key releases can be handled explicitly, too.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>