aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/faq_keymap.md4
-rw-r--r--docs/feature_advanced_keycodes.md2
-rw-r--r--docs/feature_macros.md6
-rw-r--r--docs/hand_wire.md2
-rw-r--r--docs/keymap.md8
-rw-r--r--docs/porting_your_keyboard_to_qmk_(arm_and_other_chibios_cpus).md4
-rw-r--r--docs/understanding_qmk.md12
7 files changed, 19 insertions, 19 deletions
diff --git a/docs/faq_keymap.md b/docs/faq_keymap.md
index ae01e9387..0a627469e 100644
--- a/docs/faq_keymap.md
+++ b/docs/faq_keymap.md
@@ -151,13 +151,13 @@ This turns right modifier keys into arrow keys when the keys are tapped while st
151 */ 151 */
152const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 152const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
153 /* 0: qwerty */ 153 /* 0: qwerty */
154 [0] = KEYMAP( \ 154 [0] = LAYOUT( \
155 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NUHS,BSPC, \ 155 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NUHS,BSPC, \
156 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ 156 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
157 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \ 157 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
158 LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,FN0, ESC, \ 158 LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,FN0, ESC, \
159 FN4, LGUI,LALT, SPC, APP, FN2, FN1, FN3), 159 FN4, LGUI,LALT, SPC, APP, FN2, FN1, FN3),
160 [1] = KEYMAP( \ 160 [1] = LAYOUT( \
161 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,TRNS, \ 161 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,TRNS, \
162 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,\ 162 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,\
163 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 163 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
diff --git a/docs/feature_advanced_keycodes.md b/docs/feature_advanced_keycodes.md
index 9edb9fceb..b20acf3c4 100644
--- a/docs/feature_advanced_keycodes.md
+++ b/docs/feature_advanced_keycodes.md
@@ -11,7 +11,7 @@ People often define custom names using `#define`. For example:
11#define ALT_TAB LALT(KC_TAB) 11#define ALT_TAB LALT(KC_TAB)
12``` 12```
13 13
14This will allow you to use `FN_CAPS` and `ALT_TAB` in your `KEYMAP()`, keeping it more readable. 14This will allow you to use `FN_CAPS` and `ALT_TAB` in your keymap, keeping it more readable.
15 15
16## Caveats 16## Caveats
17 17
diff --git a/docs/feature_macros.md b/docs/feature_macros.md
index aa13fb97f..79419abd2 100644
--- a/docs/feature_macros.md
+++ b/docs/feature_macros.md
@@ -183,11 +183,11 @@ A macro can include the following commands:
183 183
184### Mapping a Macro to a Key 184### Mapping a Macro to a Key
185 185
186Use the `M()` function within your `KEYMAP()` to call a macro. For example, here is the keymap for a 2-key keyboard: 186Use the `M()` function within your keymap to call a macro. For example, here is the keymap for a 2-key keyboard:
187 187
188```c 188```c
189const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 189const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
190 [0] = KEYMAP( 190 [0] = LAYOUT(
191 M(0), M(1) 191 M(0), M(1)
192 ), 192 ),
193}; 193};
@@ -216,7 +216,7 @@ If you have a bunch of macros you want to refer to from your keymap while keepin
216#define M_BYE M(1) 216#define M_BYE M(1)
217 217
218const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 218const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
219 [0] = KEYMAP( 219 [0] = LAYOUT(
220 M_HI, M_BYE 220 M_HI, M_BYE
221 ), 221 ),
222}; 222};
diff --git a/docs/hand_wire.md b/docs/hand_wire.md
index ba2eee712..697a50805 100644
--- a/docs/hand_wire.md
+++ b/docs/hand_wire.md
@@ -216,7 +216,7 @@ Farther down are `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`. Change their definitio
216 216
217### `<project_name>.h` 217### `<project_name>.h`
218 218
219The next file you'll want to look at is `<project_name>.h`. You're going to want to rewrite the `KEYMAP` definition - the format and syntax here is extremely important, so pay attention to how things are setup. The first half of the definition are considered the arguments - this is the format that you'll be following in your keymap later on, so you'll want to have as many k*xy* variables here as you do keys. The second half is the part that the firmware actually looks at, and will contain gaps depending on how you wired your matrix. 219The next file you'll want to look at is `<project_name>.h`. You're going to want to rewrite the `LAYOUT` definition - the format and syntax here is extremely important, so pay attention to how things are setup. The first half of the definition are considered the arguments - this is the format that you'll be following in your keymap later on, so you'll want to have as many k*xy* variables here as you do keys. The second half is the part that the firmware actually looks at, and will contain gaps depending on how you wired your matrix.
220 220
221We'll dive into how this will work with the following example. Say we have a keyboard like this: 221We'll dive into how this will work with the following example. Say we have a keyboard like this:
222 222
diff --git a/docs/keymap.md b/docs/keymap.md
index 382a0e911..49e6654a2 100644
--- a/docs/keymap.md
+++ b/docs/keymap.md
@@ -1,6 +1,6 @@
1# Keymap Overview 1# Keymap Overview
2 2
3QMK keymaps are defined inside a C source file. The data structure is an array of arrays. The outer array is a list of layer arrays while the inner layer array is a list of keys. Most keyboards define a `KEYMAP()` macro to help you create this array of arrays. 3QMK keymaps are defined inside a C source file. The data structure is an array of arrays. The outer array is a list of layer arrays while the inner layer array is a list of keys. Most keyboards define a `LAYOUT()` macro to help you create this array of arrays.
4 4
5 5
6## Keymap and Layers 6## Keymap and Layers
@@ -119,7 +119,7 @@ The main part of this file is the `keymaps[]` definition. This is where you list
119 119
120 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 120 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
121 121
122After this you'll find a list of KEYMAP() macros. A KEYMAP() 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. 122After 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.
123 123
124`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. 124`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.
125 125
@@ -131,7 +131,7 @@ Here is an example of the Clueboard's base layer:
131 131
132 /* Keymap _BL: Base Layer (Default Layer) 132 /* Keymap _BL: Base Layer (Default Layer)
133 */ 133 */
134 [_BL] = KEYMAP( 134 [_BL] = LAYOUT(
135 F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_GRV, KC_BSPC, KC_PGUP, \ 135 F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_GRV, KC_BSPC, KC_PGUP, \
136 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, \ 136 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, \
137 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, \ 137 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, \
@@ -149,7 +149,7 @@ Some interesting things to note about this:
149 149
150Our function layer is, from a code point of view, no different from the base layer. Conceptually, however, you will build that layer as an overlay, not a replacement. For many people this distinction does not matter, but as you build more complicated layering setups it matters more and more. 150Our function layer is, from a code point of view, no different from the base layer. Conceptually, however, you will build that layer as an overlay, not a replacement. For many people this distinction does not matter, but as you build more complicated layering setups it matters more and more.
151 151
152 [_FL] = KEYMAP( 152 [_FL] = LAYOUT(
153 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_DEL, BL_STEP, \ 153 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_DEL, BL_STEP, \
154 _______, _______, _______,_______,_______,_______,_______,_______,KC_PSCR,KC_SLCK, KC_PAUS, _______, _______, _______, _______, \ 154 _______, _______, _______,_______,_______,_______,_______,_______,KC_PSCR,KC_SLCK, KC_PAUS, _______, _______, _______, _______, \
155 _______, _______, MO(_CL),_______,_______,_______,_______,_______,_______,_______, _______, _______, _______, _______, \ 155 _______, _______, MO(_CL),_______,_______,_______,_______,_______,_______,_______, _______, _______, _______, _______, \
diff --git a/docs/porting_your_keyboard_to_qmk_(arm_and_other_chibios_cpus).md b/docs/porting_your_keyboard_to_qmk_(arm_and_other_chibios_cpus).md
index 50d291a23..c32c428cf 100644
--- a/docs/porting_your_keyboard_to_qmk_(arm_and_other_chibios_cpus).md
+++ b/docs/porting_your_keyboard_to_qmk_(arm_and_other_chibios_cpus).md
@@ -54,10 +54,10 @@ This is where all of the custom logic for your keyboard goes - you may not need
54 54
55## `/keyboards/<keyboard>/<keyboard>.h` 55## `/keyboards/<keyboard>/<keyboard>.h`
56 56
57Here is where you can (optionally) define your `KEYMAP` function to remap your matrix into a more readable format. With ortholinear boards, this isn't always necessary, but it can help to accommodate the dead spots on your matrix, where there are keys that take up more than one space (2u, staggering, 6.25u, etc). The example shows the difference between the physical keys, and the matrix design: 57Here is where you can (optionally) define your `LAYOUT` function to remap your matrix into a more readable format. With ortholinear boards, this isn't always necessary, but it can help to accommodate the dead spots on your matrix, where there are keys that take up more than one space (2u, staggering, 6.25u, etc). The example shows the difference between the physical keys, and the matrix design:
58 58
59``` 59```
60#define KEYMAP( \ 60#define LAYOUT( \
61 k00, k01, k02, \ 61 k00, k01, k02, \
62 k10, k11 \ 62 k10, k11 \
63) \ 63) \
diff --git a/docs/understanding_qmk.md b/docs/understanding_qmk.md
index 20ead2b3f..bf4b5eadc 100644
--- a/docs/understanding_qmk.md
+++ b/docs/understanding_qmk.md
@@ -57,10 +57,10 @@ Matrix Scanning runs many times per second. The exact rate varies but typically
57 57
58Once we know the state of every switch on our keyboard we have to map that to a keycode. In QMK this is done by making use of C macros to allow us to separate the definition of the physical layout from the definition of keycodes. 58Once we know the state of every switch on our keyboard we have to map that to a keycode. In QMK this is done by making use of C macros to allow us to separate the definition of the physical layout from the definition of keycodes.
59 59
60At the keyboard level we define a C macro (typically named `KEYMAP()`) which maps our keyboard's matrix to physical keys. Sometimes the matrix does not have a switch in every location, and we can use this macro to pre-populate those with KC_NO, making the keymap definition easier to work with. Here's an example `KEYMAP()` macro for a numpad: 60At the keyboard level we define a C macro (typically named `LAYOUT()`) which maps our keyboard's matrix to physical keys. Sometimes the matrix does not have a switch in every location, and we can use this macro to pre-populate those with KC_NO, making the keymap definition easier to work with. Here's an example `LAYOUT()` macro for a numpad:
61 61
62```c 62```c
63#define KEYMAP( \ 63#define LAYOUT( \
64 k00, k01, k02, k03, \ 64 k00, k01, k02, k03, \
65 k10, k11, k12, k13, \ 65 k10, k11, k12, k13, \
66 k20, k21, k22, \ 66 k20, k21, k22, \
@@ -75,17 +75,17 @@ At the keyboard level we define a C macro (typically named `KEYMAP()`) which map
75} 75}
76``` 76```
77 77
78Notice how the second block of our `KEYMAP()` macro matches the Matrix Scanning array above? This macro is what will map the matrix scanning array to keycodes. However, if you look at a 17 key numpad you'll notice that it has 3 places where the matrix could have a switch but doesn't, due to larger keys. We have populated those spaces with `KC_NO` so that our keymap definition doesn't have to. 78Notice how the second block of our `LAYOUT()` macro matches the Matrix Scanning array above? This macro is what will map the matrix scanning array to keycodes. However, if you look at a 17 key numpad you'll notice that it has 3 places where the matrix could have a switch but doesn't, due to larger keys. We have populated those spaces with `KC_NO` so that our keymap definition doesn't have to.
79 79
80You can also use this macro to handle unusual matrix layouts, for example the [Clueboard rev 2](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/keyboards/clueboard/66/rev2/rev2.h). Explaining that is outside the scope of this document. 80You can also use this macro to handle unusual matrix layouts, for example the [Clueboard rev 2](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/keyboards/clueboard/66/rev2/rev2.h). Explaining that is outside the scope of this document.
81 81
82##### Keycode Assignment 82##### Keycode Assignment
83 83
84At the keymap level we make use of our `KEYMAP()` macro above to map keycodes to physical locations to matrix locations. It looks like this: 84At the keymap level we make use of our `LAYOUT()` macro above to map keycodes to physical locations to matrix locations. It looks like this:
85 85
86``` 86```
87const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 87const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
88[0] = KEYMAP( 88[0] = LAYOUT(
89 KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ 89 KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \
90 KC_P7, KC_P8, KC_P9, KC_PPLS, \ 90 KC_P7, KC_P8, KC_P9, KC_PPLS, \
91 KC_P4, KC_P5, KC_P6, \ 91 KC_P4, KC_P5, KC_P6, \
@@ -94,7 +94,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
94} 94}
95``` 95```
96 96
97Notice how all of these arguments match up with the first half of the `KEYMAP()` macro from the last section? This is how we take a keycode and map it to our Matrix Scan from earlier. 97Notice how all of these arguments match up with the first half of the `LAYOUT()` macro from the last section? This is how we take a keycode and map it to our Matrix Scan from earlier.
98 98
99##### State Change Detection 99##### State Change Detection
100 100