aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/_summary.md1
-rw-r--r--docs/config_options.md2
-rw-r--r--docs/custom_quantum_functions.md68
-rw-r--r--docs/faq_build.md4
-rw-r--r--docs/feature_advanced_keycodes.md77
-rw-r--r--docs/feature_backlight.md1
-rw-r--r--docs/feature_bootmagic.md4
-rw-r--r--docs/feature_combo.md2
-rw-r--r--docs/feature_command.md64
-rw-r--r--docs/feature_layouts.md29
-rw-r--r--docs/feature_led_matrix.md90
-rw-r--r--docs/feature_rgb_matrix.md4
-rw-r--r--docs/feature_space_cadet_shift.md16
-rw-r--r--docs/hardware_keyboard_guidelines.md151
-rw-r--r--docs/i2c_driver.md18
-rw-r--r--docs/newbs.md5
-rw-r--r--docs/newbs_building_firmware_configurator.md105
-rw-r--r--docs/newbs_getting_started.md5
-rw-r--r--docs/reference_info_json.md73
19 files changed, 590 insertions, 129 deletions
diff --git a/docs/_summary.md b/docs/_summary.md
index c467a7231..6bc747189 100644
--- a/docs/_summary.md
+++ b/docs/_summary.md
@@ -40,6 +40,7 @@
40 * [Unit Testing](unit_testing.md) 40 * [Unit Testing](unit_testing.md)
41 * [Useful Functions](ref_functions.md) 41 * [Useful Functions](ref_functions.md)
42 * [Configurator Support](reference_configurator_support.md) 42 * [Configurator Support](reference_configurator_support.md)
43 * [info.json Format](reference_info_json.md)
43 44
44* [Features](features.md) 45* [Features](features.md)
45 * [Basic Keycodes](keycodes_basic.md) 46 * [Basic Keycodes](keycodes_basic.md)
diff --git a/docs/config_options.md b/docs/config_options.md
index f5c2e76e7..5e2de6d04 100644
--- a/docs/config_options.md
+++ b/docs/config_options.md
@@ -87,7 +87,7 @@ This is a C header file that is one of the first things included, and will persi
87 * mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap 87 * mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
88* `#define LOCKING_RESYNC_ENABLE` 88* `#define LOCKING_RESYNC_ENABLE`
89 * tries to keep switch state consistent with keyboard LED state 89 * tries to keep switch state consistent with keyboard LED state
90* `#define IS_COMMAND() ( keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) )` 90* `#define IS_COMMAND() (get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))`
91 * key combination that allows the use of magic commands (useful for debugging) 91 * key combination that allows the use of magic commands (useful for debugging)
92* `#define USB_MAX_POWER_CONSUMPTION` 92* `#define USB_MAX_POWER_CONSUMPTION`
93 * sets the maximum power (in mA) over USB for the device (default: 500) 93 * sets the maximum power (in mA) over USB for the device (default: 500)
diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md
index d44786e2d..cc84e141f 100644
--- a/docs/custom_quantum_functions.md
+++ b/docs/custom_quantum_functions.md
@@ -165,18 +165,35 @@ In addition, it is possible to specify the brightness level of all LEDs with `er
165 165
166Ergodox boards also define `LED_BRIGHTNESS_LO` for the lowest brightness and `LED_BRIGHTNESS_HI` for the highest brightness (which is the default). 166Ergodox boards also define `LED_BRIGHTNESS_LO` for the lowest brightness and `LED_BRIGHTNESS_HI` for the highest brightness (which is the default).
167 167
168# Matrix Initialization Code 168# Keyboard Initialization Code
169 169
170Before a keyboard can be used the hardware must be initialized. QMK handles initialization of the keyboard matrix itself, but if you have other hardware like LEDs or i²c controllers you will need to set up that hardware before it can be used. 170There are several steps in the keyboard initialization process. Depending on what you want to do, it will influence which function you should use.
171 171
172These are the three main initialization functions, listed in the order that they're called.
172 173
173### Example `matrix_init_user()` Implementation 174* `keyboard_pre_init_*` - Happens before most anything is started. Good for hardware setup that you want running very early.
175* `matrix_init_*` - Happens midway through the firmware's startup process. Hardware is initialized, but features may not be yet.
176* `keyboard_post_init_*` - Happens at the end of the firmware's startup process. This is where you'd want to put "customization" code, for the most part.
177
178!> For most people, the `keyboard_post_init_user` function is what you want to call. For instance, this is where you want to set up things for RGB Underglow.
179
180## Keyboard Pre Initialization code
181
182This runs very early during startup, even before the USB has been started.
183
184Shortly after this, the matrix is initialized.
185
186For most users, this shouldn't be used, as it's primarily for hardware oriented initialization.
187
188However, if you have hardware stuff that you need initialized, this is the best place for it (such as initializing LED pins).
189
190### Example `keyboard_pre_init_user()` Implementation
174 191
175This example, at the keyboard level, sets up B1, B2, and B3 as LED pins. 192This example, at the keyboard level, sets up B1, B2, and B3 as LED pins.
176 193
177```c 194```c
178void matrix_init_user(void) { 195void keyboard_pre_init_user(void) {
179 // Call the keymap level matrix init. 196 // Call the keyboard pre init code.
180 197
181 // Set our LED pins as output 198 // Set our LED pins as output
182 DDRB |= (1<<1); 199 DDRB |= (1<<1);
@@ -185,11 +202,47 @@ void matrix_init_user(void) {
185} 202}
186``` 203```
187 204
205### `keyboard_pre_init_*` Function Documentation
206
207* Keyboard/Revision: `void keyboard_pre_init_kb(void)`
208* Keymap: `void keyboard_pre_init_user(void)`
209
210## Matrix Initialization Code
211
212This is called when the matrix is initialized, and after some of the hardware has been set up, but before many of the features have been initialized.
213
214This is useful for setting up stuff that you may need elsewhere, but isn't hardware related nor is dependant on where it's started.
215
216
188### `matrix_init_*` Function Documentation 217### `matrix_init_*` Function Documentation
189 218
190* Keyboard/Revision: `void matrix_init_kb(void)` 219* Keyboard/Revision: `void matrix_init_kb(void)`
191* Keymap: `void matrix_init_user(void)` 220* Keymap: `void matrix_init_user(void)`
192 221
222
223## Keyboard Post Initialization code
224
225This is ran as the very last task in the keyboard initialization process. This is useful if you want to make changes to certain features, as they should be initialized by this point.
226
227
228### Example `keyboard_post_init_user()` Implementation
229
230This example, running after everything else has initialized, sets up the rgb underglow configuration.
231
232```c
233void keyboard_post_init_user(void) {
234 // Call the post init code.
235 rgblight_enable_noeeprom(); // enables Rgb, without saving settings
236 rgblight_sethsv_noeeprom(180, 255, 255): // sets the color to teal/cyan without saving
237 rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); // sets mode to Fast breathing without saving
238}
239```
240
241### `keyboard_post_init_*` Function Documentation
242
243* Keyboard/Revision: `void keyboard_post_init_kb(void)`
244* Keymap: `void keyboard_post_init_user(void)`
245
193# Matrix Scanning Code 246# Matrix Scanning Code
194 247
195Whenever possible you should customize your keyboard by using `process_record_*()` and hooking into events that way, to ensure that your code does not have a negative performance impact on your keyboard. However, in rare cases it is necessary to hook into the matrix scanning. Be extremely careful with the performance of code in these functions, as it will be called at least 10 times per second. 248Whenever possible you should customize your keyboard by using `process_record_*()` and hooking into events that way, to ensure that your code does not have a negative performance impact on your keyboard. However, in rare cases it is necessary to hook into the matrix scanning. Be extremely careful with the performance of code in these functions, as it will be called at least 10 times per second.
@@ -229,10 +282,9 @@ void suspend_wakeup_init_user(void)
229{ 282{
230 rgb_matrix_set_suspend_state(false); 283 rgb_matrix_set_suspend_state(false);
231} 284}
232
233``` 285```
234 286
235### `keyboard_init_*` Function Documentation 287### Keyboard suspend/wake Function Documentation
236 288
237* Keyboard/Revision: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)` 289* Keyboard/Revision: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)`
238* Keymap: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)` 290* Keymap: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)`
@@ -285,7 +337,7 @@ Keep in mind that EEPROM has a limited number of writes. While this is very high
285 337
286* If you don't understand the example, then you may want to avoid using this feature, as it is rather complicated. 338* If you don't understand the example, then you may want to avoid using this feature, as it is rather complicated.
287 339
288### Example Implementation 340### Example Implementation
289 341
290This is an example of how to add settings, and read and write it. We're using the user keymap for the example here. This is a complex function, and has a lot going on. In fact, it uses a lot of the above functions to work! 342This is an example of how to add settings, and read and write it. We're using the user keymap for the example here. This is a complex function, and has a lot going on. In fact, it uses a lot of the above functions to work!
291 343
diff --git a/docs/faq_build.md b/docs/faq_build.md
index 14c61a1e9..d920d27e2 100644
--- a/docs/faq_build.md
+++ b/docs/faq_build.md
@@ -37,6 +37,10 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff0", MODE:="066
37SUBSYSTEMS=="usb", ATTRS{idVendor}=="feed", MODE:="0666" 37SUBSYSTEMS=="usb", ATTRS{idVendor}=="feed", MODE:="0666"
38``` 38```
39 39
40### Serial device is not detected in bootloader mode on Linux
41Make sure your kernel has appropriate support for your device. If your device uses USB ACM, such as
42Pro Micro (Atmega32u4), make sure to include `CONFIG_USB_ACM=y`. Other devices may require `USB_SERIAL` and any of its sub options.
43
40## Unknown Device for DFU Bootloader 44## Unknown Device for DFU Bootloader
41 45
42If you're using Windows to flash your keyboard, and you are running into issues, check the Device Manager. If you see an "Unknown Device" when the keyboard is in "bootloader mode", then you may have a driver issue. 46If you're using Windows to flash your keyboard, and you are running into issues, check the Device Manager. If you see an "Unknown Device" when the keyboard is in "bootloader mode", then you may have a driver issue.
diff --git a/docs/feature_advanced_keycodes.md b/docs/feature_advanced_keycodes.md
index 37a3d43fc..95c47355c 100644
--- a/docs/feature_advanced_keycodes.md
+++ b/docs/feature_advanced_keycodes.md
@@ -21,7 +21,7 @@ Additionally, if at least one right-handed modifier is specified in a Mod Tap or
21 21
22# Switching and Toggling Layers 22# Switching and Toggling Layers
23 23
24These functions allow you to activate layers in various ways. Note that layers are not generally independent layouts -- multiple layers can be activated at once, and it's typical for layers to use `KC_TRNS` to allow keypresses to pass through to lower layers. For a detailed explanation of layers, see [Keymap Overview](keymap.md#keymap-and-layers) When using momentary layer switching with MO(), LM(), TT(), or LT(), make sure to leave the key on the above layers transparent or it may not work as intended. 24These functions allow you to activate layers in various ways. Note that layers are not generally independent layouts -- multiple layers can be activated at once, and it's typical for layers to use `KC_TRNS` to allow keypresses to pass through to lower layers. For a detailed explanation of layers, see [Keymap Overview](keymap.md#keymap-and-layers). When using momentary layer switching with MO(), LM(), TT(), or LT(), make sure to leave the key on the above layers transparent or it may not work as intended.
25 25
26* `DF(layer)` - switches the default layer. The default layer is the always-active base layer that other layers stack on top of. See below for more about the default layer. This might be used to switch from QWERTY to Dvorak layout. (Note that this is a temporary switch that only persists until the keyboard loses power. To modify the default layer in a persistent way requires deeper customization, such as calling the `set_single_persistent_default_layer` function inside of [process_record_user](custom_quantum_functions.md#programming-the-behavior-of-any-keycode).) 26* `DF(layer)` - switches the default layer. The default layer is the always-active base layer that other layers stack on top of. See below for more about the default layer. This might be used to switch from QWERTY to Dvorak layout. (Note that this is a temporary switch that only persists until the keyboard loses power. To modify the default layer in a persistent way requires deeper customization, such as calling the `set_single_persistent_default_layer` function inside of [process_record_user](custom_quantum_functions.md#programming-the-behavior-of-any-keycode).)
27* `MO(layer)` - momentarily activates *layer*. As soon as you let go of the key, the layer is deactivated. 27* `MO(layer)` - momentarily activates *layer*. As soon as you let go of the key, the layer is deactivated.
@@ -161,6 +161,81 @@ For one shot mods, you need to call `set_oneshot_mods(MOD)` to set it, or `clear
161 161
162!> If you're having issues with OSM translating over Remote Desktop Connection, this can be fixed by opening the settings, going to the "Local Resources" tap, and in the keyboard section, change the drop down to "On this Computer". This will fix the issue and allow OSM to function properly over Remote Desktop. 162!> If you're having issues with OSM translating over Remote Desktop Connection, this can be fixed by opening the settings, going to the "Local Resources" tap, and in the keyboard section, change the drop down to "On this Computer". This will fix the issue and allow OSM to function properly over Remote Desktop.
163 163
164## Callbacks
165
166When you'd like to perform custom logic when pressing a one shot key, there are several callbacks you can choose to implement. You could indicate changes in one shot keys by flashing an LED or making a sound, for example.
167
168There is a callback for `OSM(mod)`. It is called whenever the state of any one shot modifier key is changed: when it toggles on, but also when it is toggled off. You can use it like this:
169
170```c
171void oneshot_mods_changed_user(uint8_t mods) {
172 if (mods & MOD_MASK_SHIFT) {
173 println("Oneshot mods SHIFT");
174 }
175 if (mods & MOD_MASK_CTRL) {
176 println("Oneshot mods CTRL");
177 }
178 if (mods & MOD_MASK_ALT) {
179 println("Oneshot mods ALT");
180 }
181 if (mods & MOD_MASK_GUI) {
182 println("Oneshot mods GUI");
183 }
184 if (!mods) {
185 println("Oneshot mods off");
186 }
187}
188```
189
190The `mods` argument contains the active mods after the change, so it reflects the current state.
191
192When you use One Shot Tap Toggle (by adding `#define ONESHOT_TAP_TOGGLE 2` in your `config.h` file), you may lock a modifier key by pressing it the specified amount of times. There's a callback for that, too:
193
194```c
195void oneshot_locked_mods_changed_user(uint8_t mods) {
196 if (mods & MOD_MASK_SHIFT) {
197 println("Oneshot locked mods SHIFT");
198 }
199 if (mods & MOD_MASK_CTRL) {
200 println("Oneshot locked mods CTRL");
201 }
202 if (mods & MOD_MASK_ALT) {
203 println("Oneshot locked mods ALT");
204 }
205 if (mods & MOD_MASK_GUI) {
206 println("Oneshot locked mods GUI");
207 }
208 if (!mods) {
209 println("Oneshot locked mods off");
210 }
211}
212```
213
214Last, there is also a callback for the `OSL(layer)` one shot key:
215
216```c
217void oneshot_layer_changed_user(uint8_t layer) {
218 if (layer == 1) {
219 println("Oneshot layer 1 on");
220 }
221 if (!layer) {
222 println("Oneshot layer off");
223 }
224}
225```
226
227If any one shot layer is switched off, `layer` will be zero. When you're looking to do something on any layer change instead of one shot layer changes, `layer_state_set_user` is a better callback to use.
228
229If you are making your own keyboard, there are also `_kb` equivalent functions:
230
231```c
232void oneshot_locked_mods_changed_kb(uint8_t mods);
233void oneshot_mods_changed_kb(uint8_t mods);
234void oneshot_layer_changed_kb(uint8_t layer);
235```
236
237As with any callback, be sure to call the `_user` variant to allow for further customizability.
238
164# Tap-Hold Configuration Options 239# Tap-Hold Configuration Options
165 240
166While Tap-Hold options are fantastic, they are not without their issues. We have tried to configure them with reasonal defaults, but that may still cause issues for some people. 241While Tap-Hold options are fantastic, they are not without their issues. We have tried to configure them with reasonal defaults, but that may still cause issues for some people.
diff --git a/docs/feature_backlight.md b/docs/feature_backlight.md
index f7a35406c..c7a1f131e 100644
--- a/docs/feature_backlight.md
+++ b/docs/feature_backlight.md
@@ -40,6 +40,7 @@ To change the behaviour of the backlighting, `#define` these in your `config.h`:
40|---------------------|-------------|-------------------------------------------------------------------------------------------------------------| 40|---------------------|-------------|-------------------------------------------------------------------------------------------------------------|
41|`BACKLIGHT_PIN` |`B7` |The pin that controls the LEDs. Unless you are designing your own keyboard, you shouldn't need to change this| 41|`BACKLIGHT_PIN` |`B7` |The pin that controls the LEDs. Unless you are designing your own keyboard, you shouldn't need to change this|
42|`BACKLIGHT_LEVELS` |`3` |The number of brightness levels (maximum 15 excluding off) | 42|`BACKLIGHT_LEVELS` |`3` |The number of brightness levels (maximum 15 excluding off) |
43|`BACKLIGHT_CAPS_LOCK`|*Not defined*|Enable Caps Lock indicator using backlight (for keyboards without dedicated LED) |
43|`BACKLIGHT_BREATHING`|*Not defined*|Enable backlight breathing, if hardware PWM is used | 44|`BACKLIGHT_BREATHING`|*Not defined*|Enable backlight breathing, if hardware PWM is used |
44|`BREATHING_PERIOD` |`6` |The length of one backlight "breath" in seconds | 45|`BREATHING_PERIOD` |`6` |The length of one backlight "breath" in seconds |
45 46
diff --git a/docs/feature_bootmagic.md b/docs/feature_bootmagic.md
index 504fb90f4..39e4e47f4 100644
--- a/docs/feature_bootmagic.md
+++ b/docs/feature_bootmagic.md
@@ -127,7 +127,9 @@ Additionally, you may want to specify which key to use. This is especially usef
127 127
128By default, these are set to 0 and 0, which is usually the "ESC" key on a majority of keyboards. 128By default, these are set to 0 and 0, which is usually the "ESC" key on a majority of keyboards.
129 129
130And to trigger the bootloader, you hold this key down when plugging the keyboard in. Just the single key. 130And to trigger the bootloader, you hold this key down when plugging the keyboard in. Just the single key.
131
132!> Using bootmagic lite will **always reset** the EEPROM, so you will lose any settings that have been saved.
131 133
132## Advanced Bootmagic Lite 134## Advanced Bootmagic Lite
133 135
diff --git a/docs/feature_combo.md b/docs/feature_combo.md
index 05ffc0d72..a2fd1423c 100644
--- a/docs/feature_combo.md
+++ b/docs/feature_combo.md
@@ -29,7 +29,7 @@ If you want to add a list, then you'd use something like this:
29enum combos { 29enum combos {
30 AB_ESC, 30 AB_ESC,
31 JK_TAB 31 JK_TAB
32} 32};
33const uint16_t PROGMEM ab_combo[] = {KC_A, KC_B, COMBO_END}; 33const uint16_t PROGMEM ab_combo[] = {KC_A, KC_B, COMBO_END};
34const uint16_t PROGMEM jk_combo[] = {KC_J, KC_K, COMBO_END}; 34const uint16_t PROGMEM jk_combo[] = {KC_J, KC_K, COMBO_END};
35 35
diff --git a/docs/feature_command.md b/docs/feature_command.md
index ca2ecce0d..53a140a11 100644
--- a/docs/feature_command.md
+++ b/docs/feature_command.md
@@ -16,35 +16,35 @@ To use Command, hold down the key combination defined by the `IS_COMMAND()` macr
16 16
17If you would like to change the key assignments for Command, `#define` these in your `config.h` at either the keyboard or keymap level. All keycode assignments here must omit the `KC_` prefix. 17If you would like to change the key assignments for Command, `#define` these in your `config.h` at either the keyboard or keymap level. All keycode assignments here must omit the `KC_` prefix.
18 18
19|Define |Default |Description | 19|Define |Default |Description |
20|------------------------------------|--------------------------------------------------------------------------------------|------------------------------------------------| 20|------------------------------------|---------------------------------------------------------------------------|------------------------------------------------|
21|`IS_COMMAND()` |<code>(keyboard_report->mods == (MOD_BIT(KC_LSHIFT) &#124; MOD_BIT(KC_RSHIFT)))</code>|The key combination to activate Command | 21|`IS_COMMAND()` |<code>(get_mods() == (MOD_BIT(KC_LSHIFT) &#124; MOD_BIT(KC_RSHIFT)))</code>|The key combination to activate Command |
22|`MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS` |`true` |Set default layer with the Function row | 22|`MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS` |`true` |Set default layer with the Function row |
23|`MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS` |`true` |Set default layer with the number keys | 23|`MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS` |`true` |Set default layer with the number keys |
24|`MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM`|`false` |Set default layer with `MAGIC_KEY_LAYER0..9` | 24|`MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM`|`false` |Set default layer with `MAGIC_KEY_LAYER0..9` |
25|`MAGIC_KEY_DEBUG` |`D` |Toggle debugging over serial | 25|`MAGIC_KEY_DEBUG` |`D` |Toggle debugging over serial |
26|`MAGIC_KEY_DEBUG_MATRIX` |`X` |Toggle key matrix debugging | 26|`MAGIC_KEY_DEBUG_MATRIX` |`X` |Toggle key matrix debugging |
27|`MAGIC_KEY_DEBUG_KBD` |`K` |Toggle keyboard debugging | 27|`MAGIC_KEY_DEBUG_KBD` |`K` |Toggle keyboard debugging |
28|`MAGIC_KEY_DEBUG_MOUSE` |`M` |Toggle mouse debugging | 28|`MAGIC_KEY_DEBUG_MOUSE` |`M` |Toggle mouse debugging |
29|`MAGIC_KEY_CONSOLE` |`C` |Enable the Command console | 29|`MAGIC_KEY_CONSOLE` |`C` |Enable the Command console |
30|`MAGIC_KEY_VERSION` |`V` |Print the running QMK version to the console | 30|`MAGIC_KEY_VERSION` |`V` |Print the running QMK version to the console |
31|`MAGIC_KEY_STATUS` |`S` |Print the current keyboard status to the console| 31|`MAGIC_KEY_STATUS` |`S` |Print the current keyboard status to the console|
32|`MAGIC_KEY_HELP1` |`H` |Print Command help to the console | 32|`MAGIC_KEY_HELP1` |`H` |Print Command help to the console |
33|`MAGIC_KEY_HELP2` |`SLASH` |Print Command help to the console (alternate) | 33|`MAGIC_KEY_HELP2` |`SLASH` |Print Command help to the console (alternate) |
34|`MAGIC_KEY_LAYER0` |`0` |Make layer 0 the default layer | 34|`MAGIC_KEY_LAYER0` |`0` |Make layer 0 the default layer |
35|`MAGIC_KEY_LAYER1` |`1` |Make layer 1 the default layer | 35|`MAGIC_KEY_LAYER1` |`1` |Make layer 1 the default layer |
36|`MAGIC_KEY_LAYER2` |`2` |Make layer 2 the default layer | 36|`MAGIC_KEY_LAYER2` |`2` |Make layer 2 the default layer |
37|`MAGIC_KEY_LAYER3` |`3` |Make layer 3 the default layer | 37|`MAGIC_KEY_LAYER3` |`3` |Make layer 3 the default layer |
38|`MAGIC_KEY_LAYER4` |`4` |Make layer 4 the default layer | 38|`MAGIC_KEY_LAYER4` |`4` |Make layer 4 the default layer |
39|`MAGIC_KEY_LAYER5` |`5` |Make layer 5 the default layer | 39|`MAGIC_KEY_LAYER5` |`5` |Make layer 5 the default layer |
40|`MAGIC_KEY_LAYER6` |`6` |Make layer 6 the default layer | 40|`MAGIC_KEY_LAYER6` |`6` |Make layer 6 the default layer |
41|`MAGIC_KEY_LAYER7` |`7` |Make layer 7 the default layer | 41|`MAGIC_KEY_LAYER7` |`7` |Make layer 7 the default layer |
42|`MAGIC_KEY_LAYER8` |`8` |Make layer 8 the default layer | 42|`MAGIC_KEY_LAYER8` |`8` |Make layer 8 the default layer |
43|`MAGIC_KEY_LAYER9` |`9` |Make layer 9 the default layer | 43|`MAGIC_KEY_LAYER9` |`9` |Make layer 9 the default layer |
44|`MAGIC_KEY_LAYER0_ALT1` |`ESC` |Make layer 0 the default layer (alternate) | 44|`MAGIC_KEY_LAYER0_ALT1` |`ESC` |Make layer 0 the default layer (alternate) |
45|`MAGIC_KEY_LAYER0_ALT2` |`GRAVE` |Make layer 0 the default layer (alternate) | 45|`MAGIC_KEY_LAYER0_ALT2` |`GRAVE` |Make layer 0 the default layer (alternate) |
46|`MAGIC_KEY_BOOTLOADER` |`PAUSE` |Enter the bootloader | 46|`MAGIC_KEY_BOOTLOADER` |`PAUSE` |Enter the bootloader |
47|`MAGIC_KEY_LOCK` |`CAPS` |Lock the keyboard so nothing can be typed | 47|`MAGIC_KEY_LOCK` |`CAPS` |Lock the keyboard so nothing can be typed |
48|`MAGIC_KEY_EEPROM` |`E` |Clear the EEPROM | 48|`MAGIC_KEY_EEPROM` |`E` |Clear the EEPROM |
49|`MAGIC_KEY_NKRO` |`N` |Toggle N-Key Rollover (NKRO) | 49|`MAGIC_KEY_NKRO` |`N` |Toggle N-Key Rollover (NKRO) |
50|`MAGIC_KEY_SLEEP_LED` |`Z` |Toggle LED when computer is sleeping | 50|`MAGIC_KEY_SLEEP_LED` |`Z` |Toggle LED when computer is sleeping |
diff --git a/docs/feature_layouts.md b/docs/feature_layouts.md
index 1ee8b5e35..b34fd442d 100644
--- a/docs/feature_layouts.md
+++ b/docs/feature_layouts.md
@@ -51,6 +51,35 @@ The folder name must be added to the keyboard's `rules.mk`:
51 51
52but the `LAYOUT_<layout>` variable must be defined in `<folder>.h` as well. 52but the `LAYOUT_<layout>` variable must be defined in `<folder>.h` as well.
53 53
54## Building a Keymap
55
56You should be able to build the keyboard keymap with a command in this format:
57
58 make <keyboard>:<layout>
59
60### Conflicting layouts
61When a keyboard supports multiple layout options,
62
63 LAYOUTS = ortho_4x4 ortho_4x12
64
65And a layout exists for both options,
66```
67layouts/
68+ community/
69| + ortho_4x4/
70| | + <layout>/
71| | | + ...
72| + ortho_4x12/
73| | + <layout>/
74| | | + ...
75| + ...
76```
77
78The FORCE_LAYOUT argument can be used to specify which layout to build
79
80 make <keyboard>:<layout> FORCE_LAYOUT=ortho_4x4
81 make <keyboard>:<layout> FORCE_LAYOUT=ortho_4x12
82
54## Tips for Making Layouts Keyboard-Agnostic 83## Tips for Making Layouts Keyboard-Agnostic
55 84
56### Includes 85### Includes
diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md
new file mode 100644
index 000000000..372407b90
--- /dev/null
+++ b/docs/feature_led_matrix.md
@@ -0,0 +1,90 @@
1# LED Matrix Lighting
2
3This feature allows you to use LED matrices driven by external drivers. It hooks into the backlight system so you can use the same keycodes as backlighting to control it.
4
5If you want to use RGB LED's you should use the [RGB Matrix Subsystem](feature_rgb_matrix.md) instead.
6
7## Driver configuration
8
9### IS31FL3731
10
11There is basic support for addressable LED matrix lighting with the I2C IS31FL3731 RGB controller. To enable it, add this to your `rules.mk`:
12
13 LED_MATRIX_ENABLE = IS31FL3731
14
15You can use between 1 and 4 IS31FL3731 IC's. Do not specify `LED_DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`:
16
17| Variable | Description | Default |
18|----------|-------------|---------|
19| `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages | 100 |
20| `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 |
21| `LED_DRIVER_COUNT` | (Required) How many LED driver IC's are present | |
22| `LED_DRIVER_LED_COUNT` | (Required) How many LED lights are present across all drivers | |
23| `LED_DRIVER_ADDR_1` | (Required) Address for the first LED driver | |
24| `LED_DRIVER_ADDR_2` | (Optional) Address for the second LED driver | |
25| `LED_DRIVER_ADDR_3` | (Optional) Address for the third LED driver | |
26| `LED_DRIVER_ADDR_4` | (Optional) Address for the fourth LED driver | |
27
28Here is an example using 2 drivers.
29
30 // This is a 7-bit address, that gets left-shifted and bit 0
31 // set to 0 for write, 1 for read (as per I2C protocol)
32 // The address will vary depending on your wiring:
33 // 0b1110100 AD <-> GND
34 // 0b1110111 AD <-> VCC
35 // 0b1110101 AD <-> SCL
36 // 0b1110110 AD <-> SDA
37 #define LED_DRIVER_ADDR_1 0b1110100
38 #define LED_DRIVER_ADDR_2 0b1110110
39
40 #define LED_DRIVER_COUNT 2
41 #define LED_DRIVER_1_LED_COUNT 25
42 #define LED_DRIVER_2_LED_COUNT 24
43 #define LED_DRIVER_LED_COUNT LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL
44
45Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations.
46
47Define these arrays listing all the LEDs in your `<keyboard>.c`:
48
49 const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
50 /* Refer to IS31 manual for these locations
51 * driver
52 * | LED address
53 * | | */
54 {0, C3_3},
55 ....
56 }
57
58Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet](http://www.issi.com/WW/pdf/31FL3731.pdf) and the header file `drivers/issi/is31fl3731-simple.h`. The `driver` is the index of the driver you defined in your `config.h` (`0`, `1`, `2`, or `3` ).
59
60## Keycodes
61
62All LED matrix keycodes are currently shared with the [backlight system](feature_backlight.md).
63
64## LED Matrix Effects
65
66Currently no LED matrix effects have been created.
67
68## Custom layer effects
69
70Custom layer effects can be done by defining this in your `<keyboard>.c`:
71
72 void led_matrix_indicators_kb(void) {
73 led_matrix_set_index_value(index, value);
74 }
75
76A similar function works in the keymap as `led_matrix_indicators_user`.
77
78## Suspended state
79
80To use the suspend feature, add this to your `<keyboard>.c`:
81
82 void suspend_power_down_kb(void)
83 {
84 led_matrix_set_suspend_state(true);
85 }
86
87 void suspend_wakeup_init_kb(void)
88 {
89 led_matrix_set_suspend_state(false);
90 }
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 0af1e4947..e955eb26f 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -1,5 +1,9 @@
1# RGB Matrix Lighting 1# RGB Matrix Lighting
2 2
3This feature allows you to use RGB LED matrices driven by external drivers. It hooks into the RGBLIGHT system so you can use the same keycodes as RGBLIGHT to control it.
4
5If you want to use single color LED's you should use the [LED Matrix Subsystem](feature_led_matrix.md) instead.
6
3## Driver configuration 7## Driver configuration
4 8
5### IS31FL3731 9### IS31FL3731
diff --git a/docs/feature_space_cadet_shift.md b/docs/feature_space_cadet_shift.md
index bec7cbd3d..427d2a581 100644
--- a/docs/feature_space_cadet_shift.md
+++ b/docs/feature_space_cadet_shift.md
@@ -25,9 +25,13 @@ COMMAND_ENABLE = no
25 25
26By default Space Cadet assumes a US ANSI layout, but if your layout uses different keys for parentheses, you can redefine them in your `config.h`. 26By default Space Cadet assumes a US ANSI layout, but if your layout uses different keys for parentheses, you can redefine them in your `config.h`.
27You can also disable the rollover, allowing you to use the opposite Shift key to cancel the Space Cadet state in the event of an erroneous press, instead of emitting a pair of parentheses when the keys are released. 27You can also disable the rollover, allowing you to use the opposite Shift key to cancel the Space Cadet state in the event of an erroneous press, instead of emitting a pair of parentheses when the keys are released.
28 28Also, by default, the Space Cadet applies modifiers LSPO_MOD and RSPC_MOD to keys defined by LSPO_KEY and RSPC_KEY. You can override this behavior by redefining those variables in your `config.h`. You can also prevent the Space Cadet to apply a modifier by defining DISABLE_SPACE_CADET_MODIFIER in your `config.h`.
29|Define |Default |Description | 29
30|------------------------------|-------------|------------------------------------------------------------| 30|Define |Default |Description |
31|`LSPO_KEY` |`KC_9` |The keycode to send when Left Shift is tapped | 31|------------------------------|-------------|--------------------------------------------------------------------------------|
32|`RSPC_KEY` |`KC_0` |The keycode to send when Right Shift is tapped | 32|`LSPO_KEY` |`KC_9` |The keycode to send when Left Shift is tapped |
33|`DISABLE_SPACE_CADET_ROLLOVER`|*Not defined*|If defined, use the opposite Shift key to cancel Space Cadet| 33|`RSPC_KEY` |`KC_0` |The keycode to send when Right Shift is tapped |
34|`LSPO_MOD` |`KC_LSFT` |The keycode to send when Left Shift is tapped |
35|`RSPC_MOD` |`KC_RSFT` |The keycode to send when Right Shift is tapped |
36|`DISABLE_SPACE_CADET_ROLLOVER`|*Not defined*|If defined, use the opposite Shift key to cancel Space Cadet |
37|`DISABLE_SPACE_CADET_MODIFIER`|*Not defined*|If defined, prevent the Space Cadet to apply a modifier to LSPO_KEY and RSPC_KEY|
diff --git a/docs/hardware_keyboard_guidelines.md b/docs/hardware_keyboard_guidelines.md
index 67af78838..c8aec40e0 100644
--- a/docs/hardware_keyboard_guidelines.md
+++ b/docs/hardware_keyboard_guidelines.md
@@ -1,107 +1,120 @@
1# QMK Keyboard Guidelines 1# QMK Keyboard Guidelines
2 2
3We welcome all keyboard projects into QMK, but ask that you try to stick to a couple guidelines that help us keep things organised and consistent. 3Since starting, QMK has grown by leaps and bounds thanks to people like you who contribute to creating and maintaining our community keyboards. As we've grown we've discovered some patterns that work well, and ask that you conform to them to make it easier for other people to benefit from your hard work.
4
4 5
5## Naming Your Keyboard/Project 6## Naming Your Keyboard/Project
6 7
7All names should be lowercase alphanumeric, and separated by an underscore (`_`), but not begin with one. Your directory and your `.h` and `.c` files should have exactly the same name. All folders should follow the same format. `test`, `keyboard`, and `all` are reserved by make and are not a valid name for a keyboard. 8All keyboard names are in lower case, consisting only of letters, numbers, and underscore (`_`). Names may not begin with an underscore. Forward slash (`/`) is used as a sub-folder separation character.
8 9
9## `readme.md` 10The names `test`, `keyboard`, and `all` are reserved for make commands and may not be used as a keyboard or subfolder name.
10 11
11All projects need to have a `readme.md` file that explains what the keyboard is, who made it, where it is available, and links to more information. Please follow the [published template](documentation_templates.md#keyboard-readmemd-template). 12Valid Examples:
12 13
13## Image/Hardware Files 14* `412_64`
15* `chimera_ortho`
16* `clueboard/66/rev3`
17* `planck`
18* `v60_type_r`
14 19
15In an effort to keep the repo size down, we're no longer accepting images of any format in the repo, with few exceptions. Hosting them elsewhere (imgur) and linking them in the `readme.md` is the preferred method. 20## Sub-folders
16 21
17Any sort of hardware file (plate, case, pcb) can't be stored in qmk_firmware, but we have the [qmk.fm repo](https://github.com/qmk/qmk.fm) where such files (as well as in-depth info) can be stored and viewed on [qmk.fm](http://qmk.fm). Downloadable files are stored in `/<keyboard>/` (name follows the same format as above) which are served at `http://qmk.fm/<keyboard>/`, and pages are generated from `/_pages/<keyboard>/` which are served at the same location (.md files are generated into .html files through Jekyll). Check out the `lets_split` directory for an example. 22QMK uses sub-folders both for organization and to share code between revisions of the same keyboard. You can nest folders up to 4 levels deep:
18 23
19## Keyboard Defaults 24 qmk_firmware/keyboards/top_folder/sub_1/sub_2/sub_3/sub_4
20 25
21Given the amount of functionality that QMK exposes it's very easy to confuse new users. When putting together the default firmware for your keyboard we recommend limiting your enabled features and options to the minimal set needed to support your hardware. Recommendations for specific features follow. 26If a sub-folder has a `rules.mk` file it will be considered a compilable keyboard. It will be available in QMK Configurator and tested with `make all`. If you are using a folder to organize several keyboards from the same maker you should not have a `rules.mk` file.
22 27
23### Bootmagic and Command 28Example:
24 29
25[Bootmagic](feature_bootmagic.md) and [Command](feature_command.md) are two related features that allow a user to control their keyboard in non-obvious ways. We recommend you think long and hard about if you're going to enable either feature, and how you will expose this functionality. Keep in mind that users who want this functionality can enable it in their personal keymaps without affecting all the novice users who may be using your keyboard as their first programmable board. 30Clueboard uses sub-folders for both purposes, organization and keyboard revisions.
26 31
27By far the most common problem new users encounter is accidentally triggering Bootmagic while they're plugging in their keyboard. They're holding the keyboard by the bottom, unknowingly pressing in alt and spacebar, and then they find that these keys have been swapped on them. We recommend leaving this feature disabled by default, but if you do turn it on consider setting `BOOTMAGIC_KEY_SALT` to a key that is hard to press while plugging your keyboard in. 32* [`qmk_firmware`](https://github.com/qmk/qmk_firmware/tree/master)
33 * [`keyboards`](https://github.com/qmk/qmk_firmware/tree/master/keyboards)
34 * [`clueboard`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard) &larr; This is the organization folder, there's no `rules.mk` file
35 * [`60`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/60) &larr; This is a compilable keyboard, it has a `rules.mk` file
36 * [`66`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66) &larr; This is also compilable- it uses `DEFAULT_FOLDER` to specify `rev3` as the default revision
37 * [`rev1`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66/rev1) &larr; compilable: `make clueboard/66/rev1`
38 * [`rev2`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66/rev2) &larr; compilable: `make clueboard/66/rev2`
39 * [`rev3`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66/rev3) &larr; compilable: `make clueboard/66/rev3` or `make clueboard/66`
28 40
29If your keyboard does not have 2 shift keys you should provide a working default for `IS_COMMAND`, even when you have set `COMMAND_ENABLE = no`. This will give your users a default to conform to if they do enable Command. 41## Keyboard Folder Structure
30 42
31## Custom Keyboard Programming 43Your keyboard should be located in `qmk_firmware/keyboards/` and the folder name should be your keyboard's name as described in the previous section. Inside this folder should be several files:
32 44
33As documented on [Customizing Functionality](custom_quantum_functions.md) you can define custom functions for your keyboard. Please keep in mind that your users may want to customize that behavior as well, and make it possible for them to do that. If you are providing a custom function, for example `process_record_kb()`, make sure that your function calls the `_user()` version of the call too. You should also take into account the return value of the `_user()` version, and only run your custom code if the user returns `true`. 45* `readme.md`
46* `info.json`
47* `config.h`
48* `rules.mk`
49* `<keyboard_name>.c`
50* `<keyboard_name>.h`
51
52### `readme.md`
53
54All projects need to have a `readme.md` file that explains what the keyboard is, who made it and where it's available. If applicable, it should also contain links to more information, such as the maker's website. Please follow the [published template](documentation_templates.md#keyboard-readmemd-template).
55
56### `info.json`
57
58This file is used by the [QMK API](https://github.com/qmk/qmk_api). It contains the information [QMK Configurator](https://config.qmk.fm/) needs to display a representation of your keyboard. You can also set metadata here. For more information see the [reference page](reference_info_json.md).
59
60### `config.h`
61
62All projects need to have a `config.h` file that sets things like the matrix size, product name, USB VID/PID, description and other settings. In general, use this file to set essential information and defaults for your keyboard that will always work.
34 63
35## Keyboard Metadata 64### `rules.mk`
36 65
37As QMK grows so does the ecosystem surrounding QMK. To make it easier for projects in that ecosystem to tie into QMK as we make changes we are developing a metadata system to expose information about keyboards in QMK. 66The presence of this file means that the folder is a keyboard target and can be used in `make` commands. This is where you setup the build environment for your keyboard and configure the default set of features.
38 67
39You can create `info.json` files at every level under `qmk_firmware/keyboards/<name>` to specify this metadata. These files are combined, with more specific files overriding keys in less specific files. This means you do not need to duplicate your metadata information. For example, `qmk_firmware/keyboards/clueboard/info.json` specifies `manufacturer` and `maintainer`, while `qmk_firmware/keyboards/clueboard/66/info.json` specifies more specific information about Clueboard 66%. 68### `<keyboard_name.c>`
40 69
41### `info.json` Format 70This is where you will write custom code for your keyboard. Typically you will write code to initialize and interface with the hardware in your keyboard. If your keyboard consists of only a key matrix with no LEDs, speakers, or other auxillary hardware this file can be blank.
42 71
43The `info.json` file is a JSON formatted dictionary with the following keys available to be set. You do not have to set all of them, merely the keys that apply to your keyboard. 72The following functions are typically defined in this file:
44 73
45* `keyboard_name` 74* `void matrix_init_kb(void)`
46 * A free-form text string describing the keyboard. 75* `void matrix_scan_kb(void)`
47 * Example: `Clueboard 66%` 76* `bool process_record_kb(uint16_t keycode, keyrecord_t *record)`
48* `url` 77* `void led_set_kb(uint8_t usb_led)`
49 * A URL to the keyboard's product page, [QMK.fm/keyboards](https://qmk.fm/keyboards) page, or other page describing information about the keyboard.
50* `maintainer`
51 * GitHub username of the maintainer, or `qmk` for community maintained boards
52* `width`
53 * Width of the board in Key Units
54* `height`
55 * Height of the board in Key Units
56* `layouts`
57 * Physical Layout representations. See the next section for more detail.
58 78
59#### Layout Format 79### `<keyboard_name.h>`
60 80
61Within our `info.json` file the `layouts` portion of the dictionary contains several nested dictionaries. The outer layer consists of QMK layout macros, for example `LAYOUT_ansi` or `LAYOUT_iso`. Within each layout macro are keys for `width`, `height`, and `key_count`, each of which should be self-explanatory. 81This file is used to define the matrix for your keyboard. You should define at least one C macro which translates an array into a matrix representing the physical switch matrix for your keyboard. If it's possible to build your keyboard with multiple layouts you should define additional macros.
62 82
63* `width` 83If you have only a single layout you should call this macro `LAYOUT`.
64 * Optional: The width of the layout in Key Units
65* `height`
66 * Optional: The height of the layout in Key Units
67* `key_count`
68 * **Required**: The number of keys in this layout
69* `layout`
70 * A list of Key Dictionaries describing the physical layout. See the next section for more details.
71 84
72#### Key Dictionary Format 85When defining multiple layouts you should have a base layout, named `LAYOUT_all`, that supports all possible switch positions on your matrix, even if that layout is impossible to build physically. This is the macro you should use in your `default` keymap. You should then have additional keymaps named `default_<layout>` that use your other layout macros. This will make it easier for people to use the layouts you define.
73 86
74Each Key Dictionary in a layout describes the physical properties of a key. If you are familiar with the Raw Code for <http://keyboard-layout-editor.com> you will find many of the concepts the same. We re-use the same key names and layout choices wherever possible, but unlike keyboard-layout-editor each key is stateless, inheriting no properties from the keys that came before it. 87Layout macro names are entirely lowercase, except for the word `LAYOUT` at the front.
75 88
76All key positions and rotations are specified in relation to the top-left corner of the keyboard, and the top-left corner of each key. 89As an example, if you have a 60% PCB that supports ANSI and ISO you might define the following layouts and keymaps:
77 90
78* `X` 91| Layout Name | Keymap Name | Description |
79 * **Required**: The absolute position of the key in the horizontal axis, in Key Units. 92|-------------|-------------|-------------|
80* `Y` 93| LAYOUT_all | default | A layout that supports both ISO and ANSI |
81 * **Required**: The absolute position of the key in the vertical axis, in Key Units. 94| LAYOUT_ansi | default_ansi | An ANSI layout |
82* `W` 95| LAYOUT_iso | default_iso | An ISO layout |
83 * The width of the key, in Key Units. Ignored if `ks` is provided. Default: `1`
84* `H`
85 * The height of the key, in Key Units. Ignored if `ks` is provided. Default: `1`
86* `R`
87 * How many degrees clockwise to rotate the key.
88* `RX`
89 * The absolute position of the point to rotate the key around in the horizontal axis. Default: `x`
90* `RY`
91 * The absolute position of the point to rotate the key around in the vertical axis. Default: `y`
92* `KS`
93 * Key Shape: define a polygon by providing a list of points, in Key Units.
94 * **Important**: These are relative to the top-left of the key, not absolute.
95 * Example ISO Enter: `[ [0,0], [1.5,0], [1.5,2], [0.25,2], [0.25,1], [0,1], [0,0] ]`
96 96
97### How is the Metadata Exposed? 97## Image/Hardware Files
98
99In an effort to keep the repo size down we're no longer accepting binary files of any format, with few exceptions. Hosting them elsewhere (such as <https://imgur.com>) and linking them in the `readme.md` is preferred.
100
101Hardware files (such as plates, cases, pcb) can be contributed to the [qmk.fm repo](https://github.com/qmk/qmk.fm) and they will be made available on [qmk.fm](http://qmk.fm). Downloadable files are stored in `/<keyboard>/` (name follows the same format as above) which are served at `http://qmk.fm/<keyboard>/`, and pages are generated from `/_pages/<keyboard>/` which are served at the same location (.md files are generated into .html files through Jekyll). Check out the `lets_split` folder for an example.
102
103## Keyboard Defaults
104
105Given the amount of functionality that QMK exposes it's very easy to confuse new users. When putting together the default firmware for your keyboard we recommend limiting your enabled features and options to the minimal set needed to support your hardware. Recommendations for specific features follow.
106
107### Bootmagic and Command
108
109[Bootmagic](feature_bootmagic.md) and [Command](feature_command.md) are two related features that allow a user to control their keyboard in non-obvious ways. We recommend you think long and hard about if you're going to enable either feature, and how you will expose this functionality. Keep in mind that users who want this functionality can enable it in their personal keymaps without affecting all the novice users who may be using your keyboard as their first programmable board.
110
111By far the most common problem new users encounter is accidentally triggering Bootmagic while they're plugging in their keyboard. They're holding the keyboard by the bottom, unknowingly pressing in alt and spacebar, and then they find that these keys have been swapped on them. We recommend leaving this feature disabled by default, but if you do turn it on consider setting `BOOTMAGIC_KEY_SALT` to a key that is hard to press while plugging your keyboard in.
98 112
99This metadata is primarily used in two ways: 113If your keyboard does not have 2 shift keys you should provide a working default for `IS_COMMAND`, even when you have set `COMMAND_ENABLE = no`. This will give your users a default to conform to if they do enable Command.
100 114
101* To allow web-based configurators to dynamically generate UI 115## Custom Keyboard Programming
102* To support the new `make keyboard:keymap:qmk` target, which bundles this metadata up with the firmware to allow QMK Toolbox to be smarter.
103 116
104Configurator authors can see the [QMK Compiler](https://docs.compile.qmk.fm/api_docs.html) docs for more information on using the JSON API. 117As documented on [Customizing Functionality](custom_quantum_functions.md) you can define custom functions for your keyboard. Please keep in mind that your users may want to customize that behavior as well, and make it possible for them to do that. If you are providing a custom function, for example `process_record_kb()`, make sure that your function calls the `_user()` version of the call too. You should also take into account the return value of the `_user()` version, and only run your custom code if the user returns `true`.
105 118
106## Non-Production/Handwired Projects 119## Non-Production/Handwired Projects
107 120
diff --git a/docs/i2c_driver.md b/docs/i2c_driver.md
index ea24dc64f..18546fc62 100644
--- a/docs/i2c_driver.md
+++ b/docs/i2c_driver.md
@@ -33,8 +33,8 @@ The following defines can be used to configure the I2C master driver.
33 33
34|Variable |Description |Default| 34|Variable |Description |Default|
35|------------------|---------------------------------------------------|-------| 35|------------------|---------------------------------------------------|-------|
36|`#F_SCL` |Clock frequency in Hz |400KHz | 36|`F_SCL` |Clock frequency in Hz |400KHz |
37|`#Prescaler` |Divides master clock to aid in I2C clock selection |1 | 37|`Prescaler` |Divides master clock to aid in I2C clock selection |1 |
38 38
39AVRs usually have set GPIO which turn into I2C pins, therefore no further configuration is required. 39AVRs usually have set GPIO which turn into I2C pins, therefore no further configuration is required.
40 40
@@ -63,20 +63,24 @@ Lastly, we need to assign the correct GPIO pins depending on the I2C hardware dr
63 63
64By default the I2C1 hardware driver is assumed to be used. If another hardware driver is used, `#define I2C_DRIVER I2CDX` should be added to the `config.h` file with X being the number of hardware driver used. For example is I2C3 is enabled, the `config.h` file should contain `#define I2C_DRIVER I2CD3`. This aligns the QMK I2C driver with the Chibios I2C driver. 64By default the I2C1 hardware driver is assumed to be used. If another hardware driver is used, `#define I2C_DRIVER I2CDX` should be added to the `config.h` file with X being the number of hardware driver used. For example is I2C3 is enabled, the `config.h` file should contain `#define I2C_DRIVER I2CD3`. This aligns the QMK I2C driver with the Chibios I2C driver.
65 65
66STM32 MCUs allows a variety of pins to be configured as I2C pins depending on the hardware driver used. By default B6 and B7 are set to I2C. 66STM32 MCUs allows a variety of pins to be configured as I2C pins depending on the hardware driver used. By default B6 and B7 are set to I2C. You can use these defines to set your i2c pins:
67 67
68This can be changed by declaring the `i2c_init` function which intentionally has a weak attribute. Please consult the datasheet of your MCU for the available GPIO configurations. The following is an example initialization function: 68| Variable | Description | Default |
69|-------------|----------------------------------------------|---------|
70| `I2C1_BANK` | The bank of pins (`GPIOA`, `GPIOB`, `GPIOC`) | `GPIOB` |
71| `I2C1_SCL` | The pin number for the SCL pin (0-9) | `6` |
72| `I2C1_SDA` | The pin number for the SDA pin (0-9) | `7` |
73
74You can also overload the `void i2c_init(void)` function, which has a weak attribute. If you do this the configuration variables above will not be used. Please consult the datasheet of your MCU for the available GPIO configurations. The following is an example initialization function:
69 75
70```C 76```C
71void i2c_init(void) 77void i2c_init(void)
72{ 78{
73 setPinInput(B6); // Try releasing special pins for a short time 79 setPinInput(B6); // Try releasing special pins for a short time
74 setPinInput(B7); 80 setPinInput(B7);
75 chThdSleepMilliseconds(10); // Wait for the release to happen 81 wait_ms(10); // Wait for the release to happen
76 82
77 palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); // Set B6 to I2C function 83 palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); // Set B6 to I2C function
78 palSetPadMode(GPIOB, 7, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); // Set B7 to I2C function 84 palSetPadMode(GPIOB, 7, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); // Set B7 to I2C function
79} 85}
80``` 86```
81
82
diff --git a/docs/newbs.md b/docs/newbs.md
index 4f115c3c7..904a52945 100644
--- a/docs/newbs.md
+++ b/docs/newbs.md
@@ -6,10 +6,11 @@ Not sure if your keyboard can run QMK? If it's a mechanical keyboard you built y
6 6
7## Overview 7## Overview
8 8
9There are 6 main sections to this guide: 9There are 7 main sections to this guide:
10 10
11* [Getting Started](newbs_getting_started.md) 11* [Getting Started](newbs_getting_started.md)
12* [Building Your First Firmware](newbs_building_firmware.md) 12* [Building Your First Firmware using the command line](newbs_building_firmware.md)
13* [Building Your First Firmware using the online GUI](newbs_building_firmware_configurator.md)
13* [Flashing Firmware](newbs_flashing.md) 14* [Flashing Firmware](newbs_flashing.md)
14* [Testing and Debugging](newbs_testing_debugging.md) 15* [Testing and Debugging](newbs_testing_debugging.md)
15* [Git Best Practices](newbs_best_practices.md) 16* [Git Best Practices](newbs_best_practices.md)
diff --git a/docs/newbs_building_firmware_configurator.md b/docs/newbs_building_firmware_configurator.md
new file mode 100644
index 000000000..0ad609304
--- /dev/null
+++ b/docs/newbs_building_firmware_configurator.md
@@ -0,0 +1,105 @@
1# QMK Configurator
2
3The [QMK Configurator](https://config.qmk.fm) is an online graphical user interface that generates QMK Firmware hex files.
4
5?> **Please follow these steps in order.**
6
7Watch the [Video Tutorial](https://youtu.be/7RH-1pAbjvw)
8
9The QMK Configurator works best with Chrome/Firefox.
10
11
12!> **Files from other tools such as KLE, or kbfirmware will not be compatible with QMK Configurator. Do not load them, do not import them. QMK Configurator is a DIFFERENT tool. **
13
14## Selecting your keyboard
15
16Click the drop down box and select the keyboard you want to create a keymap for.
17
18?> If your keyboard has several versions, make sure you select the correct one.**
19
20I'll say that again because it's important
21
22!> **MAKE SURE YOU SELECT THE RIGHT VERSION!**
23
24If your keyboard has been advertised to be powered by QMK but is not in the list, chances are a developer hasn't gotten to it yet or we haven't had a chance to merge it in yet. File an issue at [qmk_firmware](https://github.com/qmk/qmk_firmware/issues) requesting to support that particular keyboard, if there is no active [Pull Request](https://github.com/qmk/qmk_firmware/pulls?q=is%3Aopen+is%3Apr+label%3Akeyboard) for it. There are also QMK powered keyboards that are in their manufacturer's own github accounts. Double check for that as well.
25
26## Selecting your keyboard layout
27
28Choose the layout that best represents the keymap you want to create. Some keyboards do not have enough layouts or correct layouts defined yet. They will be supported in the future.
29
30## Keymap Name
31
32Call this keymap what you want.
33
34?> If you are running into issues when compiling, it may be worth changing this name, as it may already exist in the QMK Firmware repo.
35
36## Creating Your Keymap
37
38Keycode Entry is accomplished in 3 ways.
391. Drag and dropping
402. Clicking on an empty spot on the layout and clicking the keycode you desire
413. Clicking on an empty spot on the layout, pressing the physical key on your keyboard.
42
43Hover your mouse over a key and a short blurb will tell you what that keycode does. For a more verbose description please see
44
45[Basic Keycode Reference](https://docs.qmk.fm/#/keycodes_basic)
46[Advanced Keycode Reference](https://docs.qmk.fm/#/feature_advanced_keycodes)
47
48In the event that you can't find a layout that supports your keymap, for example three spots for spacebar, or two spots for backspace, or 2 spots for shift etc etc, Fill them ALL up.
49
50### Example:
51
523 spots for spacebar: Fill them ALL with spacebar
53
542 spots for backspace: Fill them BOTH with backspace
55
562 spots for right shift: Fill them BOTH with right shift
57
581 spot for left shift and 1 spot for iso support: Fill them both with left shift
59
605 spots, but only 4 keys: Guess and check or ask someone who has done it before.
61
62## Saving Your Keymap for Future Edits
63
64When you're satisfied with your keymap or just want to work on it later, press the `Export Keymap` button. It will save your keymap as the name you chose above appended with .json.
65
66You can then load this .json file in the future by pressing the `Import Keymap` button.
67
68!> **CAUTION:** This is not the same type of .json file used for kbfirmware.com or any other tool. If you try to use this for those tools, or the .json from those tools with QMK Configurator, there is a chance your keyboard will **explode**.
69
70## Generating your firmware file
71
72Press the green `Compile` button.
73
74When the compilation is done, you will be able to press the green `Download Firmware` button.
75
76## Flashing Your Keyboard
77
78Please refer to [Flashing Firmware](newbs_flashing.md)
79
80## Troubleshooting
81
82#### My .json file is not working
83
84If the .json file was generated with QMK Configurator, congratulations you have stumbled upon a bug. File an issue at [qmk_configurator](https://github.com/qmk/qmk_configurator/issues)
85
86If not....how did you miss my big bold message at the top saying not to use other .json files?
87
88#### There are extra spaces in my layout? What do I do?
89
90If you're referring to having three spots for space bar, the best course of action is to just fill them all with space bar. The same can be done for backspace and shifts
91
92#### What is the keycode for.......
93
94Please see
95
96[Basic Keycode Reference](https://docs.qmk.fm/#/keycodes_basic)
97[Advanced Keycode Reference](https://docs.qmk.fm/#/feature_advanced_keycodes)
98
99#### It won't compile
100
101Please double check the other layers of your keymap to make sure there are no random keys present.
102
103## Problems and Bugs
104
105We are always accepting customer requests and bug reports. Please file them at [qmk_configurator](https://github.com/qmk/qmk_configurator/issues)
diff --git a/docs/newbs_getting_started.md b/docs/newbs_getting_started.md
index 276c7fec3..aefa1b738 100644
--- a/docs/newbs_getting_started.md
+++ b/docs/newbs_getting_started.md
@@ -6,7 +6,10 @@ QMK tries to put a lot of power into your hands by making easy things easy, and
6 6
7# Getting Started 7# Getting Started
8 8
9Before you can build keymaps, you need to install some software and set up your build environment. This only has to be done once no matter how many keyboards you plan to compile firmware for. 9Before you can build keymaps, you need to install some software and set up your build environment. This only has to be done once no matter how many keyboards you plan to compile firmware for.
10
11If you would prefer a more graphical user interface approach, please consider using the online [QMK Configurator](https://config.qmk.fm). Please refer to [Building Your First Firmware using the online GUI](newbs_building_firmware_configurator.md).
12
10 13
11## Download Software 14## Download Software
12 15
diff --git a/docs/reference_info_json.md b/docs/reference_info_json.md
new file mode 100644
index 000000000..badfabd91
--- /dev/null
+++ b/docs/reference_info_json.md
@@ -0,0 +1,73 @@
1# `info.json`
2
3This file is used by the [QMK API](https://github.com/qmk/qmk_api). It contains the information [QMK Configurator](https://config.qmk.fm/) needs to display a representation of your keyboard. You can also set metadata here.
4
5You can create `info.json` files at every level under `qmk_firmware/keyboards/<name>` to specify this metadata. These files are combined, with more specific files overriding keys in less specific files. This means you do not need to duplicate your metadata information. For example, `qmk_firmware/keyboards/clueboard/info.json` specifies `manufacturer` and `maintainer`, while `qmk_firmware/keyboards/clueboard/66/info.json` specifies more specific information about Clueboard 66%.
6
7## `info.json` Format
8
9The `info.json` file is a JSON formatted dictionary with the following keys available to be set. You do not have to set all of them, merely the keys that apply to your keyboard.
10
11* `keyboard_name`
12 * A free-form text string describing the keyboard.
13 * Example: `Clueboard 66%`
14* `url`
15 * A URL to the keyboard's product page, [QMK.fm/keyboards](https://qmk.fm/keyboards) page, or other page describing information about the keyboard.
16* `maintainer`
17 * GitHub username of the maintainer, or `qmk` for community maintained boards
18* `width`
19 * Width of the board in Key Units
20* `height`
21 * Height of the board in Key Units
22* `layouts`
23 * Physical Layout representations. See the next section for more detail.
24
25### Layout Format
26
27Within our `info.json` file the `layouts` portion of the dictionary contains several nested dictionaries. The outer layer consists of QMK layout macros, for example `LAYOUT_ansi` or `LAYOUT_iso`. Within each layout macro are keys for `width`, `height`, and `key_count`, each of which should be self-explanatory.
28
29* `width`
30 * Optional: The width of the layout in Key Units
31* `height`
32 * Optional: The height of the layout in Key Units
33* `key_count`
34 * **Required**: The number of keys in this layout
35* `layout`
36 * A list of Key Dictionaries describing the physical layout. See the next section for more details.
37
38### Key Dictionary Format
39
40Each Key Dictionary in a layout describes the physical properties of a key. If you are familiar with the Raw Code for <http://keyboard-layout-editor.com> you will find many of the concepts the same. We re-use the same key names and layout choices wherever possible, but unlike keyboard-layout-editor each key is stateless, inheriting no properties from the keys that came before it.
41
42All key positions and rotations are specified in relation to the top-left corner of the keyboard, and the top-left corner of each key.
43
44* `x`
45 * **Required**: The absolute position of the key in the horizontal axis, in Key Units.
46* `y`
47 * **Required**: The absolute position of the key in the vertical axis, in Key Units.
48* `w`
49 * The width of the key, in Key Units. Ignored if `ks` is provided. Default: `1`
50* `h`
51 * The height of the key, in Key Units. Ignored if `ks` is provided. Default: `1`
52* `r`
53 * How many degrees clockwise to rotate the key.
54* `rx`
55 * The absolute position of the point to rotate the key around in the horizontal axis. Default: `x`
56* `ry`
57 * The absolute position of the point to rotate the key around in the vertical axis. Default: `y`
58* `ks`
59 * Key Shape: define a polygon by providing a list of points, in Key Units.
60 * **Important**: These are relative to the top-left of the key, not absolute.
61 * Example ISO Enter: `[ [0,0], [1.5,0], [1.5,2], [0.25,2], [0.25,1], [0,1], [0,0] ]`
62* `label`
63 * What to name this position in the matrix.
64 * This should usually be the same name as what is silkscreened on the PCB at this location.
65
66## How is the Metadata Exposed?
67
68This metadata is primarily used in two ways:
69
70* To allow web-based configurators to dynamically generate UI
71* To support the new `make keyboard:keymap:qmk` target, which bundles this metadata up with the firmware to allow QMK Toolbox to be smarter.
72
73Configurator authors can see the [QMK Compiler](https://docs.api.qmk.fm/using-the-api) docs for more information on using the JSON API.