For trivial key definitions, the higher 8 bits of the **action code** are all 0 and the lower 8 bits holds the USB HID usage code generated by the key as **keycode**.
More than one layer can be active simultaneously. Layers are indexed with 0 to 31 and higher layer index has higher precedence.
More than one layer can be active simultaneously. Layers are indexed with 0 to 31 and higher layer indexes have higher precedence.
Keymap: 32 Layers Layer: action code matrix
----------------- ---------------------
@ -72,7 +72,7 @@ On the other hand, you can change `layer_state` to overlay the base layer with o
### Layer Precedence and Transparency
Note that ***higher layers have higher precedence within the stack of layers***. When a physical key is pressed, the firmware works its way down from the highest active layers to look up keycodes. Once the firmware locates a keycode other than `KC_TRNS` (transparent) on an active layer, sends that keycode and stops searching. Lower layers aren't searched even if active.
Note that ***higher layers have higher precedence within the stack of layers***. When a physical key is pressed, the firmware works its way down from the highest active layers to look up keycodes. Once the firmware locates a keycode other than `KC_TRNS` (transparent) on an active layer, that keycode is sent and the search is stopped. Lower layers aren't searched even if active.
____________
/ / <---Higherlayer
@ -125,7 +125,7 @@ At the top of the file you'll find this:
_CL,
};
Since layer `_BL` is defined first in the enum, it will have the lowest precedence (keymap layer '0') and will be the default layer at firmware startup. Layer `_CL` will have the higest precedence. Using names like these for the layers rather than numbers makes it easier to refer to them in subsequent code. The custom `GRAVE_MODS` definition is used later in a custom function.
Since layer `_BL` is defined first in the enum, it will have the lowest precedence (keymap layer '0') and will be the default layer at firmware startup. Layer `_CL` will have the highest precedence. Using names like these for the layers rather than numbers makes it easier to refer to them in subsequent code. The custom `GRAVE_MODS` definition is used later in a custom function.
Note: You may also find some older keymap files may also have a define(s) for `_______` and/or `XXXXXXX`. These can be used in place for `KC_TRNS` and `KC_NO` respectively, making it easier to see what keys a layer is overriding. These definitions are now unnecessary, as they are included by default.