Dakkar's Keyboardio Model 01 Firmware
This is mostly a stripped-down version of the official firmware, with custom keymaps and two custom plugins.
Keymaps
The keymaps are in keymaps.h
, which should not be
included directly. #include "keymap-wrapper.h"
instead! The wrapper defines the (hacky) ColorKeymaps
macro that
transposes the array-of-pairs keymaps into pair-of-arrays (actual
keymap, color map).
This allows me to define, next to each key, what "class" of key it is,
and therefore which colour its LED should light up. The classes are
defined in key-classes.h
, and the corresponding
colours in color-themes.h
.
Macros
The only non-trivial macro is fvwmMacro
: it selects the
FVWM
layer, and also acts as the LeftAlt
key.
This is because all the functions of my window manager (fvwm2) are accessed with key combinations using the left "alt" key, for which I have a dedicated layout, plus I need alt-tab to switch to a different window, and that needs left-alt to stay pressed.
Plugins
DakkarColor
Source: DakkarColor.h
This plugin defines a LEDMode
sub class, which uses a color map as
built by keymap-wrapper.h
(i.e. a DefaultColormap) to assign each
key its color.
In addition to simple colors, it allows you to set a function pointer
(look at the num-breathe()
function in color-themes.h
for a
minimal example).
ColorPicker
Source color-picker.h
This plugin defines a LEDMode
subclass that, when selected, takes
over all key presses, and turns half the keyboard into a control panel
to paint the other half.
The Fn (palm) keys switch into editing mode, with that half housing the controls.
The controls are:
- the keys of the 2 outermost columns show the value of the 8 colors in the palette; pressing one selects the color
- 3 rows of 4 keys to change the selected color in the HSV space (one row for H, one for S, one for V; in each row the keys do -10 -1 +1 +10)
Pressing a key on the non-control half of the keyboard assigns the selected color to that key.
The plugin also defines a Focus (serial control protocol) command
color-picker.dump
which prints the current values of the 8 colors,
and a compact color map for the keys.