LAYOUT()macro to help you create this array of arrays.
const uint16_t PROGMEM keymaps[MATRIX_ROWS][MATRIX_COLS]holds multiple layers of keymap information in 16 bit data holding the action code. You can define 32 layers at most.
default_layer_stateindicates a base keymap layer (0-31) which is always valid and to be referred (the default layer).
layer_statehas current on/off status of each layer in its bits.
default_layer, with other layers initially off after booting up the firmware, although this can configured differently in
config.h. It is useful to change
default_layerwhen you completely switch a key layout, for example, if you want to switch to Colemak instead of Qwerty.
layer_stateto overlay the base layer with other layers for features such as navigation keys, function keys (F1-F12), media keys, and/or special actions.
KC_TRNS(transparent) on an active layer, it stops searching, and lower layers aren't referenced.
keymap.cfile you'll want to concern yourself with:
GRAVE_MODSdefinition will be used later in our custom function, and the following
_CLdefines make it easier to refer to each of our layers.
XXXXXXX. These can be used in place for
KC_NOrespectively, making it easier to see what keys a layer is overriding. These definitions are now unecessary, as they are included by default.
keymapsdefinition. This is where you list your layers and the contents of those layers. This part of the file begins with this definition:
keymaps[MATRIX_ROWS][MATRIX_COLS]in QMK holds the 16 bit action code (sometimes referred as the quantum keycode) in it. For the keycode representing typical keys, its high byte is 0 and its low byte is the USB HID usage ID for keyboard.
const uint8_t PROGMEM keymaps[MATRIX_ROWS][MATRIX_COLS]instead and holds the 8 bit keycode. Some keycode values are reserved to induce execution of certain action codes via the
MO(_FL), which moves to the
_FLlayer while that key is being held down.
_______definition to turn
_______. This makes it easier to spot the keys that have changed on this layer.
_______keys it will activate the key in the next lowest active layer.