Since keyboard_layout.[ch] has gained more features, and handles more than just
filling out the keyboard report, move it to action.[ch] instead. I see no sane
way to separate the keyboard and mouse report filling, unless we want to loop
over key states twice, hence them being in the same file.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This implements the mouse action handling. There is no acceleration while
holding the mouse movement keys yet, though, that will be a separate step.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Due to a copy & paste error, Mod+d was doing Shift+Tab instead of Alt+Tab, this
fixes that.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This sets up the `Mouse` layer to have all the keys in their right place, even
if they do nothing for now. A number of enums were introduced to make it easier
to describe mouse key behaviour.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Adds `Fn` and `Mouse` layers, so the switcher keys actually work. Also
rearranged `Mod` to follow the factory layout, with the added change that
`Shift` keys are also included on the layer. The `Fn` layer was laid out,
according to the factory layout. The `Mouse` layer is mostly empty, except for
some modifiers and the switcher key.
The most significant difference from the factory layout is that modifiers are
present on all layers, in the same position.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Instead of passing the same constant to LedDisplay_SetLayerLed() all the time,
lift it out into a global.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
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>