aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAlex Ong <the.onga@gmail.com>2019-01-04 19:43:45 +1100
committerAlex Ong <the.onga@gmail.com>2019-01-04 19:43:45 +1100
commit2bb2977c133646c4e056960e72029270d77cc1eb (patch)
tree235d491f992121ac1716c5bf2fafb80983748576 /docs
parenta55c838961c89097ab849ed6cb1f261791e6b9b4 (diff)
parent47c91fc7f75ae0a477e55b687aa0fc30da0a283c (diff)
downloadqmk_firmware-2bb2977c133646c4e056960e72029270d77cc1eb.tar.gz
qmk_firmware-2bb2977c133646c4e056960e72029270d77cc1eb.zip
Merge branch 'master' into debounce_refactor
# Conflicts: # tmk_core/common/keyboard.c
Diffstat (limited to 'docs')
-rw-r--r--docs/LANGS.md4
-rw-r--r--docs/_sidebar.md10
-rw-r--r--docs/_summary.md10
-rw-r--r--docs/arm_debugging.md87
-rw-r--r--docs/becoming_a_qmk_collaborator.md10
-rw-r--r--docs/config_options.md107
-rw-r--r--docs/contributing.md24
-rw-r--r--docs/custom_quantum_functions.md182
-rw-r--r--docs/documentation_templates.md2
-rw-r--r--docs/faq_build.md14
-rw-r--r--docs/faq_keymap.md21
-rw-r--r--docs/feature_advanced_keycodes.md214
-rw-r--r--docs/feature_audio.md33
-rw-r--r--docs/feature_backlight.md19
-rw-r--r--docs/feature_bluetooth.md32
-rw-r--r--docs/feature_bootmagic.md53
-rw-r--r--docs/feature_combo.md89
-rw-r--r--docs/feature_encoders.md48
-rw-r--r--docs/feature_layouts.md6
-rw-r--r--docs/feature_leader_key.md111
-rw-r--r--docs/feature_macros.md164
-rw-r--r--docs/feature_ps2_mouse.md18
-rw-r--r--docs/feature_rgb_matrix.md25
-rw-r--r--docs/feature_rgblight.md64
-rw-r--r--docs/feature_tap_dance.md38
-rw-r--r--docs/feature_unicode.md177
-rw-r--r--docs/feature_userspace.md178
-rw-r--r--docs/features.md4
-rw-r--r--docs/flashing.md39
-rw-r--r--docs/getting_started_build_tools.md35
-rw-r--r--docs/getting_started_github.md2
-rw-r--r--docs/hardware_avr.md44
-rw-r--r--docs/how_keyboards_work.md14
-rw-r--r--docs/i2c_driver.md82
-rw-r--r--docs/index.html3
-rw-r--r--docs/internals_gpio_control.md23
-rw-r--r--docs/keycode.txt261
-rw-r--r--docs/keycodes.md79
-rw-r--r--docs/keycodes_basic.md10
-rw-r--r--docs/keycodes_us_ansi_shifted.md4
-rw-r--r--docs/keymap.md12
-rw-r--r--docs/newbs.md6
-rw-r--r--docs/newbs_best_practices.md163
-rw-r--r--docs/newbs_building_firmware.md16
-rw-r--r--docs/newbs_getting_started.md78
-rw-r--r--docs/newbs_learn_more_resources.md16
-rw-r--r--docs/newbs_testing_debugging.md2
-rw-r--r--docs/quantum_keycodes.md25
-rw-r--r--docs/ref_functions.md97
-rw-r--r--docs/reference_configurator_support.md195
-rw-r--r--docs/reference_glossary.md2
-rw-r--r--docs/support.md43
-rw-r--r--docs/understanding_qmk.md51
-rw-r--r--docs/zh/README.md32
-rw-r--r--docs/zh/_sidebar.md99
55 files changed, 2376 insertions, 801 deletions
diff --git a/docs/LANGS.md b/docs/LANGS.md
new file mode 100644
index 000000000..4b48f2d3d
--- /dev/null
+++ b/docs/LANGS.md
@@ -0,0 +1,4 @@
1# Languages
2
3* [English](/)
4* [Chinese](zh/)
diff --git a/docs/_sidebar.md b/docs/_sidebar.md
index a35014dd8..b209c5e0b 100644
--- a/docs/_sidebar.md
+++ b/docs/_sidebar.md
@@ -3,6 +3,8 @@
3 * [Building Your First Firmware](newbs_building_firmware.md) 3 * [Building Your First Firmware](newbs_building_firmware.md)
4 * [Flashing Firmware](newbs_flashing.md) 4 * [Flashing Firmware](newbs_flashing.md)
5 * [Testing and Debugging](newbs_testing_debugging.md) 5 * [Testing and Debugging](newbs_testing_debugging.md)
6 * [Best Practices](newbs_best_practices.md)
7 * [Learning Resources](newbs_learn_more_resources.md)
6 8
7* [QMK Basics](README.md) 9* [QMK Basics](README.md)
8 * [QMK Introduction](getting_started_introduction.md) 10 * [QMK Introduction](getting_started_introduction.md)
@@ -37,9 +39,11 @@
37 * [Glossary](reference_glossary.md) 39 * [Glossary](reference_glossary.md)
38 * [Unit Testing](unit_testing.md) 40 * [Unit Testing](unit_testing.md)
39 * [Useful Functions](ref_functions.md) 41 * [Useful Functions](ref_functions.md)
42 * [Configurator Support](reference_configurator_support.md)
40 43
41* [Features](features.md) 44* [Features](features.md)
42 * [Basic Keycodes](keycodes_basic.md) 45 * [Basic Keycodes](keycodes_basic.md)
46 * [US ANSI Shifted Keys](keycodes_us_ansi_shifted.md)
43 * [Quantum Keycodes](quantum_keycodes.md) 47 * [Quantum Keycodes](quantum_keycodes.md)
44 * [Advanced Keycodes](feature_advanced_keycodes.md) 48 * [Advanced Keycodes](feature_advanced_keycodes.md)
45 * [Audio](feature_audio.md) 49 * [Audio](feature_audio.md)
@@ -47,8 +51,10 @@
47 * [Backlight](feature_backlight.md) 51 * [Backlight](feature_backlight.md)
48 * [Bluetooth](feature_bluetooth.md) 52 * [Bluetooth](feature_bluetooth.md)
49 * [Bootmagic](feature_bootmagic.md) 53 * [Bootmagic](feature_bootmagic.md)
54 * [Combos](feature_combo)
50 * [Command](feature_command.md) 55 * [Command](feature_command.md)
51 * [Dynamic Macros](feature_dynamic_macros.md) 56 * [Dynamic Macros](feature_dynamic_macros.md)
57 * [Encoders](feature_encoders.md)
52 * [Grave Escape](feature_grave_esc.md) 58 * [Grave Escape](feature_grave_esc.md)
53 * [Key Lock](feature_key_lock.md) 59 * [Key Lock](feature_key_lock.md)
54 * [Layouts](feature_layouts.md) 60 * [Layouts](feature_layouts.md)
@@ -69,11 +75,12 @@
69 * [Thermal Printer](feature_thermal_printer.md) 75 * [Thermal Printer](feature_thermal_printer.md)
70 * [Unicode](feature_unicode.md) 76 * [Unicode](feature_unicode.md)
71 * [Userspace](feature_userspace.md) 77 * [Userspace](feature_userspace.md)
72 * [US ANSI Shifted Keys](keycodes_us_ansi_shifted.md)
73 78
74* For Makers and Modders 79* For Makers and Modders
75 * [Hand Wiring Guide](hand_wire.md) 80 * [Hand Wiring Guide](hand_wire.md)
76 * [ISP Flashing Guide](isp_flashing_guide.md) 81 * [ISP Flashing Guide](isp_flashing_guide.md)
82 * [ARM Debugging Guide](arm_debugging.md)
83 * [I2C Driver](i2c_driver.md)
77 84
78* For a Deeper Understanding 85* For a Deeper Understanding
79 * [How Keyboards Work](how_keyboards_work.md) 86 * [How Keyboards Work](how_keyboards_work.md)
@@ -81,6 +88,7 @@
81 88
82* Other Topics 89* Other Topics
83 * [Using Eclipse with QMK](eclipse.md) 90 * [Using Eclipse with QMK](eclipse.md)
91 * [Support](support.md)
84 92
85* QMK Internals (In Progress) 93* QMK Internals (In Progress)
86 * [Defines](internals_defines.md) 94 * [Defines](internals_defines.md)
diff --git a/docs/_summary.md b/docs/_summary.md
index a35014dd8..b209c5e0b 100644
--- a/docs/_summary.md
+++ b/docs/_summary.md
@@ -3,6 +3,8 @@
3 * [Building Your First Firmware](newbs_building_firmware.md) 3 * [Building Your First Firmware](newbs_building_firmware.md)
4 * [Flashing Firmware](newbs_flashing.md) 4 * [Flashing Firmware](newbs_flashing.md)
5 * [Testing and Debugging](newbs_testing_debugging.md) 5 * [Testing and Debugging](newbs_testing_debugging.md)
6 * [Best Practices](newbs_best_practices.md)
7 * [Learning Resources](newbs_learn_more_resources.md)
6 8
7* [QMK Basics](README.md) 9* [QMK Basics](README.md)
8 * [QMK Introduction](getting_started_introduction.md) 10 * [QMK Introduction](getting_started_introduction.md)
@@ -37,9 +39,11 @@
37 * [Glossary](reference_glossary.md) 39 * [Glossary](reference_glossary.md)
38 * [Unit Testing](unit_testing.md) 40 * [Unit Testing](unit_testing.md)
39 * [Useful Functions](ref_functions.md) 41 * [Useful Functions](ref_functions.md)
42 * [Configurator Support](reference_configurator_support.md)
40 43
41* [Features](features.md) 44* [Features](features.md)
42 * [Basic Keycodes](keycodes_basic.md) 45 * [Basic Keycodes](keycodes_basic.md)
46 * [US ANSI Shifted Keys](keycodes_us_ansi_shifted.md)
43 * [Quantum Keycodes](quantum_keycodes.md) 47 * [Quantum Keycodes](quantum_keycodes.md)
44 * [Advanced Keycodes](feature_advanced_keycodes.md) 48 * [Advanced Keycodes](feature_advanced_keycodes.md)
45 * [Audio](feature_audio.md) 49 * [Audio](feature_audio.md)
@@ -47,8 +51,10 @@
47 * [Backlight](feature_backlight.md) 51 * [Backlight](feature_backlight.md)
48 * [Bluetooth](feature_bluetooth.md) 52 * [Bluetooth](feature_bluetooth.md)
49 * [Bootmagic](feature_bootmagic.md) 53 * [Bootmagic](feature_bootmagic.md)
54 * [Combos](feature_combo)
50 * [Command](feature_command.md) 55 * [Command](feature_command.md)
51 * [Dynamic Macros](feature_dynamic_macros.md) 56 * [Dynamic Macros](feature_dynamic_macros.md)
57 * [Encoders](feature_encoders.md)
52 * [Grave Escape](feature_grave_esc.md) 58 * [Grave Escape](feature_grave_esc.md)
53 * [Key Lock](feature_key_lock.md) 59 * [Key Lock](feature_key_lock.md)
54 * [Layouts](feature_layouts.md) 60 * [Layouts](feature_layouts.md)
@@ -69,11 +75,12 @@
69 * [Thermal Printer](feature_thermal_printer.md) 75 * [Thermal Printer](feature_thermal_printer.md)
70 * [Unicode](feature_unicode.md) 76 * [Unicode](feature_unicode.md)
71 * [Userspace](feature_userspace.md) 77 * [Userspace](feature_userspace.md)
72 * [US ANSI Shifted Keys](keycodes_us_ansi_shifted.md)
73 78
74* For Makers and Modders 79* For Makers and Modders
75 * [Hand Wiring Guide](hand_wire.md) 80 * [Hand Wiring Guide](hand_wire.md)
76 * [ISP Flashing Guide](isp_flashing_guide.md) 81 * [ISP Flashing Guide](isp_flashing_guide.md)
82 * [ARM Debugging Guide](arm_debugging.md)
83 * [I2C Driver](i2c_driver.md)
77 84
78* For a Deeper Understanding 85* For a Deeper Understanding
79 * [How Keyboards Work](how_keyboards_work.md) 86 * [How Keyboards Work](how_keyboards_work.md)
@@ -81,6 +88,7 @@
81 88
82* Other Topics 89* Other Topics
83 * [Using Eclipse with QMK](eclipse.md) 90 * [Using Eclipse with QMK](eclipse.md)
91 * [Support](support.md)
84 92
85* QMK Internals (In Progress) 93* QMK Internals (In Progress)
86 * [Defines](internals_defines.md) 94 * [Defines](internals_defines.md)
diff --git a/docs/arm_debugging.md b/docs/arm_debugging.md
new file mode 100644
index 000000000..491dfe8ad
--- /dev/null
+++ b/docs/arm_debugging.md
@@ -0,0 +1,87 @@
1# ARM Debugging usign Eclipse
2
3This page describes how to setup debugging for ARM MCUs using an SWD adapter and open-source/free tools. In this guide we will install GNU MCU Eclipse IDE for C/C++ Developers and OpenOCD together with all the necessary dependencies.
4
5This guide is catered towards advance users and assumes you can compile an ARM compatible keyboard on your machine using the MAKE flow.
6
7## Installing the software
8
9The main objective here is to get the MCU Eclipse IDE correcly installed on our machine. The necesarry instructions are derived from [this](https://gnu-mcu-eclipse.github.io/install/) install guide.
10
11### The xPack Manager
12
13This tool is a software package manager and it is used to help us get the necesarry depencencies.
14
15XPM runs using Node.js so grab that form [here](https://nodejs.org/en/). After installation, open a terminal and type `npm -v`. A reply with the version number means that the instalation was successful.
16
17XPM instalation instructions can be found [here](https://www.npmjs.com/package/xpm) and are OS specific. Entering `xpm --version` to your terminal should return the software version.
18
19### The ARM Toolchain
20
21Using XPM it is very easy to install the ARM toolchain. Enter the command `xpm install --global @gnu-mcu-eclipse/arm-none-eabi-gcc`.
22
23### Windows build tools
24
25If you are using windows you need to install this!
26
27`xpm install --global @gnu-mcu-eclipse/windows-build-tools`
28
29### Programer/Debugger Drivers
30
31Now its the time to install your programer's drivers. This tutorial was made using an ST-Link v2 which you can get from almost anywhere.
32If you have an ST-Link the drivers can be found [here](https://www.st.com/en/development-tools/stsw-link009.html) otherwise consult the manufuturer of your tool.
33
34### OpenOCD
35
36This dependency allows SWD access from GDB and it is essential for debugging. Run `xpm install --global @gnu-mcu-eclipse/openocd`.
37
38### Java
39
40Java is needed by Eclipse so please download it from [here](https://www.oracle.com/technetwork/java/javase/downloads/index.html).
41
42### GNU MCU Eclipse IDE
43
44Now its finally time to install the IDE. Use the Release page [here](https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases/) to get the latest version.
45
46## Configuring Eclipse
47
48Open up the Eclipse IDE we just downloaded. To import our QMK directory select File -> Import -> C/C++ -> Existing code as Makefile Project. Select next and use Browse to select your QMK folder. In the tool-chain list select ARM Cross GCC and select Finish.
49
50Now you can see the QMK folder on the left hand side. Right click it and select Properties. On the left hand side, expand MCU and select ARM Toolchain Paths. Press xPack and OK. Repeat for OpenOCD Path and if you are on windows for Build Tool Path. Select Apply and Close.
51
52Now its time to install the necessary MCU packages. Go to Packs perspective by selecting Window -> Open Perspective -> Others -> Packs. Now select the yellow refresh symbol next to the Packs tab. This will take a long time as it is requesting the MCU definitions from various places. If some of the links fail you can probably select Ignore.
53
54When this finishes you must find the MCU which we will be building/debugging for. In this example I will be using the STM32F3 series MCUs. On the left, select STMicroelectonics -> STM32F3 Series. On the middle window we can see the pack. Right click and select Install. Once that is done we can go back to the default perspective, Window -> Open Perspective -> Others -> C/C++.
55
56We need to let eclipse know the device we intent to build QMK on. Right click on the QMK folder -> Properties -> C/C++ Build -> Settings. Select the Devices tab and under devices select the appropriate variant of your MCU. For my example it is STM32F303CC
57
58While we are here let's setup the build command as well. Select C/C++ Build and then the Behavior tab. On the build command, replace `all` with your necessary make command. For example for a rev6 Planck with the default keymap this would be `planck/rev6:default`. Select Apply and Close.
59
60## Building
61
62If you have setup everything correctly pressing the hammer button should build the firmware for you and a .bin file should appear.
63
64## Debugging
65
66### Connecting the Debugger
67
68ARM MCUs use the Single Wire Debug (SWD) protocol which comprises of the clock (SWCLK) signal and the data (SWDIO) signal. Connecting this two wires and ground should be enough to allow full manipulation of the MCU. Here we assume that the keyboard will be powered though USB. The RESET signal is not necessary as we can manually assert it using the reset button. For a more advance setup, the SWO signal can be used which pipes printf and scanf asynchronously to the host but for our setup we will ignore it.
69
70NOTE: Make sure the SWCLK and SWDIO pins are not used in the matrix of your keyboard. If they are you can temporarily switch them for some other pins.
71
72### Configuring the Debugger
73
74Right click on your QMK folder, select Debug As -> Debug Configuration. Here double click on GDB OpenOCD Debugging. Select the debugger tab and enter the configuration necessary for your MCU. This might take some fiddling and googleing to find out. The default script for the STM32F3 is called stm32f3discovery.cfg. To let OpenOCD know, in the Config options enter `-f board/stm32f3discovery.cfg`.
75
76NOTE: In my case this configuration script requires editing to disable the reset assertion. The locations of the scripts can be found in the actual executable field usually under the path `openocd/version/.content/scripts/board`. Here I edited `reset_config srst_only` to `reset_config none`.
77
78Select Apply and Close.
79
80### Running the Debugger.
81
82Reset your keyboard.
83
84Press the bug icon and if all goes well you should soon find yourself in the debug perspective. Here the program counter will pause at the beginning of the main function and way for you to press Play. Most of the features of all debuggers work on ARM MCUs but for exact details google is your friend!
85
86
87Happy debugging! \ No newline at end of file
diff --git a/docs/becoming_a_qmk_collaborator.md b/docs/becoming_a_qmk_collaborator.md
index 3cac63c97..16ae0d569 100644
--- a/docs/becoming_a_qmk_collaborator.md
+++ b/docs/becoming_a_qmk_collaborator.md
@@ -1,7 +1,9 @@
1A QMK collaborator is a keyboard maker/designer that is interested in helping QMK grow and fully support their keyboard(s), and encouraging their users/customers to submit features, ideas, and keymaps. We're always looking to add more keyboards and collaborators, but we ask that they fulfill these requirements: 1# Becoming a QMK Collaborator
2 2
3* **Have a PCB available for sale** - unfortunately there's just too much variation and complications with handwired keyboards. 3A QMK collaborator is a keyboard maker or designer that is interested in helping QMK grow and fully support their keyboard(s), and encouraging their users and customers to submit features, ideas, and keymaps. We're always looking to add more keyboards and collaborators, but we ask that they fulfill these requirements:
4* **Maintain the your keyboard's directory** - this may just require an initial setup to get your keyboard working, but it could also include accommodating changes made to QMK's core. 4
5* **Approve and merge your keyboard's keymap pull requests** - we like to encourage users to contribute their keymaps for others to see and work from when creating their own. 5* **Have a PCB available for sale.** Unfortunately there's just too much variation and complications with handwired keyboards.
6* **Maintain your keyboard in QMK.** This may just require an initial setup to get your keyboard working, but it could also include accommodating changes made to QMK's core that might break or render any custom code redundant.
7* **Approve and merge keymap pull requests for your keyboard.** We like to encourage users to contribute their keymaps for others to see and work from when creating their own.
6 8
7If you feel you meet these requirements, shoot us an email at hello@qmk.fm with an introduction and some links to your keyboard! 9If you feel you meet these requirements, shoot us an email at hello@qmk.fm with an introduction and some links to your keyboard!
diff --git a/docs/config_options.md b/docs/config_options.md
index e978bcce8..085ab3ee5 100644
--- a/docs/config_options.md
+++ b/docs/config_options.md
@@ -119,8 +119,8 @@ If you define these options you will enable the associated feature, which may in
119 119
120* `#define FORCE_NKRO` 120* `#define FORCE_NKRO`
121 * NKRO by default requires to be turned on, this forces it on during keyboard startup regardless of EEPROM setting. NKRO can still be turned off but will be turned on again if the keyboard reboots. 121 * NKRO by default requires to be turned on, this forces it on during keyboard startup regardless of EEPROM setting. NKRO can still be turned off but will be turned on again if the keyboard reboots.
122* `#define PREVENT_STUCK_MODIFIERS` 122* `#define STRICT_LAYER_RELEASE`
123 * stores the layer a key press came from so the same layer is used when the key is released, regardless of which layers are enabled 123 * force a key release to be evaluated using the current layer stack instead of remembering which layer it came from (used for advanced cases)
124 124
125## Behaviors That Can Be Configured 125## Behaviors That Can Be Configured
126 126
@@ -132,16 +132,22 @@ If you define these options you will enable the associated feature, which may in
132* `#define TAPPING_TOGGLE 2` 132* `#define TAPPING_TOGGLE 2`
133 * how many taps before triggering the toggle 133 * how many taps before triggering the toggle
134* `#define PERMISSIVE_HOLD` 134* `#define PERMISSIVE_HOLD`
135 * makes tap and hold keys work better for fast typers who don't want tapping term set above 500 135 * makes tap and hold keys trigger the hold if another key is pressed before releasing, even if it hasn't hit the `TAPPING_TERM`
136 * See [Permissive Hold](feature_advanced_keycodes.md#permissive-hold) for details 136 * See [Permissive Hold](feature_advanced_keycodes.md#permissive-hold) for details
137* `#define IGNORE_MOD_TAP_INTERRUPT` 137* `#define IGNORE_MOD_TAP_INTERRUPT`
138 * makes it possible to do rolling combos (zx) with keys that convert to other keys on hold 138 * makes it possible to do rolling combos (zx) with keys that convert to other keys on hold, by enforcing the `TAPPING_TERM` for both keys.
139 * See [Mod tap interrupt](feature_advanced_keycodes.md#mod-tap-interrupt) for details 139 * See [Mod tap interrupt](feature_advanced_keycodes.md#ignore-mod-tap-interrupt) for details
140* `#define TAPPING_FORCE_HOLD` 140* `#define TAPPING_FORCE_HOLD`
141 * makes it possible to use a dual role key as modifier shortly after having been tapped 141 * makes it possible to use a dual role key as modifier shortly after having been tapped
142 * See [Hold after tap](feature_advanced_keycodes.md#hold-after-tap) 142 * See [Hold after tap](feature_advanced_keycodes.md#tapping-force-hold)
143 * Breaks any Tap Toggle functionality (`TT` or the One Shot Tap Toggle)
143* `#define LEADER_TIMEOUT 300` 144* `#define LEADER_TIMEOUT 300`
144 * how long before the leader key times out 145 * how long before the leader key times out
146 * If you're having issues finishing the sequence before it times out, you may need to increase the timeout setting. Or you may want to enable the `LEADER_PER_KEY_TIMING` option, which resets the timeout after each key is tapped.
147* `#define LEADER_PER_KEY_TIMING`
148 * sets the timer for leader key chords to run on each key press rather than overall
149* `#define LEADER_KEY_STRICT_KEY_PROCESSING`
150 * Disables keycode filtering for Mod-Tap and Layer-Tap keycodes. Eg, if you enable this, you would need to specify `MT(MOD_CTL, KC_A)` if you want to use `KC_A`.
145* `#define ONESHOT_TIMEOUT 300` 151* `#define ONESHOT_TIMEOUT 300`
146 * how long before oneshot times out 152 * how long before oneshot times out
147* `#define ONESHOT_TAP_TOGGLE 2` 153* `#define ONESHOT_TAP_TOGGLE 2`
@@ -155,6 +161,12 @@ If you define these options you will enable the associated feature, which may in
155 going to produce the 500 keystrokes a second needed to actually get more than a 161 going to produce the 500 keystrokes a second needed to actually get more than a
156 few ms of delay from this. But if you're doing chording on something with 3-4ms 162 few ms of delay from this. But if you're doing chording on something with 3-4ms
157 scan times? You probably want this. 163 scan times? You probably want this.
164* `#define COMBO_COUNT 2`
165 * Set this to the number of combos that you're using in the [Combo](feature_combo.md) feature.
166* `#define COMBO_TERM 200`
167 * how long for the Combo keys to be detected. Defaults to `TAPPING_TERM` if not defined.
168* `#define TAP_CODE_DELAY 100`
169 * Sets the delay between `register_code` and `unregister_code`, if you're having issues with it registering properly (common on VUSB boards). The value is in milliseconds.
158 170
159## RGB Light Configuration 171## RGB Light Configuration
160 172
@@ -185,12 +197,48 @@ If you define these options you will enable the associated feature, which may in
185 197
186Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk 198Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk
187 199
188* `#define SPLIT_HAND_PIN B7` 200### Setting Handedness
189 * For using high/low pin to determine handedness, low = right hand, high = left hand. Replace 'B7' with the pin you are using. This is optional and you can still use the EEHANDS method or MASTER_LEFT / MASTER_RIGHT defines like the stock Let's Split uses. 201
190 202One thing to remember, the side that the USB port is plugged into is always the master half. The side not plugged into USB is the slave.
203
204There are a few different ways to set handedness for split keyboards (listed in order of precedence):
205
2061. Set `SPLIT_HAND_PIN`: Reads a pin to determine handedness. If pin is high, it's the left side, if low, the half is determined to be the right side
2072. Set `EE_HANDS` and flash `eeprom-lefthand.eep`/`eeprom-righthand.eep` to each half
2083. Set `MASTER_RIGHT`: Half that is plugged into the USB port is determined to be the master and right half (inverse of the default)
2094. Default: The side that is plugged into the USB port is the master half and is assumed to be the left half. The slave side is the right half
210
211* `#define SPLIT_HAND_PIN B7`
212 * For using high/low pin to determine handedness, low = right hand, high = left hand. Replace `B7` with the pin you are using. This is optional, and if you leave `SPLIT_HAND_PIN` undefined, then you can still use the EE_HANDS method or MASTER_LEFT / MASTER_RIGHT defines like the stock Let's Split uses.
213
214* `#define EE_HANDS` (only works if `SPLIT_HAND_PIN` is not defined)
215 * Reads the handedness value stored in the EEPROM after `eeprom-lefthand.eep`/`eeprom-righthand.eep` has been flashed to their respective halves.
216
217* `#define MASTER_RIGHT`
218 * Master half is defined to be the right half.
219
220### Other Options
221
191* `#define USE_I2C` 222* `#define USE_I2C`
192 * For using I2C instead of Serial (defaults to serial) 223 * For using I2C instead of Serial (defaults to serial)
193 224
225* `#define SOFT_SERIAL_PIN D0`
226 * When using serial, define this. `D0` or `D1`,`D2`,`D3`,`E6`.
227
228* `#define MATRIX_ROW_PINS_RIGHT { <row pins> }`
229* `#define MATRIX_COL_PINS_RIGHT { <col pins> }`
230 * If you want to specify a different pinout for the right half than the left half, you can define `MATRIX_ROW_PINS_RIGHT`/`MATRIX_COL_PINS_RIGHT`. Currently, the size of `MATRIX_ROW_PINS` must be the same as `MATRIX_ROW_PINS_RIGHT` and likewise for the definition of columns.
231
232* `#define SELECT_SOFT_SERIAL_SPEED <speed>` (default speed is 1)
233 * Sets the protocol speed when using serial communication
234 * Speeds:
235 * 0: about 189kbps (Experimental only)
236 * 1: about 137kbps (default)
237 * 2: about 75kbps
238 * 3: about 39kbps
239 * 4: about 26kbps
240 * 5: about 20kbps
241
194# The `rules.mk` File 242# The `rules.mk` File
195 243
196This is a [make](https://www.gnu.org/software/make/manual/make.html) file that is included by the top-level `Makefile`. It is used to set some information about the MCU that we will be compiling for as well as enabling and disabling certain features. 244This is a [make](https://www.gnu.org/software/make/manual/make.html) file that is included by the top-level `Makefile`. It is used to set some information about the MCU that we will be compiling for as well as enabling and disabling certain features.
@@ -234,17 +282,56 @@ Use these to enable or disable building certain features. The more you have enab
234 * Console for debug(+400) 282 * Console for debug(+400)
235* `COMMAND_ENABLE` 283* `COMMAND_ENABLE`
236 * Commands for debug and configuration 284 * Commands for debug and configuration
285* `COMBO_ENABLE`
286 * Key combo feature
237* `NKRO_ENABLE` 287* `NKRO_ENABLE`
238 * USB N-Key Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 288 * USB N-Key Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
239* `AUDIO_ENABLE` 289* `AUDIO_ENABLE`
240 * Enable the audio subsystem. 290 * Enable the audio subsystem.
241* `RGBLIGHT_ENABLE` 291* `RGBLIGHT_ENABLE`
242 * Enable keyboard underlight functionality 292 * Enable keyboard underlight functionality
293* `LEADER_ENABLE`
294 * Enable leader key chording
243* `MIDI_ENABLE` 295* `MIDI_ENABLE`
244 * MIDI controls 296 * MIDI controls
245* `UNICODE_ENABLE` 297* `UNICODE_ENABLE`
246 * Unicode 298 * Unicode
247* `BLUETOOTH_ENABLE` 299* `BLUETOOTH_ENABLE`
248 * Enable Bluetooth with the Adafruit EZ-Key HID 300 * Legacy option to Enable Bluetooth with the Adafruit EZ-Key HID. See BLUETOOTH
301* `BLUETOOTH`
302 * Current options are AdafruitEzKey, AdafruitBLE, RN42
249* `SPLIT_KEYBOARD` 303* `SPLIT_KEYBOARD`
250 * Enables split keyboard support (dual MCU like the let's split and bakingpy's boards) and includes all necessary files located at quantum/split_common 304 * Enables split keyboard support (dual MCU like the let's split and bakingpy's boards) and includes all necessary files located at quantum/split_common
305* `WAIT_FOR_USB`
306 * Forces the keyboard to wait for a USB connection to be established before it starts up
307* `NO_USB_STARTUP_CHECK`
308 * Disables usb suspend check after keyboard startup. Usually the keyboard waits for the host to wake it up before any tasks are performed. This is useful for split keyboards as one half will not get a wakeup call but must send commands to the master.
309
310## USB Endpoint Limitations
311
312In order to provide services over USB, QMK has to use USB endpoints.
313These are a finite resource: each microcontroller has only a certain number.
314This limits what features can be enabled together.
315If the available endpoints are exceeded, a build error is thrown.
316
317The following features can require separate endpoints:
318
319* `MOUSEKEY_ENABLE`
320* `EXTRAKEY_ENABLE`
321* `CONSOLE_ENABLE`
322* `NKRO_ENABLE`
323* `MIDI_ENABLE`
324* `RAW_ENABLE`
325* `VIRTSER_ENABLE`
326
327In order to improve utilisation of the endpoints, the HID features can be combined to use a single endpoint.
328By default, `MOUSEKEY`, `EXTRAKEY`, and `NKRO` are combined into a single endpoint.
329
330The base keyboard functionality can also be combined into the endpoint,
331by setting `KEYBOARD_SHARED_EP = yes`.
332This frees up one more endpoint,
333but it can prevent the keyboard working in some BIOSes,
334as they do not implement Boot Keyboard protocol switching.
335
336Combining the mouse also breaks Boot Mouse compatibility.
337The mouse can be uncombined by setting `MOUSE_SHARED_EP = no` if this functionality is required.
diff --git a/docs/contributing.md b/docs/contributing.md
index 8242cc1ad..bcedcaf97 100644
--- a/docs/contributing.md
+++ b/docs/contributing.md
@@ -57,19 +57,39 @@ Never made an open source contribution before? Wondering how contributions work
57Most of our style is pretty easy to pick up on, but right now it's not entirely consistent. You should match the style of the code surrounding your change, but if that code is inconsistent or unclear use the following guidelines: 57Most of our style is pretty easy to pick up on, but right now it's not entirely consistent. You should match the style of the code surrounding your change, but if that code is inconsistent or unclear use the following guidelines:
58 58
59* We indent using two spaces (soft tabs) 59* We indent using two spaces (soft tabs)
60* We use One True Brace Style 60* We use a modified One True Brace Style
61 * Opening Brace: At the end of the same line as the statement that opens the block 61 * Opening Brace: At the end of the same line as the statement that opens the block
62 * Closing Brace: Lined up with the first character of the statement that opens the block 62 * Closing Brace: Lined up with the first character of the statement that opens the block
63 * Else If: Place the closing brace at the beginning of the line and the next opening brace at the end of the same line. 63 * Else If: Place the closing brace at the beginning of the line and the next opening brace at the end of the same line.
64 * Optional Braces: Always include optional braces. 64 * Optional Braces: Always include optional braces.
65 * Good: if (condition) { return false; } 65 * Good: if (condition) { return false; }
66 * Bad: if (condition) return false; 66 * Bad: if (condition) return false;
67* We use C style comments: `/* */` 67* We encourage use of C style comments: `/* */`
68 * Think of them as a story describing the feature 68 * Think of them as a story describing the feature
69 * Use them liberally to explain why particular decisions were made. 69 * Use them liberally to explain why particular decisions were made.
70 * Do not write obvious comments 70 * Do not write obvious comments
71 * If you not sure if a comment is obvious, go ahead and include it. 71 * If you not sure if a comment is obvious, go ahead and include it.
72* In general we don't wrap lines, they can be as long as needed. If you do choose to wrap lines please do not wrap any wider than 76 columns. 72* In general we don't wrap lines, they can be as long as needed. If you do choose to wrap lines please do not wrap any wider than 76 columns.
73* We use `#pragma once` at the start of header files rather than old-style include guards (`#ifndef THIS_FILE_H`, `#define THIS_FILE_H`, ..., `#endif`)
74
75Here is an example for easy reference:
76
77```c
78/* Enums for foo */
79enum foo_state {
80 FOO_BAR,
81 FOO_BAZ,
82};
83
84/* Returns a value */
85int foo(void) {
86 if (some_condition) {
87 return FOO_BAR;
88 } else {
89 return -1;
90 }
91}
92```
73 93
74# General Guidelines 94# General Guidelines
75 95
diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md
index 10c5c75a2..5b95450f2 100644
--- a/docs/custom_quantum_functions.md
+++ b/docs/custom_quantum_functions.md
@@ -27,7 +27,7 @@ The first step to creating your own custom keycode(s) is to enumerate them. This
27 27
28Here is an example of enumerating 2 keycodes. After adding this block to your `keymap.c` you will be able to use `FOO` and `BAR` inside your keymap. 28Here is an example of enumerating 2 keycodes. After adding this block to your `keymap.c` you will be able to use `FOO` and `BAR` inside your keymap.
29 29
30``` 30```c
31enum my_keycodes { 31enum my_keycodes {
32 FOO = SAFE_RANGE, 32 FOO = SAFE_RANGE,
33 BAR 33 BAR
@@ -44,7 +44,7 @@ These function are called every time a key is pressed or released.
44 44
45This example does two things. It defines the behavior for a custom keycode called `FOO`, and it supplements our Enter key by playing a tone whenever it is pressed. 45This example does two things. It defines the behavior for a custom keycode called `FOO`, and it supplements our Enter key by playing a tone whenever it is pressed.
46 46
47``` 47```c
48bool process_record_user(uint16_t keycode, keyrecord_t *record) { 48bool process_record_user(uint16_t keycode, keyrecord_t *record) {
49 switch (keycode) { 49 switch (keycode) {
50 case FOO: 50 case FOO:
@@ -75,16 +75,16 @@ The `keycode` argument is whatever is defined in your keymap, eg `MO(1)`, `KC_L`
75 75
76The `record` argument contains information about the actual press: 76The `record` argument contains information about the actual press:
77 77
78``` 78```c
79keyrecord_t record { 79keyrecord_t record {
80+-keyevent_t event { 80 keyevent_t event {
81| +-keypos_t key { 81 keypos_t key {
82| | +-uint8_t col 82 uint8_t col
83| | +-uint8_t row 83 uint8_t row
84| | } 84 }
85| +-bool pressed 85 bool pressed
86| +-uint16_t time 86 uint16_t time
87| } 87 }
88} 88}
89``` 89```
90 90
@@ -100,7 +100,7 @@ This allows you to control the 5 LED's defined as part of the USB Keyboard spec.
100 100
101### Example `led_set_user()` Implementation 101### Example `led_set_user()` Implementation
102 102
103``` 103```c
104void led_set_user(uint8_t usb_led) { 104void led_set_user(uint8_t usb_led) {
105 if (usb_led & (1<<USB_LED_NUM_LOCK)) { 105 if (usb_led & (1<<USB_LED_NUM_LOCK)) {
106 PORTB |= (1<<0); 106 PORTB |= (1<<0);
@@ -117,12 +117,12 @@ void led_set_user(uint8_t usb_led) {
117 } else { 117 } else {
118 PORTB &= ~(1<<2); 118 PORTB &= ~(1<<2);
119 } 119 }
120 if (usb_led & (1<<USB_LED_COMPOSE_LOCK)) { 120 if (usb_led & (1<<USB_LED_COMPOSE)) {
121 PORTB |= (1<<3); 121 PORTB |= (1<<3);
122 } else { 122 } else {
123 PORTB &= ~(1<<3); 123 PORTB &= ~(1<<3);
124 } 124 }
125 if (usb_led & (1<<USB_LED_KANA_LOCK)) { 125 if (usb_led & (1<<USB_LED_KANA)) {
126 PORTB |= (1<<4); 126 PORTB |= (1<<4);
127 } else { 127 } else {
128 PORTB &= ~(1<<4); 128 PORTB &= ~(1<<4);
@@ -138,14 +138,14 @@ void led_set_user(uint8_t usb_led) {
138 138
139# Matrix Initialization Code 139# Matrix Initialization Code
140 140
141Before 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 LED's or i&#xb2;c controllers you will need to set up that hardware before it can be used. 141Before 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 LED's or i&#xb2;c controllers you will need to set up that hardware before it can be used.
142 142
143 143
144### Example `matrix_init_user()` Implementation 144### Example `matrix_init_user()` Implementation
145 145
146This example, at the keyboard level, sets up B1, B2, and B3 as LED pins. 146This example, at the keyboard level, sets up B1, B2, and B3 as LED pins.
147 147
148``` 148```c
149void matrix_init_user(void) { 149void matrix_init_user(void) {
150 // Call the keymap level matrix init. 150 // Call the keymap level matrix init.
151 151
@@ -181,16 +181,16 @@ You should use this function if you need custom matrix scanning code. It can als
181 181
182# Keyboard Idling/Wake Code 182# Keyboard Idling/Wake Code
183 183
184If the board supports it, it can be "idled", by stopping a number of functions. A good example of this is RGB lights or backlights. This can save on power consumption, or may be better behavior for your keyboard. 184If the board supports it, it can be "idled", by stopping a number of functions. A good example of this is RGB lights or backlights. This can save on power consumption, or may be better behavior for your keyboard.
185 185
186This is controlled by two functions: `suspend_power_down_*` and `suspend_wakeup_init_*`, which are called when the system is board is idled and when it wakes up, respectively. 186This is controlled by two functions: `suspend_power_down_*` and `suspend_wakeup_init_*`, which are called when the system is board is idled and when it wakes up, respectively.
187 187
188 188
189### Example suspend_power_down_user() and suspend_wakeup_init_user() Implementation 189### Example suspend_power_down_user() and suspend_wakeup_init_user() Implementation
190 190
191This example, at the keyboard level, sets up B1, B2, and B3 as LED pins. 191This example, at the keyboard level, sets up B1, B2, and B3 as LED pins.
192 192
193``` 193```c
194void suspend_power_down_user(void) 194void suspend_power_down_user(void)
195{ 195{
196 rgb_matrix_set_suspend_state(true); 196 rgb_matrix_set_suspend_state(true);
@@ -210,13 +210,13 @@ void suspend_wakeup_init_user(void)
210 210
211# Layer Change Code 211# Layer Change Code
212 212
213This runs code every time that the layers get changed. This can be useful for layer indication, or custom layer handling. 213This runs code every time that the layers get changed. This can be useful for layer indication, or custom layer handling.
214 214
215### Example `layer_state_set_*` Implementation 215### Example `layer_state_set_*` Implementation
216 216
217This example shows how to set the [RGB Underglow](feature_rgblight.md) lights based on the layer, using the Planck as an example 217This example shows how to set the [RGB Underglow](feature_rgblight.md) lights based on the layer, using the Planck as an example
218 218
219``` 219```c
220uint32_t layer_state_set_user(uint32_t state) { 220uint32_t layer_state_set_user(uint32_t state) {
221 switch (biton32(state)) { 221 switch (biton32(state)) {
222 case _RAISE: 222 case _RAISE:
@@ -244,3 +244,143 @@ uint32_t layer_state_set_user(uint32_t state) {
244* Keymap: `uint32_t layer_state_set_user(uint32_t state)` 244* Keymap: `uint32_t layer_state_set_user(uint32_t state)`
245 245
246The `state` is the bitmask of the active layers, as explained in the [Keymap Overview](keymap.md#keymap-layer-status) 246The `state` is the bitmask of the active layers, as explained in the [Keymap Overview](keymap.md#keymap-layer-status)
247
248
249# Persistent Configuration (EEPROM)
250
251This allows you to configure persistent settings for your keyboard. These settings are stored in the EEPROM of your controller, and are retained even after power loss. The settings can be read with `eeconfig_read_kb` and `eeconfig_read_user`, and can be written to using `eeconfig_update_kb` and `eeconfig_update_user`. This is useful for features that you want to be able to toggle (like toggling rgb layer indication). Additionally, you can use `eeconfig_init_kb` and `eeconfig_init_user` to set the default values for the EEPROM.
252
253The complicated part here, is that there are a bunch of ways that you can store and access data via EEPROM, and there is no "correct" way to do this. However, you only have a DWORD (4 bytes) for each function.
254
255Keep in mind that EEPROM has a limited number of writes. While this is very high, it's not the only thing writing to the EEPROM, and if you write too often, you can potentially drastically shorten the life of your MCU.
256
257* If you don't understand the example, then you may want to avoid using this feature, as it is rather complicated.
258
259### Example Implementation
260
261This 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!
262
263
264In your keymap.c file, add this to the top:
265```
266typedef union {
267 uint32_t raw;
268 struct {
269 bool rgb_layer_change :1;
270 };
271} user_config_t;
272
273user_config_t user_config;
274```
275
276This sets up a 32 bit structure that we can store settings with in memory, and write to the EEPROM. Using this removes the need to define variables, since they're defined in this structure. Remember that `bool` (boolean) values use 1 bit, `uint8_t` uses 8 bits, `uint16_t` uses up 16 bits. You can mix and match, but changing the order can cause issues, as it will change the values that are read and written.
277
278We're using `rgb_layer_change`, for the `layer_state_set_*` function, and use `matrix_init_user` and `process_record_user` to configure everything.
279
280Now, using the `matrix_init_user` code above, you want to add `eeconfig_read_user()` to it, to populate the structure you've just created. And you can then immediately use this structure to control functionality in your keymap. And It should look like:
281```
282void matrix_init_user(void) {
283 // Call the keymap level matrix init.
284
285 // Read the user config from EEPROM
286 user_config.raw = eeconfig_read_user();
287
288 // Set default layer, if enabled
289 if (user_config.rgb_layer_change) {
290 rgblight_enable_noeeprom();
291 rgblight_sethsv_noeeprom_cyan();
292 rgblight_mode_noeeprom(1);
293 }
294}
295```
296The above function will use the EEPROM config immediately after reading it, to set the default layer's RGB color. The "raw" value of it is converted in a usable structure based on the "union" that you created above.
297
298```
299uint32_t layer_state_set_user(uint32_t state) {
300 switch (biton32(state)) {
301 case _RAISE:
302 if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_magenta(); rgblight_mode_noeeprom(1); }
303 break;
304 case _LOWER:
305 if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_red(); rgblight_mode_noeeprom(1); }
306 break;
307 case _PLOVER:
308 if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_green(); rgblight_mode_noeeprom(1); }
309 break;
310 case _ADJUST:
311 if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_white(); rgblight_mode_noeeprom(1); }
312 break;
313 default: // for any other layers, or the default layer
314 if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_cyan(); rgblight_mode_noeeprom(1); }
315 break;
316 }
317 return state;
318}
319```
320This will cause the RGB underglow to be changed ONLY if the value was enabled. Now to configure this value, create a new keycode for `process_record_user` called `RGB_LYR` and `EPRM`. Additionally, we want to make sure that if you use the normal RGB codes, that it turns off Using the example above, make it look this:
321```
322
323bool process_record_user(uint16_t keycode, keyrecord_t *record) {
324 switch (keycode) {
325 case FOO:
326 if (record->event.pressed) {
327 // Do something when pressed
328 } else {
329 // Do something else when release
330 }
331 return false; // Skip all further processing of this key
332 case KC_ENTER:
333 // Play a tone when enter is pressed
334 if (record->event.pressed) {
335 PLAY_NOTE_ARRAY(tone_qwerty);
336 }
337 return true; // Let QMK send the enter press/release events
338 case EPRM:
339 if (record->event.pressed) {
340 eeconfig_init(); // resets the EEPROM to default
341 }
342 return false;
343 case RGB_LYR: // This allows me to use underglow as layer indication, or as normal
344 if (record->event.pressed) {
345 user_config.rgb_layer_change ^= 1; // Toggles the status
346 eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM
347 if (user_config.rgb_layer_change) { // if layer state indication is enabled,
348 layer_state_set(layer_state); // then immediately update the layer color
349 }
350 }
351 return false; break;
352 case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // For any of the RGB codes (see quantum_keycodes.h, L400 for reference)
353 if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled
354 if (user_config.rgb_layer_change) { // only if this is enabled
355 user_config.rgb_layer_change = false; // disable it, and
356 eeconfig_update_user(user_config.raw); // write the setings to EEPROM
357 }
358 }
359 return true; break;
360 default:
361 return true; // Process all other keycodes normally
362 }
363}
364```
365And lastly, you want to add the `eeconfig_init_user` function, so that when the EEPROM is reset, you can specify default values, and even custom actions. For example, if you want to set rgb layer indication by default, and save the default valued.
366
367```
368void eeconfig_init_user(void) { // EEPROM is getting reset!
369 user_config.rgb_layer_change = true; // We want this enabled by default
370 eeconfig_update_user(user_config.raw); // Write default value to EEPROM now
371
372 // use the non noeeprom versions, to write these values to EEPROM too
373 rgblight_enable(); // Enable RGB by default
374 rgblight_sethsv_cyan(); // Set it to CYAN by default
375 rgblight_mode(1); // set to solid by default
376}
377```
378
379And you're done. The RGB layer indication will only work if you want it to. And it will be saved, even after unplugging the board. And if you use any of the RGB codes, it will disable the layer indication, so that it stays on the mode and color that you set it to.
380
381### 'EECONFIG' Function Documentation
382
383* Keyboard/Revision: `void eeconfig_init_kb(void)`, `uint32_t eeconfig_read_kb(void)` and `void eeconfig_update_kb(uint32_t val)`
384* Keymap: `void eeconfig_init_user(void)`, `uint32_t eeconfig_read_user(void)` and `void eeconfig_update_user(uint32_t val)`
385
386The `val` is the value of the data that you want to write to EEPROM. And the `eeconfig_read_*` function return a 32 bit (DWORD) value from the EEPROM.
diff --git a/docs/documentation_templates.md b/docs/documentation_templates.md
index 18829ed0f..ba3830b64 100644
--- a/docs/documentation_templates.md
+++ b/docs/documentation_templates.md
@@ -36,7 +36,7 @@ Make example for this keyboard (after setting up your build environment):
36 36
37 make planck/rev4:default 37 make planck/rev4:default
38 38
39See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. 39See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
40``` 40```
41 41
42There needs to be two spaces at the end of the `Keyboard Maintainer` and `Hardware Supported` lines for it to render correctly with Markdown. 42There needs to be two spaces at the end of the `Keyboard Maintainer` and `Hardware Supported` lines for it to render correctly with Markdown.
diff --git a/docs/faq_build.md b/docs/faq_build.md
index 7d17df074..14c61a1e9 100644
--- a/docs/faq_build.md
+++ b/docs/faq_build.md
@@ -17,7 +17,7 @@ or just:
17 17
18Note that running `make` with `sudo` is generally *not* a good idea, and you should use one of the former methods, if possible. 18Note that running `make` with `sudo` is generally *not* a good idea, and you should use one of the former methods, if possible.
19 19
20## Linux `udev` Rules 20### Linux `udev` Rules
21On Linux, you'll need proper privileges to access the MCU. You can either use 21On Linux, you'll need proper privileges to access the MCU. You can either use
22`sudo` when flashing firmware, or place these files in `/etc/udev/rules.d/`. 22`sudo` when flashing firmware, or place these files in `/etc/udev/rules.d/`.
23 23
@@ -37,6 +37,14 @@ 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## Unknown Device for DFU Bootloader
41
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.
43
44Re-running the installation script for MSYS2 may help (eg run `./util/qmk_install.sh` from MSYS2/WSL) or reinstalling the QMK Toolbox may fix the issue.
45
46If that doesn't work, then you may need to grab the [Zadig Utility](https://zadig.akeo.ie/). Download this, find the device in question, and select the `WinUS(libusb-1.0)` option, and hit "Reinstall driver". Once you've done that, try flashing your board, again.
47
40## WINAVR is Obsolete 48## WINAVR is Obsolete
41It is no longer recommended and may cause some problem. 49It is no longer recommended and may cause some problem.
42See [TMK Issue #99](https://github.com/tmk/tmk_keyboard/issues/99). 50See [TMK Issue #99](https://github.com/tmk/tmk_keyboard/issues/99).
@@ -97,10 +105,12 @@ The solution is to remove and reinstall all affected modules.
97``` 105```
98brew rm avr-gcc 106brew rm avr-gcc
99brew rm dfu-programmer 107brew rm dfu-programmer
108brew rm dfu-util
100brew rm gcc-arm-none-eabi 109brew rm gcc-arm-none-eabi
101brew rm avrdude 110brew rm avrdude
102brew install avr-gcc 111brew install avr-gcc
103brew install dfu-programmer 112brew install dfu-programmer
113brew install dfu-util
104brew install gcc-arm-none-eabi 114brew install gcc-arm-none-eabi
105brew install avrdude 115brew install avrdude
106``` 116```
@@ -116,5 +126,5 @@ For now, you need to rollback avr-gcc to 7 in brew.
116``` 126```
117brew uninstall --force avr-gcc 127brew uninstall --force avr-gcc
118brew install avr-gcc@7 128brew install avr-gcc@7
119brew link avr-gcc@7 129brew link --force avr-gcc@7
120``` 130```
diff --git a/docs/faq_keymap.md b/docs/faq_keymap.md
index 07d74d6cf..ae01e9387 100644
--- a/docs/faq_keymap.md
+++ b/docs/faq_keymap.md
@@ -11,8 +11,8 @@ Keycodes are actually defined in [common/keycode.h](https://github.com/qmk/qmk_f
11 11
12There are 3 standard keyboard layouts in use around the world- ANSI, ISO, and JIS. North America primarily uses ANSI, Europe and Africa primarily use ISO, and Japan uses JIS. Regions not mentioned typically use either ANSI or ISO. The keycodes corresponding to these layouts are shown here: 12There are 3 standard keyboard layouts in use around the world- ANSI, ISO, and JIS. North America primarily uses ANSI, Europe and Africa primarily use ISO, and Japan uses JIS. Regions not mentioned typically use either ANSI or ISO. The keycodes corresponding to these layouts are shown here:
13 13
14<!-- Source for this image: http://www.keyboard-layout-editor.com/#/gists/070a530eedaed36a2d77f3f6fd455677 --> 14<!-- Source for this image: http://www.keyboard-layout-editor.com/#/gists/bf431647d1001cff5eff20ae55621e9a -->
15![Keyboard Layout Image](https://i.imgur.com/gvlNUpQ.png) 15![Keyboard Layout Image](https://i.imgur.com/5wsh5wM.png)
16 16
17## Some Of My Keys Are Swapped Or Not Working 17## Some Of My Keys Are Swapped Or Not Working
18 18
@@ -211,20 +211,3 @@ here real_mods lost state for 'physical left shift'.
211 211
212weak_mods is ORed with real_mods when keyboard report is sent. 212weak_mods is ORed with real_mods when keyboard report is sent.
213https://github.com/tmk/tmk_core/blob/master/common/action_util.c#L57 213https://github.com/tmk/tmk_core/blob/master/common/action_util.c#L57
214
215## Timer Functionality
216
217It's possible to start timers and read values for time-specific events - here's an example:
218
219```c
220static uint16_t key_timer;
221key_timer = timer_read();
222
223if (timer_elapsed(key_timer) < 100) {
224 // do something if less than 100ms have passed
225} else {
226 // do something if 100ms or more have passed
227}
228```
229
230It's best to declare the `static uint16_t key_timer;` at the top of the file, outside of any code blocks you're using it in.
diff --git a/docs/feature_advanced_keycodes.md b/docs/feature_advanced_keycodes.md
index f93b8033a..8c0a22fc6 100644
--- a/docs/feature_advanced_keycodes.md
+++ b/docs/feature_advanced_keycodes.md
@@ -2,7 +2,7 @@
2 2
3Your keymap can include keycodes that are more advanced than normal, for example keys that switch layers or send modifiers when held, but send regular keycodes when tapped. This page documents the functions that are available to you. 3Your keymap can include keycodes that are more advanced than normal, for example keys that switch layers or send modifiers when held, but send regular keycodes when tapped. This page documents the functions that are available to you.
4 4
5### Assigning Custom Names 5## Assigning Custom Names
6 6
7People often define custom names using `#define`. For example: 7People often define custom names using `#define`. For example:
8 8
@@ -13,18 +13,21 @@ People often define custom names using `#define`. For example:
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### Limits of These Aliases 16## Caveats
17 17
18Currently, the keycodes able to used with these functions are limited to the [Basic Keycodes](keycodes_basic.md), meaning you can't use keycodes like `KC_TILD`, or anything greater than 0xFF. For a full list of the keycodes able to be used see [Basic Keycodes](keycodes_basic.md). 18Currently, `LT()` and `MT()` are limited to the [Basic Keycode set](keycodes_basic.md), meaning you can't use keycodes like `LCTL()`, `KC_TILD`, or anything greater than `0xFF`. Modifiers specified as part of a Layer Tap or Mod Tap's keycode will be ignored.
19
20Additionally, if at least one right-handed modifier is specified in a Mod Tap or Layer Tap, it will cause all modifiers specified to become right-handed, so it is not possible to mix and match the two.
19 21
20# Switching and Toggling Layers 22# Switching and Toggling Layers
21 23
22These 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) 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.
23 25
24* `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).)
25* `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.
26* `LM(layer, mod)` - Momentarily activates *layer* (like `MO`), but with modifier(s) *mod* active. Only supports layers 0-15 and the left modifiers. 28* `LM(layer, mod)` - Momentarily activates *layer* (like `MO`), but with modifier(s) *mod* active. Only supports layers 0-15 and the left modifiers.
27* `LT(layer, kc)` - momentarily activates *layer* when held, and sends *kc* when tapped. 29* `LT(layer, kc)` - momentarily activates *layer* when held, and sends *kc* when tapped. Only supports layers 0-15.
30* `OSL(layer)` - momentarily activates *layer* until the next key is pressed. See [One Shot Keys](#one-shot-keys) for details and additional functionality.
28* `TG(layer)` - toggles *layer*, activating it if it's inactive and vice versa 31* `TG(layer)` - toggles *layer*, activating it if it's inactive and vice versa
29* `TO(layer)` - activates *layer* and de-activates all other layers (except your default layer). This function is special, because instead of just adding/removing one layer to your active layer stack, it will completely replace your current active layers, uniquely allowing you to replace higher layers with a lower one. This is activated on keydown (as soon as the key is pressed). 32* `TO(layer)` - activates *layer* and de-activates all other layers (except your default layer). This function is special, because instead of just adding/removing one layer to your active layer stack, it will completely replace your current active layers, uniquely allowing you to replace higher layers with a lower one. This is activated on keydown (as soon as the key is pressed).
30* `TT(layer)` - Layer Tap-Toggle. If you hold the key down, *layer* is activated, and then is de-activated when you let go (like `MO`). If you repeatedly tap it, the layer will be toggled on or off (like `TG`). It needs 5 taps by default, but you can change this by defining `TAPPING_TOGGLE` -- for example, `#define TAPPING_TOGGLE 2` to toggle on just two taps. 33* `TT(layer)` - Layer Tap-Toggle. If you hold the key down, *layer* is activated, and then is de-activated when you let go (like `MO`). If you repeatedly tap it, the layer will be toggled on or off (like `TG`). It needs 5 taps by default, but you can change this by defining `TAPPING_TOGGLE` -- for example, `#define TAPPING_TOGGLE 2` to toggle on just two taps.
@@ -33,7 +36,7 @@ These functions allow you to activate layers in various ways. Note that layers a
33 36
34Care must be taken when switching layers, it's possible to lock yourself into a layer with no way to deactivate that layer (without unplugging your keyboard.) We've created some guidelines to help users avoid the most common problems. 37Care must be taken when switching layers, it's possible to lock yourself into a layer with no way to deactivate that layer (without unplugging your keyboard.) We've created some guidelines to help users avoid the most common problems.
35 38
36### Beginners 39## Beginners
37 40
38If you are just getting started with QMK you will want to keep everything simple. Follow these guidelines when setting up your layers: 41If you are just getting started with QMK you will want to keep everything simple. Follow these guidelines when setting up your layers:
39 42
@@ -41,11 +44,11 @@ If you are just getting started with QMK you will want to keep everything simple
41* Arrange your layers in a "tree" layout, with layer 0 as the root. Do not try to enter the same layer from more than one other layer. 44* Arrange your layers in a "tree" layout, with layer 0 as the root. Do not try to enter the same layer from more than one other layer.
42* In a layer's keymap, only reference higher-numbered layers. Because layers are processed from the highest-numbered (topmost) active layer down, modifying the state of lower layers can be tricky and error-prone. 45* In a layer's keymap, only reference higher-numbered layers. Because layers are processed from the highest-numbered (topmost) active layer down, modifying the state of lower layers can be tricky and error-prone.
43 46
44### Intermediate Users 47## Intermediate Users
45 48
46Sometimes you need more than one base layer. For example, if you want to switch between QWERTY and Dvorak, switch between layouts for different countries, or switch your layout for different videogames. Your base layers should always be the lowest numbered layers. When you have multiple base layers you should always treat them as mutually exclusive. When one base layer is on the others are off. 49Sometimes you need more than one base layer. For example, if you want to switch between QWERTY and Dvorak, switch between layouts for different countries, or switch your layout for different videogames. Your base layers should always be the lowest numbered layers. When you have multiple base layers you should always treat them as mutually exclusive. When one base layer is on the others are off.
47 50
48### Advanced Users 51## Advanced Users
49 52
50Once you have a good feel for how layers work and what you can do, you can get more creative. The rules listed in the beginner section will help you be successful by avoiding some of the tricker details but they can be constraining, especially for ultra-compact keyboard users. Understanding how layers work will allow you to use them in more advanced ways. 53Once you have a good feel for how layers work and what you can do, you can get more creative. The rules listed in the beginner section will help you be successful by avoiding some of the tricker details but they can be constraining, especially for ultra-compact keyboard users. Understanding how layers work will allow you to use them in more advanced ways.
51 54
@@ -55,57 +58,80 @@ Sometimes, you might want to switch between layers in a macro or as part of a ta
55 58
56# Modifier Keys 59# Modifier Keys
57 60
58These functions allow you to combine a mod with a keycode. When pressed the keydown for the mod will be sent first, and then *kc* will be sent. When released the keyup for *kc* will be sent and then the mod will be sent. 61These allow you to combine a modifier with a keycode. When pressed, the keydown event for the modifier, then `kc` will be sent. On release, the keyup event for `kc`, then the modifier will be sent.
59 62
60* `LSFT(kc)` or `S(kc)` - applies left Shift to *kc* (keycode) 63|Key |Aliases |Description |
61* `RSFT(kc)` - applies right Shift to *kc* 64|----------|----------------------|----------------------------------------------------|
62* `LCTL(kc)` - applies left Control to *kc* 65|`LCTL(kc)`| |Hold Left Control and press `kc` |
63* `RCTL(kc)` - applies right Control to *kc* 66|`LSFT(kc)`|`S(kc)` |Hold Left Shift and press `kc` |
64* `LALT(kc)` - applies left Alt to *kc* 67|`LALT(kc)`| |Hold Left Alt and press `kc` |
65* `RALT(kc)` - applies right Alt to *kc* 68|`LGUI(kc)`|`LCMD(kc)`, `LWIN(kc)`|Hold Left GUI and press `kc` |
66* `LGUI(kc)` - applies left GUI (command/win) to *kc* 69|`RCTL(kc)`| |Hold Right Control and press `kc` |
67* `RGUI(kc)` - applies right GUI (command/win) to *kc* 70|`RSFT(kc)`| |Hold Right Shift and press `kc` |
68* `HYPR(kc)` - applies Hyper (all modifiers) to *kc* 71|`RALT(kc)`|`ALGR(kc)` |Hold Right Alt and press `kc` |
69* `MEH(kc)` - applies Meh (all modifiers except Win/Cmd) to *kc* 72|`RGUI(kc)`|`RCMD(kc)`, `LWIN(kc)`|Hold Right GUI and press `kc` |
70* `LCAG(kc)` - applies CtrlAltGui to *kc* 73|`HYPR(kc)`| |Hold Left Control, Shift, Alt and GUI and press `kc`|
71 74|`MEH(kc)` | |Hold Left Control, Shift and Alt and press `kc` |
72You can also chain these, like this: 75|`LCAG(kc)`| |Hold Left Control, Alt and GUI and press `kc` |
73 76|`SGUI(kc)`|`SCMD(kc)`, `SWIN(kc)`|Hold Left Shift and GUI and press `kc` |
74 LALT(LCTL(KC_DEL)) -- this makes a key that sends Alt, Control, and Delete in a single keypress. 77|`LCA(kc)` | |Hold Left Control and Alt and press `kc` |
75 78
76# Mod Tap 79You can also chain them, for example `LCTL(LALT(KC_DEL))` makes a key that sends Control+Alt+Delete with a single keypress.
80
81# Mod-Tap
82
83The Mod-Tap key `MT(mod, kc)` acts like a modifier when held, and a regular keycode when tapped. In other words, you can have a key that sends Escape when you tap it, but functions as a Control or Shift key when you hold it down.
84
85The modifiers this keycode and `OSM()` accept are prefixed with `MOD_`, not `KC_`:
86
87|Modifier |Description |
88|----------|----------------------------------------|
89|`MOD_LCTL`|Left Control |
90|`MOD_LSFT`|Left Shift |
91|`MOD_LALT`|Left Alt |
92|`MOD_LGUI`|Left GUI (Windows/Command/Meta key) |
93|`MOD_RCTL`|Right Control |
94|`MOD_RSFT`|Right Shift |
95|`MOD_RALT`|Right Alt (AltGr) |
96|`MOD_RGUI`|Right GUI (Windows/Command/Meta key) |
97|`MOD_HYPR`|Hyper (Left Control, Shift, Alt and GUI)|
98|`MOD_MEH` |Meh (Left Control, Shift, and Alt) |
99
100You can combine these by ORing them together like so:
77 101
78`MT(mod, kc)` - is *mod* (modifier key - MOD_LCTL, MOD_LSFT) when held, and *kc* when tapped. In other words, you can have a key that sends Esc (or the letter O or whatever) when you tap it, but works as a Control key or a Shift key when you hold it down. 102```c
103MT(MOD_LCTL | MOD_LSFT, KC_ESC)
104```
79 105
80These are the values you can use for the `mod` in `MT()` and `OSM()`: 106This key would activate Left Control and Left Shift when held, and send Escape when tapped.
81 107
82 * MOD_LCTL 108For convenience, QMK includes some Mod-Tap shortcuts to make common combinations more compact in your keymap:
83 * MOD_LSFT
84 * MOD_LALT
85 * MOD_LGUI
86 * MOD_RCTL
87 * MOD_RSFT
88 * MOD_RALT
89 * MOD_RGUI
90 * MOD_HYPR
91 * MOD_MEH
92 109
93These can also be combined like `MOD_LCTL | MOD_LSFT` e.g. `MT(MOD_LCTL | MOD_LSFT, KC_ESC)` which would activate Control and Shift when held, and send Escape when tapped. 110|Key |Aliases |Description |
111|------------|---------------------------------------|-------------------------------------------------------|
112|`LCTL_T(kc)`|`CTL_T(kc)` |Left Control when held, `kc` when tapped |
113|`RCTL_T(kc)`| |Right Control when held, `kc` when tapped |
114|`LSFT_T(kc)`|`SFT_T(kc)` |Left Shift when held, `kc` when tapped |
115|`RSFT_T(kc)`| |Right Shift when held, `kc` when tapped |
116|`LALT_T(kc)`|`ALT_T(kc)` |Left Alt when held, `kc` when tapped |
117|`RALT_T(kc)`|`ALGR_T(kc)` |Right Alt when held, `kc` when tapped |
118|`LGUI_T(kc)`|`LCMD_T(kc)`, `RWIN_T(kc)`, `GUI_T(kc)`|Left GUI when held, `kc` when tapped |
119|`RGUI_T(kc)`|`RCMD_T(kc)`, `RWIN_T(kc)` |Right GUI when held, `kc` when tapped |
120|`C_S_T(kc)` | |Left Control and Shift when held, `kc` when tapped |
121|`MEH_T(kc)` | |Left Control, Shift and Alt when held, `kc` when tapped|
122|`LCAG_T(kc)`| |Left Control, Alt and GUI when held, `kc` when tapped |
123|`RCAG_T(kc)`| |Right Control, Alt and GUI when held, `kc` when tapped |
124|`ALL_T(kc)` | |Left Control, Shift, Alt and GUI when held, `kc` when tapped - more info [here](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)|
125|`SGUI_T(kc)`|`SCMD_T(kc)`, `SWIN_T(kc)` |Left Shift and GUI when held, `kc` when tapped |
126|`LCA_T(kc)` | |Left Control and Alt when held, `kc` when tapped |
94 127
95We've added shortcuts to make common modifier/tap (mod-tap) mappings more compact: 128## Caveats
96 129
97 * `CTL_T(kc)` - is LCTL when held and *kc* when tapped 130Unfortunately, these keycodes cannot be used in Mod-Taps or Layer-Taps, since any modifiers specified in the keycode are ignored.
98 * `SFT_T(kc)` - is LSFT when held and *kc* when tapped
99 * `ALT_T(kc)` - is LALT when held and *kc* when tapped
100 * `ALGR_T(kc)` - is AltGr when held and *kc* when tapped
101 * `GUI_T(kc)` - is LGUI when held and *kc* when tapped
102 * `ALL_T(kc)` - is Hyper (all mods) when held and *kc* when tapped. To read more about what you can do with a Hyper key, see [this blog post by Brett Terpstra](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)
103 * `LCAG_T(kc)` - is CtrlAltGui when held and *kc* when tapped
104 * `MEH_T(kc)` - is like Hyper, but not as cool -- does not include the Cmd/Win key, so just sends Alt+Ctrl+Shift.
105 131
106?> Due to the way that keycodes are structured, any modifiers specified as part of `kc`, such as `LCTL()` or `KC_LPRN`, will only activate when held instead of tapped. 132Additionally, you may run into issues when using Remote Desktop Connection on Windows. Because these codes send shift very fast, Remote Desktop may miss the codes.
107 133
108?> Additionally, if there is at least one right-handed modifier, any other modifiers in a chain of functions will turn into their right-handed equivalents, so it is not possible to "mix and match" the two. 134To fix this, open Remote Desktop Connection, click on "Show Options", open the the "Local Resources" tab. In the keyboard section, change the drop down to "On this Computer". This will fix the issue, and allow the characters to work correctly.
109 135
110# One Shot Keys 136# One Shot Keys
111 137
@@ -115,6 +141,8 @@ For example, if you define a key as `OSM(MOD_LSFT)`, you can type a capital A ch
115 141
116One shot keys also work as normal modifiers. If you hold down a one shot key and type other keys, your one shot will be released immediately after you let go of the key. 142One shot keys also work as normal modifiers. If you hold down a one shot key and type other keys, your one shot will be released immediately after you let go of the key.
117 143
144Additionally, hitting keys five times in a short period will lock that key. This applies for both One Shot Modifiers and One Shot Layers, and is controlled by the `ONESHOT_TAP_TOGGLE` define.
145
118You can control the behavior of one shot keys by defining these in `config.h`: 146You can control the behavior of one shot keys by defining these in `config.h`:
119 147
120```c 148```c
@@ -125,42 +153,78 @@ You can control the behavior of one shot keys by defining these in `config.h`:
125* `OSM(mod)` - Momentarily hold down *mod*. You must use the `MOD_*` keycodes as shown in [Mod Tap](#mod-tap), not the `KC_*` codes. 153* `OSM(mod)` - Momentarily hold down *mod*. You must use the `MOD_*` keycodes as shown in [Mod Tap](#mod-tap), not the `KC_*` codes.
126* `OSL(layer)` - momentary switch to *layer*. 154* `OSL(layer)` - momentary switch to *layer*.
127 155
128Sometimes, you want to activate a one-shot layer as part of a macro or tap dance routine. To do this, you need to call `set_oneshot_layer(LAYER, ONESHOT_START)` on key down, and `set_oneshot_layer(ONESHOT_PRESSED)` on key up. If you want to cancel the oneshot, call `reset_oneshot_layer()`. For more complicated actions, take a look at the oneshot implementation in [`process_record`](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/action.c#L429). 156Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine.
157
158For one shot layers, you need to call `set_oneshot_layer(LAYER, ONESHOT_START)` on key down, and `set_oneshot_layer(ONESHOT_PRESSED)` on key up. If you want to cancel the oneshot, call `reset_oneshot_layer()`.
129 159
130If 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. 160For one shot mods, you need to call `set_oneshot_mods(MOD)` to set it, or `clear_oneshot_mods()` to cancel it.
131 161
132# Permissive Hold 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
164# Tap-Hold Configuration Options
165
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.
167
168These options let you modify the behavior of the Tap-Hold keys.
169
170## Permissive Hold
133 171
134As of [PR#1359](https://github.com/qmk/qmk_firmware/pull/1359/), there is a new `config.h` option: 172As of [PR#1359](https://github.com/qmk/qmk_firmware/pull/1359/), there is a new `config.h` option:
135 173
136``` 174```c
137#define PERMISSIVE_HOLD 175#define PERMISSIVE_HOLD
138``` 176```
139 177
140This makes it easier for fast typists to use dual-function keys. Without this, if you let go of a held key inside the tapping term, it won't register. 178This makes tap and hold keys (like Mod Tap) work better for fast typist, or for high `TAPPING_TERM` settings.
141 179
142Example: (Tapping Term = 200ms) 180If you press a Mod Tap key, tap another key (press and release) and then release the Mod Tap key, all within the tapping term, it will output the "tapping" function for both keys.
143 181
144- SHFT_T(KC_A) Down 182For Instance:
145- KC_X Down
146- KC_X Up
147- SHFT_T(KC_A) Up
148 183
149With defaults, if above is typed within tapping term, this will emit `ax`. With permissive hold, if above is typed within tapping term, this will emit `X` (so, Shift+X). 184- `SHFT_T(KC_A)` Down
185- `KC_X` Down
186- `KC_X` Up
187- `SHFT_T(KC_A)` Up
150 188
151# Mod tap interrupt 189Normally, if you do all this within the `TAPPING_TERM` (default: 200ms) this will be registered as `ax` by the firmware and host system. With permissive hold enabled, this modifies how this is handled by considering the Mod Tap keys as a Mod if another key is tapped, and would registered as `X` (`SHIFT`+`x`).
152 190
153When a dual role key used for a modifier is quickly followed by another keys, it is interpreted as held even before the tapping term elapsed. This is a problem if a key is used for example inside a rolling combo because the second key will be pressed before the first key is released. 191?> If you have `Ignore Mod Tap Interrupt` enabled, as well, this will modify how both work. The regular key has the modifier added if the first key is released first or if both keys are held longer than the `TAPPING_TERM`.
154 192
155For example, when trying to type the rolling combo "zx" and z being configured to send Ctrl when hold, z rapidly followed by x actually sends Ctrl-x. That's bad. 193## Ignore Mod Tap Interrupt
156 194
157You can disable this behavior by defining `IGNORE_MOD_TAP_INTERRUPT` in `config.h`. 195To enable this setting, add this to your `config.h`:
158 196
159Note that this only concerns modifiers and not layer switching keys. 197```c
198#define IGNORE_MOD_TAP_INTERRUPT
199```
200
201Similar to Permissive Hold, this alters how the firmware processes input for fast typist. If you press a Mod Tap key, press another key, release the Mod Tap key, and then release the normal key, it would normally output the "tapping" function for both keys. This may not be desirable for rolling combo keys.
202
203Setting `Ignore Mod Tap Interrupt` requires holding both keys for the `TAPPING_TERM` to trigger the hold function (the mod).
204
205For Instance:
206
207- `SHFT_T(KC_A)` Down
208- `KC_X` Down
209- `SHFT_T(KC_A)` Up
210- `KC_X` Up
211
212Normally, this would send `X` (`SHIFT`+`x`). With `Ignore Mod Tap Interrupt` enabled, holding both keys are required for the `TAPPING_TERM` to register the hold action. A quick tap will output `ax` in this case, while a hold on both will still output `X` (`SHIFT`+`x`).
213
214
215?> __Note__: This only concerns modifiers and not layer switching keys.
216
217?> If you have `Permissive Hold` enabled, as well, this will modify how both work. The regular key has the modifier added if the first key is released first or if both keys are held longer than the `TAPPING_TERM`.
160 218
161# Hold after tap 219## Tapping Force Hold
162 220
163When the user holds a key after tap, this repeats the tapped key rather to hold a modifier key. This allows to use auto repeat for the tapped key. If you prefer to hold a modifier instead, define `TAPPING_FORCE_HOLD` in `config.h`. 221To enable `tapping force hold`, add the following to your `config.h`:
222
223```c
224#define TAPPING_FORCE_HOLD
225```
226
227When the user holds a key after tap, this repeats the tapped key rather to hold a modifier key. This allows to use auto repeat for the tapped key.
164 228
165Example: 229Example:
166 230
@@ -176,8 +240,14 @@ With `TAPPING_FORCE_HOLD`, the second press will be interpreted as a Shift, allo
176 240
177!> `TAPPING_FORCE_HOLD` will break anything that uses tapping toggles (Such as the `TT` layer keycode, and the One Shot Tapping Toggle). 241!> `TAPPING_FORCE_HOLD` will break anything that uses tapping toggles (Such as the `TT` layer keycode, and the One Shot Tapping Toggle).
178 242
179# Retro Tapping 243## Retro Tapping
244
245To enable `retro tapping`, add the following to your `config.h`:
246
247```c
248#define RETRO_TAPPING
249```
180 250
181When you hold a dual function key, and haven't pressed anything when you release the key, normally nothing happens. However, if you enable this, if you release the key without pressing another key, it will send the original key, even if it is outside of the tapping term. 251Holding and releasing a dual function key without pressing another key will result in nothing happening. With retro tapping enabled, releasing the key without pressing another will send the original keycode even if it is outside the tapping term.
182 252
183For instance, if you're using `LT(2, KC_SPACE)`, if you hold the key, don't hit anything else and then release it, normally, nothing happens. But with `RETRO_TAPPING` defined in your `config.h`, it will send `KC_SPACE`. 253For instance, holding and releasing `LT(2, KC_SPACE)` without hitting another key will result in nothing happening. With this enabled, it will send `KC_SPACE` instead.
diff --git a/docs/feature_audio.md b/docs/feature_audio.md
index 039c62cdf..38861e8c1 100644
--- a/docs/feature_audio.md
+++ b/docs/feature_audio.md
@@ -61,10 +61,19 @@ It's advised that you wrap all audio features in `#ifdef AUDIO_ENABLE` / `#endif
61 61
62The available keycodes for audio are: 62The available keycodes for audio are:
63 63
64* `AU_ON` - Turn audio mode on 64* `AU_ON` - Turn Audio Feature on
65* `AU_OFF` - Turn audio mode off 65* `AU_OFF` - Turn Audio Feature off
66* `AU_TOG` - Toggle audio mode 66* `AU_TOG` - Toggle Audio Feature state
67 67
68!> These keycodes turn all of the audio functionality on and off. Turning it off means that audio feedback, audio clicky, music mode, etc. are disabled, completely.
69
70## ARM Audio Volume
71
72For ARM devices, you can adjust the DAC sample values. If your board is too loud for you or your coworkers, you can set the max using `DAC_SAMPLE_MAX` in your `config.h`:
73
74```c
75#define DAC_SAMPLE_MAX 65535U
76```
68 77
69## Music Mode 78## Music Mode
70 79
@@ -119,22 +128,22 @@ You can completely disable Music Mode as well. This is useful, if you're pressed
119 128
120 #define NO_MUSIC_MODE 129 #define NO_MUSIC_MODE
121 130
122## Faux Click 131## Audio Click
123 132
124This adds a click sound each time you hit a button, to simulate click sounds from the keyboard. And the sounds are slightly different for each keypress, so it doesn't sound like a single long note, if you type rapidly. 133This adds a click sound each time you hit a button, to simulate click sounds from the keyboard. And the sounds are slightly different for each keypress, so it doesn't sound like a single long note, if you type rapidly.
125 134
126* `CK_TOGG` - Toggles the status (will play sound if enabled) 135* `CK_TOGG` - Toggles the status (will play sound if enabled)
127* `CK_RST` - Resets the frequency to the default state 136* `CK_ON` - Turns on Audio Click (plays sound)
128* `CK_UP` - Increases the frequency of the clicks 137* `CK_OFF` - Turns off Audio Click (doesn't play sound)
129* `CK_DOWN` - Decreases the frequency of the clicks 138* `CK_RST` - Resets the frequency to the default state (plays sound at default frequency)
139* `CK_UP` - Increases the frequency of the clicks (plays sound at new frequency)
140* `CK_DOWN` - Decreases the frequency of the clicks (plays sound at new frequency)
141
130 142
131The feature is disabled by default, to save space. To enable it, add this to your `config.h`: 143The feature is disabled by default, to save space. To enable it, add this to your `config.h`:
132 144
133 #define AUDIO_CLICKY 145 #define AUDIO_CLICKY
134 146
135Additionally, even when enabled, the feature is not enabled by default, so you would need to turn it on first. And since we don't use EEPROM to store the setting (yet), you can default this to on by adding this to your `config.h`:
136
137 #define AUDIO_CLICKY_ON
138 147
139You can configure the default, min and max frequencies, the stepping and built in randomness by defining these values: 148You can configure the default, min and max frequencies, the stepping and built in randomness by defining these values:
140 149
@@ -144,14 +153,14 @@ You can configure the default, min and max frequencies, the stepping and built i
144| `AUDIO_CLICKY_FREQ_MIN` | 65.0f | Sets the lowest frequency (under 60f are a bit buggy). | 153| `AUDIO_CLICKY_FREQ_MIN` | 65.0f | Sets the lowest frequency (under 60f are a bit buggy). |
145| `AUDIO_CLICKY_FREQ_MAX` | 1500.0f | Sets the the highest frequency. Too high may result in coworkers attacking you. | 154| `AUDIO_CLICKY_FREQ_MAX` | 1500.0f | Sets the the highest frequency. Too high may result in coworkers attacking you. |
146| `AUDIO_CLICKY_FREQ_FACTOR` | 1.18921f| Sets the stepping of UP/DOWN key codes. | 155| `AUDIO_CLICKY_FREQ_FACTOR` | 1.18921f| Sets the stepping of UP/DOWN key codes. |
147| `AUDIO_CLICKY_FREQ_RANDOMNESS` | 0.05f | Sets a factor of randomness for the clicks, Setting this to `0f` will make each click identical. | 156| `AUDIO_CLICKY_FREQ_RANDOMNESS` | 0.05f | Sets a factor of randomness for the clicks, Setting this to `0f` will make each click identical, and `1.0f` will make this sound much like the 90's computer screen scrolling/typing effect. |
148 157
149 158
150 159
151 160
152## MIDI Functionality 161## MIDI Functionality
153 162
154This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile. 163This is still a WIP, but check out `quantum/process_keycode/process_midi.c` to see what's happening. Enable from the Makefile.
155 164
156 165
157## Audio Keycodes 166## Audio Keycodes
diff --git a/docs/feature_backlight.md b/docs/feature_backlight.md
index 8f883e08f..f7a35406c 100644
--- a/docs/feature_backlight.md
+++ b/docs/feature_backlight.md
@@ -54,14 +54,17 @@ In this handler, the value of an incrementing counter is mapped onto a precomput
54 54
55## Backlight Functions 55## Backlight Functions
56 56
57|Function |Description | 57|Function |Description |
58|----------|----------------------------------------------------------| 58|----------|-----------------------------------------------------------|
59|`backlight_toggle()` |Turn the backlight on or off | 59|`backlight_toggle()` |Turn the backlight on or off |
60|`backlight_step()` |Cycle through backlight levels | 60|`backlight_enable()` |Turn the backlight on |
61|`backlight_increase()` |Increase the backlight level | 61|`backlight_disable()` |Turn the backlight off |
62|`backlight_decrease()` |Decrease the backlight level | 62|`backlight_step()` |Cycle through backlight levels |
63|`backlight_level(x)` |Sets the backlight level to specified level | 63|`backlight_increase()` |Increase the backlight level |
64|`get_backlight_level()`|Toggle backlight breathing | 64|`backlight_decrease()` |Decrease the backlight level |
65|`backlight_level(x)` |Sets the backlight level to specified level |
66|`get_backlight_level()` |Return the current backlight level |
67|`is_backlight_enabled()`|Return whether the backlight is currently on |
65 68
66### Backlight Breathing Functions 69### Backlight Breathing Functions
67 70
diff --git a/docs/feature_bluetooth.md b/docs/feature_bluetooth.md
index f647adc72..3ffbfa068 100644
--- a/docs/feature_bluetooth.md
+++ b/docs/feature_bluetooth.md
@@ -1,10 +1,40 @@
1# Bluetooth 1# Bluetooth
2 2
3## Bluetooth Functionality 3## Bluetooth Known Supported Hardware
4 4
5Currently Bluetooth support is limited to AVR based chips. For Bluetooth 2.1 Qmk has support for RN-42 HID Firmware and Bluefruit EZ Key the later of which is not produced anymore. For more recent BLE protocols currently only the Adafruit Bluefruit SPI friend is directly supported. BLE is needed to connect to iOS devices. Note iOS does not support Mouse Input.
6
7|Board |Bluetooth Protocol |Connection Type |Rules.mk |Bluetooth Chip|
8|----------------------------------------------------------------|----------------------------|----------------|---------------------------|--------------|
9|[Adafruit EzKey HID]("https://www.adafruit.com/product/1535") |Bluetooth Classic | UART | BLUETOOTH = AdafruitEZKey | |
10|Rover Networks RN-42 (Sparkfun Bluesmirf) |Bluetooth Classic | UART | BLUETOOTH = RN42 | RN-42 |
11|[Bluefruit LE SPI Friend](https://www.adafruit.com/product/2633)|Bluetooth Low Energy | SPI | BLUETOOTH = AdafruitBLE | nRF5182 |
12
13Not Supported Yet but possible:
14* [Bluefruit LE UART Friend](https://www.adafruit.com/product/2479). [Possible tmk implementation found in](https://github.com/tmk/tmk_keyboard/issues/514)
15* HC-05 boards flashed with RN-42 firmware. They apparently both use the CSR BC417 Chip. Flashing it with RN-42 firmware gives it HID capability.
16* [Sparkfun Bluetooth mate](https://www.sparkfun.com/products/14839)
17* HM-13 based boards
18
19### Adafruit BLE SPI Friend
20Currently The only bluetooth chipset supported by QMK is the Adafruit Bluefruit SPI Friend. It's a Nordic nRF5182 based chip running Adafruit's custom firmware. Data is transmitted via Adafruit's SDEP over Hardware SPI. The [Feather 32u4 Bluefruit LE](https://www.adafruit.com/product/2829) is supported as it's an AVR mcu connected via SPI to the Nordic BLE chip with Adafruit firmware. If Building a custom board with the SPI friend it would be easiest to just use the pin selection that the 32u4 feather uses but you can change the pins in the config.h options with the following defines:
21* #define AdafruitBleResetPin D4
22* #define AdafruitBleCSPin B4
23* #define AdafruitBleIRQPin E6
24
25A Bluefruit UART friend can be converted to an SPI friend, however this [requires](https://github.com/qmk/qmk_firmware/issues/2274) some reflashing and soldering directly to the MDBT40 chip.
26
27## Adafruit EZ-Key hid
5This requires [some hardware changes](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts), but can be enabled via the Makefile. The firmware will still output characters via USB, so be aware of this when charging via a computer. It would make sense to have a switch on the Bluefruit to turn it off at will. 28This requires [some hardware changes](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts), but can be enabled via the Makefile. The firmware will still output characters via USB, so be aware of this when charging via a computer. It would make sense to have a switch on the Bluefruit to turn it off at will.
6 29
30
7<!-- FIXME: Document bluetooth support more completely. --> 31<!-- FIXME: Document bluetooth support more completely. -->
32## Bluetooth Rules.mk Options
33Use only one of these
34* BLUETOOTH_ENABLE = yes (Legacy Option)
35* BLUETOOTH = RN42
36* BLUETOOTH = AdafruitEZKey
37* BLUETOOTH = AdafruitBLE
8 38
9## Bluetooth Keycodes 39## Bluetooth Keycodes
10 40
diff --git a/docs/feature_bootmagic.md b/docs/feature_bootmagic.md
index d6915d355..504fb90f4 100644
--- a/docs/feature_bootmagic.md
+++ b/docs/feature_bootmagic.md
@@ -11,7 +11,15 @@ There are three separate but related features that allow you to change the behav
11On some keyboards Bootmagic is disabled by default. If this is the case, it must be explicitly enabled in your `rules.mk` with: 11On some keyboards Bootmagic is disabled by default. If this is the case, it must be explicitly enabled in your `rules.mk` with:
12 12
13```make 13```make
14BOOTMAGIC_ENABLE = yes 14BOOTMAGIC_ENABLE = full
15```
16
17?> You may see `yes` being used in place of `full`, and this is okay. However, `yes` is deprecated, and ideally `full` (or `lite`) should be used instead.
18
19Additionally, you can use [Bootmagic Lite](#bootmagic-lite) (a scaled down, very basic version of Bootmagic) by adding the following to your `rules.mk` file:
20
21```make
22BOOTMAGIC_ENABLE = lite
15``` 23```
16 24
17## Hotkeys 25## Hotkeys
@@ -57,6 +65,7 @@ Hold down the Bootmagic key (Space by default) and the desired hotkey while plug
57|`MAGIC_UNNO_GUI` | |Enable the GUI keys | 65|`MAGIC_UNNO_GUI` | |Enable the GUI keys |
58|`MAGIC_SWAP_ALT_GUI` |`AG_SWAP`|Swap Alt and GUI on both sides (for macOS)| 66|`MAGIC_SWAP_ALT_GUI` |`AG_SWAP`|Swap Alt and GUI on both sides (for macOS)|
59|`MAGIC_UNSWAP_ALT_GUI` |`AG_NORM`|Unswap Left Alt and Left GUI | 67|`MAGIC_UNSWAP_ALT_GUI` |`AG_NORM`|Unswap Left Alt and Left GUI |
68|`MAGIC_TOGGLE_ALT_GUI` |`AG_TOGG`|Toggle Left Alt and GUI swap |
60|`MAGIC_SWAP_BACKSLASH_BACKSPACE` | |Swap `\` and Backspace | 69|`MAGIC_SWAP_BACKSLASH_BACKSPACE` | |Swap `\` and Backspace |
61|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`| |Unswap `\` and Backspace | 70|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`| |Unswap `\` and Backspace |
62|`MAGIC_SWAP_CONTROL_CAPSLOCK` | |Swap Left Control and Caps Lock | 71|`MAGIC_SWAP_CONTROL_CAPSLOCK` | |Swap Left Control and Caps Lock |
@@ -98,3 +107,45 @@ If you would like to change the hotkey assignments for Bootmagic, `#define` thes
98|`BOOTMAGIC_KEY_DEFAULT_LAYER_5` |`KC_5` |Make layer 5 the default layer | 107|`BOOTMAGIC_KEY_DEFAULT_LAYER_5` |`KC_5` |Make layer 5 the default layer |
99|`BOOTMAGIC_KEY_DEFAULT_LAYER_6` |`KC_6` |Make layer 6 the default layer | 108|`BOOTMAGIC_KEY_DEFAULT_LAYER_6` |`KC_6` |Make layer 6 the default layer |
100|`BOOTMAGIC_KEY_DEFAULT_LAYER_7` |`KC_7` |Make layer 7 the default layer | 109|`BOOTMAGIC_KEY_DEFAULT_LAYER_7` |`KC_7` |Make layer 7 the default layer |
110
111# Bootmagic Lite
112
113In addition to the full blown Bootmagic feature, is the Bootmagic Lite feature that only handles jumping into the bootloader. This is great for boards that don't have a physical reset button but you need a way to jump into the bootloader, and don't want to deal with the headache that Bootmagic can cause.
114
115To enable this version of Bootmagic, you need to enable it in your `rules.mk` with:
116
117```make
118BOOTMAGIC_ENABLE = lite
119```
120
121Additionally, you may want to specify which key to use. This is especially useful for keyboards that have unusual matrices. To do so, you need to specify the row and column of the key that you want to use. Add these entries to your `config.h` file:
122
123```c
124#define BOOTMAGIC_LITE_ROW 0
125#define BOOTMAGIC_LITE_COLUMN 1
126```
127
128By default, these are set to 0 and 0, which is usually the "ESC" key on a majority of keyboards.
129
130And to trigger the bootloader, you hold this key down when plugging the keyboard in. Just the single key.
131
132## Advanced Bootmagic Lite
133
134The `bootmagic_lite` function is defined weakly, so that you can replace this in your code, if you need. A great example of this is the Zeal60 boards that have some additional handling needed.
135
136To replace the function, all you need to do is add something like this to your code:
137
138```c
139void bootmagic_lite(void) {
140 matrix_scan();
141 wait_ms(DEBOUNCING_DELAY * 2);
142 matrix_scan();
143
144 if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) {
145 // Jump to bootloader.
146 bootloader_jump();
147 }
148}
149```
150
151You can additional feature here. For instance, resetting the eeprom or requiring additional keys to be pressed to trigger bootmagic. Keep in mind that `bootmagic_lite` is called before a majority of features are initialized in the firmware.
diff --git a/docs/feature_combo.md b/docs/feature_combo.md
new file mode 100644
index 000000000..05ffc0d72
--- /dev/null
+++ b/docs/feature_combo.md
@@ -0,0 +1,89 @@
1# Combos
2
3The Combo feature is a chording type solution for adding custom actions. It lets you hit multiple keys at once and produce a different effect. For instance, hitting `A` and `S` within the tapping term would hit `ESC` instead, or have it perform even more complex tasks.
4
5To enable this feature, yu need to add `COMBO_ENABLE = yes` to your `rules.mk`.
6
7Additionally, in your `config.h`, you'll need to specify the number of combos that you'll be using, by adding `#define COMBO_COUNT 1` (replacing 1 with the number that you're using).
8<!-- At this time, this is necessary -->
9
10Also, by default, the tapping term for the Combos is set to the same value as `TAPPING_TERM` (200 by default on most boards). But you can specify a different value by defining it in your `config.h`. For instance: `#define COMBO_TERM 300` would set the time out period for combos to 300ms.
11
12Then, your `keymap.c` file, you'll need to define a sequence of keys, terminated with `COMBO_END`, and a structure to list the combination of keys, and it's resulting action.
13
14```c
15const uint16_t PROGMEM test_combo[] = {KC_A, KC_B, COMBO_END};
16combo_t key_combos[COMBO_COUNT] = {COMBO(test_combo, KC_ESC)};
17```
18
19This will send "Escape" if you hit the A and B keys.
20
21!> This method only supports [basic keycodes](keycodes_basic.md). See the examples for more control.
22!> You cannot reuse (share) keys in combos. Each key should only belong to a single combo.
23
24## Examples
25
26If you want to add a list, then you'd use something like this:
27
28```c
29enum combos {
30 AB_ESC,
31 JK_TAB
32}
33const uint16_t PROGMEM ab_combo[] = {KC_A, KC_B, COMBO_END};
34const uint16_t PROGMEM jk_combo[] = {KC_J, KC_K, COMBO_END};
35
36combo_t key_combos[COMBO_COUNT] = {
37 [AB_ESC] = COMBO(ab_combo, KC_ESC),
38 [JK_TAB] = COMBO(jk_combo, KC_TAB)
39};
40```
41
42For a more complicated implementation, you can use the `process_combo_event` function to add custom handling.
43
44```c
45enum combo_events {
46 ZC_COPY,
47 XV_PASTE
48 };
49
50const uint16_t PROGMEM copy_combo[] = {KC_Z, KC_C, COMBO_END};
51const uint16_t PROGMEM paste_combo[] = {KC_X, KC_V, COMBO_END};
52
53combo_t key_combos[COMBO_COUNT] = {
54 [ZC_COPY] = COMBO_ACTION(copy_combo),
55 [XV_PASTE] = COMBO_ACTION(paste_combo),
56};
57
58void process_combo_event(uint8_t combo_index, bool pressed) {
59 switch(combo_index) {
60 case ZC_COPY:
61 if (pressed) {
62 register_code(KC_LCTL);
63 register_code(KC_C);
64 unregister_code(KC_C);
65 unregister_code(KC_LCTL);
66 }
67 break;
68
69 case XV_PASTE:
70 if (pressed) {
71 register_code(KC_LCTL);
72 register_code(KC_V);
73 unregister_code(KC_V);
74 unregister_code(KC_LCTL);
75 }
76 break;
77 }
78}
79```
80
81This will send Ctrl+C if you hit Z and C, and Ctrl+V if you hit X and V. But you could change this to do stuff like change layers, play sounds, or change settings.
82
83## Additional Configuration
84
85If you're using long combos, or even longer combos, you may run into issues with this, as the structure may not be large enough to accommodate what you're doing.
86
87In this case, you can add either `#define EXTRA_LONG_COMBOS` or `#define EXTRA_EXTRA_LONG_COMBOS` in your `config.h` file.
88
89You may also be able to enable action keys by defining `COMBO_ALLOW_ACTION_KEYS`.
diff --git a/docs/feature_encoders.md b/docs/feature_encoders.md
new file mode 100644
index 000000000..208d6db13
--- /dev/null
+++ b/docs/feature_encoders.md
@@ -0,0 +1,48 @@
1# Encoders
2
3Basic encoders are supported by adding this to your `rules.mk`:
4
5 ENCODER_ENABLE = yes
6
7and this to your `config.h`:
8
9 #define NUMBER_OF_ENCODERS 1
10 #define ENCODERS_PAD_A { B12 }
11 #define ENCODERS_PAD_B { B13 }
12
13Each PAD_A/B variable defines an array so multiple encoders can be defined, e.g.:
14
15 #define ENCODERS_PAD_A { encoder1a, encoder2a }
16 #define ENCODERS_PAD_B { encoder1b, encoder2b }
17
18If your encoder's clockwise directions are incorrect, you can swap the A & B pad definitions.
19
20Additionally, the resolution can be specified in the same file (the default & suggested is 4):
21
22 #define ENCODER_RESOLUTION 4
23
24## Callbacks
25
26The callback functions can be inserted into your `<keyboard>.c`:
27
28 void encoder_update_kb(uint8_t index, bool clockwise) {
29 encoder_update_user(index, clockwise);
30 }
31
32or `keymap.c`:
33
34 void encoder_update_user(uint8_t index, bool clockwise) {
35 if (index == 0) {
36 if (clockwise) {
37 register_code(KC_PGDN);
38 unregister_code(KC_PGDN);
39 } else {
40 register_code(KC_PGUP);
41 unregister_code(KC_PGUP);
42 }
43 }
44 }
45
46## Hardware
47
48The A an B lines of the encoders should be wired directly to the MCU, and the C/common lines should be wired to ground.
diff --git a/docs/feature_layouts.md b/docs/feature_layouts.md
index bfae92044..1ee8b5e35 100644
--- a/docs/feature_layouts.md
+++ b/docs/feature_layouts.md
@@ -53,6 +53,8 @@ but the `LAYOUT_<layout>` variable must be defined in `<folder>.h` as well.
53 53
54## Tips for Making Layouts Keyboard-Agnostic 54## Tips for Making Layouts Keyboard-Agnostic
55 55
56### Includes
57
56Instead of using `#include "planck.h"`, you can use this line to include whatever `<keyboard>.h` (`<folder>.h` should not be included here) file that is being compiled: 58Instead of using `#include "planck.h"`, you can use this line to include whatever `<keyboard>.h` (`<folder>.h` should not be included here) file that is being compiled:
57 59
58 #include QMK_KEYBOARD_H 60 #include QMK_KEYBOARD_H
@@ -72,3 +74,7 @@ For example:
72``` 74```
73 75
74Note that the names are lowercase and match the folder/file names for the keyboard/revision exactly. 76Note that the names are lowercase and match the folder/file names for the keyboard/revision exactly.
77
78### Keymaps
79
80In order to support both split and non-split keyboards with the same layout, you need to use the keyboard agnostic `LAYOUT_<layout name>` macro in your keymap. For instance, in order for a Let's Split and Planck to share the same layout file, you need to use `LAYOUT_ortho_4x12` instead of `LAYOUT_planck_grid` or just `{}` for a C array.
diff --git a/docs/feature_leader_key.md b/docs/feature_leader_key.md
index 46633b287..82cf78901 100644
--- a/docs/feature_leader_key.md
+++ b/docs/feature_leader_key.md
@@ -5,10 +5,11 @@ If you've ever used Vim, you know what a Leader key is. If not, you're about to
5That's what `KC_LEAD` does. Here's an example: 5That's what `KC_LEAD` does. Here's an example:
6 6
71. Pick a key on your keyboard you want to use as the Leader key. Assign it the keycode `KC_LEAD`. This key would be dedicated just for this -- it's a single action key, can't be used for anything else. 71. Pick a key on your keyboard you want to use as the Leader key. Assign it the keycode `KC_LEAD`. This key would be dedicated just for this -- it's a single action key, can't be used for anything else.
82. Include the line `#define LEADER_TIMEOUT 300` somewhere in your keymap.c file, probably near the top. The 300 there is 300ms -- that's how long you have for the sequence of keys following the leader. You can tweak this value for comfort, of course. 82. Include the line `#define LEADER_TIMEOUT 300` in your `config.h`. This sets the timeout for the `KC_LEAD` key. Specifically, when you press the `KC_LEAD` key, you only have a certain amount of time to complete the Leader Key sequence. The `300` here sets that to 300ms, and you can increase this value to give you more time to hit the sequence. But any keys pressed during this timeout are intercepted and not sent, so you may want to keep this value low. .
93. Within your `matrix_scan_user` function, do something like this: 9 * By default, this timeout is how long after pressing `KC_LEAD` to complete your entire sequence. This may be very low for some people. So you may want to increase this timeout. Optionally, you may want to enable the `LEADER_PER_KEY_TIMING` option, which resets the timeout after each key is tapped. This allows you to maintain a low value here, but still be able to use the longer sequences. To enable this option, add `#define LEADER_PER_KEY_TIMING` to your `config.h`.
103. Within your `matrix_scan_user` function, add something like this:
10 11
11``` 12```c
12LEADER_EXTERNS(); 13LEADER_EXTERNS();
13 14
14void matrix_scan_user(void) { 15void matrix_scan_user(void) {
@@ -39,3 +40,107 @@ void matrix_scan_user(void) {
39As you can see, you have a few function. You can use `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS`, `SEQ_THREE_KEYS` up to `SEQ_FIVE_KEYS` for longer sequences. 40As you can see, you have a few function. You can use `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS`, `SEQ_THREE_KEYS` up to `SEQ_FIVE_KEYS` for longer sequences.
40 41
41Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously. 42Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously.
43
44## Adding Leader Key Support in the `rules.mk`
45
46To add support for Leader Key you simply need to add a single line to your keymap's `rules.mk`:
47
48```make
49LEADER_ENABLE = yes
50```
51
52## Per Key Timing on Leader keys
53
54Rather than relying on an incredibly high timeout for long leader key strings or those of us without 200wpm typing skills, we can enable per key timing to ensure that each key pressed provides us with more time to finish our stroke. This is incredibly helpful with leader key emulation of tap dance (read: multiple taps of the same key like C, C, C).
55
56In order to enable this, place this in your `config.h`:
57```c
58#define LEADER_PER_KEY_TIMING
59```
60
61After this, it's recommended that you lower your `LEADER_TIMEOUT` to something less that 300ms.
62
63```c
64#define LEADER_TIMEOUT 250
65```
66
67Now, something like this won't seem impossible to do without a 1000MS leader key timeout:
68
69```c
70SEQ_THREE_KEYS(KC_C, KC_C, KC_C) {
71 SEND_STRING("Per key timing is great!!!");
72}
73```
74
75## Strict Key Processing
76
77By default, the Leader Key feature will filter the keycode out of [`Mod-Tap`](feature_advanced_keycodes.md#mod-tap) and [`Layer Tap`](feature_advanced_keycodes.md#switching-and-toggling-layers) functions when checking for the Leader sequences. That means if you're using `LT(3, KC_A)`, it will pick this up as `KC_A` for the sequence, rather than `LT(3, KC_A)`, giving a more expected behavior for newer users.
78
79While, this may be fine for most, if you want to specify the whole keycode (eg, `LT(3, KC_A)` from the example above) in the sequence, you can enable this by added `#define LEADER_KEY_STRICT_KEY_PROCESSING` to your `config.h` file. This well then disable the filtering, and you'll need to specify the whole keycode.
80
81## Customization
82
83The Leader Key feature has some additional customization to how the Leader Key feature works. It has two functions that can be called at certain parts of the process. Namely `leader_start()` and `leader_end()`.
84
85The `leader_start()` function is called when you tap the `KC_LEAD` key, and the `leader_end()` function is called when either the leader sequence is completed, or the leader timeout is hit.
86
87You can add these functions to your code (`keymap.c` usually) to add feedback to the Leader sequences (such as beeping or playing music).
88
89```c
90void leader_start(void) {
91 // sequence started
92}
93
94void leader_end(void) {
95 // sequence ended (no success/failuer detection)
96}
97```
98
99### Example
100
101This example will play the Mario "One Up" sound when you hit `KC_LEAD` to start the Leader Sequence, and will play "All Star" if it completes successfully or "Rick Roll" you if it fails.
102
103```c
104bool did_leader_succeed;
105#ifdef AUDIO_ENABLE
106float leader_start[][2] = SONG(ONE_UP_SOUND );
107float leader_succeed[][2] = SONG(ALL_STAR);
108float leader_fail[][2] = SONG(RICK_ROLL);
109#endif
110LEADER_EXTERNS();
111
112void matrix_scan_user(void) {
113 LEADER_DICTIONARY() {
114 did_leader_succeed = leading = false;
115
116 SEQ_ONE_KEY(KC_E) {
117 // Anything you can do in a macro.
118 SEND_STRING(SS_LCTRL(SS_LSFT("t")));
119 did_leader_succeed = true;
120 } else
121 SEQ_TWO_KEYS(KC_E, KC_D) {
122 SEND_STRING(SS_LGUI("r")"cmd"SS_TAP(KC_ENTER)SS_LCTRL("c"));
123 did_leader_succeed = true;
124 }
125 leader_end();
126 }
127}
128
129void leader_start(void) {
130#ifdef AUDIO_ENABLE
131 PLAY_SONG(leader_start);
132#endif
133}
134
135void leader_end(void) {
136 if (did_leader_succeed) {
137#ifdef AUDIO_ENABLE
138 PLAY_SONG(leader_succeed);
139#endif
140 } else {
141#ifdef AUDIO_ENABLE
142 PLAY_SONG(leader_fail);
143#endif
144 }
145}
146```
diff --git a/docs/feature_macros.md b/docs/feature_macros.md
index 673153081..aa13fb97f 100644
--- a/docs/feature_macros.md
+++ b/docs/feature_macros.md
@@ -12,24 +12,28 @@ Here is an example `keymap.c` for a two-key keyboard:
12 12
13```c 13```c
14enum custom_keycodes { 14enum custom_keycodes {
15 MY_CUSTOM_MACRO = SAFE_RANGE 15 QMKBEST = SAFE_RANGE,
16}; 16};
17 17
18bool process_record_user(uint16_t keycode, keyrecord_t *record) { 18bool process_record_user(uint16_t keycode, keyrecord_t *record) {
19 if (record->event.pressed) { 19 switch (keycode) {
20 switch(keycode) { 20 case QMKBEST:
21 case MY_CUSTOM_MACRO: 21 if (record->event.pressed) {
22 SEND_STRING("QMK is the best thing ever!"); // this is our macro! 22 // when keycode QMKBEST is pressed
23 return false; 23 SEND_STRING("QMK is the best thing ever!");
24 } 24 } else {
25 } 25 // when keycode QMKBEST is released
26 return true; 26 }
27 break;
28
29 }
30 return true;
27}; 31};
28 32
29const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 33const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
30 [0] = { 34 [0] = {
31 {MY_CUSTOM_MACRO, KC_ESC} 35 {QMKBEST, KC_ESC}
32 } 36 }
33}; 37};
34``` 38```
35 39
@@ -37,7 +41,7 @@ What happens here is this:
37We first define a new custom keycode in the range not occupied by any other keycodes. 41We first define a new custom keycode in the range not occupied by any other keycodes.
38Then we use the `process_record_user` function, which is called whenever a key is pressed or released, to check if our custom keycode has been activated. 42Then we use the `process_record_user` function, which is called whenever a key is pressed or released, to check if our custom keycode has been activated.
39If yes, we send the string `"QMK is the best thing ever!"` to the computer via the `SEND_STRING` macro (this is a C preprocessor macro, not to be confused with QMK macros). 43If yes, we send the string `"QMK is the best thing ever!"` to the computer via the `SEND_STRING` macro (this is a C preprocessor macro, not to be confused with QMK macros).
40We return `false` to indicate to the caller that the key press we just processed need not be processed any further. 44We return `true` to indicate to the caller that the key press we just processed should continue to be processed as normal (as we didn't replace or alter the functionality).
41Finally, we define the keymap so that the first button activates our macro and the second button is just an escape button. 45Finally, we define the keymap so that the first button activates our macro and the second button is just an escape button.
42 46
43You might want to add more than one macro. 47You might want to add more than one macro.
@@ -45,28 +49,42 @@ You can do that by adding another keycode and adding another case to the switch
45 49
46```c 50```c
47enum custom_keycodes { 51enum custom_keycodes {
48 MY_CUSTOM_MACRO = SAFE_RANGE, 52 QMKBEST = SAFE_RANGE,
49 MY_OTHER_MACRO 53 QMKURL,
54 MY_OTHER_MACRO
50}; 55};
51 56
52bool process_record_user(uint16_t keycode, keyrecord_t *record) { 57bool process_record_user(uint16_t keycode, keyrecord_t *record) {
53 if (record->event.pressed) { 58 switch (keycode) {
54 switch(keycode) { 59 case QMKBEST:
55 case MY_CUSTOM_MACRO: 60 if (record->event.pressed) {
56 SEND_STRING("QMK is the best thing ever!"); 61 // when keycode QMKBEST is pressed
57 return false; 62 SEND_STRING("QMK is the best thing ever!");
58 case MY_OTHER_MACRO: 63 } else {
59 SEND_STRING(SS_LCTRL("ac")); // selects all and copies 64 // when keycode QMKBEST is released
60 return false; 65 }
61 } 66 break;
62 } 67 case QMKURL:
63 return true; 68 if (record->event.pressed) {
69 // when keycode QMKURL is pressed
70 SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER));
71 } else {
72 // when keycode QMKURL is released
73 }
74 break;
75 case MY_OTHER_MACRO:
76 if (record->event.pressed) {
77 SEND_STRING(SS_LCTRL("ac")); // selects all and copies
78 }
79 break;
80 }
81 return true;
64}; 82};
65 83
66const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 84const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
67 [0] = { 85 [0] = {
68 {MY_CUSTOM_MACRO, MY_OTHER_MACRO} 86 {MY_CUSTOM_MACRO, MY_OTHER_MACRO}
69 } 87 }
70}; 88};
71``` 89```
72 90
@@ -136,21 +154,21 @@ By default QMK assumes you don't have any macros. To define your macros you crea
136 154
137```c 155```c
138const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { 156const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
139 if (record->event.pressed) { 157 if (record->event.pressed) {
140 switch(id) { 158 switch(id) {
141 case 0: 159 case 0:
142 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END); 160 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END);
143 case 1: 161 case 1:
144 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END); 162 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END);
145 } 163 }
146 } 164 }
147 return MACRO_NONE; 165 return MACRO_NONE;
148}; 166};
149``` 167```
150 168
151This defines two macros which will be run when the key they are assigned to is pressed. If instead you'd like them to run when the key is released you can change the if statement: 169This defines two macros which will be run when the key they are assigned to is pressed. If instead you'd like them to run when the key is released you can change the if statement:
152 170
153 if (!record->event.pressed) { 171 if (!record->event.pressed) {
154 172
155### Macro Commands 173### Macro Commands
156 174
@@ -169,21 +187,21 @@ Use the `M()` function within your `KEYMAP()` to call a macro. For example, here
169 187
170```c 188```c
171const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 189const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
172 [0] = KEYMAP( 190 [0] = KEYMAP(
173 M(0), M(1) 191 M(0), M(1)
174 ), 192 ),
175}; 193};
176 194
177const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { 195const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
178 if (record->event.pressed) { 196 if (record->event.pressed) {
179 switch(id) { 197 switch(id) {
180 case 0: 198 case 0:
181 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END); 199 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END);
182 case 1: 200 case 1:
183 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END); 201 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END);
184 } 202 }
185 } 203 }
186 return MACRO_NONE; 204 return MACRO_NONE;
187}; 205};
188``` 206```
189 207
@@ -198,9 +216,9 @@ If you have a bunch of macros you want to refer to from your keymap while keepin
198#define M_BYE M(1) 216#define M_BYE M(1)
199 217
200const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 218const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
201 [0] = KEYMAP( 219 [0] = KEYMAP(
202 M_HI, M_BYE 220 M_HI, M_BYE
203 ), 221 ),
204}; 222};
205``` 223```
206 224
@@ -213,11 +231,11 @@ There are some functions you may find useful in macro-writing. Keep in mind that
213This is a boolean value that can be tested to see if the switch is being pressed or released. An example of this is 231This is a boolean value that can be tested to see if the switch is being pressed or released. An example of this is
214 232
215```c 233```c
216 if (record->event.pressed) { 234 if (record->event.pressed) {
217 // on keydown 235 // on keydown
218 } else { 236 } else {
219 // on keyup 237 // on keyup
220 } 238 }
221``` 239```
222 240
223### `register_code(<kc>);` 241### `register_code(<kc>);`
@@ -228,6 +246,12 @@ This sends the `<kc>` keydown event to the computer. Some examples would be `KC_
228 246
229Parallel to `register_code` function, this sends the `<kc>` keyup event to the computer. If you don't use this, the key will be held down until it's sent. 247Parallel to `register_code` function, this sends the `<kc>` keyup event to the computer. If you don't use this, the key will be held down until it's sent.
230 248
249### `tap_code(<kc>);`
250
251This will send `register_code(<kc>)` and then `unregister_code(<kc>)`. This is useful if you want to send both the press and release events ("tap" the key, rather than hold it).
252
253If you're having issues with taps (un)registering, you can add a delay between the register and unregister events by setting `#define TAP_CODE_DELAY 100` in your `config.h` file. The value is in milliseconds.
254
231### `clear_keyboard();` 255### `clear_keyboard();`
232 256
233This will clear all mods and keys currently pressed. 257This will clear all mods and keys currently pressed.
@@ -246,16 +270,16 @@ This example defines a macro which sends `Ctrl-C` when pressed down, and `Ctrl-V
246 270
247```c 271```c
248const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { 272const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
249 switch(id) { 273 switch(id) {
250 case 0: { 274 case 0: {
251 if (record->event.pressed) { 275 if (record->event.pressed) {
252 return MACRO( D(LCTL), T(C), U(LCTL), END ); 276 return MACRO( D(LCTL), T(C), U(LCTL), END );
253 } else { 277 } else {
254 return MACRO( D(LCTL), T(V), U(LCTL), END ); 278 return MACRO( D(LCTL), T(V), U(LCTL), END );
255 } 279 }
256 break; 280 break;
257 } 281 }
258 } 282 }
259 return MACRO_NONE; 283 return MACRO_NONE;
260}; 284};
261``` 285```
diff --git a/docs/feature_ps2_mouse.md b/docs/feature_ps2_mouse.md
index 909406e7d..01e2cc63d 100644
--- a/docs/feature_ps2_mouse.md
+++ b/docs/feature_ps2_mouse.md
@@ -6,6 +6,24 @@ To hook up a Trackpoint, you need to obtain a Trackpoint module (i.e. harvest fr
6 6
7There are three available modes for hooking up PS/2 devices: USART (best), interrupts (better) or busywait (not recommended). 7There are three available modes for hooking up PS/2 devices: USART (best), interrupts (better) or busywait (not recommended).
8 8
9### The Cirtuitry between Trackpoint and Controller
10
11To get the things working, a 4.7K drag is needed between the two lines DATA and CLK and the line 5+.
12
13```
14
15 DATA ----------+--------- PIN
16 |
17 4.7K
18 |
19MODULE 5+ --------+--+--------- PWR CONTROLLER
20 |
21 4.7K
22 |
23 CLK ------+------------ PIN
24```
25
26
9### Busywait Version 27### Busywait Version
10 28
11Note: This is not recommended, you may encounter jerky movement or unsent inputs. Please use interrupt or USART version if possible. 29Note: This is not recommended, you may encounter jerky movement or unsent inputs. Please use interrupt or USART version if possible.
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 4f827f8dc..0af1e4947 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -140,6 +140,7 @@ These are the effects that are currently available:
140 RGB_MATRIX_RAINBOW_PINWHEELS, 140 RGB_MATRIX_RAINBOW_PINWHEELS,
141 RGB_MATRIX_RAINBOW_MOVING_CHEVRON, 141 RGB_MATRIX_RAINBOW_MOVING_CHEVRON,
142 RGB_MATRIX_JELLYBEAN_RAINDROPS, 142 RGB_MATRIX_JELLYBEAN_RAINDROPS,
143 RGB_MATRIX_DIGITAL_RAIN,
143 #ifdef RGB_MATRIX_KEYPRESSES 144 #ifdef RGB_MATRIX_KEYPRESSES
144 RGB_MATRIX_SOLID_REACTIVE, 145 RGB_MATRIX_SOLID_REACTIVE,
145 RGB_MATRIX_SPLASH, 146 RGB_MATRIX_SPLASH,
@@ -149,6 +150,30 @@ These are the effects that are currently available:
149 #endif 150 #endif
150 RGB_MATRIX_EFFECT_MAX 151 RGB_MATRIX_EFFECT_MAX
151 }; 152 };
153
154You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `config.h`:
155
156
157|Define |Description |
158|---------------------------------------------------|--------------------------------------------|
159|`#define DISABLE_RGB_MATRIX_ALPHAS_MODS` |Disables `RGB_MATRIX_ALPHAS_MODS` |
160|`#define DISABLE_RGB_MATRIX_DUAL_BEACON` |Disables `RGB_MATRIX_DUAL_BEACON` |
161|`#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Disables `RGB_MATRIX_GRADIENT_UP_DOWN` |
162|`#define DISABLE_RGB_MATRIX_RAINDROPS` |Disables `RGB_MATRIX_RAINDROPS` |
163|`#define DISABLE_RGB_MATRIX_CYCLE_ALL` |Disables `RGB_MATRIX_CYCLE_ALL` |
164|`#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT` |Disables `RGB_MATRIX_CYCLE_LEFT_RIGHT` |
165|`#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN` |Disables `RGB_MATRIX_CYCLE_UP_DOWN` |
166|`#define DISABLE_RGB_MATRIX_RAINBOW_BEACON` |Disables `RGB_MATRIX_RAINBOW_BEACON` |
167|`#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS` |Disables `RGB_MATRIX_RAINBOW_PINWHEELS` |
168|`#define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON`|Disables `RGB_MATRIX_RAINBOW_MOVING_CHEVRON`|
169|`#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS` |Disables `RGB_MATRIX_JELLYBEAN_RAINDROPS` |
170|`#define DISABLE_RGB_MATRIX_DIGITAL_RAIN` |Disables `RGB_MATRIX_DIGITAL_RAIN` |
171|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE` |Disables `RGB_MATRIX_SOLID_REACTIVE` |
172|`#define DISABLE_RGB_MATRIX_SPLASH` |Disables `RGB_MATRIX_SPLASH` |
173|`#define DISABLE_RGB_MATRIX_MULTISPLASH` |Disables `RGB_MATRIX_MULTISPLASH` |
174|`#define DISABLE_RGB_MATRIX_SOLID_SPLASH` |Disables `RGB_MATRIX_SOLID_SPLASH` |
175|`#define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH` |Disables `RGB_MATRIX_SOLID_MULTISPLASH` |
176
152 177
153## Custom layer effects 178## Custom layer effects
154 179
diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md
index d48941a04..52d5c5fe8 100644
--- a/docs/feature_rgblight.md
+++ b/docs/feature_rgblight.md
@@ -63,8 +63,6 @@ Changing the **Value** sets the overall brightness.
63|`RGB_MODE_GRADIENT`|`RGB_M_G` |Static gradient animation mode | 63|`RGB_MODE_GRADIENT`|`RGB_M_G` |Static gradient animation mode |
64|`RGB_MODE_RGBTEST` |`RGB_M_T` |Red, Green, Blue test animation mode | 64|`RGB_MODE_RGBTEST` |`RGB_M_T` |Red, Green, Blue test animation mode |
65 65
66?> For backwards compatibility, `RGB_SMOD` is another alias of `RGB_MOD`.
67
68## Configuration 66## Configuration
69 67
70Your RGB lighting can be configured by placing these `#define`s in your `config.h`: 68Your RGB lighting can be configured by placing these `#define`s in your `config.h`:
@@ -79,28 +77,41 @@ Your RGB lighting can be configured by placing these `#define`s in your `config.
79 77
80## Animations 78## Animations
81 79
82Not only can this lighting be whatever color you want, if `RGBLIGHT_ANIMATIONS` is defined, you also have a number of animation modes at your disposal: 80
83 81Not only can this lighting be whatever color you want,
84|Mode |Description | 82if `RGBLIGHT_EFFECT_xxxx` or `RGBLIGHT_ANIMATIONS` is defined, you also have a number of animation modes at your disposal:
85|-----|---------------------| 83
86|1 |Solid color | 84|Mode number symbol |Additional number |Description |
87|2-5 |Solid color breathing| 85|-----------------------------|-------------------|---------------------------------------|
88|6-8 |Cycling rainbow | 86|`RGBLIGHT_MODE_STATIC_LIGHT` | *None* |Solid color (this mode is always enabled) |
89|9-14 |Swirling rainbow | 87|`RGBLIGHT_MODE_BREATHING` | 0,1,2,3 |Solid color breathing |
90|15-20|Snake | 88|`RGBLIGHT_MODE_RAINBOW_MOOD` | 0,1,2 |Cycling rainbow |
91|21-23|Knight | 89|`RGBLIGHT_MODE_RAINBOW_SWIRL`| 0,1,2,3,4,5 |Swirling rainbow |
92|24 |Christmas | 90|`RGBLIGHT_MODE_SNAKE` | 0,1,2,3,4,5 |Snake |
93|25-34|Static gradient | 91|`RGBLIGHT_MODE_KNIGHT` | 0,1,2 |Knight |
94|35 |RGB Test | 92|`RGBLIGHT_MODE_CHRISTMAS` | *None* |Christmas |
95|36 |Alternating | 93|`RGBLIGHT_MODE_STATIC_GRADIENT`| 0,1,..,9 |Static gradient |
94|`RGBLIGHT_MODE_RGB_TEST` | *None* |RGB Test |
95|`RGBLIGHT_MODE_ALTERNATING` | *None* |Alternating |
96 96
97Check out [this video](https://youtube.com/watch?v=VKrpPAHlisY) for a demonstration. 97Check out [this video](https://youtube.com/watch?v=VKrpPAHlisY) for a demonstration.
98 98
99Note: For versions older than 0.6.117, The mode numbers were written directly. In `quantum/rgblight.h` there is a contrast table between the old mode number and the current symbol.
100
99The following options can be used to tweak the various animations: 101The following options can be used to tweak the various animations:
100 102
101|Define |Default |Description | 103|Define |Default |Description |
102|------------------------------------|-------------|-------------------------------------------------------------------------------------| 104|------------------------------------|-------------|-------------------------------------------------------------------------------------|
103|`RGBLIGHT_ANIMATIONS` |*Not defined*|If defined, enables additional animation modes | 105|`RGBLIGHT_EFFECT_BREATHING` |*Not defined*|If defined, enable breathing animation mode. |
106|`RGBLIGHT_EFFECT_RAINBOW_MOOD` |*Not defined*|If defined, enable rainbow mood animation mode. |
107|`RGBLIGHT_EFFECT_RAINBOW_SWIRL` |*Not defined*|If defined, enable rainbow swirl animation mode. |
108|`RGBLIGHT_EFFECT_SNAKE` |*Not defined*|If defined, enable snake animation mode. |
109|`RGBLIGHT_EFFECT_KNIGHT` |*Not defined*|If defined, enable knight animation mode. |
110|`RGBLIGHT_EFFECT_CHRISTMAS` |*Not defined*|If defined, enable christmas animation mode. |
111|`RGBLIGHT_EFFECT_STATIC_GRADIENT` |*Not defined*|If defined, enable static gradient mode. |
112|`RGBLIGHT_EFFECT_RGB_TEST` |*Not defined*|If defined, enable RGB test animation mode. |
113|`RGBLIGHT_EFFECT_ALTERNATING` |*Not defined*|If defined, enable alternating animation mode. |
114|`RGBLIGHT_ANIMATIONS` |*Not defined*|If defined, enables all additional animation modes |
104|`RGBLIGHT_EFFECT_BREATHE_CENTER` |`1.85` |Used to calculate the curve for the breathing animation. Valid values are 1.0 to 2.7 | 115|`RGBLIGHT_EFFECT_BREATHE_CENTER` |`1.85` |Used to calculate the curve for the breathing animation. Valid values are 1.0 to 2.7 |
105|`RGBLIGHT_EFFECT_BREATHE_MAX` |`255` |The maximum brightness for the breathing mode. Valid values are 1 to 255 | 116|`RGBLIGHT_EFFECT_BREATHE_MAX` |`255` |The maximum brightness for the breathing mode. Valid values are 1 to 255 |
106|`RGBLIGHT_EFFECT_SNAKE_LENGTH` |`4` |The number of LEDs to light up for the "Snake" animation | 117|`RGBLIGHT_EFFECT_SNAKE_LENGTH` |`4` |The number of LEDs to light up for the "Snake" animation |
@@ -109,6 +120,7 @@ The following options can be used to tweak the various animations:
109|`RGBLIGHT_EFFECT_KNIGHT_LED_NUM` |`RGBLED_NUM` |The number of LEDs to have the "Knight" animation travel | 120|`RGBLIGHT_EFFECT_KNIGHT_LED_NUM` |`RGBLED_NUM` |The number of LEDs to have the "Knight" animation travel |
110|`RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL`|`1000` |How long to wait between light changes for the "Christmas" animation, in milliseconds| 121|`RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL`|`1000` |How long to wait between light changes for the "Christmas" animation, in milliseconds|
111|`RGBLIGHT_EFFECT_CHRISTMAS_STEP` |`2` |The number of LEDs to group the red/green colors by for the "Christmas" animation | 122|`RGBLIGHT_EFFECT_CHRISTMAS_STEP` |`2` |The number of LEDs to group the red/green colors by for the "Christmas" animation |
123|`RGBLIGHT_RAINBOW_SWIRL_RANGE` |`360` |Range adjustment for the rainbow swirl effect to get different swirls |
112 124
113You can also modify the speeds that the different modes animate at: 125You can also modify the speeds that the different modes animate at:
114 126
@@ -149,6 +161,24 @@ If you need to change your RGB lighting in code, for example in a macro to chang
149|`rgblight_sethsv(h, s, v)` |Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 | 161|`rgblight_sethsv(h, s, v)` |Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 |
150|`rgblight_sethsv_noeeprom(h, s, v)`|Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 (not written to EEPROM) | 162|`rgblight_sethsv_noeeprom(h, s, v)`|Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 (not written to EEPROM) |
151|`rgblight_sethsv_at(h, s, v, led)` |Set a single LED to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255, and `led` is between 0 and `RGBLED_NUM` (not written to EEPROM)| 163|`rgblight_sethsv_at(h, s, v, led)` |Set a single LED to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255, and `led` is between 0 and `RGBLED_NUM` (not written to EEPROM)|
164|`rgblight_toggle()` |Toggle all LEDs between on and off |
165|`rgblight_toggle_noeeprom()` |Toggle all LEDs between on and off (not written to EEPROM) |
166|`rgblight_step()` |Change the mode to the next RGB animation in the list of enabled RGB animations |
167|`rgblight_step_noeeprom()` |Change the mode to the next RGB animation in the list of enabled RGB animations (not written to EEPROM) |
168|`rgblight_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations |
169|`rgblight_step_reverse_noeeprom()` |Change the mode to the previous RGB animation in the list of enabled RGB animations (not written to EEPROM) |
170|`rgblight_increase_hue()` |Increase the hue for all LEDs. This wraps around at maximum hue |
171|`rgblight_increase_hue_noeeprom()` |Increase the hue for all LEDs. This wraps around at maximum hue (not written to EEPROM) |
172|`rgblight_decrease_hue()` |Decrease the hue for all LEDs. This wraps around at minimum hue |
173|`rgblight_decrease_hue_noeeprom()` |Decrease the hue for all LEDs. This wraps around at minimum hue (not written to EEPROM) |
174|`rgblight_increase_sat()` |Increase the saturation for all LEDs. This wraps around at maximum saturation |
175|`rgblight_increase_sat_noeeprom()` |Increase the saturation for all LEDs. This wraps around at maximum saturation (not written to EEPROM) |
176|`rgblight_decrease_sat()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation |
177|`rgblight_decrease_sat_noeeprom()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation (not written to EEPROM) |
178|`rgblight_increase_val()` |Increase the value for all LEDs. This wraps around at maximum value |
179|`rgblight_increase_val_noeeprom()` |Increase the value for all LEDs. This wraps around at maximum value (not written to EEPROM) |
180|`rgblight_decrease_val()` |Decrease the value for all LEDs. This wraps around at minimum value |
181|`rgblight_decrease_val_noeeprom()` |Decrease the value for all LEDs. This wraps around at minimum value (not written to EEPROM) |
152 182
153Additionally, [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h) defines several predefined shortcuts for various colors. Feel free to add to this list! 183Additionally, [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h) defines several predefined shortcuts for various colors. Feel free to add to this list!
154 184
diff --git a/docs/feature_tap_dance.md b/docs/feature_tap_dance.md
index 93d190883..f2f274944 100644
--- a/docs/feature_tap_dance.md
+++ b/docs/feature_tap_dance.md
@@ -26,6 +26,8 @@ This array specifies what actions shall be taken when a tap-dance key is in acti
26 26
27The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE_DOUBLE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise. 27The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE_DOUBLE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise.
28 28
29!> Keep in mind that only [basic keycodes](keycodes_basic.md) are supported here. Custom keycodes are not supported.
30
29And that's the bulk of it! 31And that's the bulk of it!
30 32
31And now, on to the explanation of how it works! 33And now, on to the explanation of how it works!
@@ -183,29 +185,11 @@ Below is a specific example:
183 185
184## Setup 186## Setup
185 187
186You will need a few things that can be used for 'Quad Function Tap-Dance'. The suggested setup is to create a user directory for yourself. This directory will contain rules.mk `<your_name>.c` and `<your_name>.h`. This directory should be called `<your_name>`, and located in the top level `users` directory. There should already be a few examples to look at there. 188You will need a few things that can be used for 'Quad Function Tap-Dance'.
187
188### In `/qmk_firmware/users/<your_name>/rules.mk`
189
190Put the following:
191```c
192TAP_DANCE_ENABLE = yes
193SRC += your_name.c
194```
195
196Pretty simple. It is a nice way to keep some rules common on all your keymaps.
197
198 189
199### In `/qmk_firmware/users/<your_name>/<your_name>.h` 190You'll need to add these to the top of your `keymap.c` file, before your keymap.
200
201You will need a few things in this file:
202 191
203```c 192```c
204#pragma once
205
206#include "quantum.h"
207#include "process_keycode/process_tap_dance.h"
208
209typedef struct { 193typedef struct {
210 bool is_press_action; 194 bool is_press_action;
211 int state; 195 int state;
@@ -232,18 +216,12 @@ int cur_dance (qk_tap_dance_state_t *state);
232//for the x tap dance. Put it here so it can be used in any keymap 216//for the x tap dance. Put it here so it can be used in any keymap
233void x_finished (qk_tap_dance_state_t *state, void *user_data); 217void x_finished (qk_tap_dance_state_t *state, void *user_data);
234void x_reset (qk_tap_dance_state_t *state, void *user_data); 218void x_reset (qk_tap_dance_state_t *state, void *user_data);
235```
236 219
237### In `/qmk_firmware/users/<your_name>/<your_name>.c` 220```
238 221
239And then in your user's `.c` file you implement the functions above: 222Now, at the bottom of your `keymap.c` file, you'll need to add the following:
240 223
241```c 224```c
242#include "<your_name>.h"
243#include "quantum.h"
244#include "action.h"
245#include "process_keycode/process_tap_dance.h"
246
247/* Return an integer that corresponds to what kind of tap dance should be executed. 225/* Return an integer that corresponds to what kind of tap dance should be executed.
248 * 226 *
249 * How to figure out tap dance state: interrupted and pressed. 227 * How to figure out tap dance state: interrupted and pressed.
@@ -333,4 +311,6 @@ qk_tap_dance_action_t tap_dance_actions[] = {
333}; 311};
334``` 312```
335 313
336And then simply use `TD(X_CTL)` anywhere in your keymap after including `<your_name>.h`. 314And then simply use `TD(X_CTL)` anywhere in your keymap.
315
316If you want to implement this in your userspace, then you may want to check out how [DanielGGordon](https://github.com/qmk/qmk_firmware/tree/master/users/gordon) has implemented this in their userspace.
diff --git a/docs/feature_unicode.md b/docs/feature_unicode.md
index ecad6c60c..9d57e2fb7 100644
--- a/docs/feature_unicode.md
+++ b/docs/feature_unicode.md
@@ -1,43 +1,172 @@
1# Unicode Support 1# Unicode Support
2 2
3There are three Unicode keymap definition method available in QMK: 3There are three Unicode keymap definition methods available in QMK:
4 4
5## UNICODE_ENABLE 5## UNICODE_ENABLE
6 6
7Supports Unicode input up to 0xFFFF. The keycode function is `UC(n)` in 7Supports Unicode up to `0xFFFF`. The keycode function is `UC(n)` in the keymap file, where _n_ is a 4 digit hexadecimal number.
8keymap file, where *n* is a 4 digit hexadecimal.
9 8
10## UNICODEMAP_ENABLE 9## UNICODEMAP_ENABLE
11 10
12Supports Unicode up to 0xFFFFFFFF. You need to maintain a separate mapping 11Supports Unicode up to `0x10FFFF` (all possible code points). You need to maintain a separate mapping table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file. The keycode function is `X(n)`, where _n_ is an array index into the mapping table.
13table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file. 12
14The keycode function is `X(n)` where *n* is the array index of the mapping 13And you may want to have an enum to make reference easier. So you'd want to add something like this to your keymap:
15table. 14
15```c
16enum unicode_names {
17 BANG,
18 IRONY,
19 SNEK,
20};
21
22const uint32_t PROGMEM unicode_map[] = {
23 [BANG] = 0x203D, // ‽
24 [IRONY] = 0x2E2E, // ⸮
25 [SNEK] = 0x1F40D, // 🐍
26};
27```
28
29Make sure that the order for both matches.
16 30
17## UCIS_ENABLE 31## UCIS_ENABLE
18 32
19TBD 33Supports Unicode up to `0x10FFFF` (all possible code points). As with `UNICODEMAP`, you may want to maintain a mapping table in your keymap file. However, there are no built-in keycodes for this feature — you will have to add a keycode or function that calls `qk_ucis_start()`. Once it's been called, you can type the mnemonic for your character, then hit Space or Enter to complete it or Esc to cancel. If the mnemonic matches an entry in your table, the typed text will automatically be erased and the corresponding Unicode sequence inserted.
34
35For instance, you would need to have a table like this in your keymap:
36
37```c
38const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE
39(
40 UCIS_SYM("poop", 0x1f4a9),
41 UCIS_SYM("rofl", 0x1f923),
42 UCIS_SYM("kiss", 0x1f619)
43);
44```
45
46You run the function, and then type "rofl" and hit enter, it should backspace remove "rofl" and input the `0x1f923` unicode.
47
48### Customization
49
50There are several functions that you can add to your keymap to customize the functionality of this feature.
51
52* `void qk_ucis_start_user(void)` - This runs when you run the "start" function, and can be used to provide feedback. By default, it types out a keyboard emoji.
53* `void qk_ucis_success(uint8_t symbol_index)` - This runs when the unicode input has matched something, and has completed. Default doesn't do anything.
54* `void qk_ucis_symbol_fallback (void)` - This runs if the input text doesn't match anything. The default function falls back to trying that input as a unicode code.
55
56You can find the default implementations of these functions in [`process_ucis.c`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_ucis.c).
57
58## Input Modes
59
60Unicode input in QMK works by inputting a sequence of characters to the OS, sort of like a macro. Unfortunately, the way this is done differs for each platform. Specifically, each platform requires a different combination of keys to trigger Unicode input. Therefore, a corresponding input mode has to be set in QMK.
61
62The following input modes are available:
63
64* **`UC_OSX`**: Mac OS X built-in Unicode hex input. Supports code points up to `0xFFFF` (`0x10FFFF` with `UNICODEMAP`).
65
66 To enable, go to _System Preferences > Keyboard > Input Sources_, add _Unicode Hex Input_ to the list (it's under _Other_), then activate it from the input dropdown in the Menu Bar.
67 By default, this mode uses the left Option key (`KC_LALT`), but this can be changed by defining [`UNICODE_OSX_KEY`](#input-key-configuration) with another keycode.
68
69* **`UC_LNX`**: Linux built-in IBus Unicode input. Supports all possible code points (`0x10FFFF`).
70
71 Enabled by default and works almost anywhere on IBus-enabled distros. Without IBus, this mode works under GTK apps, but rarely anywhere else.
72
73* **`UC_WIN`**: _(not recommended)_ Windows built-in hex numpad Unicode input. Supports code points up to `0xFFFF`.
74
75 To enable, create a registry key under `HKEY_CURRENT_USER\Control Panel\Input Method\EnableHexNumpad` of type `REG_SZ` called `EnableHexNumpad` and set its value to `1`. This can be done from the Command Prompt by running `reg add "HKCU\Control Panel\Input Method" -v EnableHexNumpad -t REG_SZ -d 1` with administrator privileges. Afterwards, reboot.
76 This mode is not recommended because of reliability and compatibility issues; use the `UC_WINC` mode instead.
77
78* **`UC_BSD`**: _(non implemented)_ Unicode input under BSD. Not implemented at this time. If you're a BSD user and want to help add support for it, please [open an issue on GitHub](https://github.com/qmk/qmk_firmware/issues).
79
80* **`UC_WINC`**: Windows Unicode input using [WinCompose](https://github.com/samhocevar/wincompose). As of v0.8.2, supports code points up to `0xFFFFF`.
81
82 To enable, install the [latest release](https://github.com/samhocevar/wincompose/releases/latest). Once installed, WinCompose will automatically run on startup. Works reliably under all version of Windows supported by the app.
83 By default, this mode uses the right Alt key (`KC_RALT`), but this can be changed in the WinCompose settings and by defining [`UNICODE_WINC_KEY`](#input-key-configuration) with another keycode.
84
85### Switching Input Modes
86
87There are two ways to set the input mode for Unicode: by keycode or by function. Keep in mind that both methods write to persistent storage (EEPROM), and are loaded each time the keyboard starts. So once you've set it the first time, you don't need to set it again unless you want to change it, or you've reset the EEPROM settings.
20 88
21Unicode input in QMK works by inputing a sequence of characters to the OS, 89You can switch the input mode at any time by using one of the following keycodes. The easiest way is to add the ones you use to your keymap.
22sort of like macro. Unfortunately, each OS has different ideas on how Unicode is inputted.
23 90
24This is the current list of Unicode input method in QMK: 91|Keycode |Alias |Input mode |Description |
92|-----------------------|---------|-------------|-----------------------------------------|
93|`UNICODE_MODE_FORWARD` |`UC_MOD` | |Cycles forwards through the available modes. [(Disabled by default)](#input-method-cycling)|
94|`UNICODE_MODE_REVERSE` |`UC_RMOD`| |Cycles forwards through the available modes. [(Disabled by default)](#input-method-cycling)|
95|`UNICODE_MODE_OSX` |`UC_M_OS`|`UC_OSX` |Switch to Mac OS X input. |
96|`UNICODE_MODE_LNX` |`UC_M_LN`|`UC_LNX` |Switch to Linux input. |
97|`UNICODE_MODE_WIN` |`UC_M_WI`|`UC_WIN` |Switch to Windows input. |
98|`UNICODE_MODE_BSD` |`UC_M_BS`|`UC_BSD` |Switch to BSD input (not implemented). |
99|`UNICODE_MODE_WINC` |`UC_M_WC`|`UC_WINC` |Switch to Windows input using WinCompose.|
25 100
26* UC_OSX: MacOS Unicode Hex Input support. Works only up to 0xFFFF. Disabled by default. To enable: go to System Preferences -> Keyboard -> Input Sources, and enable Unicode Hex. 101You can also switch the input mode by calling `set_unicode_input_mode(x)` in your code, where _x_ is one of the above input mode constants (e.g. `UC_LNX`). Since the function only needs to be called once, it's recommended that you do it in `eeconfig_init_user` (or a similar function). For example:
27* UC_OSX_RALT: Same as UC_OSX, but sends the Right Alt key for unicode input
28* UC_LNX: Unicode input method under Linux. Works up to 0xFFFFF. Should work almost anywhere on ibus enabled distros. Without ibus, this works under GTK apps, but rarely anywhere else.
29* UC_WIN: (not recommended) Windows built-in Unicode input. To enable: create registry key under `HKEY_CURRENT_USER\Control Panel\Input Method\EnableHexNumpad` of type `REG_SZ` called `EnableHexNumpad`, set its value to 1, and reboot. This method is not recommended because of reliability and compatibility issue, use WinCompose method below instead.
30* UC_WINC: Windows Unicode input using WinCompose. Requires [WinCompose](https://github.com/samhocevar/wincompose). Works reliably under many (all?) variations of Windows.
31 102
32# Additional Language Support 103```c
104void eeconfig_init_user(void) {
105 set_unicode_input_mode(UC_LNX);
106}
107```
108
109### Audio Feedback
110
111If you have the [Audio feature](feature_audio.md) enabled on the board, you can set melodies to be played when you press the above keys. That way you can have some audio feedback when switching input modes.
112
113For instance, you can add these definitions to your `config.h` file:
114
115```c
116#define UNICODE_SONG_OSX COIN_SOUND
117#define UNICODE_SONG_LNX UNICODE_LINUX
118#define UNICODE_SONG_BSD MARIO_GAMEOVER
119#define UNICODE_SONG_WIN UNICODE_WINDOWS
120#define UNICODE_SONG_WINC UNICODE_WINDOWS
121```
122
123### Additional Customization
124
125Because Unicode is such a large and variable feature, there are a number of options that you can customize to work better on your system.
126
127#### Start and Finish input functions
128
129The functions for starting and finishing Unicode input on your platform can be overridden locally. Possible uses include customizing input mode behavior if you don't use the default keys, or adding extra visual/audio feedback to Unicode input.
130
131* `void unicode_input_start(void)` – This sends the initial sequence that tells your platform to enter Unicode input mode. For example, it presses Ctrl+Shift+U on Linux and holds the Option key on Mac.
132* `void unicode_input_finish(void)` – This is called to exit Unicode input mode, for example by pressing Space or releasing the Option key.
133
134You can find the default implementations of these functions in [`process_unicode_common.c`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicode_common.c).
135
136
137#### Input Key Configuration
138
139Additionally, you can customize the keys used to trigger the unicode input for macOS and WinCompose by adding defines to your `config.h`
140
141```c
142#define UNICODE_OSX_KEY KC_LALT
143#define UNICODE_WINC_KEY KC_RALT
144```
145
146#### Input Method Cycling
147
148Also, you can choose which input methods are availble for cycling through. By default, this is disabled. But if you want to enabled it, then limiting it to just those modes makes sense. Note that `UNICODE_SELECTED_MODES` define is comma delimited.
149
150```c
151#define UNICODE_SELECTED_MODES UC_OSX, UC_LNX, UC_WIN, UC_BSD, UC_WINC
152```
153
154## `send_unicode_hex_string`
155
156To type multiple characters for things like (ノಠ痊ಠ)ノ彡┻━┻, you can use `send_unicode_hex_string()` much like `SEND_STRING()` except you would use hex values separate by spaces.
157For example, the table flip seen above would be `send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B")`
158
159There are many ways to get a hex code, but an easy one is [this site](https://r12a.github.io/app-conversion/). Just make sure to convert to hexadecimal, and that is your string.
160
161## Additional Language Support
33 162
34In `quantum/keymap_extras/`, you'll see various language files - these work the same way as the alternative layout ones do. Most are defined by their two letter country/language code followed by an underscore and a 4-letter abbreviation of its name. `FR_UGRV` which will result in a `ù` when using a software-implemented AZERTY layout. It's currently difficult to send such characters in just the firmware. 163In `quantum/keymap_extras/`, you'll see various language files - these work the same way as the alternative layout ones do. Most are defined by their two letter country/language code followed by an underscore and a 4-letter abbreviation of its name. `FR_UGRV` which will result in a `ù` when using a software-implemented AZERTY layout. It's currently difficult to send such characters in just the firmware.
35 164
36# International Characters on Windows 165## International Characters on Windows
37 166
38[AutoHotkey](https://autohotkey.com) allows Windows users to create custom hotkeys among others. 167### AutoHotkey allows Windows users to create custom hotkeys among others.
39 168
40The method does not require Unicode support in the keyboard itself but depends instead of AutoHotkey running in the background. 169The method does not require Unicode support in the keyboard itself but depends instead of [AutoHotkey](https://autohotkey.com) running in the background.
41 170
42First you need to select a modifier combination that is not in use by any of your programs. 171First you need to select a modifier combination that is not in use by any of your programs.
43CtrlAltWin is not used very widely and should therefore be perfect for this. 172CtrlAltWin is not used very widely and should therefore be perfect for this.
@@ -52,3 +181,11 @@ In the default script of AutoHotkey you can define custom hotkeys.
52 181
53The hotkeys above are for the combination CtrlAltGui and CtrlAltGuiShift plus the letter a. 182The hotkeys above are for the combination CtrlAltGui and CtrlAltGuiShift plus the letter a.
54AutoHotkey inserts the Text right of `Send, ` when this combination is pressed. 183AutoHotkey inserts the Text right of `Send, ` when this combination is pressed.
184
185### US International
186
187If you enable the US International layout on the system, it will use punctuation to accent the characters.
188
189For instance, typing "`a" will result in à.
190
191You can find details on how to enable this [here](https://support.microsoft.com/en-us/help/17424/windows-change-keyboard-layout).
diff --git a/docs/feature_userspace.md b/docs/feature_userspace.md
index 5f7c05b83..5a9fc287b 100644
--- a/docs/feature_userspace.md
+++ b/docs/feature_userspace.md
@@ -5,15 +5,12 @@ If you use more than one keyboard with a similar keymap, you might see the benef
5* `/users/<name>/` (added to the path automatically) 5* `/users/<name>/` (added to the path automatically)
6 * `readme.md` (optional, recommended) 6 * `readme.md` (optional, recommended)
7 * `rules.mk` (included automatically) 7 * `rules.mk` (included automatically)
8 * `config.h` (included automatically)
8 * `<name>.h` (optional) 9 * `<name>.h` (optional)
9 * `<name>.c` (optional) 10 * `<name>.c` (optional)
10 * `config.h` (optional) 11 * `cool_rgb_stuff.c` (optional)
12 * `cool_rgb_stuff.h` (optional)
11 13
12`<name>.c` will need to be added to the SRC in `rules.mk` like this:
13
14 SRC += <name>.c
15
16Additional files may be added in the same way - it's recommended you have one named `<name>`.c/.h though.
17 14
18All this only happens when you build a keymap named `<name>`, like this: 15All this only happens when you build a keymap named `<name>`, like this:
19 16
@@ -23,82 +20,179 @@ For example,
23 20
24 make planck:jack 21 make planck:jack
25 22
26Will include the `/users/jack/` folder in the path, along with `/users/jack/rules.mk`. 23Will include the `/users/jack/` folder in the path, along with `/users/jack/rules.mk`.
27 24
28Additionally, `config.h` here will be processed like the same file in your keymap folder. This is handled separately from the `<name>.h` file. 25!> This `name` can be [overridden](#override-default-userspace), if needed.
29 26
30The reason for this, is that `<name>.h` won't be added in time to add settings (such as `#define TAPPING_TERM 100`), and including the `<name.h>` file in any `config.h` files will result in compile issues. 27## `Rules.mk`
28
29The `rules.mk` is one of the two files that gets processed automatically. This is how you add additional source files (such as `<name>.c`) will be added when compiling.
31 30
32So you should use the `config.h` for QMK settings, and the `<name>.h` file for user or keymap specific settings. 31It's highly recommended that you use `<name>.c` as the default source file to be added. And to add it, you need to add it the SRC in `rules.mk` like this:
33 32
34`/users/<name>/rules.mk` will be included in the build _after_ the `rules.mk` from your keymap. This allows you to have features in your userspace `rules.mk` that depend on individual QMK features that may or may not be available on a specific keyboard. For example, if you have RGB control features shared between all your keyboards that support RGB lighting, you can `define RGB_ENABLE` in your keymap `rules.mk` and then check for the variable in your userspace `rules.mk` like this: 33 SRC += <name>.c
34
35Additional files may be added in the same way - it's recommended you have one named `<name>`.c/.h to start off with, though.
36
37The `/users/<name>/rules.mk` file will be included in the build _after_ the `rules.mk` from your keymap. This allows you to have features in your userspace `rules.mk` that depend on individual QMK features that may or may not be available on a specific keyboard.
38
39For example, if you have RGB control features shared between all your keyboards that support RGB lighting, you can add support for that if the RGBLIGHT feature is enabled:
35```make 40```make
36ifdef RGB_ENABLE 41ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
37 # Include my fancy rgb functions source here 42 # Include my fancy rgb functions source here
43 SRC += cool_rgb_stuff.c
38endif 44endif
39``` 45```
40Because of this, any time you turn on QMK features in your `users/<name>/rules.mk`, you should conditionally enable them only if the flag isn't already defined, like this: 46
47Alternatively, you can `define RGB_ENABLE` in your keymap's `rules.mk` and then check for the variable in your userspace's `rules.mk` like this:
41```make 48```make
42ifndef TAP_DANCE_ENABLE 49ifdef RGB_ENABLE
43 TAP_DANCE_ENABLE = yes 50 # Include my fancy rgb functions source here
51 SRC += cool_rgb_stuff.c
44endif 52endif
45``` 53```
46This will ensure that you can explicitly turn off features for an individual keymap.
47 54
48## Readme 55### Override default userspace
56
57By default the userspace used will be the same as the keymap name. In some situations this isn't desirable. For instance, if you use the [layout](feature_layouts.md) feature you can't use the same name for different keymaps (e.g. ANSI and ISO). You can name your layouts `mylayout-ansi` and `mylayout-iso` and add the following line to your layout's `rules.mk`:
58
59```
60USER_NAME := mylayout
61```
62
63This is also useful if you have multiple different keyboards with different features physically present on the board (such as one with RGB Lights, and one with Audio, or different number of LEDs, or connected to a different PIN on the controller).
64
65## Configuration Options (`config.h`)
66
67Additionally, `config.h` here will be processed like the same file in your keymap folder. This is handled separately from the `<name>.h` file.
68
69The reason for this, is that `<name>.h` won't be added in time to add settings (such as `#define TAPPING_TERM 100`), and including the `<name.h>` file in any `config.h` files will result in compile issues.
70
71!>You should use the `config.h` for [configuration options](config_options.md), and the `<name>.h` file for user or keymap specific settings (such as the enum for layer or keycodes)
72
73
74## Readme (`readme.md`)
49 75
50Please include authorship (your name, github username, email), and optionally [a license that's GPL compatible](https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses). 76Please include authorship (your name, github username, email), and optionally [a license that's GPL compatible](https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses).
51 77
52## `Config.h` 78You can use this as a template:
79```
80Copyright <year> <name> <email> @<github_username>
81
82This program is free software: you can redistribute it and/or modify
83it under the terms of the GNU General Public License as published by
84the Free Software Foundation, either version 2 of the License, or
85(at your option) any later version.
86
87This program is distributed in the hope that it will be useful,
88but WITHOUT ANY WARRANTY; without even the implied warranty of
89MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
90GNU General Public License for more details.
91
92You should have received a copy of the GNU General Public License
93along with this program. If not, see <http://www.gnu.org/licenses/>.
94```
95
96You'd want to replace the year, name, email and github username with your info.
97
98Additionally, this is a good place to document your code, if you wish to share it with others.
99
100# Examples
101
102For a brief example, checkout [`/users/_example/`](https://github.com/qmk/qmk_firmware/tree/master/users/drashna).
103For a more complicated example, checkout [`/users/drashna/`](https://github.com/qmk/qmk_firmware/tree/master/users/drashna)'s userspace.
104
105
106## Customized Functions
107
108QMK has a bunch of [functions](custom_quantum_functions.md) that have [`_quantum`, `_kb`, and `_user` versions](custom_quantum_functions.md#a-word-on-core-vs-keyboards-vs-keymap) that you can use. You will pretty much always want to use the user version of these functions. But the problem is that if you use them in your userspace, then you don't have a version that you can use in your keymap.
109
110However, you can actually add support for keymap version, so that you can use it in both your userspace and your keymap!
53 111
54If you do add a `config,h` file, you want to make sure that it only gets processed once. So you may want to start off with something like this:
55 112
113For instance, lets looks at the `layer_state_set_user` function. Lets enable the [Tri Layer State](ref_functions.md#olkb-tri-layers) functionalitly to all of our boards, and then still have your `keymap.c` still able to use this functionality.
114
115In your `<name.c>` file, you'd want to add this:
56```c 116```c
57#ifndef USERSPACE_CONFIG_H 117__attribute__ ((weak))
58#define USERSPACE_CONFIG_H 118uint32_t layer_state_set_keymap (uint32_t state) {
119 return state;
120}
121
122uint32_t layer_state_set_user (uint32_t state) {
123 state = update_tri_layer_state(state, 2, 3, 5);
124 return layer_state_set_keymap (state);
125}
126```
127The `__attribute__ ((weak))` part tells the compiler that this is a placeholder function that can then be replaced by a version in your `keymap.c`. That way, you don't need to add it to your `keymap.c`, but if you do, you won't get any conflicts because the function is the same name.
59 128
60// Put normal config.h settings here: 129The `_keymap` part here doesn't matter, it just needs to be something other than `_quantum`, `_kb`, or `_user`, since those are already in use. So you could use `layer_state_set_mine`, `layer_state_set_fn`, or anything else.
61 130
62#endif // !USERSPACE_CONFIG_H 131You can see a list of this and other common functions in [`template.c`](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/template.c) in [`users/drashna`](https://github.com/qmk/qmk_firmware/tree/master/users/drashna).
132
133## Custom Features
134
135Since the Userspace feature can support a staggering number of boards, you may have boards that you want to enable certain functionality for, but not for others. And you can actually create "features" that you can enable or disable in your own userspace.
136
137For instance, if you wanted to have a bunch of macros available, but only on certain boards (to save space), you could "hide" them being a `#ifdef MACROS_ENABLED`, and then enable it per board. To do this, add this to your rules.mk
138```make
139ifeq ($(strip $(MACROS_ENABLED)), yes)
140 OPT_DEFS += -DMACROS_ENABLED
141endif
63``` 142```
143The `OPT_DEFS` setting causes `MACROS_ENABLED` to be defined for your keyboards (note the `-D` in front of the name), and you could use `#ifdef MACROS_ENABLED` to check the status in your c/h files, and handle that code based on that.
64 144
65You can use any option hre that you could use in your keymap's `config.h` file. You can find a list of vales [here](config_options.md). 145Then you add `MACROS_ENABLED = yes` to the `rules.mk` for you keymap to enable this feature and the code in your userspace.
66 146
67## Example 147And in your `process_record_user` function, you'd do something like this:
148```c
149bool process_record_user(uint16_t keycode, keyrecord_t *record) {
150 switch (keycode) {
151#ifdef MACROS_ENABLED
152 case MACRO1:
153 if (!record->event.pressed) {
154 SEND_STRING("This is macro 1!");
155 }
156 break;
157 case MACRO2:
158 if (!record->event.pressed) {
159 SEND_STRING("This is macro 2!");
160 }
161 break;
162#endif
163 }
164 return true;
165}
166```
68 167
69For a brief example, checkout `/users/_example/` , or for a more detailed examples check out [`template.h`](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/template.h) and [`template.c`](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/template.c) in `/users/drashna/` .
70 168
71### Consolidated Macros 169## Consolidated Macros
72 170
73If you wanted to consolidate macros and other functions into your userspace for all of your keymaps, you can do that. The issue is that you then cannot call any function defined in your userspace, or it gets complicated. To better handle this, you can call the functions here and create new functions to use in individual keymaps. 171If you wanted to consolidate macros and other functions into your userspace for all of your keymaps, you can do that. This builds upon the [Customized Functions](#customized-functions) example above. This lets you maintain a bunch of macros that are shared between the different keyboards, and allow for keyboard specific macros, too.
74 172
75First, you'd want to go through all of your `keymap.c` files and replace `process_record_user` with `process_record_keymap` instead. This way, you can still use keyboard specific codes on those boards, and use your custom "global" keycodes as well. You'll also want to replace `SAFE_RANGE` with `NEW_SAFE_RANGE` so that you wont have any overlapping keycodes 173First, you'd want to go through all of your `keymap.c` files and replace `process_record_user` with `process_record_keymap` instead. This way, you can still use keyboard specific codes on those boards, and use your custom "global" keycodes as well. You'll also want to replace `SAFE_RANGE` with `NEW_SAFE_RANGE` so that you wont have any overlapping keycodes
76 174
77Then add `#include <name.h>` to all of your keymap.c files. This allows you to use these new keycodes without having to redefine them in each keymap. 175Then add `#include <name.h>` to all of your keymap.c files. This allows you to use these new keycodes without having to redefine them in each keymap.
78 176
79Once you've done that, you'll want to set the keycode definitions that you need to the `<name>.h` file. For instance: 177Once you've done that, you'll want to set the keycode definitions that you need to the `<name>.h` file. For instance:
80``` 178```c
81#ifndef USERSPACE 179#pragma once
82#define USERSPACE
83 180
84#include "quantum.h" 181#include "quantum.h"
182#include "action.h"
183#include "version.h"
85 184
86// Define all of 185// Define all of
87enum custom_keycodes { 186enum custom_keycodes {
88 KC_MAKE = SAFE_RANGE, 187 KC_MAKE = SAFE_RANGE,
89 NEW_SAFE_RANGE //use "NEW_SAFE_RANGE" for keymap specific codes 188 NEW_SAFE_RANGE //use "NEW_SAFE_RANGE" for keymap specific codes
90}; 189};
91
92#endif
93``` 190```
94 191
95Now you want to create the `<name>.c` file, and add this content to it: 192Now you want to create the `<name>.c` file, and add this content to it:
96 193
97``` 194```c
98#include "<name>.h" 195#include "<name>.h"
99#include "quantum.h"
100#include "action.h"
101#include "version.h"
102 196
103__attribute__ ((weak)) 197__attribute__ ((weak))
104bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { 198bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
@@ -126,14 +220,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
126} 220}
127``` 221```
128 222
129This will add a new `KC_MAKE` keycode that can be used in any of your keymaps. And this keycode will output `make <keyboard>:<keymap">`, making frequent compiling easier. And this will work with any keyboard and any keymap as it will output the current boards info, so that you don't have to type this out every time. 223This will add a new `KC_MAKE` keycode that can be used in any of your keymaps. And this keycode will output `make <keyboard>:<keymap>`, making frequent compiling easier. And this will work with any keyboard and any keymap as it will output the current boards info, so that you don't have to type this out every time.
130 224
131Additionally, this should flash the newly compiled firmware automatically, using the correct utility, based on the bootloader settings (or default to just generating the HEX file). However, it should be noted that this may not work on all systems. AVRDUDE doesn't work on WSL, namely (and will dump the HEX in the ".build" folder instead). 225Additionally, this should flash the newly compiled firmware automatically, using the correct utility, based on the bootloader settings (or default to just generating the HEX file). However, it should be noted that this may not work on all systems. AVRDUDE doesn't work on WSL, namely (and will dump the HEX in the ".build" folder instead).
132 226
133## Override default userspace
134 227
135By default the userspace used will be the same as the keymap name. In some situations this isn't desirable. For instance, if you use the [layout](feature_layouts.md) feature you can't use the same name for different keymaps (e.g. ANSI and ISO). You can name your layouts `mylayout-ansi` and `mylayout-iso` and add the following line to your layout's `rules.mk`:
136
137```
138USER_NAME := mylayout
139```
diff --git a/docs/features.md b/docs/features.md
index 537e1061c..85f4cf6e0 100644
--- a/docs/features.md
+++ b/docs/features.md
@@ -8,13 +8,17 @@ QMK has a staggering number of features for building your keyboard. It can take
8* [Auto Shift](feature_auto_shift.md) - Tap for the normal key, hold slightly longer for its shifted state. 8* [Auto Shift](feature_auto_shift.md) - Tap for the normal key, hold slightly longer for its shifted state.
9* [Backlight](feature_backlight.md) - LED lighting support for your keyboard. 9* [Backlight](feature_backlight.md) - LED lighting support for your keyboard.
10* [Bootmagic](feature_bootmagic.md) - Adjust the behavior of your keyboard using hotkeys. 10* [Bootmagic](feature_bootmagic.md) - Adjust the behavior of your keyboard using hotkeys.
11* [Combos](feature_combo.md) - Custom actions for multiple key holds.
12* [Command](feature_command.md) - Runtime version of bootmagic (Formerly known as "Magic").
11* [Dynamic Macros](feature_dynamic_macros.md) - Record and playback macros from the keyboard itself. 13* [Dynamic Macros](feature_dynamic_macros.md) - Record and playback macros from the keyboard itself.
14* [Grave Escape](feature_grave_esc.md) - Lets you use a single key for Esc and Grave.
12* [HD44780 LCD Display](feature_hd44780.md) - Support for LCD character displays using the HD44780 standard. 15* [HD44780 LCD Display](feature_hd44780.md) - Support for LCD character displays using the HD44780 standard.
13* [Key Lock](feature_key_lock.md) - Lock a key in the "down" state. 16* [Key Lock](feature_key_lock.md) - Lock a key in the "down" state.
14* [Layouts](feature_layouts.md) - Use one keymap with any keyboard that supports your layout. 17* [Layouts](feature_layouts.md) - Use one keymap with any keyboard that supports your layout.
15* [Leader Key](feature_leader_key.md) - Tap the leader key followed by a sequence to trigger custom behavior. 18* [Leader Key](feature_leader_key.md) - Tap the leader key followed by a sequence to trigger custom behavior.
16* [Macros](feature_macros.md) - Send multiple key presses when pressing only one physical key. 19* [Macros](feature_macros.md) - Send multiple key presses when pressing only one physical key.
17* [Mouse keys](feature_mouse_keys.md) - Control your mouse pointer from your keyboard. 20* [Mouse keys](feature_mouse_keys.md) - Control your mouse pointer from your keyboard.
21* [One Shot Keys](feature_advanced_keycodes.md#one-shot-keys) - Sticky Keys, lets hit a key rather than holding it.
18* [Pointing Device](feature_pointing_device.md) - Framework for connecting your custom pointing device to your keyboard. 22* [Pointing Device](feature_pointing_device.md) - Framework for connecting your custom pointing device to your keyboard.
19* [PS2 Mouse](feature_ps2_mouse.md) - Driver for connecting a PS/2 mouse directly to your keyboard. 23* [PS2 Mouse](feature_ps2_mouse.md) - Driver for connecting a PS/2 mouse directly to your keyboard.
20* [RGB Light](feature_rgblight.md) - RGB lighting for your keyboard. 24* [RGB Light](feature_rgblight.md) - RGB lighting for your keyboard.
diff --git a/docs/flashing.md b/docs/flashing.md
index e5fe59f8f..bc418c415 100644
--- a/docs/flashing.md
+++ b/docs/flashing.md
@@ -2,7 +2,7 @@
2 2
3There are quite a few different types of bootloaders that keyboards use, and just about all of the use a different flashing method. Luckily, projects like the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) aim to be compatible with all the different types without having to think about it much, but this article will describe the different types of bootloaders, and available methods for flashing them. 3There are quite a few different types of bootloaders that keyboards use, and just about all of the use a different flashing method. Luckily, projects like the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) aim to be compatible with all the different types without having to think about it much, but this article will describe the different types of bootloaders, and available methods for flashing them.
4 4
5If you have a bootloader selected with the `BOOTLOADER` variable in your `rules.mk`, QMK will automatically calculate if your .hex file is the right size to be flashed to the device, and output the total size it bytes (along with the max). To run this process manually, compile with the target `check-size`, eg `make planck/rev4:default:check-size`. 5If you have a bootloader selected with the `BOOTLOADER` variable in your `rules.mk`, QMK will automatically calculate if your .hex file is the right size to be flashed to the device, and output the total size in bytes (along with the max). To run this process manually, compile with the target `check-size`, eg `make planck/rev4:default:check-size`.
6 6
7## DFU 7## DFU
8 8
@@ -71,13 +71,19 @@ Flashing sequence:
71 71
721. Press the `RESET` keycode, or short RST to GND quickly (you only have 7 seconds to flash once it enters) 721. Press the `RESET` keycode, or short RST to GND quickly (you only have 7 seconds to flash once it enters)
732. Wait for the OS to detect the device 732. Wait for the OS to detect the device
744. Flash a .hex file 743. Flash a .hex file
755. Wait for the device to reset automatically 754. Wait for the device to reset automatically
76 76
77or 77or
78 78
79 make <keyboard>:<keymap>:avrdude 79 make <keyboard>:<keymap>:avrdude
80 80
81or if you want to flash multiple boards, use the following command
82
83 make <keyboard>:<keymap>:avrdude-loop
84
85When you're done flashing boards, you'll need to hit Ctrl + C or whatever the correct keystroke is for your operating system to break the loop.
86
81## Halfkay 87## Halfkay
82 88
83Halfkay is a super-slim protocol developed by PJRC that uses HID, and come on all Teensys (namely the 2.0). 89Halfkay is a super-slim protocol developed by PJRC that uses HID, and come on all Teensys (namely the 2.0).
@@ -100,5 +106,28 @@ Flashing sequence:
100 106
1011. Press the `RESET` keycode, or short RST to GND quickly (you only have 7 seconds to flash once it enters) 1071. Press the `RESET` keycode, or short RST to GND quickly (you only have 7 seconds to flash once it enters)
1022. Wait for the OS to detect the device 1082. Wait for the OS to detect the device
1034. Flash a .hex file 1093. Flash a .hex file
1045. Reset the device into application mode (may be done automatically) 1104. Reset the device into application mode (may be done automatically)
111
112## STM32
113
114All STM32 chips come preloaded with a factory bootloader that cannot be modified nor deleted. Some STM32 chips have bootloaders that do not come with USB programming (e.g. STM32F103) but the process is still the same.
115
116At the moment, no `BOOTLOADER` variable is needed on `rules.mk` for STM32.
117
118Compatible flashers:
119
120* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI)
121* [dfu-util](https://github.com/Stefan-Schmidt/dfu-util) / `:dfu-util` (recommended command line)
122
123Flashing sequence:
124
1251. Enter the bootloader using any of the following methods:
126 * Tap the `RESET` keycode (may not work on STM32F042 devices)
127 * If a reset circuit is present, tap the RESET button
128 * Otherwise, you need to bridge BOOT0 to VCC (via BOOT0 button or bridge), short RESET to GND (via RESET button or bridge), and then let go of the BOOT0 bridge
1292. Wait for the OS to detect the device
1303. Flash a .bin file
131 * You will receive a warning about the DFU signature; Just ignore it
1324. Reset the device into application mode (may be done automatically)
133 * If you are building from command line (e.g. `make planck/rev6:default:dfu-util`), make sure that `:leave` is passed to the `DFU_ARGS` variable inside your `rules.mk` (e.g. `DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave`) so that your device resets after flashing
diff --git a/docs/getting_started_build_tools.md b/docs/getting_started_build_tools.md
index c1e02d4e0..375e9d108 100644
--- a/docs/getting_started_build_tools.md
+++ b/docs/getting_started_build_tools.md
@@ -8,7 +8,7 @@ Note: If it is your first time here, Check out the "Complete Newbs guide" instea
8 8
9## Linux 9## Linux
10 10
11To ensure you are always up to date, you can just run `sudo util/install_dependencies.sh`. That should always install all the dependencies needed. **This will run `apt-get upgrade`.** 11To ensure you are always up to date, you can just run `sudo util/qmk_install.sh`. That should always install all the dependencies needed. **This will run `apt-get upgrade`.**
12 12
13You can also install things manually, but this documentation might not be always up to date with all requirements. 13You can also install things manually, but this documentation might not be always up to date with all requirements.
14 14
@@ -57,11 +57,13 @@ If you're using [homebrew,](http://brew.sh/) you can use the following commands:
57 brew tap PX4/homebrew-px4 57 brew tap PX4/homebrew-px4
58 brew update 58 brew update
59 brew install avr-gcc@7 59 brew install avr-gcc@7
60 brew link --force avr-gcc@7
60 brew install dfu-programmer 61 brew install dfu-programmer
62 brew install dfu-util
61 brew install gcc-arm-none-eabi 63 brew install gcc-arm-none-eabi
62 brew install avrdude 64 brew install avrdude
63 65
64This is the recommended method. If you don't have homebrew, [install it!](http://brew.sh/) It's very much worth it for anyone who works in the command line. Note that the `make` and `make install` portion during the homebrew installation of avr-libc can take over 20 minutes and exhibit high CPU usage. 66This is the recommended method. If you don't have homebrew, [install it!](http://brew.sh/) It's very much worth it for anyone who works in the command line. Note that the `make` and `make install` portion during the homebrew installation of `avr-gcc@7` can take over 20 minutes and exhibit high CPU usage.
65 67
66## Windows with msys2 (recommended) 68## Windows with msys2 (recommended)
67 69
@@ -69,9 +71,9 @@ The best environment to use, for Windows Vista through any later version (tested
69 71
70* Install msys2 by downloading it and following the instructions here: http://www.msys2.org 72* Install msys2 by downloading it and following the instructions here: http://www.msys2.org
71* Open the ``MSYS2 MingGW 64-bit`` shortcut 73* Open the ``MSYS2 MingGW 64-bit`` shortcut
72* Navigate to your qmk checkout. For example, if it's in the root of your c drive: 74* Navigate to your QMK repository. For example, if it's in the root of your c drive:
73 * `$ cd /c/qmk_firmware` 75 * `$ cd /c/qmk_firmware`
74* Run `util/msys2_install.sh` and follow the prompts 76* Run `util/qmk_install.sh` and follow the prompts
75 77
76## Windows 10 (deprecated) 78## Windows 10 (deprecated)
77These are the old instructions for Windows 10. We recommend you use [MSYS2 as outlined above](#windows-with-msys2-recommended). 79These are the old instructions for Windows 10. We recommend you use [MSYS2 as outlined above](#windows-with-msys2-recommended).
@@ -121,24 +123,27 @@ If you have trouble and want to ask for help, it is useful to generate a *Win_Ch
121 123
122## Docker 124## Docker
123 125
124If this is a bit complex for you, Docker might be the turn-key solution you need. After installing [Docker](https://www.docker.com/products/docker), run the following command at the root of the QMK folder to build a keyboard/keymap: 126If this is a bit complex for you, Docker might be the turn-key solution you need. After installing [Docker CE](https://docs.docker.com/install/#supported-platforms), run the following command from the `qmk_firmware` directory to build a keyboard/keymap:
125
126```bash 127```bash
127# You'll run this every time you want to build a keymap 128util/docker_build.sh keyboard:keymap
128# modify the keymap and keyboard assignment to compile what you want 129# For example: util/docker_build.sh ergodox_ez:steno
129# defaults are ergodox/default
130
131docker run -e keymap=gwen -e keyboard=ergodox_ez --rm -v $('pwd'):/qmk:rw edasque/qmk_firmware
132``` 130```
131This will compile the targeted keyboard/keymap and leave the resulting `.hex` or `.bin` file in the QMK directory for you to flash. If `:keymap` is omitted, the `default` keymap is used. Note that the parameter format is the same as when building with `make`.
133 132
134On Windows Docker seems to have issues with the VOLUME tag in Dockerfile, and `$('pwd')` won't print a Windows compliant path; use full path instead, like this: 133You can also start the script without any parameters, in which case it will ask you to input the build parameters one by one, which you may find easier to use:
135
136```bash 134```bash
137docker run -e keymap=default -e keyboard=ergodox_ez --rm -v D:/Users/Sacapuces/Documents/Repositories/qmk:/qmk:rw edasque/qmk_firmware 135util/docker_build.sh
136# Reads parameters as input (leave blank for defaults)
137```
138 138
139There is also support for building _and_ flashing the keyboard straight from Docker by specifying the `target` as well:
140```bash
141util/docker_build.sh keyboard:keymap:target
142# For example: util/docker_build.sh planck/rev6:default:dfu-util
139``` 143```
144If you're on Linux, this should work out of the box. On Windows and macOS, it requires [Docker Machine](http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos/) to be running. This is tedious to set up, so it's not recommended; use QMK Toolbox instead.
140 145
141This will compile the targeted keyboard/keymap and leave it in your QMK directory for you to flash. 146!> Docker for Windows requires [Hyper-V](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v) to be enabled. This means that it cannot work on versions of Windows which don't have Hyper-V, such as Windows 7, Windows 8 and **Windows 10 Home**.
142 147
143## Vagrant 148## Vagrant
144If you have any problems building the firmware, you can try using a tool called Vagrant. It will set up a virtual computer with a known configuration that's ready-to-go for firmware building. OLKB does NOT host the files for this virtual computer. Details on how to set up Vagrant are in the [vagrant guide](getting_started_vagrant.md). 149If you have any problems building the firmware, you can try using a tool called Vagrant. It will set up a virtual computer with a known configuration that's ready-to-go for firmware building. OLKB does NOT host the files for this virtual computer. Details on how to set up Vagrant are in the [vagrant guide](getting_started_vagrant.md).
diff --git a/docs/getting_started_github.md b/docs/getting_started_github.md
index 7a3531c75..aeb8738b7 100644
--- a/docs/getting_started_github.md
+++ b/docs/getting_started_github.md
@@ -8,7 +8,7 @@ Start on the [QMK Github page](https://github.com/qmk/qmk_firmware), and you'll
8 8
9![Fork on Github](http://i.imgur.com/8Toomz4.jpg) 9![Fork on Github](http://i.imgur.com/8Toomz4.jpg)
10 10
11If you're apart of an organization, you'll need to choose which account to fork it to. In most circumstances, you'll want to fork it to your personal account. Once your fork is completed (sometimes this takes a little while), click the "Clone or Download" button: 11If you're a part of an organization, you'll need to choose which account to fork it to. In most circumstances, you'll want to fork it to your personal account. Once your fork is completed (sometimes this takes a little while), click the "Clone or Download" button:
12 12
13![Download from Github](http://i.imgur.com/N1NYcSz.jpg) 13![Download from Github](http://i.imgur.com/N1NYcSz.jpg)
14 14
diff --git a/docs/hardware_avr.md b/docs/hardware_avr.md
index be6932406..2c3652a02 100644
--- a/docs/hardware_avr.md
+++ b/docs/hardware_avr.md
@@ -8,7 +8,7 @@ If you have not yet you should read the [Keyboard Guidelines](hardware_keyboard_
8 8
9QMK has a number of features to simplify working with AVR keyboards. For most keyboards you don't have to write a single line of code. To get started run the `util/new_project.sh` script: 9QMK has a number of features to simplify working with AVR keyboards. For most keyboards you don't have to write a single line of code. To get started run the `util/new_project.sh` script:
10 10
11``` 11```bash
12$ util/new_project.sh my_awesome_keyboard 12$ util/new_project.sh my_awesome_keyboard
13###################################################### 13######################################################
14# /keyboards/my_awesome_keyboard project created. To start 14# /keyboards/my_awesome_keyboard project created. To start
@@ -30,7 +30,7 @@ This is where all the custom logic for your keyboard goes. Many keyboards do not
30 30
31This is the file you define your [Layout Macro(s)](feature_layouts.md) in. At minimum you should have a `#define LAYOUT` for your keyboard that looks something like this: 31This is the file you define your [Layout Macro(s)](feature_layouts.md) in. At minimum you should have a `#define LAYOUT` for your keyboard that looks something like this:
32 32
33``` 33```c
34#define LAYOUT( \ 34#define LAYOUT( \
35 k00, k01, k02, \ 35 k00, k01, k02, \
36 k10, k11 \ 36 k10, k11 \
@@ -57,7 +57,7 @@ At the top of the `config.h` you'll find USB related settings. These control how
57 57
58Do change the `MANUFACTURER`, `PRODUCT`, and `DESCRIPTION` lines to accurately reflect your keyboard. 58Do change the `MANUFACTURER`, `PRODUCT`, and `DESCRIPTION` lines to accurately reflect your keyboard.
59 59
60``` 60```c
61#define VENDOR_ID 0xFEED 61#define VENDOR_ID 0xFEED
62#define PRODUCT_ID 0x6060 62#define PRODUCT_ID 0x6060
63#define DEVICE_VER 0x0001 63#define DEVICE_VER 0x0001
@@ -66,20 +66,20 @@ Do change the `MANUFACTURER`, `PRODUCT`, and `DESCRIPTION` lines to accurately r
66#define DESCRIPTION A custom keyboard 66#define DESCRIPTION A custom keyboard
67``` 67```
68 68
69?> Note: On Windows and macOS the `MANUFACTURER`, `PRODUCT`, and `DESCRIPTION` fields will be displayed in the list of USB devices. On Linux these values will not be visible in `lsusb`, since Linux takes that information from the list published by the USB-IF. 69?> Note: On Windows and macOS the `MANUFACTURER`, `PRODUCT`, and `DESCRIPTION` fields will be displayed in the list of USB devices. ?> On Linux these values will not be visible in lsusb by default, since Linux takes the information from the list maintained by [USB ID Repository](http://www.linux-usb.org/usb-ids.html) by default. lsusb will show the information reported by the device when executed with -v option. It is also present in kernel logs after plugging in the device.
70 70
71### Keyboard Matrix Configuration 71### Keyboard Matrix Configuration
72 72
73The next section of the `config.h` file deals with your keyboard's matrix. The first thing you should set is the matrix's size. This is usually, but not always, the same number of rows and columns as the physical key arrangement. 73The next section of the `config.h` file deals with your keyboard's matrix. The first thing you should set is the matrix's size. This is usually, but not always, the same number of rows and columns as the physical key arrangement.
74 74
75``` 75```c
76#define MATRIX_ROWS 2 76#define MATRIX_ROWS 2
77#define MATRIX_COLS 3 77#define MATRIX_COLS 3
78``` 78```
79 79
80Once you've defined the size of your matrix you need to define which pins on your MCU are connected to rows and columns. To do so simply specify the names of those pins: 80Once you've defined the size of your matrix you need to define which pins on your MCU are connected to rows and columns. To do so simply specify the names of those pins:
81 81
82``` 82```c
83#define MATRIX_ROW_PINS { D0, D5 } 83#define MATRIX_ROW_PINS { D0, D5 }
84#define MATRIX_COL_PINS { F1, F0, B0 } 84#define MATRIX_COL_PINS { F1, F0, B0 }
85#define UNUSED_PINS 85#define UNUSED_PINS
@@ -89,7 +89,7 @@ The number of `MATRIX_ROW_PINS` entries must be the same as the number you assig
89 89
90Finally, you can specify the direction your diodes point. This can be `COL2ROW`, `ROW2COL`, or `CUSTOM_MATRIX`. 90Finally, you can specify the direction your diodes point. This can be `COL2ROW`, `ROW2COL`, or `CUSTOM_MATRIX`.
91 91
92``` 92```c
93#define DIODE_DIRECTION COL2ROW 93#define DIODE_DIRECTION COL2ROW
94``` 94```
95 95
@@ -97,16 +97,14 @@ Finally, you can specify the direction your diodes point. This can be `COL2ROW`,
97 97
98By default QMK supports backlighting on pins `B5`, `B6`, and `B7`. If you are using one of those you can simply enable it here. For more details see the [Backlight Documentation](feature_backlight.md). 98By default QMK supports backlighting on pins `B5`, `B6`, and `B7`. If you are using one of those you can simply enable it here. For more details see the [Backlight Documentation](feature_backlight.md).
99 99
100``` 100```c
101#define BACKLIGHT_PIN B7 101#define BACKLIGHT_PIN B7
102#define BACKLIGHT_LEVELS 3 102#define BACKLIGHT_LEVELS 3
103#define BACKLIGHT_BREATHING 103#define BACKLIGHT_BREATHING
104#define BREATHING_PERIOD 6 104#define BREATHING_PERIOD 6
105``` 105```
106 106
107{% hint style='info' %} 107?> You can use backlighting on any pin you like, but you will have to do more work to support that. See the [Backlight Documentation](feature_backlight.md) for more details.
108You can use backlighting on any pin you like, but you will have to do more work to support that. See the [Backlight Documentation](feature_backlight.md) for more details.
109{% endhint %}
110 108
111### Other Configuration Options 109### Other Configuration Options
112 110
@@ -120,7 +118,7 @@ You use the `rules.mk` file to tell QMK what files to build and what features to
120 118
121These options tell the build system what CPU to build for. Be very careful if you change any of these settings, you can render your keyboard inoperable. 119These options tell the build system what CPU to build for. Be very careful if you change any of these settings, you can render your keyboard inoperable.
122 120
123``` 121```make
124MCU = atmega32u4 122MCU = atmega32u4
125F_CPU = 16000000 123F_CPU = 16000000
126ARCH = AVR8 124ARCH = AVR8
@@ -128,26 +126,26 @@ F_USB = $(F_CPU)
128OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 126OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
129``` 127```
130 128
131### Bootloader Size 129### Bootloaders
132 130
133The bootloader is a special section of your MCU that allows you to upgrade the code stored on the MCU. Think of it like a Rescue Partition for your keyboard. If you are using a teensy 2.0, or a device like the Ergodox EZ that uses the teensy bootloader you should set this to `512`. Most other bootloaders should be set to `4096`, but `1024` and `2048` are other possible values you may encounter. 131The bootloader is a special section of your MCU that allows you to upgrade the code stored on the MCU. Think of it like a Rescue Partition for your keyboard.
134 132
135#### Teensy 2.0 Bootloader Example 133#### Teensy Bootloader Example
136 134
137``` 135```make
138OPT_DEFS += -DBOOTLOADER_SIZE=512 136BOOTLOADER = halfkay
139``` 137```
140 138
141#### Teensy 2.0++ Bootloader Example 139#### Atmel DFU Loader Example
142 140
143``` 141```make
144OPT_DEFS += -DBOOTLOADER_SIZE=1024 142BOOTLOADER = atmel-dfu
145``` 143```
146 144
147#### Atmel DFU Loader Example 145#### Pro Micro Bootloader Example
148 146
149``` 147```make
150OPT_DEFS += -DBOOTLOADER_SIZE=4096 148BOOTLOADER = caterina
151``` 149```
152 150
153### Build Options 151### Build Options
diff --git a/docs/how_keyboards_work.md b/docs/how_keyboards_work.md
index fac2b5a48..cc54e566a 100644
--- a/docs/how_keyboards_work.md
+++ b/docs/how_keyboards_work.md
@@ -27,17 +27,17 @@ This usually happens with a periodic scan of key presses. This speed often is li
27 27
28## 2. What the Firmware Sends 28## 2. What the Firmware Sends
29 29
30The [HID specification](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) tells what a keyboard can actually send through USB to have a chance to be properly recognised. This includes a pre-defined list of scancodes which are simple numbers from `0x00` to `0xE7`. The firmware assigns a scancode to each key of the keyboard. 30The [HID specification](https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf) tells what a keyboard can actually send through USB to have a chance to be properly recognised. This includes a pre-defined list of scancodes which are simple numbers from `0x00` to `0xE7`. The firmware assigns a scancode to each key of the keyboard.
31 31
32The firmware does not send actually letters or characters, but only scancodes. 32The firmware does not send actual letters or characters, but only scancodes.
33Thus, by modifying the firmware, you only can modify what scancode is sent over 33Thus, by modifying the firmware, you can only modify what scancode is sent over
34USB for a given key. 34USB for a given key.
35 35
36## 3. What the Operating System Does 36## 3. What the Operating System Does
37 37
38Once the keycode reaches the operating system, a piece of software has to have 38Once the keycode reaches the operating system, a piece of software has to have
39it match an actual character thanks to a keyboard layout. For example, if your 39it match an actual character thanks to a keyboard layout. For example, if your
40layout is set to QWERTY, a sample of the matching table is as follow: 40layout is set to QWERTY, a sample of the matching table is as follows:
41 41
42| keycode | character | 42| keycode | character |
43|---------|-----------| 43|---------|-----------|
@@ -55,11 +55,11 @@ As the layout is generally fixed (unless you create your own), the firmware can
55 55
56## List of Characters You Can Send 56## List of Characters You Can Send
57 57
58Putting aside shortcuts, having a limited set of keycodes mapped to a limited layout means that **the list of characters you can assign to a given key only is the ones present in the layout**. 58Putting aside shortcuts, having a limited set of keycodes mapped to a limited layout means that **the list of characters you can assign to a given key are only the ones present in the layout**.
59 59
60For example, this means that if you have a QWERTY US layout, and you want to assign 1 key to produce `€` (euro currency symbol), you are unable to do so, because the QWERTY US layout does not have such mapping. You could fix that by using a QWERTY UK layout, or a QWERTY US International. 60For example, this means that if you have a QWERTY US layout, and you want to assign one key to produce `€` (euro currency symbol), you are unable to do so, because the QWERTY US layout does not have such mapping. You could fix that by using a QWERTY UK layout, or a QWERTY US International.
61 61
62You may wonder why a keyboard layout containing all of Unicode is not devised then? The limited number of keycode available through USB simply disallow such a thing. 62You may wonder why a keyboard layout containing all of Unicode is not devised then? The limited number of keycodes available through USB simply disallows such a thing.
63 63
64## How to (Maybe) Enter Unicode Characters 64## How to (Maybe) Enter Unicode Characters
65 65
diff --git a/docs/i2c_driver.md b/docs/i2c_driver.md
new file mode 100644
index 000000000..ea24dc64f
--- /dev/null
+++ b/docs/i2c_driver.md
@@ -0,0 +1,82 @@
1# I2C Master Driver
2
3The I2C Master drivers used in QMK have a set of common functions to allow portability between MCUs.
4
5## Available functions
6
7|Function |Description |
8|------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
9|`void i2c_init(void);` |Initializes the I2C driver. This function should be called once before any transaction is initiated. |
10|`uint8_t i2c_start(uint8_t address);` |Starts an I2C transaction. Address is the 7-bit slave address without the direction bit. |
11|`uint8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);` |Transmit data over I2C. Address is the 7-bit slave address without the direction. Returns status of transaction. |
12|`uint8_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);` |Receive data over I2C. Address is the 7-bit slave address without the direction. Saves number of bytes specified by `length` in `data` array. Returns status of transaction. |
13|`uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);` |Same as the `i2c_transmit` function but `regaddr` sets where in the slave the data will be written. |
14|`uint8_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);` |Same as the `i2c_receive` function but `regaddr` sets from where in the slave the data will be read. |
15|`uint8_t i2c_stop(uint16_t timeout);` |Stops the I2C driver. |
16
17### Function Return
18
19All the above functions, except `void i2c_init(void);` return the following truth table:
20
21|Return Value |Description |
22|---------------|---------------------------------------------------|
23|0 |Operation executed successfully. |
24|-1 |Operation failed. |
25|-2 |Operation timed out. |
26
27
28## AVR
29
30### Configuration
31
32The following defines can be used to configure the I2C master driver.
33
34|Variable |Description |Default|
35|------------------|---------------------------------------------------|-------|
36|`#F_SCL` |Clock frequency in Hz |400KHz |
37|`#Prescaler` |Divides master clock to aid in I2C clock selection |1 |
38
39AVRs usually have set GPIO which turn into I2C pins, therefore no further configuration is required.
40
41## ARM
42
43For ARM the Chibios I2C HAL driver is under the hood.
44This section assumes an STM32 MCU.
45
46### Configuration
47
48The configuration for ARM MCUs can be quite complex as often there are multiple I2C drivers which can be assigned to a variety of ports.
49
50Firstly the `mcuconf.h` file must be setup to enable the necessary hardware drivers.
51
52|Variable |Description |Default|
53|------------------------------|------------------------------------------------------------------------------------|-------|
54|`#STM32_I2C_USE_XXX` |Enable/Disable the hardware driver XXX (each driver should be explicitly listed) |FALSE |
55|`#STM32_I2C_BUSY_TIMEOUT` |Time in ms until the I2C command is aborted if no response is received |50 |
56|`#STM32_I2C_XXX_IRQ_PRIORITY` |Interrupt priority for hardware driver XXX (THIS IS AN EXPERT SETTING) |10 |
57|`#STM32_I2C_USE_DMA` |Enable/Disable the ability of the MCU to offload the data transfer to the DMA unit |TRUE |
58|`#STM32_I2C_XXX_DMA_PRIORITY` |Priority of DMA unit for hardware driver XXX (THIS IS AN EXPERT SETTING) |1 |
59
60Secondly, in the `halconf.h` file, `#define HAL_USE_I2C` must be set to `TRUE`. This allows ChibiOS to load its I2C driver.
61
62Lastly, we need to assign the correct GPIO pins depending on the I2C hardware driver we want to use.
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.
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.
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:
69
70```C
71void i2c_init(void)
72{
73 setPinInput(B6); // Try releasing special pins for a short time
74 setPinInput(B7);
75 chThdSleepMilliseconds(10); // Wait for the release to happen
76
77 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
79}
80```
81
82
diff --git a/docs/index.html b/docs/index.html
index f0b1fae07..f5aa92b53 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -25,7 +25,8 @@
25 placeholder: 'Search Documentation...', 25 placeholder: 'Search Documentation...',
26 noData: 'We could not find any documents matching your search.', 26 noData: 'We could not find any documents matching your search.',
27 depth: 6 27 depth: 6
28 } 28 },
29 fallbackLanguages: ['zh']
29 } 30 }
30 </script> 31 </script>
31 <script src="//unpkg.com/docsify/lib/docsify.min.js"></script> 32 <script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
diff --git a/docs/internals_gpio_control.md b/docs/internals_gpio_control.md
new file mode 100644
index 000000000..083e69664
--- /dev/null
+++ b/docs/internals_gpio_control.md
@@ -0,0 +1,23 @@
1# GPIO Control
2
3QMK has a GPIO control abstraction layer which is micro-controller agnostic. This is done to allow easy access to pin control across different platforms.
4
5## Functions
6
7The following functions can provide basic control of GPIOs and are found in `quantum/quantum.h`.
8
9|Function |Description |
10|----------------------|------------------------------------------------------------------|
11|`setPinInput(pin)` |Set pin as input with high impedance (High-Z) |
12|`setPinInputHigh(pin)`|Set pin as input with build in pull-up |
13|`setPinInputLow(pin)` |Set pin as input with build in pull-down (Supported only on STM32)|
14|`setPinOutput(pin)` |Set pin as output |
15|`writePinHigh(pin)` |Set pin level as high, assuming it is an output |
16|`writePinLow(pin)` |Set pin level as low, assuming it is an output |
17|`writePin(pin, level)`|Set pin level, assuming it is an output |
18|`readPin(pin)` |Returns the level of the pin |
19
20## Advance settings
21
22Each micro-controller can have multiple advance settings regarding its GPIO. This abstraction layer does not limit the use of architecture specific functions. Advance users should consult the datasheet of there desired device and include any needed libraries. For AVR the standard avr/io.h library is used and for STM32 the Chibios [PAL library](http://chibios.sourceforge.net/docs3/hal/group___p_a_l.html) is used.
23
diff --git a/docs/keycode.txt b/docs/keycode.txt
deleted file mode 100644
index b2070f711..000000000
--- a/docs/keycode.txt
+++ /dev/null
@@ -1,261 +0,0 @@
1Keycode Symbol Table
2====================
3Keycodes are defined in `common/keycode.h`.
4Range of 00-A4 and E0-E7 are identical with HID Usage:
5<http://www.usb.org/developers/hidpage/Hut1_12v2.pdf>
6Virtual keycodes are defined out of above range to support special actions.
7
8
9Keycode Symbol Short name Description
10--------------------------------------------------------------------------------
11KC_NO 00 Reserved (no event indicated)
12KC_ROLL_OVER 01 Keyboard ErrorRollOver
13KC_POST_FAIL 02 Keyboard POSTFail
14KC_UNDEFINED 03 Keyboard ErrorUndefined
15KC_A 04 Keyboard a and A
16KC_B 05 Keyboard b and B
17KC_C 06 Keyboard c and C
18KC_D 07 Keyboard d and D
19KC_E 08 Keyboard e and E
20KC_F 09 Keyboard f and F
21KC_G 0A Keyboard g and G
22KC_H 0B Keyboard h and H
23KC_I 0C Keyboard i and I
24KC_J 0D Keyboard j and J
25KC_K 0E Keyboard k and K
26KC_L 0F Keyboard l and L
27KC_M 10 Keyboard m and M
28KC_N 11 Keyboard n and N
29KC_O 12 Keyboard o and O
30KC_P 13 Keyboard p and P
31KC_Q 14 Keyboard q and Q
32KC_R 15 Keyboard r and R
33KC_S 16 Keyboard s and S
34KC_T 17 Keyboard t and T
35KC_U 18 Keyboard u and U
36KC_V 19 Keyboard v and V
37KC_W 1A Keyboard w and W
38KC_X 1B Keyboard x and X
39KC_Y 1C Keyboard y and Y
40KC_Z 1D Keyboard z and Z
41KC_1 1E Keyboard 1 and !
42KC_2 1F Keyboard 2 and @
43KC_3 20 Keyboard 3 and #
44KC_4 21 Keyboard 4 and $
45KC_5 22 Keyboard 5 and %
46KC_6 23 Keyboard 6 and ^
47KC_7 24 Keyboard 7 and &
48KC_8 25 Keyboard 8 and *
49KC_9 26 Keyboard 9 and (
50KC_0 27 Keyboard 0 and )
51KC_ENTER KC_ENT 28 Keyboard Return (ENTER)
52KC_ESCAPE KC_ESC 29 Keyboard ESCAPE
53KC_BSPACE KC_BSPC 2A Keyboard DELETE (Backspace)
54KC_TAB 2B Keyboard Tab
55KC_SPACE KC_SPC 2C Keyboard Spacebar
56KC_MINUS KC_MINS 2D Keyboard - and (underscore)
57KC_EQUAL KC_EQL 2E Keyboard = and +
58KC_LBRACKET KC_LBRC 2F Keyboard [ and {
59KC_RBRACKET KC_RBRC 30 Keyboard ] and }
60KC_BSLASH KC_BSLS 31 Keyboard \ and |
61KC_NONUS_HASH KC_NUHS 32 Keyboard Non-US # and ~
62KC_SCOLON KC_SCLN 33 Keyboard ; and :
63KC_QUOTE KC_QUOT 34 Keyboard ‘ and “
64KC_GRAVE KC_GRV 35 Keyboard Grave Accent and Tilde
65KC_COMMA KC_COMM 36 Keyboard , and <
66KC_DOT 37 Keyboard . and >
67KC_SLASH KC_SLSH 38 Keyboard / and ?
68KC_CAPSLOCK KC_CAPS 39 Keyboard Caps Lock
69KC_F1 3A Keyboard F1
70KC_F2 3B Keyboard F2
71KC_F3 3C Keyboard F3
72KC_F4 3D Keyboard F4
73KC_F5 3E Keyboard F5
74KC_F6 3F Keyboard F6
75KC_F7 40 Keyboard F7
76KC_F8 41 Keyboard F8
77KC_F9 42 Keyboard F9
78KC_F10 43 Keyboard F10
79KC_F11 44 Keyboard F11
80KC_F12 45 Keyboard F12
81KC_PSCREEN KC_PSCR 46 Keyboard PrintScreen
82KC_SCROLLLOCK KC_SLCK 47 Keyboard Scroll Lock
83KC_PAUSE KC_PAUS 48 Keyboard Pause
84KC_INSERT KC_INS 49 Keyboard Insert
85KC_HOME 4A Keyboard Home
86KC_PGUP 4B Keyboard PageUp
87KC_DELETE KC_DEL 4C Keyboard Delete Forward
88KC_END 4D Keyboard End
89KC_PGDOWN KC_PGDN 4E Keyboard PageDown
90KC_RIGHT KC_RGHT 4F Keyboard RightArrow
91KC_LEFT 50 Keyboard LeftArrow
92KC_DOWN 51 Keyboard DownArrow
93KC_UP 52 Keyboard UpArrow
94KC_NUMLOCK KC_NLCK 53 Keypad Num Lock and Clear
95KC_KP_SLASH KC_PSLS 54 Keypad /
96KC_KP_ASTERISK KC_PAST 55 Keypad *
97KC_KP_MINUS KC_PMNS 56 Keypad -
98KC_KP_PLUS KC_PPLS 57 Keypad +
99KC_KP_ENTER KC_PENT 58 Keypad ENTER
100KC_KP_1 KC_P1 59 Keypad 1 and End
101KC_KP_2 KC_P2 5A Keypad 2 and Down Arrow
102KC_KP_3 KC_P3 5B Keypad 3 and PageDn
103KC_KP_4 KC_P4 5C Keypad 4 and Left Arrow
104KC_KP_5 KC_P5 5D Keypad 5
105KC_KP_6 KC_P6 5E Keypad 6 and Right Arrow
106KC_KP_7 KC_P7 5F Keypad 7 and Home
107KC_KP_8 KC_P8 60 Keypad 8 and Up Arrow
108KC_KP_9 KC_P9 61 Keypad 9 and PageUp
109KC_KP_0 KC_P0 62 Keypad 0 and Insert
110KC_KP_DOT KC_PDOT 63 Keypad . and Delete
111KC_NONUS_BSLASH KC_NUBS 64 Keyboard Non-US \ and |
112KC_APPLICATION KC_APP 65 Keyboard Application
113KC_POWER 66 Keyboard Power
114KC_KP_EQUAL KC_PEQL 67 Keypad =
115KC_F13 68 Keyboard F13
116KC_F14 69 Keyboard F14
117KC_F15 6A Keyboard F15
118KC_F16 6B Keyboard F16
119KC_F17 6C Keyboard F17
120KC_F18 6D Keyboard F18
121KC_F19 6E Keyboard F19
122KC_F20 6F Keyboard F20
123KC_F21 70 Keyboard F21
124KC_F22 71 Keyboard F22
125KC_F23 72 Keyboard F23
126KC_F24 73 Keyboard F24
127KC_EXECUTE 74 Keyboard Execute
128KC_HELP 75 Keyboard Help
129KC_MENU 76 Keyboard Menu
130KC_SELECT 77 Keyboard Select
131KC_STOP 78 Keyboard Stop
132KC_AGAIN 79 Keyboard Again
133KC_UNDO 7A Keyboard Undo
134KC_CUT 7B Keyboard Cut
135KC_COPY 7C Keyboard Copy
136KC_PASTE 7D Keyboard Paste
137KC_FIND 7E Keyboard Find
138KC__MUTE 7F Keyboard Mute
139KC__VOLUP 80 Keyboard Volume Up
140KC__VOLDOWN 81 Keyboard Volume Down
141KC_LOCKING_CAPS 82 Keyboard Locking Caps Lock
142KC_LOCKING_NUM 83 Keyboard Locking Num Lock
143KC_LOCKING_SCROLL 84 Keyboard Locking Scroll Lock
144KC_KP_COMMA KC_PCMM 85 Keypad Comma
145KC_KP_EQUAL_AS400 86 Keypad Equal Sign
146KC_INT1 KC_RO 87 Keyboard International115
147KC_INT2 KC_KANA 88 Keyboard International216
148KC_INT3 KC_JYEN 89 Keyboard International317
149KC_INT4 KC_HENK 8A Keyboard International418
150KC_INT5 KC_MHEN 8B Keyboard International519
151KC_INT6 8C Keyboard International620
152KC_INT7 8D Keyboard International721
153KC_INT8 8E Keyboard International822
154KC_INT9 8F Keyboard International922
155KC_LANG1 90 Keyboard LANG125
156KC_LANG2 91 Keyboard LANG226
157KC_LANG3 92 Keyboard LANG330
158KC_LANG4 93 Keyboard LANG431
159KC_LANG5 94 Keyboard LANG532
160KC_LANG6 95 Keyboard LANG68
161KC_LANG7 96 Keyboard LANG78
162KC_LANG8 97 Keyboard LANG88
163KC_LANG9 98 Keyboard LANG98
164KC_ALT_ERASE 99 Keyboard Alternate Erase
165KC_SYSREQ 9A Keyboard SysReq/Attention
166KC_CANCEL 9B Keyboard Cancel
167KC_CLEAR 9C Keyboard Clear
168KC_PRIOR 9D Keyboard Prior
169KC_RETURN 9E Keyboard Return
170KC_SEPARATOR 9F Keyboard Separator
171KC_OUT A0 Keyboard Out
172KC_OPER A1 Keyboard Oper
173KC_CLEAR_AGAIN A2 Keyboard Clear/Again
174KC_CRSEL A3 Keyboard CrSel/Props
175KC_EXSEL A4 Keyboard ExSel
176/* Modifiers */
177KC_LCTRL KC_LCTL E0 Keyboard LeftControl
178KC_LSHIFT KC_LSFT E1 Keyboard LeftShift
179KC_LALT E2 Keyboard LeftAlt
180KC_LGUI E3 Keyboard Left GUI(Windows/Apple/Meta key)
181KC_RCTRL KC_RCTL E4 Keyboard RightControl
182KC_RSHIFT KC_RSFT E5 Keyboard RightShift
183KC_RALT E6 Keyboard RightAlt
184KC_RGUI E7 Keyboard Right GUI(Windows/Apple/Meta key)
185
186/*
187 * Virtual keycodes
188 */
189/* System Control */
190KC_SYSTEM_POWER KC_PWR System Power Down
191KC_SYSTEM_SLEEP KC_SLEP System Sleep
192KC_SYSTEM_WAKE KC_WAKE System Wake
193/* Consumer Page */
194KC_AUDIO_MUTE KC_MUTE
195KC_AUDIO_VOL_UP KC_VOLU
196KC_AUDIO_VOL_DOWN KC_VOLD
197KC_MEDIA_NEXT_TRACK KC_MNXT
198KC_MEDIA_PREV_TRACK KC_MPRV
199KC_MEDIA_STOP KC_MSTP
200KC_MEDIA_PLAY_PAUSE KC_MPLY
201KC_MEDIA_SELECT KC_MSEL
202KC_MAIL KC_MAIL
203KC_CALCULATOR KC_CALC
204KC_MY_COMPUTER KC_MYCM
205KC_WWW_SEARCH KC_WSCH
206KC_WWW_HOME KC_WHOM
207KC_WWW_BACK KC_WBAK
208KC_WWW_FORWARD KC_WFWD
209KC_WWW_STOP KC_WSTP
210KC_WWW_REFRESH KC_WREF
211KC_WWW_FAVORITES KC_WFAV
212/* Mousekey */
213KC_MS_UP KC_MS_U Mouse Cursor Up
214KC_MS_DOWN KC_MS_D Mouse Cursor Down
215KC_MS_LEFT KC_MS_L Mouse Cursor Left
216KC_MS_RIGHT KC_MS_R Mouse Cursor Right
217KC_MS_BTN1 KC_BTN1 Mouse Button 1
218KC_MS_BTN2 KC_BTN2 Mouse Button 2
219KC_MS_BTN3 KC_BTN3 Mouse Button 3
220KC_MS_BTN4 KC_BTN4 Mouse Button 4
221KC_MS_BTN5 KC_BTN5 Mouse Button 5
222KC_MS_WH_UP KC_WH_U Mouse Wheel Up
223KC_MS_WH_DOWN KC_WH_D Mouse Wheel Down
224KC_MS_WH_LEFT KC_WH_L Mouse Wheel Left
225KC_MS_WH_RIGHT KC_WH_R Mouse Wheel Right
226KC_MS_ACCEL0 KC_ACL0 Mouse Acceleration 0
227KC_MS_ACCEL1 KC_ACL1 Mouse Acceleration 1
228KC_MS_ACCEL2 KC_ACL2 Mouse Acceleration 2
229/* Fn key */
230KC_FN0
231KC_FN1
232KC_FN2
233KC_FN3
234KC_FN4
235KC_FN5
236KC_FN6
237KC_FN7
238KC_FN8
239KC_FN9
240KC_FN10
241KC_FN11
242KC_FN12
243KC_FN13
244KC_FN14
245KC_FN15
246KC_FN16
247KC_FN17
248KC_FN18
249KC_FN19
250KC_FN20
251KC_FN21
252KC_FN22
253KC_FN23
254KC_FN24
255KC_FN25
256KC_FN26
257KC_FN27
258KC_FN28
259KC_FN29
260KC_FN30
261KC_FN31
diff --git a/docs/keycodes.md b/docs/keycodes.md
index fd3776bb7..6d8525393 100644
--- a/docs/keycodes.md
+++ b/docs/keycodes.md
@@ -141,9 +141,9 @@ This is a reference only. Each group of keys links to the page documenting their
141|`KC_LOCKING_SCROLL` |`KC_LSCR` |Locking Scroll Lock | 141|`KC_LOCKING_SCROLL` |`KC_LSCR` |Locking Scroll Lock |
142|`KC_KP_COMMA` |`KC_PCMM` |Keypad `,` | 142|`KC_KP_COMMA` |`KC_PCMM` |Keypad `,` |
143|`KC_KP_EQUAL_AS400` | |Keypad `=` on AS/400 keyboards | 143|`KC_KP_EQUAL_AS400` | |Keypad `=` on AS/400 keyboards |
144|`KC_INT1` |`KC_RO` |JIS `\` and <code>&#124;</code> | 144|`KC_INT1` |`KC_RO` |JIS `\` and `_` |
145|`KC_INT2` |`KC_KANA` |JIS Katakana/Hiragana | 145|`KC_INT2` |`KC_KANA` |JIS Katakana/Hiragana |
146|`KC_INT3` |`KC_JYEN` |JIS `¥` | 146|`KC_INT3` |`KC_JYEN` |JIS `¥` and <code>&#124;</code> |
147|`KC_INT4` |`KC_HENK` |JIS Henkan | 147|`KC_INT4` |`KC_HENK` |JIS Henkan |
148|`KC_INT5` |`KC_MHEN` |JIS Muhenkan | 148|`KC_INT5` |`KC_MHEN` |JIS Muhenkan |
149|`KC_INT6` | |JIS Numpad `,` | 149|`KC_INT6` | |JIS Numpad `,` |
@@ -177,7 +177,7 @@ This is a reference only. Each group of keys links to the page documenting their
177|`KC_LGUI` |`KC_LCMD`, `KC_LWIN`|Left GUI (Windows/Command/Meta key) | 177|`KC_LGUI` |`KC_LCMD`, `KC_LWIN`|Left GUI (Windows/Command/Meta key) |
178|`KC_RCTRL` |`KC_RCTL` |Right Control | 178|`KC_RCTRL` |`KC_RCTL` |Right Control |
179|`KC_RSHIFT` |`KC_RSFT` |Right Shift | 179|`KC_RSHIFT` |`KC_RSFT` |Right Shift |
180|`KC_RALT` | |Right Alt | 180|`KC_RALT` |`KC_ALGR` |Right Alt (AltGr) |
181|`KC_RGUI` |`KC_RCMD`, `KC_RWIN`|Right GUI (Windows/Command/Meta key) | 181|`KC_RGUI` |`KC_RCMD`, `KC_RWIN`|Right GUI (Windows/Command/Meta key) |
182|`KC_SYSTEM_POWER` |`KC_PWR` |System Power Down | 182|`KC_SYSTEM_POWER` |`KC_PWR` |System Power Down |
183|`KC_SYSTEM_SLEEP` |`KC_SLEP` |System Sleep | 183|`KC_SYSTEM_SLEEP` |`KC_SLEP` |System Sleep |
@@ -203,29 +203,32 @@ This is a reference only. Each group of keys links to the page documenting their
203|`KC_WWW_FAVORITES` |`KC_WFAV` |Browser Favorites (Windows) | 203|`KC_WWW_FAVORITES` |`KC_WFAV` |Browser Favorites (Windows) |
204|`KC_MEDIA_FAST_FORWARD`|`KC_MFFD` |Next Track (macOS) | 204|`KC_MEDIA_FAST_FORWARD`|`KC_MFFD` |Next Track (macOS) |
205|`KC_MEDIA_REWIND` |`KC_MRWD` |Previous Track (macOS) | 205|`KC_MEDIA_REWIND` |`KC_MRWD` |Previous Track (macOS) |
206|`KC_BRIGHTNESS_UP` |`KC_BRIU` |Brightness Up |
207|`KC_BRIGHTNESS_DOWN` |`KC_BRID` |Brightness Down |
206 208
207## [Quantum Keycodes](quantum_keycodes.md#qmk-keycodes) 209## [Quantum Keycodes](quantum_keycodes.md#qmk-keycodes)
208 210
209|Key |Aliases |Description | 211|Key |Aliases |Description |
210|-------------|-----------|---------------------------------------------------------------------| 212|---------------|-----------|---------------------------------------------------------------------|
211|`RESET` | |Put the keyboard into DFU mode for flashing | 213|`RESET` | |Put the keyboard into DFU mode for flashing |
212|`DEBUG` | |Toggle debug mode | 214|`DEBUG` | |Toggle debug mode |
213|`KC_GESC` |`GRAVE_ESC`|Escape when tapped, <code>&#96;</code> when pressed with Shift or GUI| 215|`EEPROM_RESET` |`EEP_RST` |Resets EEPROM state by reinitializing it |
214|`KC_LSPO` | |Left Shift when held, `(` when tapped | 216|`KC_GESC` |`GRAVE_ESC`|Escape when tapped, <code>&#96;</code> when pressed with Shift or GUI|
215|`KC_RSPC` | |Right Shift when held, `)` when tapped | 217|`KC_LSPO` | |Left Shift when held, `(` when tapped |
216|`KC_LEAD` | |The [Leader key](feature_leader_key.md) | 218|`KC_RSPC` | |Right Shift when held, `)` when tapped |
217|`KC_LOCK` | |The [Lock key](feature_key_lock.md) | 219|`KC_LEAD` | |The [Leader key](feature_leader_key.md) |
218|`FUNC(n)` |`F(n)` |Call `fn_action(n)` (deprecated) | 220|`KC_LOCK` | |The [Lock key](feature_key_lock.md) |
219|`M(n)` | |Call macro `n` | 221|`FUNC(n)` |`F(n)` |Call `fn_action(n)` (deprecated) |
220|`MACROTAP(n)`| |Macro-tap `n` idk FIXME | 222|`M(n)` | |Call macro `n` |
223|`MACROTAP(n)` | |Macro-tap `n` idk FIXME |
221 224
222## [Audio Keys](feature_audio.md) 225## [Audio Keys](feature_audio.md)
223 226
224|Key |Aliases |Description | 227|Key |Aliases |Description |
225|----------------|---------|----------------------------------| 228|----------------|---------|----------------------------------|
226|`AU_ON` | |Audio mode on | 229|`AU_ON` | |Turns on Audio Feature |
227|`AU_OFF` | |Audio mode off | 230|`AU_OFF` | |Turns off Audio Feature |
228|`AU_TOG` | |Toggles Audio mode | 231|`AU_TOG` | |Toggles Audio state |
229|`CLICKY_TOGGLE` |`CK_TOGG`|Toggles Audio clicky mode | 232|`CLICKY_TOGGLE` |`CK_TOGG`|Toggles Audio clicky mode |
230|`CLICKY_UP` |`CK_UP` |Increases frequency of the clicks | 233|`CLICKY_UP` |`CK_UP` |Increases frequency of the clicks |
231|`CLICKY_DOWN` |`CK_DOWN`|Decreases frequency of the clicks | 234|`CLICKY_DOWN` |`CK_DOWN`|Decreases frequency of the clicks |
@@ -271,6 +274,7 @@ This is a reference only. Each group of keys links to the page documenting their
271|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`| |Unswap `\` and Backspace | 274|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`| |Unswap `\` and Backspace |
272|`MAGIC_UNHOST_NKRO` | |Force NKRO off | 275|`MAGIC_UNHOST_NKRO` | |Force NKRO off |
273|`MAGIC_UNSWAP_ALT_GUI` |`AG_NORM`|Unswap Alt and GUI on both sides | 276|`MAGIC_UNSWAP_ALT_GUI` |`AG_NORM`|Unswap Alt and GUI on both sides |
277|`MAGIC_TOGGLE_ALT_GUI` |`AG_TOGG`|Toggle Alt and GUI swap on both sides|
274|`MAGIC_TOGGLE_NKRO` | |Turn NKRO on or off | 278|`MAGIC_TOGGLE_NKRO` | |Turn NKRO on or off |
275 279
276## [Bluetooth](feature_bluetooth.md) 280## [Bluetooth](feature_bluetooth.md)
@@ -284,15 +288,16 @@ This is a reference only. Each group of keys links to the page documenting their
284 288
285## [Layer Switching](feature_advanced_keycodes.md#switching-and-toggling-layers) 289## [Layer Switching](feature_advanced_keycodes.md#switching-and-toggling-layers)
286 290
287|Key |Description | 291|Key |Description |
288|-----------------|---------------------------------------------------------------------| 292|----------------|----------------------------------------------------------------------------------|
289|`DF(layer)` |Switches the default layer | 293|`DF(layer)` |Set the base (default) layer |
290|`MO(layer)` |Momentarily activates layer, switches off when you let go | 294|`MO(layer)` |Momentarily turn on `layer` when pressed (requires `KC_TRNS` on destination layer)|
291|`LM(layer, mod)` |As `MO(layer)` but with `mod` active | 295|`OSL(layer)` |Momentarily activates `layer` until a key is pressed. See [One Shot Keys](https://docs.qmk.fm/#/feature_advanced_keycodes?id=one-shot-keys) for details. |
292|`LT(layer, kc)` |Momentarily activates layer if held, sends kc if tapped | 296|`LM(layer, mod)`|Momentarily turn on `layer` (like MO) with `mod` active as well.
293|`TG(layer)` |Toggles the layer (enables it if no active, and vise versa) | 297|`LT(layer, kc)` |Turn on `layer` when held, `kc` when tapped |
294|`TO(layer)` |Activates layer and deactivates all other layers | 298|`TG(layer)` |Toggle `layer` on or off |
295|`TT(layer)` |Momentarily activates layer if held, toggles it if tapped repeatedly | 299|`TO(layer)` |Turn on `layer` when pressed |
300|`TT(layer)` |Normally acts like MO unless it's tapped multiple times, which toggles `layer` on |
296 301
297## [Mouse Keys](feature_mouse_keys.md) 302## [Mouse Keys](feature_mouse_keys.md)
298 303
@@ -318,7 +323,7 @@ This is a reference only. Each group of keys links to the page documenting their
318## [Modifiers](feature_advanced_keycodes.md#modifier-keys) 323## [Modifiers](feature_advanced_keycodes.md#modifier-keys)
319 324
320|Key |Aliases |Description | 325|Key |Aliases |Description |
321|----------|---------- |----------------------------------------------------| 326|----------|----------------------|----------------------------------------------------|
322|`KC_HYPR` | |Hold Left Control, Shift, Alt and GUI | 327|`KC_HYPR` | |Hold Left Control, Shift, Alt and GUI |
323|`KC_MEH` | |Hold Left Control, Shift and Alt | 328|`KC_MEH` | |Hold Left Control, Shift and Alt |
324|`LCTL(kc)`| |Hold Left Control and press `kc` | 329|`LCTL(kc)`| |Hold Left Control and press `kc` |
@@ -327,12 +332,11 @@ This is a reference only. Each group of keys links to the page documenting their
327|`LGUI(kc)`|`LCMD(kc)`, `LWIN(kc)`|Hold Left GUI and press `kc` | 332|`LGUI(kc)`|`LCMD(kc)`, `LWIN(kc)`|Hold Left GUI and press `kc` |
328|`RCTL(kc)`| |Hold Right Control and press `kc` | 333|`RCTL(kc)`| |Hold Right Control and press `kc` |
329|`RSFT(kc)`| |Hold Right Shift and press `kc` | 334|`RSFT(kc)`| |Hold Right Shift and press `kc` |
330|`RALT(kc)`| |Hold Right Alt and press `kc` | 335|`RALT(kc)`|`ALGR(kc)` |Hold Right Alt and press `kc` |
331|`RGUI(kc)`|`RCMD(kc)`, `LWIN(kc)`|Hold Right GUI and press `kc` | 336|`RGUI(kc)`|`RCMD(kc)`, `LWIN(kc)`|Hold Right GUI and press `kc` |
332|`HYPR(kc)`| |Hold Left Control, Shift, Alt and GUI and press `kc`| 337|`HYPR(kc)`| |Hold Left Control, Shift, Alt and GUI and press `kc`|
333|`MEH(kc)` | |Hold Left Control, Shift and Alt and press `kc` | 338|`MEH(kc)` | |Hold Left Control, Shift and Alt and press `kc` |
334|`LCAG(kc)`| |Hold Left Control, Alt and GUI and press `kc` | 339|`LCAG(kc)`| |Hold Left Control, Alt and GUI and press `kc` |
335|`ALTG(kc)`| |Hold Right Control and Alt and press `kc` |
336|`SGUI(kc)`|`SCMD(kc)`, `SWIN(kc)`|Hold Left Shift and GUI and press `kc` | 340|`SGUI(kc)`|`SCMD(kc)`, `SWIN(kc)`|Hold Left Shift and GUI and press `kc` |
337|`LCA(kc)` | |Hold Left Control and Alt and press `kc` | 341|`LCA(kc)` | |Hold Left Control and Alt and press `kc` |
338 342
@@ -353,7 +357,7 @@ This is a reference only. Each group of keys links to the page documenting their
353|`LCAG_T(kc)`| |Left Control, Alt and GUI when held, `kc` when tapped | 357|`LCAG_T(kc)`| |Left Control, Alt and GUI when held, `kc` when tapped |
354|`RCAG_T(kc)`| |Right Control, Alt and GUI when held, `kc` when tapped | 358|`RCAG_T(kc)`| |Right Control, Alt and GUI when held, `kc` when tapped |
355|`ALL_T(kc)` | |Left Control, Shift, Alt and GUI when held, `kc` when tapped - more info [here](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)| 359|`ALL_T(kc)` | |Left Control, Shift, Alt and GUI when held, `kc` when tapped - more info [here](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)|
356|`SCMD_T(kc)`|`SWIN_T(kc)` |Left Shift and GUI when held, `kc` when tapped | 360|`SGUI_T(kc)`|`SCMD_T(kc)`, `SWIN_T(kc)` |Left Shift and GUI when held, `kc` when tapped |
357|`LCA_T(kc)` | |Left Control and Alt when held, `kc` when tapped | 361|`LCA_T(kc)` | |Left Control and Alt when held, `kc` when tapped |
358 362
359## [RGB Lighting](feature_rgblight.md) 363## [RGB Lighting](feature_rgblight.md)
@@ -428,18 +432,6 @@ This is a reference only. Each group of keys links to the page documenting their
428|`KC_RIGHT_ANGLE_BRACKET`|`KC_RABK`, `KC_GT` |`>` | 432|`KC_RIGHT_ANGLE_BRACKET`|`KC_RABK`, `KC_GT` |`>` |
429|`KC_QUESTION` |`KC_QUES` |`?` | 433|`KC_QUESTION` |`KC_QUES` |`?` |
430 434
431## [Switching and Toggling Layers](feature_advanced_keycodes.md#switching-and-toggling-layers)
432
433|Key |Description |
434|----------------|----------------------------------------------------------------------------------|
435|`LT(layer, kc)` |Turn on `layer` when held, `kc` when tapped |
436|`TO(layer)` |Turn on `layer` when pressed |
437|`MO(layer)` |Momentarily turn on `layer` when pressed (requires `KC_TRNS` on destination layer)|
438|`DF(layer)` |Set the base (default) layer |
439|`TG(layer)` |Toggle `layer` on or off |
440|`TT(layer)` |Normally acts like MO unless it's tapped multiple times, which toggles `layer` on |
441|`LM(layer, mod)`|Momentarily turn on `layer` (like MO) with `mod` active as well. |
442
443## [One Shot Keys](feature_advanced_keycodes.md#one-shot-keys) 435## [One Shot Keys](feature_advanced_keycodes.md#one-shot-keys)
444 436
445|Key |Description | 437|Key |Description |
@@ -459,6 +451,7 @@ This is a reference only. Each group of keys links to the page documenting their
459|`SH_MOFF` |Momentarily turns off swap. | 451|`SH_MOFF` |Momentarily turns off swap. |
460|`SH_TG` |Toggles swap on and off with every key press. | 452|`SH_TG` |Toggles swap on and off with every key press. |
461|`SH_TT` |Toggles with a tap; momentary when held. | 453|`SH_TT` |Toggles with a tap; momentary when held. |
454
462## [Unicode Support](feature_unicode.md) 455## [Unicode Support](feature_unicode.md)
463 456
464|Key |Aliases| | 457|Key |Aliases| |
diff --git a/docs/keycodes_basic.md b/docs/keycodes_basic.md
index 8445b05ef..cba876d34 100644
--- a/docs/keycodes_basic.md
+++ b/docs/keycodes_basic.md
@@ -1,6 +1,6 @@
1# Basic Keycodes 1# Basic Keycodes
2 2
3The basic set of keycodes are based on the [HID Keyboard/Keypad Usage Page (0x07)](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) with the exception of `KC_NO`, `KC_TRNS` and keycodes in the `0xA5-DF` range. See below for more details. 3The basic set of keycodes are based on the [HID Keyboard/Keypad Usage Page (0x07)](https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf) with the exception of `KC_NO`, `KC_TRNS` and keycodes in the `0xA5-DF` range. See below for more details.
4 4
5## Letters and Numbers 5## Letters and Numbers
6 6
@@ -116,16 +116,16 @@ The basic set of keycodes are based on the [HID Keyboard/Keypad Usage Page (0x07
116|`KC_LGUI` |`KC_LCMD`, `KC_LWIN`|Left GUI (Windows/Command/Meta key) | 116|`KC_LGUI` |`KC_LCMD`, `KC_LWIN`|Left GUI (Windows/Command/Meta key) |
117|`KC_RCTRL` |`KC_RCTL` |Right Control | 117|`KC_RCTRL` |`KC_RCTL` |Right Control |
118|`KC_RSHIFT`|`KC_RSFT` |Right Shift | 118|`KC_RSHIFT`|`KC_RSFT` |Right Shift |
119|`KC_RALT` | |Right Alt | 119|`KC_RALT` |`KC_ALGR` |Right Alt (AltGr) |
120|`KC_RGUI` |`KC_RCMD`, `KC_RWIN`|Right GUI (Windows/Command/Meta key)| 120|`KC_RGUI` |`KC_RCMD`, `KC_RWIN`|Right GUI (Windows/Command/Meta key)|
121 121
122## International 122## International
123 123
124|Key |Aliases |Description | 124|Key |Aliases |Description |
125|----------|---------|-------------------------------| 125|----------|---------|-------------------------------|
126|`KC_INT1` |`KC_RO` |JIS `\` and <code>&#124;</code>| 126|`KC_INT1` |`KC_RO` |JIS `\` and `_` |
127|`KC_INT2` |`KC_KANA`|JIS Katakana/Hiragana | 127|`KC_INT2` |`KC_KANA`|JIS Katakana/Hiragana |
128|`KC_INT3` |`KC_JYEN`|JIS `¥` | 128|`KC_INT3` |`KC_JYEN`|JIS `¥` and <code>&#124;</code>|
129|`KC_INT4` |`KC_HENK`|JIS Henkan | 129|`KC_INT4` |`KC_HENK`|JIS Henkan |
130|`KC_INT5` |`KC_MHEN`|JIS Muhenkan | 130|`KC_INT5` |`KC_MHEN`|JIS Muhenkan |
131|`KC_INT6` | |JIS Numpad `,` | 131|`KC_INT6` | |JIS Numpad `,` |
@@ -219,6 +219,8 @@ Windows and macOS use different keycodes for "next track" and "previous track".
219|`KC_WWW_FAVORITES` |`KC_WFAV`|Browser Favorites (Windows) | 219|`KC_WWW_FAVORITES` |`KC_WFAV`|Browser Favorites (Windows) |
220|`KC_MEDIA_FAST_FORWARD`|`KC_MFFD`|Next Track (macOS) | 220|`KC_MEDIA_FAST_FORWARD`|`KC_MFFD`|Next Track (macOS) |
221|`KC_MEDIA_REWIND` |`KC_MRWD`|Previous Track (macOS) | 221|`KC_MEDIA_REWIND` |`KC_MRWD`|Previous Track (macOS) |
222|`KC_BRIGHTNESS_UP` |`KC_BRIU`|Brightness Up |
223|`KC_BRIGHTNESS_DOWN` |`KC_BRID`|Brightness Down |
222 224
223## Number Pad 225## Number Pad
224 226
diff --git a/docs/keycodes_us_ansi_shifted.md b/docs/keycodes_us_ansi_shifted.md
index e7abaa709..41d603592 100644
--- a/docs/keycodes_us_ansi_shifted.md
+++ b/docs/keycodes_us_ansi_shifted.md
@@ -6,6 +6,10 @@ These keycodes correspond to characters that are "shifted" on a standard US ANSI
6 6
7Unfortunately, these keycodes cannot be used in Mod-Taps or Layer-Taps, since any modifiers specified in the keycode are ignored. 7Unfortunately, these keycodes cannot be used in Mod-Taps or Layer-Taps, since any modifiers specified in the keycode are ignored.
8 8
9Additionally, you may run into issues when using Remote Desktop Connection on Windows. Because these codes send shift very fast, Remote Desktop may miss the codes.
10
11To fix this, open Remote Desktop Connection, click on "Show Options", open the the "Local Resources" tab. In the keyboard section, change the drop down to "On this Computer". This will fix the issue, and allow the characters to work correctly.
12
9## Keycodes 13## Keycodes
10 14
11|Key |Aliases |Description | 15|Key |Aliases |Description |
diff --git a/docs/keymap.md b/docs/keymap.md
index b28d21a21..382a0e911 100644
--- a/docs/keymap.md
+++ b/docs/keymap.md
@@ -89,11 +89,15 @@ There are 3 main sections of a `keymap.c` file you'll want to concern yourself w
89 89
90At the top of the file you'll find this: 90At the top of the file you'll find this:
91 91
92 #include "clueboard.h" 92 #include QMK_KEYBOARD_H
93 93
94 // Helpful defines 94 // Helpful defines
95 #define GRAVE_MODS (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)|MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT)) 95 #define GRAVE_MODS (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)|MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
96 #define _______ KC_TRNS 96
97 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
98 * You can use _______ in place for KC_TRNS (transparent) *
99 * Or you can use XXXXXXX for KC_NO (NOOP) *
100 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
97 101
98 // Each layer gets a name for readability. 102 // Each layer gets a name for readability.
99 // The underscores don't mean anything - you can 103 // The underscores don't mean anything - you can
@@ -105,7 +109,9 @@ At the top of the file you'll find this:
105 #define _FL 1 109 #define _FL 1
106 #define _CL 2 110 #define _CL 2
107 111
108These are some handy definitions we can use when building our keymap and our custom function. The `GRAVE_MODS` definition will be used later in our custom function. The `_______` define makes it easier to see what keys a layer is overriding, while the `_BL`, `_FL`, and `_CL` defines make it easier to refer to each of our layers. 112These are some handy definitions we can use when building our keymap and our custom function. The `GRAVE_MODS` definition will be used later in our custom function, and the following `_BL`, `_FL`, and `_CL` defines make it easier to refer to each of our layers.
113
114Note: 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 unecessary, as they are included by default.
109 115
110### Layers and Keymaps 116### Layers and Keymaps
111 117
diff --git a/docs/newbs.md b/docs/newbs.md
index 87933b018..4f115c3c7 100644
--- a/docs/newbs.md
+++ b/docs/newbs.md
@@ -6,13 +6,17 @@ 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 4 main sections to this guide: 9There are 6 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](newbs_building_firmware.md)
13* [Flashing Firmware](newbs_flashing.md) 13* [Flashing Firmware](newbs_flashing.md)
14* [Testing and Debugging](newbs_testing_debugging.md) 14* [Testing and Debugging](newbs_testing_debugging.md)
15* [Git Best Practices](newbs_best_practices.md)
15* [Learn More with these Resources](newbs_learn_more_resources.md) 16* [Learn More with these Resources](newbs_learn_more_resources.md)
16 17
17This guide is focused on helping someone who has never compiled software before. It makes choices and recommendations based on that viewpoint. There are alternative methods for many of these procedures, and we support most of those alternatives. If you have any doubt about how to accomplish a task you can [ask us for guidance](getting_started_getting_help.md). 18This guide is focused on helping someone who has never compiled software before. It makes choices and recommendations based on that viewpoint. There are alternative methods for many of these procedures, and we support most of those alternatives. If you have any doubt about how to accomplish a task you can [ask us for guidance](getting_started_getting_help.md).
18 19
20## Additional Resources
21
22* [Thomas Baart's QMK Basics Blog](https://thomasbaart.nl/category/mechanical-keyboards/firmware/qmk/qmk-basics/) – A user-created blog covering the basics of how to use QMK Firmware, as seen from a new user's perspective.
diff --git a/docs/newbs_best_practices.md b/docs/newbs_best_practices.md
new file mode 100644
index 000000000..61bcc0c6a
--- /dev/null
+++ b/docs/newbs_best_practices.md
@@ -0,0 +1,163 @@
1# Best Practices
2
3## Or, "How I Learned to Stop Worrying and Love Git."
4
5This document aims to instruct novices in the best ways to have a smooth experience in contributing to QMK. We will walk through the process of contributing to QMK, detailing some ways to make this task easier, and then later we'll break some things in order to teach you how to fix them.
6
7This document assumes a few things:
8
91. You have a GitHub account, and have [forked the qmk_firmware repository](getting_started_github.md) to your account.
102. You've [set up your build environment](newbs_getting_started.md?id=environment-setup).
11
12
13## Your fork's master: Update Often, Commit Never
14
15It is highly recommended for QMK development, regardless of what is being done or where, to keep your `master` branch updated, but ***never*** commit to it. Instead, do all your changes in a development branch and issue pull requests from your branches when you're developing.
16
17To reduce the chances of merge conflicts &mdash; instances where two or more users have edited the same part of a file concurrently &mdash; keep your `master` branch relatively up-to-date, and start any new developments by creating a new branch.
18
19### Updating your master branch
20
21To keep your `master` branch updated, it is recommended to add the QMK Firmware repository ("repo") as a remote repository in git. To do this, open your Git command line interface and enter:
22
23```
24git remote add upstream https://github.com/qmk/qmk_firmware.git
25```
26
27To verify that the repository has been added, run `git remote -v`, which should return the following:
28
29```
30$ git remote -v
31origin https://github.com/<your_username>/qmk_firmware.git (fetch)
32origin https://github.com/<your_username>/qmk_firmware.git (push)
33upstream https://github.com/qmk/qmk_firmware.git (fetch)
34upstream https://github.com/qmk/qmk_firmware.git (push)
35```
36
37Now that this is done, you can check for updates to the repo by running `git fetch upstream`. This retrieves the branches and tags &mdash; collectively referred to as "refs" &mdash; from the QMK repo, which now has the nickname `upstream`. We can now compare the data on our fork `origin` to that held by QMK.
38
39To update your fork's master, run the following, hitting the Enter key after each line:
40
41```
42git checkout master
43git fetch upstream
44git pull upstream master
45git push origin master
46```
47
48This switches you to your `master` branch, retrieves the refs from the QMK repo, downloads the current QMK `master` branch to your computer, and then uploads it to your fork.
49
50### Making Changes
51
52To make changes, create a new branch by entering:
53
54```
55git checkout -b dev_branch
56git push --set-upstream origin dev_branch
57```
58
59This creates a new branch named `dev_branch`, checks it out, and then saves the new branch to your fork. The `--set-upstream` argument tells git to use your fork and the `dev_branch` branch every time you use `git push` or `git pull` from this branch. It only needs to be used on the first push; after that, you can safely use `git push` or `git pull`, without the rest of the arguments.
60
61!> With `git push`, you can use `-u` in place of `--set-upstream` &mdash; `-u` is an alias for `--set-upstream`.
62
63You can name your branch nearly anything you want, though it is recommended to name it something related to the changes you are going to make.
64
65By default `git checkout -b` will base your new branch on the branch that is checked out. You can base your new branch on an existing branch that is not checked out by adding the name of the existing branch to the command:
66
67```
68git checkout -b dev_branch master
69```
70
71Now that you have a development branch, open your text editor and make whatever changes you need to make. It is recommended to make many small commits to your branch; that way, any change that causes issues can be more easily traced and undone if needed. To make your changes, edit and save any files that need to be updated, add them to Git's *staging area*, and then commit them to your branch:
72
73```
74git add path/to/updated_file
75git commit -m "My commit message."
76```
77
78`git add` adds files that have been changed to Git's *staging area*, which is Git's "loading zone." This contains the changes that are going to be *committed* by `git commit`, which saves the changes to the repo. Use descriptive commit messages so you can know what was changed at a glance.
79
80!> If you've changed a lot of files, but all the files are part of the same change, you can use `git add .` to add all the changed files that are in your current directory, rather than having to add each file individually.
81
82### Publishing Your Changes
83
84The last step is to push your changes to your fork. To do this, enter `git push`. Git now publishes the current state of `dev_branch` to your fork.
85
86
87## Resolving Merge Conflicts
88
89Sometimes when your work in a branch takes a long time to complete, changes that have been made by others conflict with changes you have made to your branch when you open a pull request. This is called a *merge conflict*, and is what happens when multiple people edit the same parts of the same files.
90
91### Rebasing Your Changes
92
93A *rebase* is Git's way of taking changes that were applied at one point, reversing them, and then applying the same changes to another point. In the case of a merge conflict, you can rebase your branch to grab the changes that were made between when you created your branch and the present time.
94
95To start, run the following:
96
97```
98git fetch upstream
99git rev-list --left-right --count HEAD...upstream/master
100```
101
102The `git rev-list` command entered here returns the number of commits that differ between the current branch and QMK's master branch. We run `git fetch` first to make sure we have the refs that represent the current state of the upstream repo. The output of the `git rev-list` command entered returns two numbers:
103
104```
105$ git rev-list --left-right --count HEAD...upstream/master
1067 35
107```
108
109The first number represents the number of commits on the current branch since it was created, and the second number is the number of commits made to `upstream/master` since the current branch was created, and thus, the changes that are not recorded in the current branch.
110
111Now that the current states of both the current branch and the upstream repo are known, we can start a rebase operation:
112
113```
114git rebase upstream/master
115```
116
117This tells Git to undo the commits on the current branch, and then reapply them against QMK's master branch.
118
119```
120$ git rebase upstream/master
121First, rewinding head to replay your work on top of it...
122Applying: Commit #1
123Using index info to reconstruct a base tree...
124M conflicting_file_1.txt
125Falling back to patching base and 3-way merge...
126Auto-merging conflicting_file_1.txt
127CONFLICT (content): Merge conflict in conflicting_file_1.txt
128error: Failed to merge in the changes.
129hint: Use 'git am --show-current-patch' to see the failed patch
130Patch failed at 0001 Commit #1
131
132Resolve all conflicts manually, mark them as resolved with
133"git add/rm <conflicted_files>", then run "git rebase --continue".
134You can instead skip this commit: run "git rebase --skip".
135To abort and get back to the state before "git rebase", run "git rebase --abort".
136```
137
138This tells us that we have a merge conflict, and gives the name of the file with the conflict. Open the conflicting file in your text editor, and somewhere in the file, you'll find something like this:
139
140```
141<<<<<<< HEAD
142<p>For help with any issues, email us at support@webhost.us.</p>
143=======
144<p>Need help? Email support@webhost.us.</p>
145>>>>>>> Commit #1
146```
147
148The line `<<<<<<< HEAD` marks the beginning of a merge conflict, and the `>>>>>>> Commit #1` line marks the end, with the conflicting sections separated by `=======`. The part on the `HEAD` side is from the QMK master version of the file, and the part marked with the commit message is from the current branch and commit.
149
150Because Git tracks *changes to files* rather than the contents of the files directly, if Git can't find the text that was in the file previous to the commit that was made, it won't know how to edit the file. Re-editing the file will solve the conflict. Make your changes, and then save the file.
151
152```
153<p>Need help? Email support@webhost.us.</p>
154```
155
156Now run:
157
158```
159git add conflicting_file_1.txt
160git rebase --continue
161```
162
163Git logs the changes to the conflicting file, and continues applying the commits from our branch until it reaches the end.
diff --git a/docs/newbs_building_firmware.md b/docs/newbs_building_firmware.md
index f227d623f..fabfefb19 100644
--- a/docs/newbs_building_firmware.md
+++ b/docs/newbs_building_firmware.md
@@ -16,12 +16,26 @@ Start by navigating to the `keymaps` folder for your keyboard.
16 16
17?> Windows: 17?> Windows:
18 18
19 start keyboards/<keyboard_folder>/keymaps 19 start .\\keyboards\\<keyboard_folder>\\keymaps
20 20
21## Create a Copy Of The `default` Keymap 21## Create a Copy Of The `default` Keymap
22 22
23Once you have the `keymaps` folder open you will want to create a copy of the `default` folder. We highly recommend you name your folder the same as your GitHub username, but you can use any name you want as long as it contains only lower case letters, numbers, and the underscore character. 23Once you have the `keymaps` folder open you will want to create a copy of the `default` folder. We highly recommend you name your folder the same as your GitHub username, but you can use any name you want as long as it contains only lower case letters, numbers, and the underscore character.
24 24
25To automate the process, you also have the option to run the `new_keymap.sh` script.
26
27Navigate to the `qmk_firmware/util` directory and type the following:
28
29```
30./new_keymap.sh <keyboard path> <username>
31```
32
33For example, for a user named John, trying to make a new keymap for the 1up60hse, they would type in
34
35```
36./new_keymap.sh 1upkeyboards/1up60hse john
37```
38
25## Open `keymap.c` In Your Favorite Text Editor 39## Open `keymap.c` In Your Favorite Text Editor
26 40
27Open up your `keymap.c`. Inside this file you'll find the structure that controls how your keyboard behaves. At the top of `keymap.c` there may be some defines and enums that make the keymap easier to read. Farther down you'll find a line that looks like this: 41Open up your `keymap.c`. Inside this file you'll find the structure that controls how your keyboard behaves. At the top of `keymap.c` there may be some defines and enums that make the keymap easier to read. Farther down you'll find a line that looks like this:
diff --git a/docs/newbs_getting_started.md b/docs/newbs_getting_started.md
index 218154285..276c7fec3 100644
--- a/docs/newbs_getting_started.md
+++ b/docs/newbs_getting_started.md
@@ -1,99 +1,97 @@
1# Introduction 1# Introduction
2 2
3Your computer keyboard has a processor inside of it, not unlike the one inside your computer. This processor runs software that is responsible for detecting button presses and sending reports about the state of the keyboard when they are pressed or released. QMK fills the role of that software, detecting button presses and passing that information on to the host computer. When you build your custom layout you are creating the equivalent of an .exe for your keyboard. 3Your computer keyboard has a processor inside of it, not unlike the one inside your computer. This processor runs software that is responsible for detecting button presses and sending reports about the state of the keyboard when buttons are pressed or released. QMK fills the role of that software, detecting button presses and passing that information on to the host computer. When you build your custom keymap, you are creating the equivalent of an executable program for your keyboard.
4 4
5QMK tries to put a lot of power into your hands by making easy things easy, and hard things possible. You don't have to know how to program to create powerful layouts, you only have to follow a few simple syntax rules. 5QMK tries to put a lot of power into your hands by making easy things easy, and hard things possible. You don't have to know how to program to create powerful keymaps — you only have to follow a few simple syntax rules.
6 6
7# Getting Started 7# Getting Started
8 8
9Before you can build keymaps you need to install some software and setup your build environment. This only has to be done one time no matter how many keyboards you want 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 10
11## Download Software 11## Download Software
12 12
13### Text Editor 13### Text Editor
14 14
15You'll need a program that can edit and save **plain text** files. If you are on Windows you can make due with Notepad, and on Linux you can use Gedit, both of which are simple but functional text editors. On macOS be careful with TextEdit.app, it will not save plain text files unless you make sure to select "Make Plain text" from the "Format" menu, or you can use another program such as Sublime Text. 15You'll need a program that can edit and save **plain text** files. If you're on Windows you can make do with Notepad, and on Linux you can use gedit. Both of these are simple but functional text editors. On macOS, be careful with the default TextEdit app: it will not save plain text files unless you explicitly select _Make Plain Text_ from the _Format_ menu.
16
17You can also download and install a dedicated text editor like [Sublime Text](https://www.sublimetext.com/) or [VS Code](https://code.visualstudio.com/). This is probably the best way to go regardless of platform, as these programs are specifically made for editing code.
16 18
17?> Not sure which text editor to use? Laurence Bradford wrote [a great introduction](https://learntocodewith.me/programming/basics/text-editors/) to the subject. 19?> Not sure which text editor to use? Laurence Bradford wrote [a great introduction](https://learntocodewith.me/programming/basics/text-editors/) to the subject.
18 20
19### QMK Toolbox 21### QMK Toolbox
20 22
21QMK Toolbox is an optional graphical Windows and macOS program that allows you to both program and debug your custom keyboard. You will likely prefer it to easily flash your keyboard and receive the debugging messages that your keyboard will print. 23QMK Toolbox is an optional graphical program for Windows and macOS that allows you to both program and debug your custom keyboard. You will likely find it invaluable for easily flashing your keyboard and viewing debug messages that it prints.
22
23Download the files from the links below:
24
25For Windows: "qmk_toolbox.exe" or "qmk_toolbox_install.exe" (with installer)
26 24
27For Mac: "QMK.Toolbox.app.zip" or "QMK.Toolbox.pkg" (with installer) 25[Download the latest release here.](https://github.com/qmk/qmk_toolbox/releases/latest)
28 26
29* [Newest Release](https://github.com/qmk/qmk_toolbox/releases/latest) 27* For Windows: `qmk_toolbox.exe` (portable) or `qmk_toolbox_install.exe` (installer)
30* [Source Code](https://github.com/qmk/qmk_toolbox/) 28* For macOS: `QMK.Toolbox.app.zip` (portable) or `QMK.Toolbox.pkg` (installer)
31 29
32## Environment Setup 30## Set Up Your Environment
33 31
34We've tried to make QMK as easy to setup as possible. You only have to prepare your Linux or Unix environment and let QMK install the rest. 32We've tried to make QMK as easy to set up as possible. You only have to prepare your Linux or Unix environment, then let QMK install the rest.
35 33
36?> If you haven't worked with the Linux/Unix command line before there are a few basic concepts and commands you should learn. These resources will teach you enough to work with QMK:<br> 34?> If you haven't worked with the Linux/Unix command line before, there are a few basic concepts and commands you should learn. These resources will teach you enough to be able to work with QMK:<br>
37[Must Know Linux Commands](https://www.guru99.com/must-know-linux-commands.html)<br> 35[Must Know Linux Commands](https://www.guru99.com/must-know-linux-commands.html)<br>
38[Some Basic Unix Commands](https://www.tjhsst.edu/~dhyatt/superap/unixcmd.html) 36[Some Basic Unix Commands](https://www.tjhsst.edu/~dhyatt/superap/unixcmd.html)
39 37
40### Windows 38### Windows
41 39
42You will need to install msys2 and git. 40You will need to install MSYS2 and Git.
43 41
44* Follow the installation instructions on the msys2 homepage: http://www.msys2.org 42* Follow the installation instructions on the [MSYS2 homepage](http://www.msys2.org).
45* Close any open msys2 terminals, and open a new terminal 43* Close any open MSYS2 terminals and open a new MSYS2 MinGW 64-bit terminal.
46* Install git by running this command: `pacman -S git` 44* Install Git by running this command: `pacman -S git`.
47 45
48### macOS 46### macOS
49 47
50You will need to install homebrew. Follow the instructions on the homebrew homepage: https://brew.sh 48You will need to install Homebrew. Follow the instructions on the [Homebrew homepage](https://brew.sh).
51 49
52After homebrew is installed continue with "Download QMK", following step "Setup QMK" runs a script that will install other packages. 50After Homebrew is installed, continue with _Set Up QMK_. In that step you will run a script that will install other packages.
53 51
54### Linux 52### Linux
55 53
56You will need to install git. It's extremely likely you already have it, but if not one of the following commands should install it: 54You will need to install Git. It's very likely that you already have it, but if not, one of the following commands should install it:
57 55
58* Debian/Ubuntu/Devuan: `apt-get install git` 56* Debian / Ubuntu / Devuan: `apt-get install git`
59* Fedora/Redhat/Centos: `yum install git` 57* Fedora / Red Hat / CentOS: `yum install git`
60* Arch: `pacman -S git` 58* Arch: `pacman -S git`
61 59
62## Download QMK 60?> Docker is also an option on all platforms. [Click here for details.](getting_started_build_tools.md#docker)
63 61
64Once you have setup your Linux/Unix environment you are ready to download QMK. We will do this by using git to "clone" the QMK repository. Open a Terminal or MSYS2 Console window and leave it open for the remainder of this guide. Inside that window run these two commands: 62## Set Up QMK
63
64Once you have set up your Linux/Unix environment, you are ready to download QMK. We will do this by using Git to "clone" the QMK repository. Open a Terminal or MSYS2 MinGW window and leave it open for the remainder of this guide. Inside that window run these two commands:
65 65
66 git clone https://github.com/qmk/qmk_firmware.git 66 git clone https://github.com/qmk/qmk_firmware.git
67 cd qmk_firmware 67 cd qmk_firmware
68 68
69?> If you already know [how to use GitHub](getting_started_github.md) we recommend you create and clone your own fork instead. If you don't know what that means you can safely ignore this message. 69?> If you already know [how to use GitHub](getting_started_github.md), we recommend that you create and clone your own fork instead. If you don't know what that means, you can safely ignore this message.
70
71## Setup QMK
72 70
73QMK comes with a script to help you setup the rest of what you'll need. You should run it now by typing in this command: 71QMK comes with a script to help you set up the rest of what you'll need. You should run it now by typing in this command:
74 72
75 ./util/qmk_install.sh 73 util/qmk_install.sh
76 74
77## Test Your Build Environment 75## Test Your Build Environment
78 76
79Now that your QMK build environment is setup you can build a firmware for your keyboard. Start by trying to build the default layout for your keyboard. You should be able to do that with a command in this format: 77Now that your QMK build environment is set up, you can build a firmware for your keyboard. Start by trying to build the keyboard's default keymap. You should be able to do that with a command in this format:
80 78
81 make <keyboard>:default 79 make <keyboard>:default
82 80
83For example, to build a firmware for a Clueboard 66% use: 81For example, to build a firmware for a Clueboard 66% you would use:
84 82
85 make clueboard/66/rev3:default 83 make clueboard/66/rev3:default
86 84
87When it is done you should have a lot of output that ends similar to this: 85When it is done you should have a lot of output that ends similar to this:
88 86
89``` 87```
90Linking: .build/clueboard_66_rev2_default.elf [OK] 88Linking: .build/clueboard_66_rev3_default.elf [OK]
91Creating load file for flashing: .build/clueboard_66_rev2_default.hex [OK] 89Creating load file for flashing: .build/clueboard_66_rev3_default.hex [OK]
92Copying clueboard_66_rev2_default.hex to qmk_firmware folder [OK] 90Copying clueboard_66_rev3_default.hex to qmk_firmware folder [OK]
93Checking file size of clueboard_66_rev2_default.hex [OK] 91Checking file size of clueboard_66_rev3_default.hex [OK]
94 * File size is fine - 25174/28672 92 * The firmware size is fine - 26356/28672 (2316 bytes free)
95``` 93```
96 94
97## Creating Your Layout 95# Creating Your Keymap
98 96
99Now you are ready to create your own personal layout. Move on to [Building Your First Firmware](newbs_building_firmware.md) for that. 97You are now ready to create your own personal keymap! Move on to [Building Your First Firmware](newbs_building_firmware.md) for that.
diff --git a/docs/newbs_learn_more_resources.md b/docs/newbs_learn_more_resources.md
index 69d165c2b..9b77db8fd 100644
--- a/docs/newbs_learn_more_resources.md
+++ b/docs/newbs_learn_more_resources.md
@@ -1,13 +1,15 @@
1# Learning Resources 1# Learning Resources
2These resources are aimed at giving new members in the qmk community more understanding to the information provided in the newbs docs. 2
3These resources are aimed at giving new members in the QMK community more understanding to the information provided in the Newbs docs.
3 4
4Git resources: 5Git resources:
5* 6
6*[Great General Tutorial](https://www.codecademy.com/learn/learn-git) 7* [Great General Tutorial](https://www.codecademy.com/learn/learn-git)
7*[Git Game To Learn From Examples](https://learngitbranching.js.org/) 8* [Git Game To Learn From Examples](https://learngitbranching.js.org/)
8*[Git Resources to Learn More About Github](getting_started_github.md) 9* [Git Resources to Learn More About Github](getting_started_github.md)
9*[Git Resources Aimed Specificly toward QMK](contributing.md) 10* [Git Resources Aimed Specifically toward QMK](contributing.md)
10 11
11 12
12Command Line resources: 13Command Line resources:
13*[Good General Tutorial on Command Line](https://www.codecademy.com/learn/learn-the-command-line) \ No newline at end of file 14
15* [Good General Tutorial on Command Line](https://www.codecademy.com/learn/learn-the-command-line)
diff --git a/docs/newbs_testing_debugging.md b/docs/newbs_testing_debugging.md
index 1d8021dec..45509110a 100644
--- a/docs/newbs_testing_debugging.md
+++ b/docs/newbs_testing_debugging.md
@@ -28,6 +28,6 @@ Sometimes it's useful to print debug messages from within your [custom code](cus
28After that you can use a few different print functions: 28After that you can use a few different print functions:
29 29
30* `print("string")`: Print a simple string. 30* `print("string")`: Print a simple string.
31* `sprintf("%s string", var)`: Print a formatted string 31* `uprintf("%s string", var)`: Print a formatted string
32* `dprint("string")` Print a simple string, but only when debug mode is enabled 32* `dprint("string")` Print a simple string, but only when debug mode is enabled
33* `dprintf("%s string", var)`: Print a formatted string, but only when debug mode is enabled 33* `dprintf("%s string", var)`: Print a formatted string, but only when debug mode is enabled
diff --git a/docs/quantum_keycodes.md b/docs/quantum_keycodes.md
index 1d7fc0e12..90192e632 100644
--- a/docs/quantum_keycodes.md
+++ b/docs/quantum_keycodes.md
@@ -8,15 +8,16 @@ On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are
8 8
9## QMK Keycodes 9## QMK Keycodes
10 10
11|Key |Aliases |Description | 11|Key |Aliases |Description |
12|-------------|-----------|---------------------------------------------------------------------| 12|---------------|-----------|---------------------------------------------------------------------|
13|`RESET` | |Put the keyboard into DFU mode for flashing | 13|`RESET` | |Put the keyboard into DFU mode for flashing |
14|`DEBUG` | |Toggle debug mode | 14|`DEBUG` | |Toggle debug mode |
15|`KC_GESC` |`GRAVE_ESC`|Escape when tapped, <code>&#96;</code> when pressed with Shift or GUI| 15|`EEPROM_RESET` |`EEP_RST` |Resets EEPROM state by reinitializing it |
16|`KC_LSPO` | |Left Shift when held, `(` when tapped | 16|`KC_GESC` |`GRAVE_ESC`|Escape when tapped, <code>&#96;</code> when pressed with Shift or GUI|
17|`KC_RSPC` | |Right Shift when held, `)` when tapped | 17|`KC_LSPO` | |Left Shift when held, `(` when tapped |
18|`KC_LEAD` | |The [Leader key](feature_leader_key.md) | 18|`KC_RSPC` | |Right Shift when held, `)` when tapped |
19|`KC_LOCK` | |The [Lock key](feature_key_lock.md) | 19|`KC_LEAD` | |The [Leader key](feature_leader_key.md) |
20|`FUNC(n)` |`F(n)` |Call `fn_action(n)` (deprecated) | 20|`KC_LOCK` | |The [Lock key](feature_key_lock.md) |
21|`M(n)` | |Call macro `n` | 21|`FUNC(n)` |`F(n)` |Call `fn_action(n)` (deprecated) |
22|`MACROTAP(n)`| |Macro-tap `n` idk FIXME | 22|`M(n)` | |Call macro `n` |
23|`MACROTAP(n)` | |Macro-tap `n` idk FIXME |
diff --git a/docs/ref_functions.md b/docs/ref_functions.md
index 7d0cda322..174d9a95a 100644
--- a/docs/ref_functions.md
+++ b/docs/ref_functions.md
@@ -1,28 +1,79 @@
1# List of Useful Core Functions To Make Your Keyboard Better 1# List of Useful Core Functions To Make Your Keyboard Better
2 2
3There are a lot of hidden functions in QMK that are incredible useful, or may add a bit of functionality that you've been wanting. Functions that are specific to certain features are not included here, as those will be on their respective feature page. 3There are a lot of hidden functions in QMK that are incredible useful, or may add a bit of functionality that you've been wanting. Functions that are specific to certain features are not included here, as those will be on their respective feature page.
4 4
5## (OLKB) Tri Layers 5## (OLKB) Tri Layers
6 6
7There are actually separate functions that you can use there, depending on what you're after. 7There are actually separate functions that you can use there, depending on what you're after.
8 8
9The first is the `update_tri_layer(x, y, z)` function. This function check to see if layers `x` and `y` are both on. If they are both on, then it runs on layer `z`. Otherwise, if both `x` and `y` are not both on (either only one is, or neither is), then it runs off layer `z`. 9### `update_tri_layer(x, y, z)`
10 10
11This function is useful if you want to create specific keys that have this functionality, but other layer keycodes won't do this. 11The first is the `update_tri_layer(x, y, z)` function. This function check to see if layers `x` and `y` are both on. If they are both on, then it runs on layer `z`. Otherwise, if both `x` and `y` are not both on (either only one is, or neither is), then it runs off layer `z`.
12 12
13The other function is `update_tri_layer_state(state, x, y, z)`. This function is meant to be called from they [`layer_state_set_*` functions](custom_quantum_functions.md#layer-change-code). This means that any time that you use a keycode to change the layer, this will be checked. So you could use `LT(layer, kc)` to change the layer and it will trigger the same layer check. 13This function is useful if you want to create specific keys that have this functionality, but other layer keycodes won't do this.
14 14
15The caveat to this method is that you cannot access the `z` layer without having `x` and `y` layers on, since if you try to activate just layer `z`, it will run this code and turn off layer `z` before you could use it. 15#### Example
16
17```c
18bool process_record_user(uint16_t keycode, keyrecord_t *record) {
19 switch (keycode) {
20 case LOWER:
21 if (record->event.pressed) {
22 layer_on(_LOWER);
23 update_tri_layer(_LOWER, _RAISE, _ADJUST);
24 } else {
25 layer_off(_LOWER);
26 update_tri_layer(_LOWER, _RAISE, _ADJUST);
27 }
28 return false;
29 break;
30 case RAISE:
31 if (record->event.pressed) {
32 layer_on(_RAISE);
33 update_tri_layer(_LOWER, _RAISE, _ADJUST);
34 } else {
35 layer_off(_RAISE);
36 update_tri_layer(_LOWER, _RAISE, _ADJUST);
37 }
38 return false;
39 break;
40 }
41 return true;
42}
43```
44
45### `update_tri_layer_state(state, x, y, z)`
46The other function is `update_tri_layer_state(state, x, y, z)`. This function is meant to be called from they [`layer_state_set_*` functions](custom_quantum_functions.md#layer-change-code). This means that any time that you use a keycode to change the layer, this will be checked. So you could use `LT(layer, kc)` to change the layer and it will trigger the same layer check.
47
48The caveat to this method is that you cannot access the `z` layer without having `x` and `y` layers on, since if you try to activate just layer `z`, it will run this code and turn off layer `z` before you could use it.
49
50#### Example
51
52```c
53uint32_t layer_state_set_user(uint32_t state) {
54 return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
55}
56```
57
58Alternatively, you don't have to immediately "return" the value. This is useful if you want to add multiple tri layers, or if you want to add additional effects.
59
60```c
61uint32_t layer_state_set_user(uint32_t state) {
62 state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
63 state = update_tri_layer_state(state, _RAISE, _SYMB, _SPECIAL);
64 return state;
65}
66```
16 67
17## Setting the Persistent Default Layer 68## Setting the Persistent Default Layer
18 69
19Do you want to set the default layer, so that it's retained even after you unplug the board? If so, this is the function for you. 70Do you want to set the default layer, so that it's retained even after you unplug the board? If so, this is the function for you.
20 71
21To use this, you would use `set_single_persistent_default_layer(layer)`. If you have a name defined for your layer, you can use that instead (such as _QWERTY, _DVORAK or _COLEMAK). 72To use this, you would use `set_single_persistent_default_layer(layer)`. If you have a name defined for your layer, you can use that instead (such as _QWERTY, _DVORAK or _COLEMAK).
22 73
23This will set the default layer, update the persistent settings, and play a tune if you have [Audio](feature_audio.md) enabled on your board, and the default layer sounds set. 74This will set the default layer, update the persistent settings, and play a tune if you have [Audio](feature_audio.md) enabled on your board, and the default layer sounds set.
24 75
25To configure the default layer sounds, you would want to define this in your `config.h` file, like this: 76To configure the default layer sounds, you would want to define this in your `config.h` file, like this:
26 77
27```c 78```c
28#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ 79#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
@@ -36,13 +87,33 @@ To configure the default layer sounds, you would want to define this in your `co
36 87
37## Reseting the keyboard 88## Reseting the keyboard
38 89
39There is the `RESET` quantum keycode that you can use. But if you want to reset the board as part of a macro, rather than hitting a key separately, you can do that. 90There is the `RESET` quantum keycode that you can use. But if you want to reset the board as part of a macro, rather than hitting a key separately, you can do that.
40 91
41And to do so, add `reset_keyboard()` to your function or macro, and this will reset to bootloader. 92And to do so, add `reset_keyboard()` to your function or macro, and this will reset to bootloader.
42 93
43## Wiping the EEPROM (Persistent Storage) 94## Wiping the EEPROM (Persistent Storage)
44 95
45If you're having issues with Audio, RGB Underglow, backlighting or keys acting weird, then you can reset the EEPROM (persistent setting storage). Bootmagic is one way to do this, but if that isn't enabled, then you can use a custom macro to do so. 96If you're having issues with Audio, RGB Underglow, backlighting or keys acting weird, then you can reset the EEPROM (persistent setting storage). Bootmagic is one way to do this, but if that isn't enabled, then you can use a custom macro to do so.
97
98To wipe the EEPROM, run `eeconfig_init()` from your function or macro to reset most of the settings to default.
99
100## Tap random key
46 101
47To wipe the EEPROM, run `eeconfig_init()` from your function or macro to reset most of the settings to default. 102If you want to send a random character to the host computer, you can use the `tap_random_base64()` function. This [pseudorandomly](https://en.wikipedia.org/wiki/Pseudorandom_number_generator) selects a number between 0 and 63, and then sends a key press based on that selection. (0–25 is `A`–`Z`, 26–51 is `a`–`z`, 52–61 is `0`–`9`, 62 is `+` and 63 is `/`).
48 103
104?> Needless to say, but this is _not_ a cryptographically secure method of generating random Base64 keys or passwords.
105
106## Software Timers
107
108It's possible to start timers and read values for time-specific events. Here's an example:
109
110```c
111static uint16_t key_timer;
112key_timer = timer_read();
113
114if (timer_elapsed(key_timer) < 100) {
115 // do something if less than 100ms have passed
116} else {
117 // do something if 100ms or more have passed
118}
119```
diff --git a/docs/reference_configurator_support.md b/docs/reference_configurator_support.md
new file mode 100644
index 000000000..a20a6c9ad
--- /dev/null
+++ b/docs/reference_configurator_support.md
@@ -0,0 +1,195 @@
1# Supporting Your Keyboard in QMK Configurator
2
3This page covers how to properly support keyboards in the [QMK Configurator](https://config.qmk.fm/).
4
5
6## How the Configurator Understands Keyboards
7
8To understand how the Configurator understands keyboards, first one must understand layout macros. For this exercise, we're going to imagine a 17-key numpad PCB, which we're going to call `numpad`.
9
10```
11┌───┬───┬───┬───┐
12│NLk│ / │ * │ - │
13├───┼───┼───┼───┤
14│7 │8 │9 │ + │
15├───┼───┼───┤ │
16│4 │5 │6 │ │
17├───┼───┼───┼───┤
18│1 │2 │3 │Ent│
19├───┴───┼───┤ │
20│0 │ . │ │
21└───────┴───┴───┘
22```
23
24?> For more on layout macros, see [Understanding QMK: Matrix Scanning](understanding_qmk.md?id=matrix-scanning) and [Understanding QMK: Matrix to Physical Layout Map](understanding_qmk.md?id=matrix-to-physical-layout-map).
25
26The Configurator's API reads the keyboard's `.h` file from `qmk_firmware/keyboards/<keyboard>/<keyboard>.h`. For our numpad, this file would be `qmk_firmware/keyboards/numpad/numpad.h`:
27
28```c
29#pragma once
30
31#define LAYOUT( \
32 k00, k01, k02, k03, \
33 k10, k11, k12, k13, \
34 k20, k21, k22, \
35 k30, k31, k32, k33, \
36 k40, k42 \
37 ) { \
38 { k00, k01, k02, k03 }, \
39 { k10, k11, k12, k13 }, \
40 { k20, k21, k22, KC_NO }, \
41 { k30, k31, k32, k33 }, \
42 { k40, KC_NO, k42, KC_NO } \
43}
44```
45
46QMK uses `KC_NO` to designate places in the switch matrix where there is no switch. Sometimes, `XXX`, `___` or `____` are used as shorthand to make this section easier to read if it needs to be debugged. This is usually defined near the beginning of the `.h` file:
47
48```c
49#pragma once
50
51#define XXX KC_NO
52
53#define LAYOUT( \
54 k00, k01, k02, k03, \
55 k10, k11, k12, k13, \
56 k20, k21, k22, \
57 k30, k31, k32, k33, \
58 k40, k42 \
59 ) { \
60 { k00, k01, k02, k03 }, \
61 { k10, k11, k12, k13 }, \
62 { k20, k21, k22, XXX }, \
63 { k30, k31, k32, k33 }, \
64 { k40, XXX, k42, XXX } \
65}
66```
67
68!> This usage differs from that of keymap macros, which almost always use `XXXXXXX` (seven capital X's) for `KC_NO` and `_______` (seven underscores) for `KC_TRNS`.
69
70!> To prevent user confusion, using `KC_NO` is preferred.
71
72The layout macro tells the Configurator that our keyboard has 17 keys, arranged in five rows of four columns each. Our switch positions are named `k<row><column>`, counting from 0. The names themselves actually don't matter, as long as they match between the top section, which receives the keycodes from the keymap, and the bottom half which designates where each key is in the matrix.
73
74To display our keyboard in a way that resembles the physical keyboard, we need to build a JSON file that tells the Configurator how to tie the physical locations and sizes of our keys to our switch matrix.
75
76## Building the JSON file
77
78To build the JSON file, the easiest way is to build the layout in [Keyboard Layout Editor](http://www.keyboard-layout-editor.com/) ("KLE"), from which we'll feed the Raw Data into a QMK tool that converts this data into a JSON the Configurator will read and use. Since KLE opens by default with a numpad layout, we're just going to remove the Getting Started instructions, and use what's left.
79
80Once the layout is as desired, move to the Raw Data tab in KLE, and copy the contents:
81
82```
83["Num Lock","/","*","-"],
84["7\nHome","8\n↑","9\nPgUp",{h:2},"+"],
85["4\n←","5","6\n→"],
86["1\nEnd","2\n↓","3\nPgDn",{h:2},"Enter"],
87[{w:2},"0\nIns",".\nDel"]
88```
89
90To convert this data into our JSON, go to the [QMK KLE-JSON Converter](https://qmk.fm/converter/), paste the Raw Data into the Input field, and click the Convert button. After a moment, our JSON data will appear in the Output field. Copy the contents to a new text document, and name the document `info.json`, saving it in the same folder that contains `numpad.h`.
91
92Use the `keyboard_name` object to set the name of the keyboard. The `bootloader` object is deprecated, so it can be deleted. For instruction purposes, we will put each key's object on its own line. This is only to make the file more human-readable, and does not affect the Configurator's functionality.
93
94```json
95{
96 "keyboard_name": "Numpad",
97 "url": "",
98 "maintainer": "qmk",
99 "tags": {
100 "form_factor": "numpad"
101 },
102 "width": 4,
103 "height": 5,
104 "layouts": {
105 "LAYOUT": {
106 "layout": [
107 {"label":"Num Lock", "x":0, "y":0},
108 {"label":"/", "x":1, "y":0},
109 {"label":"*", "x":2, "y":0},
110 {"label":"-", "x":3, "y":0},
111 {"label":"7", "x":0, "y":1},
112 {"label":"8", "x":1, "y":1},
113 {"label":"9", "x":2, "y":1},
114 {"label":"+", "x":3, "y":1, "h":2},
115 {"label":"4", "x":0, "y":2},
116 {"label":"5", "x":1, "y":2},
117 {"label":"6", "x":2, "y":2},
118 {"label":"1", "x":0, "y":3},
119 {"label":"2", "x":1, "y":3},
120 {"label":"3", "x":2, "y":3},
121 {"label":"Enter", "x":3, "y":3, "h":2},
122 {"label":"0", "x":0, "y":4, "w":2},
123 {"label":".", "x":2, "y":4}
124 ]
125 }
126 }
127}
128```
129
130The `layouts` object contains the data that represents the physical layout of the keyboard. It has an object `LAYOUT`, which needs to match the name of our layout macro from `numpad.h`. The `LAYOUT` object itself has an object named `layout`, which contains one JSON object for each physical key on our keyboard, formatted as follows:
131
132```
133 ┌ The name of the key. Not displayed in the Configurator.
134 │ ┌ The key's X-axis location, in key units from the
135 │ │ keyboard's left edge.
136 │ │ ┌ The key's Y-axis location, in key units from
137 │ │ │ the keyboard's top (rear-facing) edge.
138 ↓ ↓ ↓
139{"label":"Num Lock", "x":0, "y":0},
140```
141
142Some objects will also have `"w"` and `"h"` keys, which represent a key's width and height, respectively.
143
144?> For more on the `info.json` files, see [QMK Keyboard Guidelines: Keyboard Metadata](hardware_keyboard_guidelines.md?id=keyboard-metadata)
145
146
147## How the Configurator Programs Keys
148
149The Configurator's API uses the layout macro and the JSON file we've given it to create a visual representation of the keyboard that has each visual object tied to a specific key, in sequence:
150
151key in layout macro | JSON object used
152:---: | :----
153k00 | {"label":"Num Lock", "x":0, "y":0}
154k01 | {"label":"/", "x":1, "y":0}
155k02 | {"label":"*", "x":2, "y":0}
156k03 | {"label":"-", "x":3, "y":0}
157k10 | {"label":"7", "x":0, "y":1}
158k11 | {"label":"8", "x":1, "y":1}
159k12 | {"label":"9", "x":2, "y":1}
160k13 | {"label":"+", "x":3, "y":1, "h":2}
161k20 | {"label":"4", "x":0, "y":2}
162k21 | {"label":"5", "x":1, "y":2}
163k22 | {"label":"6", "x":2, "y":2}
164k30 | {"label":"1", "x":0, "y":3}
165k31 | {"label":"2", "x":1, "y":3}
166k32 | {"label":"3", "x":2, "y":3}
167k33 | {"label":"Enter", "x":3, "y":3, "h":2}
168k40 | {"label":"0", "x":0, "y":4, "w":2}
169k42 | {"label":".", "x":2, "y":4}
170
171When a user selects the top-left key in the Configurator, and assigns Num Lock to it, the Configurator builds a keymap file with `KC_NLCK` as the first key, and so on as the keymap is built. The `label` keys are not used; they are only for the user's reference in identifying specific keys when debugging the `info.json` file.
172
173
174## Issues and Hazards
175
176Currently, the Configurator does not support key rotation or non-rectangular key shapes like ISO Enter. Additionally, keys that are vertically-offset from their "row" &mdash; the arrow keys on 1800-layouts like the [TKC1800](https://github.com/qmk/qmk_firmware/tree/4ac48a61a66206beaf2fdd5f2939d8bbedd0004c/keyboards/tkc1800/) being a prominent example &mdash; confuse the KLE-to-JSON Converter, if not adjusted for by the contributor of the `info.json` file.
177
178### Workarounds
179
180#### Non-rectangular keys
181
182For ISO Enter keys, QMK custom is to display it as a rectangular key, 1.25u wide and 2u high, aligned so its right edge is aligned with the right edge of the alphanumeric key block.
183
184![](https://i.imgur.com/JKngtTw.png)
185*A 60% keyboard in standard ISO layout, as rendered by QMK Configurator.*
186
187#### Vertically-offset keys
188
189For vertically-offset keys, place them in KLE as if they were not offset, then edit the Y-values as needed in the converted JSON file
190
191![](https://i.imgur.com/fmDvDzR.png)
192*An 1800-layout keyboard as rendered in Keyboard Layout Editor, without the vertical offset applied to the arrow keys.*
193
194![](https://i.imgur.com/8beYMBR.png)
195*A Unix diff file, showing the changes needed to vertically-offset the arrow keys in our keyboard's JSON file.*
diff --git a/docs/reference_glossary.md b/docs/reference_glossary.md
index 29d07f26d..422abb2ec 100644
--- a/docs/reference_glossary.md
+++ b/docs/reference_glossary.md
@@ -128,7 +128,7 @@ The standard Deutsche (German) keyboard layout. Named for the first 6 letters on
128The term for pressing a key while a key is already held down. Variants include 2KRO, 6KRO, and NKRO. 128The term for pressing a key while a key is already held down. Variants include 2KRO, 6KRO, and NKRO.
129 129
130## Scancode 130## Scancode
131A 1 byte number that is sent as part of a HID report over USB that represents a single key. These numbers are documented in the [HID Usage Tables](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) published by the [USB-IF](http://www.usb.org/). 131A 1 byte number that is sent as part of a HID report over USB that represents a single key. These numbers are documented in the [HID Usage Tables](https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf) published by the [USB-IF](http://www.usb.org/).
132 132
133## Space Cadet Shift 133## Space Cadet Shift
134A special set of shift keys which allow you to type various types of braces by tapping the left or right shift one or more times. 134A special set of shift keys which allow you to type various types of braces by tapping the left or right shift one or more times.
diff --git a/docs/support.md b/docs/support.md
new file mode 100644
index 000000000..5c275b07e
--- /dev/null
+++ b/docs/support.md
@@ -0,0 +1,43 @@
1# Support
2
3If you need help with something, the best place to get quick support is going to be on our [Discord Server](https://discord.gg/Uq7gcHh). There is usually somebody online, and there are a bunch of very helpful people there.
4
5Don't forget to read our [Code of Conduct](https://qmk.fm/coc/).
6
7## Help! I don't know where to start!
8
9If this is the case, then you should start with our [Newbs Guide](https://docs.qmk.fm/#/newbs). There is a lot of great info there, and that should cover everything you need to get started.
10
11If that's an issue, hop onto the [QMK Configurator](https://config.qmk.fm), as that will handle a majority of what you need there.
12
13## Help! I'm having issues flashing!
14
15First, head to the [Compiling/Flashing FAQ Page](https://docs.qmk.fm/#/faq_build). There is a good deal of info there, and you'll find a bunch of solutions to common issues there.
16
17## Help, I have an issue that isn't covered by the links above
18
19Okay, that's fine. Then please check the [open issues in our GitHub](https://github.com/qmk/qmk_firmware/issues) to see if somebody is experiencing the same thing (make sure it's not just similar, but actually the same).
20
21If you can't find anything, then please open a [new issue](https://github.com/qmk/qmk_firmware/issues/new)!
22
23## What if I found a bug?
24
25Then please open an [issue](https://github.com/qmk/qmk_firmware/issues/new), and if you know how to fix it, open up a Pull Request on GitHub with the fix.
26
27## But `git` and `GitHub` are intimidating!
28
29Don't worry, we have some pretty nice [Guidelines](https://docs.qmk.fm/#/newbs_best_practices) on how to start using `git` and GitHub to make things easier to develop.
30
31Additionally, you can find additional `git` and GitHub related links [here](https://docs.qmk.fm/#/newbs_learn_more_resources).
32
33## I have a Keyboard that I want to add support for
34
35Awesome! Open up a Pull Request for it. We'll review the code, and merge it!
36
37### What if I want to do brand it with `QMK`?
38
39That's amazing! We would love to assist you with that!
40
41In fact, we have a [whole page](https://qmk.fm/powered/) dedicated to adding QMK Branding to your page and keyboard. This covers pretty much everything you need (knowledge and images) to officially support QMK.
42
43If you have any questions about this, open an issue or head to [Discord](https://discord.gg/Uq7gcHh).
diff --git a/docs/understanding_qmk.md b/docs/understanding_qmk.md
index 4544cb260..35596cc69 100644
--- a/docs/understanding_qmk.md
+++ b/docs/understanding_qmk.md
@@ -12,7 +12,7 @@ You can think of QMK as no different from any other computer program. It is star
12 12
13The reason for this is the different platforms that QMK supports. The most common platform is `lufa`, which runs on AVR processors such at the atmega32u4. We also support `chibios` and `vusb`. 13The reason for this is the different platforms that QMK supports. The most common platform is `lufa`, which runs on AVR processors such at the atmega32u4. We also support `chibios` and `vusb`.
14 14
15We'll focus on AVR processors for the moment, which use the `lufa` platform. You can find the `main()` function in [tmk_core/protocol/lufa/lufa.c](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/protocol/lufa/lufa.c#L1129). If you browse through that function you'll find that it initializes any hardware that has been configured (including USB to the host) and then it starts the core part of the program with a [`while(1)`](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/protocol/lufa/lufa.c#L1182). This is [The Main Loop](#the_main_loop). 15We'll focus on AVR processors for the moment, which use the `lufa` platform. You can find the `main()` function in [tmk_core/protocol/lufa/lufa.c](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/tmk_core/protocol/lufa/lufa.c#L1019). If you browse through that function you'll find that it initializes any hardware that has been configured (including USB to the host) and then it starts the core part of the program with a [`while(1)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/tmk_core/protocol/lufa/lufa.c#L1060). This is [The Main Loop](#the-main-loop).
16 16
17## The Main Loop 17## The Main Loop
18 18
@@ -22,7 +22,7 @@ This section of code is called "The Main Loop" because it's responsible for loop
22 keyboard_task(); 22 keyboard_task();
23``` 23```
24 24
25This is where all the keyboard specific functionality is dispatched. The source code for `keyboard_task()` can be found in [tmk_core/common/keyboard.c](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/keyboard.c#L154), and it is responsible for detecting changes in the matrix and turning status LED's on and off. 25This is where all the keyboard specific functionality is dispatched. The source code for `keyboard_task()` can be found in [tmk_core/common/keyboard.c](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/tmk_core/common/keyboard.c#L206), and it is responsible for detecting changes in the matrix and turning status LED's on and off.
26 26
27Within `keyboard_task()` you'll find code to handle: 27Within `keyboard_task()` you'll find code to handle:
28 28
@@ -77,7 +77,7 @@ At the keyboard level we define a C macro (typically named `KEYMAP()`) which map
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 `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.
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/master/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/661ca4440cc42f3b60697e98985c44b0571ccfc1/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
@@ -130,26 +130,31 @@ Comparing against our keymap we can see that the pressed key is KC_NLCK. From he
130 130
131##### Process Record 131##### Process Record
132 132
133The `process_record()` function itself is deceptively simple, but hidden within is a gateway to overriding functionality at various levels of QMK. The chain of events is described below, using cluecard whenever we need to look at the keyboard/keymap level functions. 133The `process_record()` function itself is deceptively simple, but hidden within is a gateway to overriding functionality at various levels of QMK. The chain of events is listed below, using cluecard whenever we need to look at the keyboard/keymap level functions. Depending on options set in rule.mk or elsewhere, only a subset of the functions below will be included in final firmware.
134 134
135* [`void process_record(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/action.c#L128) 135* [`void process_record(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/tmk_core/common/action.c#L172)
136 * [`bool process_record_quantum(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L140) 136 * [`bool process_record_quantum(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/quantum/quantum.c#L193)
137 * [Map this record to a keycode](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L143) 137 * [Map this record to a keycode](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/quantum/quantum.c#L213)
138 * [`bool process_record_kb(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/clueboard/card/card.c#L20) 138 * [`void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/quantum/process_keycode/process_tap_dance.c#L115)
139 * [`bool process_record_user(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/clueboard/card/keymaps/default/keymap.c#L58) 139 * [`bool process_key_lock(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/quantum/process_keycode/process_key_lock.c#L62)
140 * [`bool process_midi(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_midi.c#L102) 140 * [`bool process_clicky(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/quantum/process_keycode/process_clicky.c#L44)
141 * [`bool process_audio(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_audio.c#L10) 141 * [`bool process_record_kb(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/keyboards/clueboard/card/card.c#L20)
142 * [`bool process_music(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_music.c#L69) 142 * [`bool process_record_user(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/keyboards/clueboard/card/keymaps/default/keymap.c#L58)
143 * [`bool process_tap_dance(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_tap_dance.c#L75) 143 * [`bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/fdd0f915271f79b104aa5d216566bcc3fd134e85/quantum/rgb_matrix.c#L139)
144 * [`bool process_leader(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_leader.c#L32) 144 * [`bool process_midi(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_midi.c#L81)
145 * [`bool process_chording(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_chording.c#L41) 145 * [`bool process_audio(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_audio.c#L19)
146 * [`bool process_combo(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_combo.c#L115) 146 * [`bool process_steno(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_steno.c#L160)
147 * [`bool process_unicode(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicode.c#L22) 147 * [`bool process_music(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_music.c#L114)
148 * [`bool process_ucis(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_ucis.c#L91) 148 * [`bool process_tap_dance(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_tap_dance.c#L136)
149 * [`bool process_printer(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_printer.c#L77) 149 * [`bool process_leader(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_leader.c#L38)
150 * [`bool process_auto_shift(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_auto_shift.c#L47) 150 * [`bool process_combo(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_combo.c#L115)
151 * [`bool process_unicode_map(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicodemap.c#L47) 151 * [`bool process_unicode(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_unicode.c#L22)
152 * [Identify and process quantum specific keycodes](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L211) 152 * [`bool process_ucis(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_ucis.c#L91)
153 * [`bool process_printer(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_printer.c#L77)
154 * [`bool process_auto_shift(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_auto_shift.c#L94)
155 * [`bool process_unicode_map(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_unicodemap.c#L47)
156 * [`bool process_terminal(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_terminal.c#L264)
157 * [Identify and process quantum specific keycodes](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/quantum.c#L287)
153 158
154At any step during this chain of events a function (such as `process_record_kb()`) can `return false` to halt all further processing. 159At any step during this chain of events a function (such as `process_record_kb()`) can `return false` to halt all further processing.
155 160
diff --git a/docs/zh/README.md b/docs/zh/README.md
new file mode 100644
index 000000000..bb9d1371f
--- /dev/null
+++ b/docs/zh/README.md
@@ -0,0 +1,32 @@
1# QMK鍵盤固件
2
3[![當前版本](https://img.shields.io/github/tag/qmk/qmk_firmware.svg)](https://github.com/qmk/qmk_firmware/tags)
4[![築邦](https://travis-ci.org/qmk/qmk_firmware.svg?branch=master)](https://travis-ci.org/qmk/qmk_firmware)
5[![不和諧](https://img.shields.io/discord/440868230475677696.svg)](https://discord.gg/Uq7gcHh)
6[![文檔狀態](https://img.shields.io/badge/docs-ready-orange.svg)](https://docs.qmk.fm)
7[![GitHub的貢獻者](https://img.shields.io/github/contributors/qmk/qmk_firmware.svg)](https://github.com/qmk/qmk_firmware/pulse/monthly)
8[![GitHub的叉](https://img.shields.io/github/forks/qmk/qmk_firmware.svg?style=social&label=Fork)](https://github.com/qmk/qmk_firmware/)
9
10## 什麼是QMK固件?
11
12QMK是一個由社群維護的開源鍵盤韌體,其中包含了QMK Toolbox、qmk.fm和其它文件。QMK韌體是以[tmk\_keyboard](http://github.com/tmk/tmk_keyboard)為基礎,讓一些有用的功能在Atmel AVR控制器實現,使用於[OLKB](https://olkb.com)、[ergodox EZ](http://www.ergodox-ez.com),和[Clueboard](http://clueboard.co/)的產品中。它也被移植到使用ChibiOS的ARM晶片上。你也可以用它來讓你徒手佈線,或是客製的鍵盤PCB發揮功能。
13
14## 如何得到QMK
15
16如果你打算貢獻鍵盤佈局,鍵盤或功能QMK,最容易做的事情是[叉通過Github上爬行](https://github.com/qmk/qmk_firmware#fork-destination-box),和克隆你爬在本地進行更改,推動他們,然後打開從你的叉子[拉請求](https://github.com/qmk/qmk_firmware/pulls)。
17
18否則,您可以直接下載([拉鍊](https://github.com/qmk/qmk_firmware/zipball/master) [焦油](https://github.com/qmk/qmk_firmware/tarball/master)),或者通過GIT中克隆它(`git@github.com:qmk/qmk_firmware.git`)或HTTP(`https://github.com/qmk/qmk_firmware.git`)。
19
20## 如何編譯
21
22你可以編譯之前,你需要[安裝環境](getting_started_build_tools.md)用於AVR或/和ARM開發。一旦完成,你會使用`make`命令建立一個鍵盤並用以下符號鍵盤佈局
23
24 make planck/rev4:default
25
26這將建立`rev4` `planck`的修訂與`default`鍵盤映射。並非所有鍵盤有一個修訂版(也稱為子項目或文件夾),在這種情況下,它可以被省略:
27
28 make preonic:default
29
30## 如何赶近
31
32QMK有很多[特點](features.md)探索和很好的協議[參考文獻](http://docs.qmk.fm)挖通的。大部分功能通過修改[鍵盤映射(keymap.md),並改變[鍵碼](keycodes.md)冤大頭。
diff --git a/docs/zh/_sidebar.md b/docs/zh/_sidebar.md
new file mode 100644
index 000000000..c16761292
--- /dev/null
+++ b/docs/zh/_sidebar.md
@@ -0,0 +1,99 @@
1* [完全指南菜鳥](zh/newbs.md)
2 * [入門](zh/newbs_getting_started.md)
3 * [構建第一個固件](zh/newbs_building_firmware.md)
4 * [刷新固件](zh/newbs_flashing.md)
5 * [測試和調試](zh/newbs_testing_debugging.md)
6 * [最佳實踐](zh/newbs_best_practices.md)
7 * [學習資源](zh/newbs_learn_more_resources.md)
8
9* [QMK基礎](zh/README.md)
10 * [QMK簡介](zh/getting_started_introduction.md)
11 * [特約QMK](zh/contributing.md)
12 * [如何使用Github上](zh/getting_started_github.md)
13 * [獲得幫助](zh/getting_started_getting_help.md)
14
15* [常問問題](zh/faq.md)
16 * [常問問題](zh/faq_general.md)
17 * [構建/編譯QMK](zh/faq_build.md)
18 * [調試/故障排除QMK](zh/faq_debug.md)
19 * [鍵盤佈局](zh/faq_keymap.md)
20
21* 詳細指南
22 * [安裝編譯工具](zh/getting_started_build_tools.md)
23 * [流浪漢指南](zh/getting_started_vagrant.md)
24 * [構建/編譯器指令](zh/getting_started_make_guide.md)
25 * [刷新固件](zh/flashing.md)
26 * [定制功能](zh/custom_quantum_functions.md)
27 * [鍵盤映射概述](zh/keymap.md)
28
29* [硬件](zh/hardware.md)
30 * [AVR處理器](zh/hardware_avr.md)
31 * [司機](zh/hardware_drivers.md)
32
33* 參考
34 * [Keyboard Guidelines](zh/hardware_keyboard_guidelines.md)
35 * [Config Options](zh/config_options.md)
36 * [Keycodes](zh/keycodes.md)
37 * [Documentation Best Practices](zh/documentation_best_practices.md)
38 * [Documentation Templates](zh/documentation_templates.md)
39 * [Glossary](zh/reference_glossary.md)
40 * [Unit Testing](zh/unit_testing.md)
41 * [Useful Functions](zh/ref_functions.md)
42 * [Configurator Support](zh/reference_configurator_support.md)
43
44* [特點](zh/features.md)
45 * [Basic Keycodes](zh/keycodes_basic.md)
46 * [Quantum Keycodes](zh/quantum_keycodes.md)
47 * [Advanced Keycodes](zh/feature_advanced_keycodes.md)
48 * [Audio](zh/feature_audio.md)
49 * [Auto Shift](zh/feature_auto_shift.md)
50 * [Backlight](zh/feature_backlight.md)
51 * [Bluetooth](zh/feature_bluetooth.md)
52 * [Bootmagic](zh/feature_bootmagic.md)
53 * [Combos](zh/feature_combo)
54 * [Command](zh/feature_command.md)
55 * [Dynamic Macros](zh/feature_dynamic_macros.md)
56 * [Encoders](zh/feature_encoders.md)
57 * [Grave Escape](zh/feature_grave_esc.md)
58 * [Key Lock](zh/feature_key_lock.md)
59 * [Layouts](zh/feature_layouts.md)
60 * [Leader Key](zh/feature_leader_key.md)
61 * [Macros](zh/feature_macros.md)
62 * [Mouse Keys](zh/feature_mouse_keys.md)
63 * [One Shot Keys](zh/feature_advanced_keycodes.md#one-shot-keys)
64 * [Pointing Device](zh/feature_pointing_device.md)
65 * [PS/2 Mouse](zh/feature_ps2_mouse.md)
66 * [RGB Lighting](zh/feature_rgblight.md)
67 * [RGB Matrix](zh/feature_rgb_matrix.md)
68 * [Space Cadet Shift](zh/feature_space_cadet_shift.md)
69 * [Space Cadet Shift Enter](zh/feature_space_cadet_shift_enter.md)
70 * [Stenography](zh/feature_stenography.md)
71 * [Swap Hands](zh/feature_swap_hands.md)
72 * [Tap Dance](zh/feature_tap_dance.md)
73 * [Terminal](zh/feature_terminal.md)
74 * [Thermal Printer](zh/feature_thermal_printer.md)
75 * [Unicode](zh/feature_unicode.md)
76 * [Userspace](zh/feature_userspace.md)
77 * [US ANSI Shifted Keys](zh/keycodes_us_ansi_shifted.md)
78
79* 對於製造商和遊戲模組
80 * [Hand Wiring Guide](zh/hand_wire.md)
81 * [ISP Flashing Guide](zh/isp_flashing_guide.md)
82 * [ARM Debugging Guide](zh/arm_debugging.md)
83 * [I2C Driver](zh/i2c_driver.md)
84
85* 為了更深入的了解
86 * [How Keyboards Work](zh/how_keyboards_work.md)
87 * [Understanding QMK](zh/understanding_qmk.md)
88
89* 其它主題
90 * [Using Eclipse with QMK](zh/eclipse.md)
91
92* QMK內部(進行中)
93 * [Defines](zh/internals_defines.md)
94 * [Input Callback Reg](zh/internals_input_callback_reg.md)
95 * [Midi Device](zh/internals_midi_device.md)
96 * [Midi Device Setup Process](zh/internals_midi_device_setup_process.md)
97 * [Midi Util](zh/internals_midi_util.md)
98 * [Send Functions](zh/internals_send_functions.md)
99 * [Sysex Tools](zh/internals_sysex_tools.md)