summaryrefslogtreecommitdiff
path: root/docs/keymap.md
diff options
context:
space:
mode:
authorkiilerix <mads@kiilerich.com>2022-03-05 05:58:50 +0100
committerGitHub <noreply@github.com>2022-03-05 15:58:50 +1100
commitda6d6ce2e1f266892badbd42fb8c6735e61e784f (patch)
treeb5e64da206540e60e01a0fc262c13fa5353d68f3 /docs/keymap.md
parent82dd84e257db8e5fd1eb33c152a0026ee5bee7fe (diff)
Some docs improvements (#15845)
* docs: clarify in "Keymap Overview" what LAYOUT is and isn't It is not strictly necessary to use LAYOUT macros in keyboard.c, but it is a convenient abstraction of hardware internals, allowing focus on the physical keyboard layout. From the C source point of view LAYOUT is macro with a parameter list, which expands to a array of rows that each is an array with a keyboard scancode for each column. A macro parameter list is not an array, and even less a single array. Perhaps no big deal, but also no reason to give incorrect hints. * docs: update "Understanding QMK's Code" to current code structure introduced in 96e2b13d1de This part of the documentation was no longer correct. I tried updating it, mainly copy editing and using github links to latest release. This is not trying to fix all problems, but just trying to fix some problems while reusing much of the old phrases and structure. * Update docs to use "qmk format-python"
Diffstat (limited to 'docs/keymap.md')
-rw-r--r--docs/keymap.md6
1 files changed, 4 insertions, 2 deletions
diff --git a/docs/keymap.md b/docs/keymap.md
index a7c9c50d74..ab8a255bc3 100644
--- a/docs/keymap.md
+++ b/docs/keymap.md
@@ -132,7 +132,7 @@ The main part of this file is the `keymaps[]` definition. This is where you list
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-After this you'll find a list of LAYOUT() macros. A LAYOUT() is simply a list of keys to define a single layer. Typically you'll have one or more "base layers" (such as QWERTY, Dvorak, or Colemak) and then you'll layer on top of that one or more "function" layers. Due to the way layers are processed you can't overlay a "lower" layer on top of a "higher" layer.
+After this you'll find the layer definitions. Typically you'll have one or more "base layers" (such as QWERTY, Dvorak, or Colemak) and then you'll layer on top of that one or more "function" layers. Due to the way layers are processed you can't overlay a "lower" layer on top of a "higher" layer.
`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.
@@ -153,7 +153,9 @@ Here is an example of the Clueboard's base layer:
Some interesting things to note about this:
-* From a C source point of view it's only a single array, but we have embedded whitespace to more easily visualize where each key is on the physical device.
+* The layer is defined using the LAYOUT macro, traditionally defined in the keyboard's `.h` file.
+* The LAYOUT macro takes a single list of keycodes, but we have written it in the C source using embedded whitespace and newlines to visualize where each key is on the physical device.
+* The LAYOUT macro hides and handles the mapping to the hardware's key scan matrix.
* Plain keyboard scancodes are prefixed with KC_, while "special" keys are not.
* The upper left key activates custom function 0 (`F(0)`)
* The "Fn" key is defined with `MO(_FL)`, which moves to the `_FL` layer while that key is being held down.