aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/BUILD_GUIDE.md2
-rw-r--r--docs/Eclipse.md2
-rw-r--r--docs/HAND_WIRE.md2
-rw-r--r--docs/Home.md18
-rw-r--r--docs/Keycodes.md2
-rw-r--r--docs/Other-Projects.md62
-rw-r--r--docs/PCB_GUIDE.md2
-rw-r--r--docs/Porting-Your-Keyboard-to-QMK-(ARM-and-other-ChibiOS-CPUs).md70
-rw-r--r--docs/Porting-your-keyboard-to-QMK.md59
-rw-r--r--docs/Previously-Asked-Questions.asciidoc14
-rw-r--r--docs/QMK-Overview.md75
-rw-r--r--docs/Report-Descriptor.md1
-rw-r--r--docs/SUMMARY.md28
-rw-r--r--docs/Space-Cadet-Shift.md24
-rw-r--r--docs/TMK-Based-Projects.md34
-rw-r--r--docs/TMK-Own-Projects.md69
-rw-r--r--docs/TMK_README.md8
-rw-r--r--docs/Tap-Dance.md144
-rw-r--r--docs/Test-for-ASCIIDOC.asciidoc17
-rw-r--r--docs/USB-HID.md11
-rw-r--r--docs/Unicode-and-additional-language-support.md54
-rw-r--r--docs/Unit-testing.md68
-rw-r--r--docs/VAGRANT_GUIDE.md4
-rw-r--r--docs/_Sidebar.md21
-rw-r--r--docs/adding_features_to_qmk.md (renamed from docs/Adding-features-to-QMK.md)0
-rw-r--r--docs/becoming_a_qmk_collaborator.md (renamed from docs/Becoming-a-QMK-Collaborator.md)0
-rw-r--r--docs/build_environment_setup.md (renamed from docs/Build-Environment-Setup.md)2
-rw-r--r--docs/build_guide.md103
-rw-r--r--docs/build_old.md2
-rw-r--r--docs/compatible_microcontrollers.md (renamed from docs/Compatible-Microcontrollers.md)0
-rw-r--r--docs/custom_quantum_functions.md (renamed from docs/Custom-Quantum-Functions.md)0
-rw-r--r--docs/cygwin_guide.md352
-rw-r--r--docs/differences_from_tmk.md (renamed from docs/Differences-from-TMK.md)0
-rw-r--r--docs/dynamic_macros.md (renamed from docs/Dynamic-Macros.md)0
-rw-r--r--docs/eclipse.md84
-rw-r--r--docs/embedding.md64
-rw-r--r--docs/faq.md238
-rw-r--r--docs/faq_build.md (renamed from docs/FAQ-Build.md)2
-rw-r--r--docs/faq_keymap.md (renamed from docs/FAQ-Keymap.md)0
-rw-r--r--docs/fuse.txt50
-rw-r--r--docs/git_subtree.md (renamed from docs/Git-subtree.md)0
-rw-r--r--docs/hand_wire.md321
-rw-r--r--docs/hhkb_alt_controller.md (renamed from docs/HHKB-Alt-controller.md)0
-rw-r--r--docs/home.md134
-rw-r--r--docs/key_functions.md (renamed from docs/Key-Functions.md)2
-rw-r--r--docs/keycodes.md228
-rw-r--r--docs/keymap.md222
-rw-r--r--docs/keymap_examples.md (renamed from docs/Keymap-examples.md)0
-rw-r--r--docs/kiibohd.asciidoc29
-rw-r--r--docs/leader_key.md (renamed from docs/Leader-Key.md)0
-rw-r--r--docs/license_clarification.md (renamed from docs/License-Clarification.md)0
-rw-r--r--docs/license_clarification_details.md (renamed from docs/License-Clarification-Details.md)0
-rw-r--r--docs/macros.md158
-rw-r--r--docs/make_instructions.md (renamed from docs/Make-Instructions.md)2
-rw-r--r--docs/mbed_cortex_porting.md (renamed from docs/mbed-cortex-porting.md)0
-rw-r--r--docs/memory_write_error,_use_debug_for_more_info.md (renamed from docs/Memory-write-error,-use-debug-for-more-info.md)0
-rw-r--r--docs/modding_your_keyboard.md (renamed from docs/Modding-your-keyboard.md)0
-rw-r--r--docs/mouse_keys.md (renamed from docs/Mouse-keys.md)0
58 files changed, 2008 insertions, 776 deletions
diff --git a/docs/BUILD_GUIDE.md b/docs/BUILD_GUIDE.md
index 78cf00b91..8573b0fd1 100644
--- a/docs/BUILD_GUIDE.md
+++ b/docs/BUILD_GUIDE.md
@@ -35,7 +35,7 @@ Debian/Ubuntu example:
35 sudo apt-get install gcc-avr avr-libc dfu-programmer 35 sudo apt-get install gcc-avr avr-libc dfu-programmer
36 36
37### Vagrant 37### Vagrant
38If 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 file](VAGRANT_GUIDE.md). 38If 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](vagrant_guide.md).
39 39
40## Verify Your Installation 40## Verify Your Installation
411. If you haven't already, obtain this repository ([https://github.com/qmk/qmk_firmware](https://github.com/qmk/qmk_firmware)). You can either download it as a zip file and extract it, or clone it using the command line tool git or the Github Desktop application. 411. If you haven't already, obtain this repository ([https://github.com/qmk/qmk_firmware](https://github.com/qmk/qmk_firmware)). You can either download it as a zip file and extract it, or clone it using the command line tool git or the Github Desktop application.
diff --git a/docs/Eclipse.md b/docs/Eclipse.md
index b9aa67637..ec5f2dc0d 100644
--- a/docs/Eclipse.md
+++ b/docs/Eclipse.md
@@ -15,7 +15,7 @@ Note that this set-up has been tested on Ubuntu 16.04 only for the moment.
15 15
16# Prerequisites 16# Prerequisites
17## Build environment 17## Build environment
18Before starting, you must have followed the [Getting Started](/Home.md#getting-started) section corresponding to your system. In particular, you must have been able to build the firmware with [the `make` command](../#the-make-command). 18Before starting, you must have followed the [Getting Started](home.md#getting-started) section corresponding to your system. In particular, you must have been able to build the firmware with [the `make` command](../#the-make-command).
19 19
20## Java 20## Java
21Eclipse is a Java application, so you will need to install Java 8 or more recent to be able to run it. You may choose between the JRE or the JDK, the latter being useful if you intend to do Java development. 21Eclipse is a Java application, so you will need to install Java 8 or more recent to be able to run it. You may choose between the JRE or the JDK, the latter being useful if you intend to do Java development.
diff --git a/docs/HAND_WIRE.md b/docs/HAND_WIRE.md
index 17ef3116f..0d3372815 100644
--- a/docs/HAND_WIRE.md
+++ b/docs/HAND_WIRE.md
@@ -282,7 +282,7 @@ It's also important to use the `KEYMAP` function we defined earlier - this is wh
282 282
283#### Compiling your firmware 283#### Compiling your firmware
284 284
285After you've written out your entire keymap, you're ready to get the firmware compiled and onto your Teensy. Before compiling, you'll need to get your [development environment set-up](/doc/BUILD_GUIDE.md) - you can skip the dfu-programmer instructions, but you'll need to download and install the [Teensy Loader](https://www.pjrc.com/teensy/loader.html) to get the firmware on your Teensy. 285After you've written out your entire keymap, you're ready to get the firmware compiled and onto your Teensy. Before compiling, you'll need to get your [development environment set-up](build_guide.md) - you can skip the dfu-programmer instructions, but you'll need to download and install the [Teensy Loader](https://www.pjrc.com/teensy/loader.html) to get the firmware on your Teensy.
286 286
287Once everything is installed, running `make` in the terminal should get you some output, and eventually a `<project_name>.hex` file in that folder. If you're having trouble with this step, see the end of the guide for the trouble-shooting section. 287Once everything is installed, running `make` in the terminal should get you some output, and eventually a `<project_name>.hex` file in that folder. If you're having trouble with this step, see the end of the guide for the trouble-shooting section.
288 288
diff --git a/docs/Home.md b/docs/Home.md
index 500712a22..df27ebdc5 100644
--- a/docs/Home.md
+++ b/docs/Home.md
@@ -1,31 +1,31 @@
1# Quantum Mechanical Keyboard Firmware 1# Quantum Mechanical Keyboard Firmware
2 2
3You have found the QMK Firmware documentation site. This is a keyboard firmware based on the [tmk\_keyboard firmware](http://github.com/tmk/tmk_keyboard) \([view differences](/Differences-from-TMK.md)\) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.com), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/). It has also been ported to ARM chips using ChibiOS. You can use it to power your own hand-wired or custom keyboard PCB. 3You have found the QMK Firmware documentation site. This is a keyboard firmware based on the [tmk\_keyboard firmware](http://github.com/tmk/tmk_keyboard) \([view differences](differences_from_tmk.md)\) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.com), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/). It has also been ported to ARM chips using ChibiOS. You can use it to power your own hand-wired or custom keyboard PCB.
4 4
5# Getting started 5# Getting started
6 6
7Before you are able to compile, you'll need to install an environment for AVR or ARM development. You'll find the instructions for any OS below. If you find another/better way to set things up from scratch, please consider [making a pull request](https://github.com/qmk/qmk_firmware/pulls) with your changes! 7Before you are able to compile, you'll need to install an environment for AVR or ARM development. You'll find the instructions for any OS below. If you find another/better way to set things up from scratch, please consider [making a pull request](https://github.com/qmk/qmk_firmware/pulls) with your changes!
8 8
9* [Build Environment Setup](/Build-Environment-Setup.md) 9* [Build Environment Setup](build_environment_setup.md)
10* [QMK Overview](/QMK-Overview.md) 10* [QMK Overview](qmk_overview.md)
11 11
12# Configuring QMK Firmware 12# Configuring QMK Firmware
13 13
14The QMK Firmware can be configured via the `keymaps` array data. For simply generating a [basic keycode](/Keycodes.md), you add it as an element of your `keymaps` array data. For more complicated actions, there are more advanced keycodes that are organized carefully to represent common operations, some of which can be found on the [Key Functions](/Key-Functions.md) page. 14The QMK Firmware can be configured via the `keymaps` array data. For simply generating a [basic keycode](keycodes.md), you add it as an element of your `keymaps` array data. For more complicated actions, there are more advanced keycodes that are organized carefully to represent common operations, some of which can be found on the [Key Functions](key_functions.md) page.
15 15
16For more details of the `keymaps` array, see [Keymap Overview](/Keymap.md) page. 16For more details of the `keymaps` array, see [Keymap Overview](keymap.md) page.
17 17
18## Space Cadet Shift: The future, built in 18## Space Cadet Shift: The future, built in
19 19
20Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds. Head on over to the [Space Cadet Shift](/Space-Cadet-Shift.md) page to read about it. 20Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds. Head on over to the [Space Cadet Shift](space_cadet_shift.md) page to read about it.
21 21
22## The Leader key: A new kind of modifier 22## The Leader key: A new kind of modifier
23 23
24Most modifiers have to be held or toggled. But what if you had a key that indicated the start of a sequence? You could press that key and then rapidly press 1-3 more keys to trigger a macro, or enter a special layer, or anything else you might want to do. To learn more about it check out the [Leader Key](/Leader-Key.md) page. 24Most modifiers have to be held or toggled. But what if you had a key that indicated the start of a sequence? You could press that key and then rapidly press 1-3 more keys to trigger a macro, or enter a special layer, or anything else you might want to do. To learn more about it check out the [Leader Key](leader_key.md) page.
25 25
26## Tap Dance: A single key can do 3, 5, or 100 different things 26## Tap Dance: A single key can do 3, 5, or 100 different things
27 27
28Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a colon. Hit it three times, and your keyboard's LEDs do a wild dance. That's just one example of what Tap Dance can do. Read more about it on the [Tap Dance](/Tap-Dance.md) page. 28Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a colon. Hit it three times, and your keyboard's LEDs do a wild dance. That's just one example of what Tap Dance can do. Read more about it on the [Tap Dance](tap_dance.md) page.
29 29
30## Temporarily setting the default layer 30## Temporarily setting the default layer
31 31
@@ -33,7 +33,7 @@ Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a co
33 33
34## Macro shortcuts: Send a whole string when pressing just one key 34## Macro shortcuts: Send a whole string when pressing just one key
35 35
36How would you like a single keypress to send a whole word, sentence, paragraph, or even document? Head on over to the [Macros](/Macros.md) page to read up on all aspects of Simple and Dynamic Macros. 36How would you like a single keypress to send a whole word, sentence, paragraph, or even document? Head on over to the [Macros](macros.md) page to read up on all aspects of Simple and Dynamic Macros.
37 37
38## Additional keycode aliases for software-implemented layouts \(Colemak, Dvorak, etc\) 38## Additional keycode aliases for software-implemented layouts \(Colemak, Dvorak, etc\)
39 39
diff --git a/docs/Keycodes.md b/docs/Keycodes.md
index a0c95a99f..5cf5c019d 100644
--- a/docs/Keycodes.md
+++ b/docs/Keycodes.md
@@ -1,6 +1,6 @@
1# Overview 1# Overview
2 2
3When defining a [keymap](Keymap.md) each key needs a valid key definition. 3When defining a [keymap](keymap.md) each key needs a valid key definition.
4 4
5This page documents the symbols that correspond to keycodes that are available to you in QMK. 5This page documents the symbols that correspond to keycodes that are available to you in QMK.
6 6
diff --git a/docs/Other-Projects.md b/docs/Other-Projects.md
deleted file mode 100644
index 163c7c1cf..000000000
--- a/docs/Other-Projects.md
+++ /dev/null
@@ -1,62 +0,0 @@
1Keyboard Firmware Projects other than TMK
2================================
3## PJRC USB Keyboard/Mouse Example[USB][PJRC][Teensy][AVR]
4- <http://www.pjrc.com/teensy/usb_keyboard.html>
5- <http://www.pjrc.com/teensy/usb_mouse.html>
6
7## kbupgrade[USB][V-USB][AVR]
8- <http://github.com/rhomann/kbupgrade>
9- <http://geekhack.org/showwiki.php?title=Island:8406>
10
11## c64key[USB][V-USB][AVR]
12- <http://symlink.dk/projects/c64key/>
13
14## rump[USB][V-USB][AVR]
15- <http://mg8.org/rump/>
16- <http://github.com/clee/rump>
17
18## dulcimer[USB][V-USB][AVR]
19- <http://www.schatenseite.de/dulcimer.html>
20
21## humblehacker-keyboard[USB][LUFA][AVR][Ergo]
22- <http://github.com/humblehacker>
23- <http://www.humblehacker.com/keyboard/>
24- <http://geekhack.org/showwiki.php?title=Island:6292>
25
26## ps2avr[PS/2][AVR]
27- <http://sourceforge.net/projects/ps2avr/>
28
29## ErgoDox[Ergo][Split][USB][AVR]
30- <http://geekhack.org/index.php?topic=22780.0>
31- <https://github.com/benblazak/ergodox-firmware>
32- <https://github.com/cub-uanic/tmk_keyboard>
33
34## Suka's keyboard collection[Ergo][Split][3DPrinting][USB][AVR]
35- <http://deskthority.net/workshop-f7/my-diy-keyboard-collection-or-how-i-became-a-kb-geek-t2534.html>
36- <https://github.com/frobiac/adnw>
37
38## bpiphany's AVR-Keyboard[PJRC][AVR][USB]
39- <https://github.com/BathroomEpiphanies/AVR-Keyboard>
40- <http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions>
41- <http://deskthority.net/wiki/Phantom>
42
43## USB-USB keyboard remapper[converter][USB-USB][AVR][Arduino]
44- <http://forum.colemak.com/viewtopic.php?pid=10837>
45- <https://github.com/darkytoothpaste/keymapper>
46
47## USB-USB converter threads[converter][USB-USB]
48- <http://deskthority.net/workshop-f7/is-remapping-a-usb-keyboard-using-teensy-possible-t2841-30.html>
49- <http://geekhack.org/index.php?topic=19458.0>
50
51## kbdbabel.org[converter][vintage][protocol][8051]
52Great resource of vintage keyboard protocol information and code
53
54- <http://www.kbdbabel.org/>
55
56## Haata's kiibohd Controller[converter][vintage][protocol][AVR][PJRC][Cortex]
57A lots of vintage keyboard protocol supports
58
59- <https://github.com/kiibohd/controller>
60
61## Kinesis ergonomic keyboard firmware replacement[V-USB][LUFA][Ergo]
62- <https://github.com/chrisandreae/kinesis-firmware>
diff --git a/docs/PCB_GUIDE.md b/docs/PCB_GUIDE.md
index 16de71114..e07a11488 100644
--- a/docs/PCB_GUIDE.md
+++ b/docs/PCB_GUIDE.md
@@ -119,7 +119,7 @@ A number of other keycodes have been added that you may find useful:
119 119
120The extended keymap extends the number of function layers from 32 to the near-infinite value of 256. Rather than using `FN<num>` notation (still available, but limited to `FN0`-`FN31`), you can use the `FUNC(<num>)` notation. `F(<num>)` is a shortcut for this. 120The extended keymap extends the number of function layers from 32 to the near-infinite value of 256. Rather than using `FN<num>` notation (still available, but limited to `FN0`-`FN31`), you can use the `FUNC(<num>)` notation. `F(<num>)` is a shortcut for this.
121 121
122The function actions are unchanged, and you can see the full list of them [here](https://github.com/jackhumbert/tmk_keyboard/blob/master/common/action_code.h). They are explained in detail [here](https://github.com/jackhumbert/tmk_keyboard/blob/master/doc/keymap.md#2-action). 122The function actions are unchanged, and you can see the full list of them [here](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/action_code.h). They are explained in detail [here](keymap.md#2-action).
123 123
124### Macros 124### Macros
125 125
diff --git a/docs/Porting-Your-Keyboard-to-QMK-(ARM-and-other-ChibiOS-CPUs).md b/docs/Porting-Your-Keyboard-to-QMK-(ARM-and-other-ChibiOS-CPUs).md
deleted file mode 100644
index 436c73cb7..000000000
--- a/docs/Porting-Your-Keyboard-to-QMK-(ARM-and-other-ChibiOS-CPUs).md
+++ /dev/null
@@ -1,70 +0,0 @@
1Setting up your ARM based PCB is a little more involved than an Atmel MCU, but is easy enough. Start by using `util/new_project.sh <keyboard>` to create a new project:
2
3```
4$ util/new_project.sh simontester
5######################################################
6# /keyboards/simontester project created. To start
7# working on things, cd into keyboards/simontester
8######################################################
9```
10
11
12
13# END OF NEW ARM DOC, OLD ATMEL DOC FOLLOWS
14
15## `/keyboards/<keyboard>/config.h`
16
17The `USB Device descriptor parameter` block contains parameters are used to uniquely identify your keyboard, but they don't really matter to the machine.
18
19Your `MATRIX_ROWS` and `MATRIX_COLS` are the numbers of rows and cols in your keyboard matrix - this may be different than the number of actual rows and columns on your keyboard. There are some tricks you can pull to increase the number of keys in a given matrix, but most keyboards are pretty straight-forward.
20
21The `MATRIX_ROW_PINS` and `MATRIX_COL_PINS` are the pins your MCU uses on each row/column. Your schematic (if you have one) will have this information on it, and the values will vary depending on your setup. This is one of the most important things to double-check in getting your keyboard setup correctly.
22
23For the `DIODE_DIRECTION`, most hand-wiring guides will instruct you to wire the diodes in the `COL2ROW` position, but it's possible that they are in the other - people coming from EasyAVR often use `ROW2COL`. Nothing will function if this is incorrect.
24
25`BACKLIGHT_PIN` is the pin that your PWM-controlled backlight (if one exists) is hooked-up to. Currently only B5, B6, and B7 are supported.
26
27`BACKLIGHT_BREATHING` is a fancier backlight feature that adds breathing/pulsing/fading effects to the backlight. It uses the same timer as the normal backlight. These breathing effects must be called by code in your keymap.
28
29`BACKLIGHT_LEVELS` is how many levels exist for your backlight - max is 15, and they are computed automatically from this number.
30
31## `/keyboards/<keyboard>/Makefile`
32
33The values at the top likely won't need to be changed, since most boards use the `atmega32u4` chip. The `BOOTLOADER_SIZE` will need to be adjusted based on your MCU type. It's defaulted to the Teensy, since that's the most common controller. Below is quoted from the `Makefile`.
34
35```
36# Boot Section Size in *bytes*
37# Teensy halfKay 512
38# Teensy++ halfKay 1024
39# Atmel DFU loader 4096
40# LUFA bootloader 4096
41# USBaspLoader 2048
42OPT_DEFS += -DBOOTLOADER_SIZE=512
43```
44
45At the bottom of the file, you'll find lots of features to turn on and off - all of these options should be set with `?=` to allow for the keymap overrides. `?=` only assigns if the variable was previously undefined. For the full documenation of these features, see the [Makefile options](#makefile-options).
46
47## `/keyboards/<keyboard>/readme.md`
48
49This is where you'll describe your keyboard - please write as much as you can about it! Talking about default functionality/features is useful here. Feel free to link to external pages/sites if necessary. Images can be included here as well. This file will be rendered into a webpage at qmk.fm/keyboards/<keyboard>/.
50
51## `/keyboards/<keyboard>/<keyboard>.c`
52
53This is where all of the custom logic for your keyboard goes - you may not need to put anything in this file, since a lot of things are configured automatically. All of the `*_kb()` functions are defined here. If you modify them, remember to keep the calls to `*_user()`, or things in the keymaps might not work. You can read more about the functions [here](#custom-quantum-functions-for-keyboards-and-keymaps)
54
55## `/keyboards/<keyboard>/<keyboard>.h`
56
57Here is where you can (optionally) define your `KEYMAP` function to remap your matrix into a more readable format. With ortholinear boards, this isn't always necessary, but it can help to accomodate the dead spots on your matrix, where there are keys that take up more than one space (2u, staggering, 6.25u, etc). The example shows the difference between the physical keys, and the matrix design:
58
59```
60#define KEYMAP( \
61 k00, k01, k02, \
62 k10, k11 \
63) \
64{ \
65 { k00, k01, k02 }, \
66 { k10, KC_NO, k11 }, \
67}
68```
69
70Each of the `kxx` variables needs to be unique, and usually follows the format `k<row><col>`. You can place `KC_NO` where your dead keys are in your matrix.
diff --git a/docs/Porting-your-keyboard-to-QMK.md b/docs/Porting-your-keyboard-to-QMK.md
deleted file mode 100644
index 6f291a432..000000000
--- a/docs/Porting-your-keyboard-to-QMK.md
+++ /dev/null
@@ -1,59 +0,0 @@
1If your keyboard is running an Atmega chip (atmega32u4 and others), it's pretty easy to get things setup for compiling your own firmware to flash onto your board. There is a `/util/new_project.sh <keyboard>` script to help get you started - you can simply pass your keyboard's name into the script, and all of the necessary files will be created. The components of each are described below.
2
3## `/keyboards/<keyboard>/config.h`
4
5The `USB Device descriptor parameter` block contains parameters are used to uniquely identify your keyboard, but they don't really matter to the machine.
6
7Your `MATRIX_ROWS` and `MATRIX_COLS` are the numbers of rows and cols in your keyboard matrix - this may be different than the number of actual rows and columns on your keyboard. There are some tricks you can pull to increase the number of keys in a given matrix, but most keyboards are pretty straight-forward.
8
9The `MATRIX_ROW_PINS` and `MATRIX_COL_PINS` are the pins your MCU uses on each row/column. Your schematic (if you have one) will have this information on it, and the values will vary depending on your setup. This is one of the most important things to double-check in getting your keyboard setup correctly.
10
11For the `DIODE_DIRECTION`, most hand-wiring guides will instruct you to wire the diodes in the `COL2ROW` position, but it's possible that they are in the other - people coming from EasyAVR often use `ROW2COL`. Nothing will function if this is incorrect.
12
13`BACKLIGHT_PIN` is the pin that your PWM-controlled backlight (if one exists) is hooked-up to. Currently only B5, B6, and B7 are supported.
14
15`BACKLIGHT_BREATHING` is a fancier backlight feature that adds breathing/pulsing/fading effects to the backlight. It uses the same timer as the normal backlight. These breathing effects must be called by code in your keymap.
16
17`BACKLIGHT_LEVELS` is how many levels exist for your backlight - max is 15, and they are computed automatically from this number.
18
19## `/keyboards/<keyboard>/Makefile`
20
21The values at the top likely won't need to be changed, since most boards use the `atmega32u4` chip. The `BOOTLOADER_SIZE` will need to be adjusted based on your MCU type. It's defaulted to the Teensy, since that's the most common controller. Below is quoted from the `Makefile`.
22
23```
24# Boot Section Size in *bytes*
25# Teensy halfKay 512
26# Teensy++ halfKay 1024
27# Atmel DFU loader 4096
28# LUFA bootloader 4096
29# USBaspLoader 2048
30OPT_DEFS += -DBOOTLOADER_SIZE=512
31```
32
33At the bottom of the file, you'll find lots of features to turn on and off - all of these options should be set with `?=` to allow for the keymap overrides. `?=` only assigns if the variable was previously undefined. For the full documenation of these features, see the [Makefile options](#makefile-options).
34
35## `/keyboards/<keyboard>/readme.md`
36
37This is where you'll describe your keyboard - please write as much as you can about it! Talking about default functionality/features is useful here. Feel free to link to external pages/sites if necessary. Images can be included here as well. This file will be rendered into a webpage at qmk.fm/keyboards/<keyboard>/.
38
39## `/keyboards/<keyboard>/<keyboard>.c`
40
41This is where all of the custom logic for your keyboard goes - you may not need to put anything in this file, since a lot of things are configured automatically. All of the `*_kb()` functions are defined here. If you modify them, remember to keep the calls to `*_user()`, or things in the keymaps might not work. You can read more about the functions [here](#custom-quantum-functions-for-keyboards-and-keymaps)
42
43## `/keyboards/<keyboard>/<keyboard>.h`
44
45Here is where you can (optionally) define your `KEYMAP` function to remap your matrix into a more readable format. With ortholinear boards, this isn't always necessary, but it can help to accomodate the dead spots on your matrix, where there are keys that take up more than one space (2u, staggering, 6.25u, etc). The example shows the difference between the physical keys, and the matrix design:
46
47```
48#define KEYMAP( \
49 k00, k01, k02, \
50 k10, k11 \
51) \
52{ \
53 { k00, k01, k02 }, \
54 { k10, KC_NO, k11 }, \
55}
56```
57
58Each of the `kxx` variables needs to be unique, and usually follows the format `k<row><col>`. You can place `KC_NO` where your dead keys are in your matrix.
59
diff --git a/docs/Previously-Asked-Questions.asciidoc b/docs/Previously-Asked-Questions.asciidoc
deleted file mode 100644
index 36af1f203..000000000
--- a/docs/Previously-Asked-Questions.asciidoc
+++ /dev/null
@@ -1,14 +0,0 @@
1= Previously Asked Questions
2:toc:
3:toc-placement: preamble
4
5toc::[]
6
7= Question thread
8http://deskthority.net/workshop-f7/how-to-build-your-very-own-keyboard-firmware-t7177-270.html
9
10= Questions
11== Columns beyond 16(uint16_t) cannot be read
12* https://github.com/tmk/tmk_keyboard/wiki/FAQ#cant-read-comlumn-of-matrix-beyond-16
13* http://deskthority.net/workshop-f7/how-to-build-your-very-own-keyboard-firmware-t7177-270.html#p247051
14* http://deskthority.net/workshop-f7/rebuilding-and-redesigning-a-classic-thinkpad-keyboard-t6181-60.html#p146279
diff --git a/docs/QMK-Overview.md b/docs/QMK-Overview.md
deleted file mode 100644
index f595bd237..000000000
--- a/docs/QMK-Overview.md
+++ /dev/null
@@ -1,75 +0,0 @@
1# QMK Overview
2
3This page attempts to explain the basic information you need to know to work with the QMK project. It assumes that you are familiar with navigating a UNIX shell, but does not assume you are familiar with C or with compiling using make.
4
5# Basic QMK structure
6
7QMK is a fork of @tmk's [tmk_keyboard](https://github.com/tmk/tmk_keyboard) project. The original TMK code, with modifications, can be found in the `tmk` folder. The QMK additions to the project may be found in the `quantum` folder. Keyboard projects may be found in the `handwired` and `keyboard` folders.
8
9## Keyboard project structure
10
11Within the `handwired` and `keyboard` folders is a directory for each keyboard project, for example `qmk_firmware/keyboards/clueboard`. Within you'll find the following structure:
12
13* `keymaps/`: Different keymaps that can be built
14* `rules.mk`: The file that sets the default "make" options. Do not edit this file directly, instead use a keymap specific `Makefile`.
15* `config.h`: The file that sets the default compile time options. Do not edit this file directly, instead use a keymap specific `config.h`.
16
17### Keymap structure
18
19In every keymap folder, the following files may be found. Only `keymap.c` is required, if the rest of the files are not found the default options will be chosen.
20
21* `config.h`: the options to configure your keymap
22* `keymap.c`: all of your keymap code, required
23* `Makefile`: the features of QMK that are enabled, required to run `make` in your keymap folder
24* `readme.md`: a description of your keymap, how others might use it, and explanations of features
25* Other files: Some people choose to include an image depicting the layout, and other files that help people to use or understand a particular keymap.
26
27# The `make` command
28
29The `make` command is how you compile the firmware into a .hex file, which can be loaded by a dfu programmer (like dfu-progammer via `make dfu`) or the [Teensy loader](https://www.pjrc.com/teensy/loader.html) (only used with Teensys). It it recommended that you always run make from within the `root` folder.
30
31**NOTE:** To abort a make command press `Ctrl-c`
32
33For more details on the QMK build process see [Make Instructions](/Make-Instructions.md).
34
35### Simple instructions for building and uploading a keyboard
36
37**Most keyboards have more specific instructions in the keyboard specific readme.md file, so please check that first**
38
391. Enter the `root` folder
402. Run `make <keyboard>-<subproject>-<keymap>-<programmer>`
41
42In the above commands, replace:
43
44* `<keyboard>` with the name of your keyboard
45* `<keymap>` with the name of your keymap
46* `<subproject>` with the name of the subproject (revision or sub-model of your keyboard). For example, for Ergodox it can be `ez` or `infinity`, and for Planck `rev3` or `rev4`.
47 * If the keyboard doesn't have a subproject, or if you are happy with the default (defined in `rules.mk` file of the `keyboard` folder), you can leave it out. But remember to also remove the dash (`-`) from the command.
48* `<programmer>` The programmer to use. Most keyboards use `dfu`, but some use `teensy`. Infinity keyboards use `dfu-util`. Check the readme file in the keyboard folder to find out which programmer to use.
49 * If you don't add `-<programmer` to the command line, the firmware will be still be compiled into a hex file, but the upload will be skipped.
50
51**NOTE:** Some operating systems will refuse to program unless you run the make command as root for example `sudo make clueboard-default-dfu`
52
53## Make Examples
54
55* Build all Clueboard keymaps: `make clueboard`
56* Build the default Planck keymap: `make planck-rev4-default`
57* Build and flash your ergodox-ez: `make ergodox-ez-default-teensy`
58
59# The `config.h` file
60
61There are 2 `config.h` locations:
62
63* keyboard (`/keyboards/<keyboard>/`)
64* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/`)
65
66The keyboard `config.h` is included only if the keymap one doesn't exist. The format to use for your custom one [is here](https://github.com/qmk/qmk_firmware/blob/master/doc/keymap_config_h_example.h). If you want to override a setting from the parent `config.h` file, you need to do this:
67
68```c
69#undef MY_SETTING
70#define MY_SETTING 4
71```
72
73For a value of `4` for this imaginary setting. So we `undef` it first, then `define` it.
74
75You can then override any settings, rather than having to copy and paste the whole thing. \ No newline at end of file
diff --git a/docs/Report-Descriptor.md b/docs/Report-Descriptor.md
deleted file mode 100644
index fd5e96c67..000000000
--- a/docs/Report-Descriptor.md
+++ /dev/null
@@ -1 +0,0 @@
1# Get Report Descriptor with lsusb \ No newline at end of file
diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md
deleted file mode 100644
index 45ba5267e..000000000
--- a/docs/SUMMARY.md
+++ /dev/null
@@ -1,28 +0,0 @@
1
2### Getting started
3* [Introduction](Home.md)
4* [QMK Overview](QMK-Overview.md)
5* [Build Environment Setup](Build-Environment-Setup.md)
6
7### Making a keymap
8* [Keymap overview](Keymap.md)
9* [Custom Quantum Functions](Custom-Quantum-Functions.md)
10* [Keycodes](Keycodes.md)
11* [Layer switching](Key-Functions.md)
12* [Leader Key](Leader-Key.md)
13* [Macros](Macros.md)
14* [Dynamic Macros](Dynamic-Macros.md)
15* [Space Cadet](Space-Cadet-Shift.md)
16* [Tap Dance](Tap-Dance.md)
17* [Mouse keys](Mouse-keys.md)
18* [FAQ: Creating a Keymap](FAQ-Keymap.md)
19* [FAQ: Compiling QMK](FAQ-Build.md)
20
21### For hardware makers and modders
22* [Modding your keyboard](Modding-your-keyboard.md)
23* [Porting your keyboard to QMK](Porting-your-keyboard-to-QMK.md)
24* [Adding features to QMK](Adding-features-to-QMK.md)
25
26### Other topics
27* [General FAQ](FAQ.md)
28* [Differences from TMK](Differences-from-TMK.md)
diff --git a/docs/Space-Cadet-Shift.md b/docs/Space-Cadet-Shift.md
deleted file mode 100644
index a1ec256de..000000000
--- a/docs/Space-Cadet-Shift.md
+++ /dev/null
@@ -1,24 +0,0 @@
1## Space Cadet Shift: The future, built in
2
3Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds.
4
5To use it, use `KC_LSPO` (Left Shift, Parens Open) for your left Shift on your keymap, and `KC_RSPC` (Right Shift, Parens Close) for your right Shift.
6
7It's defaulted to work on US keyboards, but if your layout uses different keys for parenthesis, you can define those in your `config.h` like this:
8
9 #define LSPO_KEY KC_9
10 #define RSPC_KEY KC_0
11
12You can also choose between different rollover behaviors of the shift keys by defining:
13
14 #define DISABLE_SPACE_CADET_ROLLOVER
15
16in your `config.h`. Disabling rollover allows you to use the opposite shift key to cancel the space cadet state in the event of an erroneous press instead of emitting a pair of parentheses when the keys are released.
17
18The only other thing you're going to want to do is create a `Makefile` in your keymap directory and set the following:
19
20```
21COMMAND_ENABLE = no # Commands for debug and configuration
22```
23
24This is just to keep the keyboard from going into command mode when you hold both Shift keys at the same time.
diff --git a/docs/TMK-Based-Projects.md b/docs/TMK-Based-Projects.md
deleted file mode 100644
index 0597b04c3..000000000
--- a/docs/TMK-Based-Projects.md
+++ /dev/null
@@ -1,34 +0,0 @@
1## TMK based projects
2Add your project here!
3See https://github.com/tmk/tmk_keyboard/issues/173
4
5### keyboards
6**S60-X**: [DIY 60% keyboard](https://www.massdrop.com/buy/sentraq-60-diy-keyboard-kit?mode=guest_open) designed by [VinnyCordeiro](https://github.com/VinnyCordeiro) for Sentraq:
7- https://github.com/VinnyCordeiro/tmk_keyboard
8
9**Octagon V1**: Korean custom keyboard designed by Duck.
10- https://github.com/xauser/tmk_keyboard/tree/xauser
11
12**Compact L3**: Custom keyboard designed by LifeZone and LeeKu.
13- https://github.com/xauser/tmk_keyboard/tree/xauser
14
15**KMAC, 1,2 and Happy**: Custom keyboard designed by kbdmania.
16- https://github.com/ageaenes/tmk_keyboard
17
18**P60**: [DIY wired 60% keyboard](https://imgur.com/a/zwsDN) by [p3lim](https://github.com/p3lim).
19- https://github.com/p3lim/keyboard_firmware
20
21**Nerd, Kitten Paw, Lightsaber, Phantom, Lightpad, Ergodox** on [xauser](https://github.com/xauser)'s repository
22- https://github.com/xauser/tmk_keyboard/tree/xauser
23
24**ErgoDox** on [cub-unanic](https://github.com/cub-uanic)'s repository
25- https://github.com/cub-uanic/tmk_keyboard/tree/master/keyboard/ergodox
26
27**Atreus** by [technomancy](https://atreus.technomancy.us)
28- https://github.com/technomancy/tmk_keyboard/tree/atreus/keyboard/atreus
29
30**[mcdox](https://github.com/DavidMcEwan/mcdox)**
31- https://github.com/DavidMcEwan/tmk_keyboard/tree/master/keyboard/mcdox
32
33
34### converters \ No newline at end of file
diff --git a/docs/TMK-Own-Projects.md b/docs/TMK-Own-Projects.md
deleted file mode 100644
index fb5b2c990..000000000
--- a/docs/TMK-Own-Projects.md
+++ /dev/null
@@ -1,69 +0,0 @@
1## TMK own projects by hasu
2Located in [tmk_keyboard](https://github.com/tmk/tmk_keyboard/tree/master/) repository.
3
4### converter
5* [ps2_usb] - [PS/2 keyboard to USB][GH_ps2]
6* [adb_usb] - [ADB keyboard to USB][GH_adb]
7* [m0110_usb] - [Macintosh 128K/512K/Plus keyboard to USB][GH_m0110]
8* [terminal_usb] - [IBM Model M terminal keyboard(PS/2 scancode set3) to USB][GH_terminal]
9* [news_usb] - [Sony NEWS keyboard to USB][GH_news]
10* [x68k_usb] - [Sharp X68000 keyboard to USB][GH_x68k]
11* [sun_usb] - [Sun] to USB(type4, 5 and 3?)
12* [pc98_usb] - [PC98] to USB
13* [usb_usb] - USB to USB(experimental)
14* [ascii_usb] - ASCII(Serial console terminal) to USB
15* [ibm4704_usb] - [IBM 4704 keyboard Converter][GH_ibm4704]
16
17### keyboard
18* [hhkb] - [Happy Hacking Keyboard pro][GH_hhkb]
19* [gh60] - [GH60][GH60_diy] DIY 60% keyboard [prototype][GH60_proto]
20* [hbkb] - [Happy Buckling spring keyboard][GH_hbkb](IBM Model M 60% mod)
21* [hid_liber] - [HID liberation][HID_liber] controller (by alaricljs)
22* [phantom] - [Phantom] keyboard (by Tranquilite)
23* [IIgs_Standard] - Apple [IIGS] keyboard mod(by JeffreySung)
24* [macway] - [Compact keyboard mod][GH_macway] [retired]
25* [KMAC] - Korean custom keyboard
26* [Lightsaber] - Korean custom keyboard
27
28[ps2_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/ps2_usb/
29[adb_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb/
30[m0110_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/m0110_usb
31[terminal_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/terminal_usb/
32[news_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/news_usb/
33[x68k_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/x68k_usb/
34[sun_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/sun_usb/
35[pc98_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/pc98_usb/
36[usb_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/usb_usb/
37[ascii_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/ascii_usb/
38[ibm4704_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/ibm4704_usb
39[hhkb]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/hhkb/
40[gh60]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/gh60/
41[hbkb]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/hbkb/
42[hid_liber]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/hid_liber/
43[phantom]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/phantom/
44[IIgs_Standard]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/IIgs/
45[macway]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/macway/
46[KMAC]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/kmac/
47[Lightsaber]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/lightsaber/
48
49[GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930
50[GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047
51[GH_ps2]: http://geekhack.org/showwiki.php?title=Island:14618
52[GH_adb]: http://geekhack.org/showwiki.php?title=Island:14290
53[GH_hhkb_bt]: http://geekhack.org/showwiki.php?title=Island:20851
54[GH_m0110]: http://geekhack.org/showwiki.php?title=Island:24965
55[GH_news]: http://geekhack.org/showwiki.php?title=Island:25759
56[GH_terminal]: http://geekhack.org/showwiki.php?title=Island:27272
57[GH_x68k]: http://geekhack.org/showwiki.php?title=Island:29060
58[GH_hbkb]: http://geekhack.org/showwiki.php?title=Island:29483
59[GH_ibm4704]: http://geekhack.org/index.php?topic=54706.0
60[HID_liber]: http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions
61[Phantom]: http://geekhack.org/index.php?topic=26742
62[GH60_diy]: http://geekhack.org/index.php?topic=34959
63[GH60_proto]: http://geekhack.org/index.php?topic=37570.0
64[PC98]: http://en.wikipedia.org/wiki/NEC_PC-9801
65[Sun]: http://en.wikipedia.org/wiki/Sun-3
66[IIGS]: http://en.wikipedia.org/wiki/Apple_IIGS
67
68
69See other [[TMK Based Projects]] \ No newline at end of file
diff --git a/docs/TMK_README.md b/docs/TMK_README.md
index e3438eda2..85cf68d57 100644
--- a/docs/TMK_README.md
+++ b/docs/TMK_README.md
@@ -113,13 +113,13 @@ Third party libraries like LUFA, PJRC and V-USB have their own license respectiv
113 113
114Build Firmware and Program Controller 114Build Firmware and Program Controller
115------------------------------------- 115-------------------------------------
116See [build environment setup](/readme.md#build-environment-setup), or the readme in the particular keyboards/* folder. 116See [build environment setup](build_environment_setup.md), or the readme in the particular keyboards/* folder.
117 117
118 118
119 119
120Change your keymap 120Change your keymap
121------------------ 121------------------
122See [doc/keymap.md](tmk_core/doc/keymap.md). 122See [keymap.md](keymap.md).
123 123
124 124
125 125
@@ -159,7 +159,7 @@ Boot Magic Configuration - Virtual DIP Switch
159Boot Magic are executed during boot up time. Press Magic key below then plug in keyboard cable. 159Boot Magic are executed during boot up time. Press Magic key below then plug in keyboard cable.
160Note that you must use keys of **Layer 0** as Magic keys. These settings are stored in EEPROM so that retain your configure over power cycles. 160Note that you must use keys of **Layer 0** as Magic keys. These settings are stored in EEPROM so that retain your configure over power cycles.
161 161
162To avoid configuring accidentally additive salt key `KC_SPACE` also needs to be pressed along with the following configuration keys. The salt key is configurable in `config.h`. See [tmk_core/common/bootmagic.h](tmk_core/common/bootmagic.h). 162To avoid configuring accidentally additive salt key `KC_SPACE` also needs to be pressed along with the following configuration keys. The salt key is configurable in `config.h`. See [tmk_core/common/bootmagic.h](/tmk_core/common/bootmagic.h).
163 163
164#### General 164#### General
165- Skip reading EEPROM to start with default configuration(`ESC`) 165- Skip reading EEPROM to start with default configuration(`ESC`)
@@ -240,4 +240,4 @@ Coding Style
240 240
241Other Keyboard Firmware Projects 241Other Keyboard Firmware Projects
242------------------ 242------------------
243You can learn a lot about keyboard firmware from these. See [doc/other_projects.md](tmk_core/doc/other_projects.md). 243You can learn a lot about keyboard firmware from these. See [docs/other_projects.md](other_projects.md).
diff --git a/docs/Tap-Dance.md b/docs/Tap-Dance.md
deleted file mode 100644
index 25827a648..000000000
--- a/docs/Tap-Dance.md
+++ /dev/null
@@ -1,144 +0,0 @@
1# Tap Dance: A single key can do 3, 5, or 100 different things
2
3Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a colon. Hit it three times, and your keyboard's LEDs do a wild dance. That's just one example of what Tap Dance can do. It's one of the nicest community-contributed features in the firmware, conceived and created by [algernon](https://github.com/algernon) in [#451](https://github.com/qmk/qmk_firmware/pull/451). Here's how algernon describes the feature:
4
5With this feature one can specify keys that behave differently, based on the amount of times they have been tapped, and when interrupted, they get handled before the interrupter.
6
7To make it clear how this is different from `ACTION_FUNCTION_TAP`, lets explore a certain setup! We want one key to send `Space` on single tap, but `Enter` on double-tap.
8
9With `ACTION_FUNCTION_TAP`, it is quite a rain-dance to set this up, and has the problem that when the sequence is interrupted, the interrupting key will be send first. Thus, `SPC a` will result in `a SPC` being sent, if they are typed within `TAPPING_TERM`. With the tap dance feature, that'll come out as `SPC a`, correctly.
10
11The implementation hooks into two parts of the system, to achieve this: into `process_record_quantum()`, and the matrix scan. We need the latter to be able to time out a tap sequence even when a key is not being pressed, so `SPC` alone will time out and register after `TAPPING_TERM` time.
12
13But lets start with how to use it, first!
14
15First, you will need `TAP_DANCE_ENABLE=yes` in your `Makefile`, because the feature is disabled by default. This adds a little less than 1k to the firmware size. Next, you will want to define some tap-dance keys, which is easiest to do with the `TD()` macro, that - similar to `F()`, takes a number, which will later be used as an index into the `tap_dance_actions` array.
16
17This array specifies what actions shall be taken when a tap-dance key is in action. Currently, there are three possible options:
18
19* `ACTION_TAP_DANCE_DOUBLE(kc1, kc2)`: Sends the `kc1` keycode when tapped once, `kc2` otherwise. When the key is held, the appropriate keycode is registered: `kc1` when pressed and held, `kc2` when tapped once, then pressed and held.
20* `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action.
21* `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function on when the dance action finishes (like the previous option), and the last function when the tap dance action resets.
22
23The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise.
24
25And that's the bulk of it!
26
27And now, on to the explanation of how it works!
28
29The main entry point is `process_tap_dance()`, called from `process_record_quantum()`, which is run for every keypress, and our handler gets to run early. This function checks whether the key pressed is a tap-dance key. If it is not, and a tap-dance was in action, we handle that first, and enqueue the newly pressed key. If it is a tap-dance key, then we check if it is the same as the already active one (if there's one active, that is). If it is not, we fire off the old one first, then register the new one. If it was the same, we increment the counter and the timer.
30
31This means that you have `TAPPING_TERM` time to tap the key again, you do not have to input all the taps within that timeframe. This allows for longer tap counts, with minimal impact on responsiveness.
32
33Our next stop is `matrix_scan_tap_dance()`. This handles the timeout of tap-dance keys.
34
35For the sake of flexibility, tap-dance actions can be either a pair of keycodes, or a user function. The latter allows one to handle higher tap counts, or do extra things, like blink the LEDs, fiddle with the backlighting, and so on. This is accomplished by using an union, and some clever macros.
36
37### Examples
38
39Here's a simple example for a single definition:
40
411. In your `makefile`, add `TAP_DANCE_ENABLE = yes`
422. In your `config.h` (which you can copy from `qmk_firmware/keyboards/planck/config.h` to your keymap directory), add `#define TAPPING_TERM 200`
433. In your `keymap.c` file, define the variables and definitions, then add to your keymap:
44
45```c
46//Tap Dance Declarations
47enum {
48 TD_ESC_CAPS = 0
49};
50
51//Tap Dance Definitions
52qk_tap_dance_action_t tap_dance_actions[] = {
53 //Tap once for Esc, twice for Caps Lock
54 [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS)
55// Other declarations would go here, separated by commas, if you have them
56};
57
58//In Layer declaration, add tap dance item in place of a key code
59TD(TD_ESC_CAPS)
60```
61
62Here's a more complex example involving custom actions:
63
64```c
65enum {
66 CT_SE = 0,
67 CT_CLN,
68 CT_EGG,
69 CT_FLSH,
70};
71
72/* Have the above three on the keymap, TD(CT_SE), etc... */
73
74void dance_cln_finished (qk_tap_dance_state_t *state, void *user_data) {
75 if (state->count == 1) {
76 register_code (KC_RSFT);
77 register_code (KC_SCLN);
78 } else {
79 register_code (KC_SCLN);
80 }
81}
82
83void dance_cln_reset (qk_tap_dance_state_t *state, void *user_data) {
84 if (state->count == 1) {
85 unregister_code (KC_RSFT);
86 unregister_code (KC_SCLN);
87 } else {
88 unregister_code (KC_SCLN);
89 }
90}
91
92void dance_egg (qk_tap_dance_state_t *state, void *user_data) {
93 if (state->count >= 100) {
94 SEND_STRING ("Safety dance!");
95 reset_tap_dance (state);
96 }
97}
98
99// on each tap, light up one led, from right to left
100// on the forth tap, turn them off from right to left
101void dance_flsh_each(qk_tap_dance_state_t *state, void *user_data) {
102 switch (state->count) {
103 case 1:
104 ergodox_right_led_3_on();
105 break;
106 case 2:
107 ergodox_right_led_2_on();
108 break;
109 case 3:
110 ergodox_right_led_1_on();
111 break;
112 case 4:
113 ergodox_right_led_3_off();
114 _delay_ms(50);
115 ergodox_right_led_2_off();
116 _delay_ms(50);
117 ergodox_right_led_1_off();
118 }
119}
120
121// on the fourth tap, set the keyboard on flash state
122void dance_flsh_finished(qk_tap_dance_state_t *state, void *user_data) {
123 if (state->count >= 4) {
124 reset_keyboard();
125 reset_tap_dance(state);
126 }
127}
128
129// if the flash state didnt happen, then turn off leds, left to right
130void dance_flsh_reset(qk_tap_dance_state_t *state, void *user_data) {
131 ergodox_right_led_1_off();
132 _delay_ms(50);
133 ergodox_right_led_2_off();
134 _delay_ms(50);
135 ergodox_right_led_3_off();
136}
137
138qk_tap_dance_action_t tap_dance_actions[] = {
139 [CT_SE] = ACTION_TAP_DANCE_DOUBLE (KC_SPC, KC_ENT)
140 ,[CT_CLN] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, dance_cln_finished, dance_cln_reset)
141 ,[CT_EGG] = ACTION_TAP_DANCE_FN (dance_egg)
142 ,[CT_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED (dance_flsh_each, dance_flsh_finished, dance_flsh_reset)
143};
144```
diff --git a/docs/Test-for-ASCIIDOC.asciidoc b/docs/Test-for-ASCIIDOC.asciidoc
deleted file mode 100644
index ce57d2781..000000000
--- a/docs/Test-for-ASCIIDOC.asciidoc
+++ /dev/null
@@ -1,17 +0,0 @@
1
2
3
4.Makefile
5[source,Makefile]
6----
7# Build Options
8# comment out to disable the options.
9#
10BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
11MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
12EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
13CONSOLE_ENABLE = yes # Console for debug(+400)
14COMMAND_ENABLE = yes # Commands for debug and configuration
15#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
16NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
17---- \ No newline at end of file
diff --git a/docs/USB-HID.md b/docs/USB-HID.md
deleted file mode 100644
index 1d0c45869..000000000
--- a/docs/USB-HID.md
+++ /dev/null
@@ -1,11 +0,0 @@
1# Getting Report Descriptor
2```
3 $ cd /sys/bus/usb/drivers/usbhid
4 $ ls
5 1-1.3.4:1.0 1-1.3.4:1.2 bind new_id uevent
6 1-1.3.4:1.1 1-1.3.4:1.3 module remove_id unbind
7 $ echo -n 1-1.4\:1.0 | sudo tee unbind
8 $ sudo lsusb -vvv -d 046d:c01d
9 $ echo -n 1-1.4\:1.0 | sudo tee bind
10```
11
diff --git a/docs/Unicode-and-additional-language-support.md b/docs/Unicode-and-additional-language-support.md
deleted file mode 100644
index 562dae4b5..000000000
--- a/docs/Unicode-and-additional-language-support.md
+++ /dev/null
@@ -1,54 +0,0 @@
1## Unicode support
2
3There are three Unicode keymap definition method available in QMK:
4
5### UNICODE_ENABLE
6
7Supports Unicode input up to 0xFFFF. The keycode function is `UC(n)` in
8keymap file, where *n* is a 4 digit hexadecimal.
9
10### UNICODEMAP_ENABLE
11
12Supports Unicode up to 0xFFFFFFFF. You need to maintain a separate mapping
13table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file.
14The keycode function is `X(n)` where *n* is the array index of the mapping
15table.
16
17### UCIS_ENABLE
18
19TBD
20
21Unicode input in QMK works by inputing a sequence of characters to the OS,
22sort of like macro. Unfortunately, each OS has different ideas on how Unicode is inputted.
23
24This is the current list of Unicode input method in QMK:
25
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.
27* 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.
28* 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.
29* UC_WINC: Windows Unicode input using WinCompose. Requires [WinCompose](https://github.com/samhocevar/wincompose). Works reliably under many (all?) variations of Windows.
30
31## Additional language support
32
33In `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.
34
35## International Characters on Windows
36
37[AutoHotkey](https://autohotkey.com) allows Windows users to create custom hotkeys among others.
38
39The method does not require Unicode support in the keyboard itself but depends instead of AutoHotkey running in the background.
40
41First you need to select a modifier combination that is not in use by any of your programs.
42CtrlAltWin is not used very widely and should therefore be perfect for this.
43There is a macro defined for a mod-tab combo `LCAG_T`.
44Add this mod-tab combo to a key on your keyboard, e.g.: `LCAG_T(KC_TAB)`.
45This makes the key behave like a tab key if pressed and released immediately but changes it to the modifier if used with another key.
46
47In the default script of AutoHotkey you can define custom hotkeys.
48
49 <^<!<#a::Send, ä
50 <^<!<#<+a::Send, Ä
51
52The hotkeys above are for the combination CtrlAltGui and CtrlAltGuiShift plus the letter a.
53AutoHotkey inserts the Text right of `Send, ` when this combination is pressed.
54
diff --git a/docs/Unit-testing.md b/docs/Unit-testing.md
deleted file mode 100644
index 3eac62509..000000000
--- a/docs/Unit-testing.md
+++ /dev/null
@@ -1,68 +0,0 @@
1# Unit Testing
2
3If you are new to unit testing, then you can find many good resources on internet. However most of it is scattered around in small pieces here and there, and there's also many different opinions, so I won't give any recommendations.
4
5Instead I recommend these two books, explaining two different styles of Unit Testing in detail.
6
7* "Test Driven Development: By Example: Kent Beck"
8* "Growing Object-Oriented Software, Guided By Tests: Steve Freeman, Nat Pryce"
9
10If you prefer videos there are Uncle Bob's [Clean Coders Videos](https://cleancoders.com/), which unfortunately cost quite a bit, especially if you want to watch many of them. But James Shore has a free [Let's Play](http://www.jamesshore.com/Blog/Lets-Play) video series.
11
12## Google Test and Google Mock
13It's possible to Unit Test your code using [Google Test](https://github.com/google/googletest). The Google Test framework also includes another component for writing testing mocks and stubs, called "Google Mock". For information how to write the actual tests, please refer to the documentation on that site.
14
15## Use of C++
16
17Note that Google Test and therefore any test has to be written in C++, even if the rest of the QMK codebases is written in C. This should hopefully not be a problem even if you don't know any C++, since there's quite clear documentation and examples of the required C++ features, and you can write the rest of the test code almost as you would write normal C. Note that some compiler errors which you might get can look quite scary, but just read carefully what it says, and you should be ok.
18
19One thing to remember, is that you have to append `extern "C"` around all of your C file includes.
20
21## Adding tests for new or existing features
22
23If you want to unit test some feature, then take a look at the existing serial_link tests, in the `quantum/serial_link/tests folder`, and follow the steps below to create a similar structure.
24
251. If it doesn't already exist, add a test subfolder to the folder containing the feature.
262. Create a `testlist.mk` and a `rules.mk` file in that folder.
273. Include those files from the root folder `testlist.mk`and `build_test.mk` respectively.
284. Add a new name for your testgroup to the `testlist.mk` file. Each group defined there will be a separate executable. And that's how you can support mocking out different parts. Note that it's worth adding some common prefix, just like it's done for the serial_link tests. The reason for that is that the make command allows substring filtering, so this way you can easily run a subset of the tests.
295. Define the source files and required options in the `rules.mk` file.
30 * `_SRC` for source files
31 * `_DEFS` for additional defines
32 * `_INC` for additional include folders
336. Write the tests in a new cpp file inside the test folder you created. That file has to be one of the files included from the `rules.mk` file.
34
35Note how there's several different tests, each mocking out a separate part. Also note that each of them only compiles the very minimum that's needed for the tests. It's recommend that you try to do the same. For a relevant video check out [Matt Hargett "Advanced Unit Testing in C & C++](https://www.youtube.com/watch?v=Wmy6g-aVgZI)
36
37## Running the tests
38
39To run all the tests in the codebase, type `make test`. You can also run test matching a substring by typing `make test-matchingsubstring` Note that the tests are always compiled with the native compiler of your platform, so they are also run like any other program on your computer.
40
41## Debugging the tests
42
43If there are problems with the tests, you can find the executable in the `./build/test` folder. You should be able to run those with GDB or a similar debugger.
44
45## Full Integration tests
46
47It's not yet possible to do a full integration test, where you would compile the whole firmware and define a keymap that you are going to test. However there are plans for doing that, because writing tests that way would probably be easier, at least for people that are not used to unit testing.
48
49In that model you would emulate the input, and expect a certain output from the emulated keyboard.
50
51# Tracing variables
52
53Sometimes you might wonder why a variable gets changed and where, and this can be quite tricky to track down without having a debugger. It's of course possible to manually add print statements to track it, but you can also enable the variable trace feature. This works for both for variables that are changed by the code, and when the variable is changed by some memory corruption.
54
55To take the feature into use add `VARIABLE_TRACE=x` to the end of you make command. `x` represents the number of variables you want to trace, which is usually 1.
56
57Then at a suitable place in the code, call `ADD_TRACED_VARIABLE`, to begin the tracing. For example to trace all the layer changes, you can do this
58```c
59void matrix_init_user(void) {
60 ADD_TRACED_VARIABLE("layer", &layer_state, sizeof(layer_state));
61}
62```
63
64This will add a traced variable named "layer" (the name is just for your information), which tracks the memory location of `layer_state`. It tracks 4 bytes (the size of `layer_state`), so any modification to the variable will be reported. By default you can not specify a size bigger than 4, but you can change it by adding `MAX_VARIABLE_TRACE_SIZE=x` to the end of the make command line.
65
66In order to actually detect changes to the variables you should call `VERIFY_TRACED_VARIABLES` around the code that you think that modifies the variable. If a variable is modified it will tell you between which two `VERIFY_TRACED_VARIABLES` calls the modification happened. You can then add more calls to track it down further. I don't recommend spamming the codebase with calls. It's better to start with a few, and then keep adding them in a binary search fashion. You can also delete the ones you don't need, as each call need to store the file name and line number in the ROM, so you can run out of memory if you add too many calls.
67
68Also remember to delete all the tracing code once you have found the bug, as you wouldn't want to create a pull request with tracing code. \ No newline at end of file
diff --git a/docs/VAGRANT_GUIDE.md b/docs/VAGRANT_GUIDE.md
index 439e78da7..61cd0815b 100644
--- a/docs/VAGRANT_GUIDE.md
+++ b/docs/VAGRANT_GUIDE.md
@@ -13,11 +13,11 @@ Other than having Vagrant and Virtualbox installed and possibly a restart of you
13 13
14Build Firmware and Program Controller 14Build Firmware and Program Controller
15------------------------------------- 15-------------------------------------
16See [/doc/BUIDE_GUIDE.md](/doc/BUILD_GUIDE.md), or the readme in the particular keyboards/* folder. 16See [build_guide.md](build_guide.md), or the readme in the particular keyboards/* folder.
17 17
18Change your keymap 18Change your keymap
19------------------ 19------------------
20See [/doc/keymap.md](/doc/keymap.md). 20See [keymap.md](keymap.md).
21 21
22## Flashing the firmware 22## Flashing the firmware
23 23
diff --git a/docs/_Sidebar.md b/docs/_Sidebar.md
deleted file mode 100644
index f82c44c3e..000000000
--- a/docs/_Sidebar.md
+++ /dev/null
@@ -1,21 +0,0 @@
1* [Wiki Home](/qmk/qmk_firmware/wiki)
2* Getting started
3 * [QMK Overview](QMK-Overview)
4 * [Build Environment Setup](Build-Environment-Setup)
5* [Overview for keymap creators](Keymap)
6 * [Keycodes](Keycodes)
7 * [Layer switching](Key-Functions)
8 * [Leader Key](Leader-Key)
9 * [Macros](Macros)
10 * [Space Cadet](Space-Cadet-Shift)
11 * [Tap Dance](Tap-Dance)
12 * [Mouse keys](Mouse-keys)
13 * [FAQ: Creating a Keymap](FAQ-Keymap)
14 * [FAQ: Compiling QMK](FAQ-Build)
15* For hardware makers and modders
16 * [Modding your keyboard](Modding-your-keyboard)
17 * [Porting your keyboard to QMK](Porting-your-keyboard-to-QMK)
18 * [Adding features to QMK](Adding-features-to-QMK)
19* [General FAQ](FAQ)
20
21
diff --git a/docs/Adding-features-to-QMK.md b/docs/adding_features_to_qmk.md
index f6f7cba20..f6f7cba20 100644
--- a/docs/Adding-features-to-QMK.md
+++ b/docs/adding_features_to_qmk.md
diff --git a/docs/Becoming-a-QMK-Collaborator.md b/docs/becoming_a_qmk_collaborator.md
index 1427675fd..1427675fd 100644
--- a/docs/Becoming-a-QMK-Collaborator.md
+++ b/docs/becoming_a_qmk_collaborator.md
diff --git a/docs/Build-Environment-Setup.md b/docs/build_environment_setup.md
index d4cec91c7..442038a58 100644
--- a/docs/Build-Environment-Setup.md
+++ b/docs/build_environment_setup.md
@@ -110,7 +110,7 @@ docker run -e keymap=default -e subproject=ez -e keyboard=ergobox --rm -v D:/Use
110This will compile the targeted keyboard/keymap and leave it in your QMK directory for you to flash. 110This will compile the targeted keyboard/keymap and leave it in your QMK directory for you to flash.
111 111
112### Vagrant 112### Vagrant
113If 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 file](https://github.com/qmk/qmk_firmware/blob/master/doc/VAGRANT_GUIDE.md). 113If 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](vagrant_guide.md).
114 114
115## Verify Your Installation 115## Verify Your Installation
1161. If you haven't already, obtain this repository ([https://github.com/qmk/qmk_firmware](https://github.com/qmk/qmk_firmware)). You can either download it as a zip file and extract it, or clone it using the command line tool git or the Github Desktop application. 1161. If you haven't already, obtain this repository ([https://github.com/qmk/qmk_firmware](https://github.com/qmk/qmk_firmware)). You can either download it as a zip file and extract it, or clone it using the command line tool git or the Github Desktop application.
diff --git a/docs/build_guide.md b/docs/build_guide.md
new file mode 100644
index 000000000..8573b0fd1
--- /dev/null
+++ b/docs/build_guide.md
@@ -0,0 +1,103 @@
1# This guide has now been included in the main readme - please reference that one instead.
2
3## Build Environment Setup
4
5### Windows (Vista and later)
61. If you have ever installed WinAVR, uninstall it.
72. Install [MHV AVR Tools](https://infernoembedded.com/sites/default/files/project/MHV_AVR_Tools_20131101.exe). Disable smatch, but **be sure to leave the option to add the tools to the PATH checked**.
83. Install [MinGW](https://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download). During installation, uncheck the option to install a graphical user interface. **DO NOT change the default installation folder.** The scripts depend on the default location.
94. Clone this repository. [This link will download it as a zip file, which you'll need to extract.](https://github.com/qmk/qmk_firmware/archive/master.zip) Open the extracted folder in Windows Explorer.
105. Double-click on the 1-setup-path-win batch script to run it. You'll need to accept a User Account Control prompt. Press the spacebar to dismiss the success message in the command prompt that pops up.
116. Right-click on the 2-setup-environment-win batch script, select "Run as administrator", and accept the User Account Control prompt. This part may take a couple of minutes, and you'll need to approve a driver installation, but once it finishes, your environment is complete!
127. Future build commands should be run from the standard Windows command prompt, which you can find by searching for "command prompt" from the start menu or start screen. Ignore the "MHV AVR Shell".
13
14### Mac
15If you're using [homebrew,](http://brew.sh/) you can use the following commands:
16
17 brew tap osx-cross/avr
18 brew install avr-libc
19 brew install dfu-programmer
20
21This 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.
22
23You can also try these instructions:
24
251. Install Xcode from the App Store.
262. Install the Command Line Tools from `Xcode->Preferences->Downloads`.
273. Install [DFU-Programmer][dfu-prog].
28
29### Linux
30Install AVR GCC, AVR libc, and dfu-progammer with your favorite package manager.
31
32Debian/Ubuntu example:
33
34 sudo apt-get update
35 sudo apt-get install gcc-avr avr-libc dfu-programmer
36
37### Vagrant
38If 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](vagrant_guide.md).
39
40## Verify Your Installation
411. If you haven't already, obtain this repository ([https://github.com/qmk/qmk_firmware](https://github.com/qmk/qmk_firmware)). You can either download it as a zip file and extract it, or clone it using the command line tool git or the Github Desktop application.
422. Open up a terminal or command prompt and navigate to the `qmk_firmware` folder using the `cd` command. The command prompt will typically open to your home directory. If, for example, you cloned the repository to your Documents folder, then you would type `cd Documents/qmk_firmware`. If you extracted the file from a zip, then it may be named `qmk_firmware-master` instead.
433. To confirm that you're in the correct location, you can display the contents of your current folder using the `dir` command on Windows, or the `ls` command on Linux or Mac. You should see several files, including `readme.md` and a `quantum` folder. From here, you need to navigate to the appropriate folder under `keyboards/`. For example, if you're building for a Planck, run `cd keyboards/planck`.
444. Once you're in the correct keyboard-specific folder, run the `make` command. This should output a lot of information about the build process. More information about the `make` command can be found below.
45
46## Customizing, Building, and Deploying Your Firmware
47
48### The Make command
49
50The `make` command is how you compile the firmware into a .hex file, which can be loaded by a dfu programmer (like dfu-progammer via `make dfu`) or the [Teensy loader](https://www.pjrc.com/teensy/loader.html) (only used with Teensys). You can run `make` from the root (`/`), your keyboard folder (`/keyboards/<keyboard>/`), or your keymap folder (`/keyboards/<keyboard>/keymaps/<keymap>/`) if you have a `Makefile` there (see the example [here](/doc/keymap_makefile_example.mk)).
51
52By default, this will generate a `<keyboard>_<keymap>.hex` file in whichever folder you run `make` from. These files are ignored by git, so don't worry about deleting them when committing/creating pull requests.
53
54* The "root" (`/`) folder is the qmk_firmware folder, in which are `doc`, `keyboard`, `quantum`, etc.
55* The "keyboard" folder is any keyboard project's folder, like `/keyboards/planck`.
56* The "keymap" folder is any keymap's folder, like `/keyboards/planck/keymaps/default`.
57
58Below is a list of the useful `make` commands in QMK:
59
60* `make` - cleans automatically and builds your keyboard and keymap depending on which folder you're in. This defaults to the "default" layout (unless in a keymap folder), and Planck keyboard in the root folder
61 * `make keyboard=<keyboard>` - specifies the keyboard (only to be used in root)
62 * `make keymap=<keymap>` - specifies the keymap (only to be used in root and keyboard folder - not needed when in keymap folder)
63* `make quick` - skips the clean step (cannot be used immediately after modifying config.h or Makefiles)
64* `make dfu` - (requires dfu-programmer) builds and flashes the keymap to your keyboard once placed in reset/dfu mode (button or press `KC_RESET`). This does not work for Teensy-based keyboards like the ErgoDox EZ.
65 * `keyboard=` and `keymap=` are compatible with this
66* `make all-keyboards` - builds all keymaps for all keyboards and outputs status of each (use in root)
67* `make all-keyboards-default` - builds all default keymaps for all keyboards and outputs status of each (use in root)
68* `make all-keymaps [keyboard=<keyboard>]` - builds all of the keymaps for whatever keyboard folder you're in, or specified by `<keyboard>`
69* `make all-keyboards-quick`, `make all-keyboards-default-quick` and `make all-keymaps-quick [keyboard=<keyboard>]` - like the normal "make-all-*" commands, but they skip the clean steps
70
71Other, less useful functionality:
72
73* `make COLOR=false` - turns off color output
74* `make SILENT=true` - turns off output besides errors/warnings
75* `make VERBOSE=true` - outputs all of the avr-gcc stuff (not interesting)
76
77### The Makefile
78
79There are 3 different `make` and `Makefile` locations:
80
81* root (`/`)
82* keyboard (`/keyboards/<keyboard>/`)
83* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/`)
84
85The root contains the code used to automatically figure out which keymap or keymaps to compile based on your current directory and commandline arguments. It's considered stable, and shouldn't be modified. The keyboard one will contain the MCU set-up and default settings for your keyboard, and shouldn't be modified unless you are the producer of that keyboard. The keymap Makefile can be modified by users, and is optional. It is included automatically if it exists. You can see an example [here](/doc/keymap_makefile_example.mk) - the last few lines are the most important. The settings you set here will override any defaults set in the keyboard Makefile. **It is required if you want to run `make` in the keymap folder.**
86
87### The `config.h` file
88
89There are 2 `config.h` locations:
90
91* keyboard (`/keyboards/<keyboard>/`)
92* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/`)
93
94The keyboard `config.h` is included only if the keymap one doesn't exist. The format to use for your custom one [is here](/doc/keymap_config_h_example.h). If you want to override a setting from the parent `config.h` file, you need to do this:
95
96```
97#undef MY_SETTING
98#define MY_SETTING 4
99```
100
101For a value of `4` for this imaginary setting. So we `undef` it first, then `define` it.
102
103You can then override any settings, rather than having to copy and paste the whole thing.
diff --git a/docs/build_old.md b/docs/build_old.md
index 5c2d57d02..9ae3a64ae 100644
--- a/docs/build_old.md
+++ b/docs/build_old.md
@@ -1,7 +1,7 @@
1Build Firmware and Program Controller 1Build Firmware and Program Controller
2===================================== 2=====================================
3 3
4## This guide may be out-dated - use doc/BUILD_GUIDE.md instead 4## This guide may be out-dated - use [build_guide.md](build_guide.md) instead
5 5
6Download and Install 6Download and Install
7-------------------- 7--------------------
diff --git a/docs/Compatible-Microcontrollers.md b/docs/compatible_microcontrollers.md
index 20ba620f6..20ba620f6 100644
--- a/docs/Compatible-Microcontrollers.md
+++ b/docs/compatible_microcontrollers.md
diff --git a/docs/Custom-Quantum-Functions.md b/docs/custom_quantum_functions.md
index 0fb1c163b..0fb1c163b 100644
--- a/docs/Custom-Quantum-Functions.md
+++ b/docs/custom_quantum_functions.md
diff --git a/docs/cygwin_guide.md b/docs/cygwin_guide.md
new file mode 100644
index 000000000..05d71961a
--- /dev/null
+++ b/docs/cygwin_guide.md
@@ -0,0 +1,352 @@
1#Planck Advanced (but not too advanced) `cygwin` Users Guide
2If you are a user of the [cygwin environment](https://cygwin.com) in Windows and want the freedom to use the latest tools available, then this is the guide for you. If compiling your own copy of the latest and greatest Gnu C Compiler makes you super happy, then this is the guide for you. If the command line make you smile, then this is the guide for you.
3
4This guide was written step by step as I went through the process on a `Windows 10` `x86_64` and a `Windows 7` `amd k10` based system. This should be generally applicable to to any `Windows` environment with `cygwin`.
5
6#####Do not skip steps. Do not move past a step until the previous step finishes successfully.
7
8Based on [avr-libc installation guide](http://www.nongnu.org/avr-libc/user-manual/install_tools.html)
9
10##Get the Required Packages
11Download the `cygwin` setup ([x86_64](https://cygwin.com/setup-x86_64.exe)) and install the default system plus the following if they are not already selected:
12- devel/git
13- devel/gcc-core
14- devel/gcc-g++
15- devel/flex
16- devel/bison
17- devel/make
18- devel/texinfo
19- devel/gettext-devel
20- devel/automake
21- devel/autoconfig
22- devel/libtool
23- text/gettext
24- libs/libgcc1
25- interpreters/m4
26- web/wget
27- archive/unzip
28
29The following sources will be required:
30- [gmp](https://gmplib.org/) (6.1.0)
31- [mpfr](http://www.mpfr.org/) (3.1.4)
32- [mpc](http://www.multiprecision.org/) (1.0.3)
33- [binutils](https://www.sourceware.org/binutils/) (2.26)
34- [gcc](https://gcc.gnu.org/) (5.3.0)
35- [avr-libc](http://www.nongnu.org/avr-libc/) (2.0.0)
36
37The `dfu-programmer` will be required to flash the new firmware
38- [dfu-programmer](https://dfu-programmer.github.io/) (0.7.2)
39
40The set of commands below will create a directory (`~/local/avr`) for the sources you compile to be installed on the machine and a directory (`~/src`) for these source files to be stored. The commands then download the sources of the needed packages and unpack them. Note: the expand commands are different depending on if the packages are offered as a `bz2` or `gz` archive
41```
42$ mkdir ~/local
43$ mkdir ~/local/avr
44$ mkdir ~/src
45$ cd ~/src
46$ wget https://gmplib.org/download/gmp/gmp-6.1.0.tar.bz2
47$ wget http://www.mpfr.org/mpfr-3.1.4/mpfr-3.1.4.tar.bz2
48$ wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
49$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.26.tar.gz
50$ wget http://mirror0.babylon.network/gcc/releases/gcc-5.3.0/gcc-5.3.0.tar.gz
51$ wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-2.0.0.tar.bz2
52$ tar -xjf gmp-6.1.0.tar.bz2
53$ tar -xjf mpfr-3.1.4.tar.bz2
54$ tar -zxf mpc-1.0.3.tar.gz
55$ tar -zxf binutils-2.26.tar.gz
56$ tar -zxf gcc-5.3.0.tar.gz
57$ tar -xjf avr-libc-2.0.0.tar.bz2
58```
59
60##Setup the Build Environment
61These commands will set up the install directory and the `PATH` variable, which will allow you to access your installed packages. Note: if you close the `cygwin` terminal window, you will need to rerun these commands, they are not permanent.
62```
63$ PREFIX=$HOME/local/avr
64$ export PREFIX
65$ PATH=/usr/local/bin:/usr/local/lib:/usr/local/include:/bin:/lib:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS
66$ PATH=$PATH:$PREFIX/bin:$PREFIX/lib
67$ export PATH
68```
69
70##The `gcc` Required Math Library Packages
71The following packages are required to be complied and installed in order to compile `gcc`. They are not sufficiently available through the `cygwin` package system, so we have to make them ourselves. They must be complied in this order because each one depends on the previous. Verfiy that for each package, `make check` returns all passing and no fails.
72
73###Build and Install `gmp`
74```
75$ cd ~/src/gmp-6.1.0
76$ ./configure --enable-static --disable-shared
77$ make
78$ make check
79$ make install
80```
81
82###Build and Install `mpfr`
83```
84$ cd ~/src/mpfr-3.1.4
85$ ./configure --with-gmp-build=../gmp-6.1.0 --enable-static --disable-shared
86$ make
87$ make check
88$ make install
89```
90
91###Build and Install `mpc`
92```
93$ cd ~/src/mpc-1.0.3
94$ ./configure --with-gmp=/usr/local --with-mpfr=/usr/local --enable-static --disable-shared
95$ make
96$ make check
97$ make install
98```
99
100##OPTIONAL Part
101You can build and install a brand new `gcc` or you can use the one supplied by `cygwin`. This will take about 4-5 hours to compile (It is a "native build", so it does the entire build **3 times**. This takes a long while).
102
103###Build and Install `gcc` for Your Machine
104```
105$ cd ~/src/gcc-5.3.0
106$ mkdir obj-local
107$ cd obj-local
108$ ../configure --enable-languages=c,c++ --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --enable-static --disable-shared
109$ make
110$ make install
111```
112##End OPTIONAL Part
113
114###Build and Install `binutils` for Your Machine
115```
116$ cd ~/src/binutils-2.26
117$ mkdir obj-local
118$ cd obj-local
119$ ../configure
120$ make
121$ make install
122```
123
124##Buliding `binutils`, `gcc`, and `avr-libc` for the AVR system
125Now we can make the critical stuff for compiling our firmware: `binutils`, `gcc`, and `avr-libc` for the AVR architecture. These allow us to build and manipulate the firmware for the keyboard.
126
127###Build `binutils` for AVR
128If you plan to build and install `avr-gdb` also, use the `gdb` install at the end of this guide as it also builds the `binutils`
129```
130$ cd ~/src/binutils-2.26
131$ mkdir obj-avr
132$ cd obj-avr
133$ ../configure --prefix=$PREFIX --target=avr --disable-nls
134$ make
135$ make install
136```
137
138###Build `gcc` for AVR
139```
140$ cd ~/src/gcc-5.3.0
141$ mkdir obj-avr
142$ cd obj-avr
143$ ../configure --prefix=$PREFIX --target=avr --enable-languages=c,c++ --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --enable-static --disable-shared --disable-nls --disable-libssp --with-dwarf2
144$ make
145$ make install
146```
147
148###Build `avr-libc` for AVR
149For building the `avr-libc`, we have to specify the host build system. In my case it is `x86_64-unknown-cygwin`. You can look for build system type in the `gcc` configure notes for the proper `--build` specification to pass when you configure `avr-libc`.
150```
151$ cd ~/src/avr-libc-2.0.0
152$ ./configure --prefix=$PREFIX --build=x86_64-unknown-cygwin --host=avr
153$ make
154$ make install
155```
156
157##Building 'dfu-programmer' for flashing the firmware via USB and installing the drivers
158We can either build our own, or use the precomplied binaries. The precompiled binaries don't play well with `cygwin` so it is better to build them ourselves. The procedure for the precompiled binaries is included at the end of this guide.
159
160### Build and Install the `libusb`
161The `dfu-programmer` requires `libusb` so that it can interact with the USB system. These repos must be bootstrapped in order to create an appropriate `./configure` and `Makefile` for your system.
162```
163$ cd ~/src
164$ git clone https://github.com/libusb/libusb.git
165$ cd libusb
166$ ./bootstrap.sh
167$ ./configure
168$ make
169$ make install
170```
171
172### Build and Install the `dfu-programmer`
173```
174$ cd ~/src
175$ git clone https://github.com/dfu-programmer/dfu-programmer.git
176$ cd dfu-programmer
177$ ./bootstrap.sh
178$ ./configure
179$ make
180$ make install
181```
182
183Verify the installation with:
184```
185$ which dfu-programmer
186/usr/local/bin/dfu-programmer
187
188$ dfu-programmer
189dfu-programmer 0.7.2
190https://github.com/dfu-programmer/dfu-programmer
191Type 'dfu-programmer --help' for a list of commands
192 'dfu-programmer --targets' to list supported target devices
193```
194If you are not getting the above result, you will not be able to flash the firmware!
195
196###Install the USB drivers
197The drivers are included in the windows binary version of [`dfu-programmer` 0.7.2](http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip).
198```
199$ cd ~/src
200$ wget http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip
201$ unzip dfu-programmer-win-0.7.2.zip -d dfu-programmer-win-0.7.2
202```
203
204or
205
206The official drivers are found in [Atmel's `FLIP` installer](http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe). Download and then install `FLIP`. Upon installation, the drivers will be found in `C:\Program Files (x86)\Atmel\Flip 3.4.7\usb`.
207
208Then, from an **administrator-privileged** `Windows` terminal, run the following command (adjust the path for username, etc. as necessary) and accept the prompt that pops up:
209```
210C:\> pnputil -i -a C:\cygwin64\home\Kevin\src\dfu-programmer-win-0.7.2\dfu-prog-usb-1.2.2\atmel_usb_dfu.inf
211or
212C:\> pnputil -i -a "C:\Program Files (x86)\Atmel\Flip 3.4.7\usb\atmel_usb_dfu.inf"
213```
214
215This should be the result:
216```
217Microsoft PnP Utility
218
219Processing inf : atmel_usb_dfu.inf
220Successfully installed the driver on a device on the system.
221Driver package added successfully.
222Published name : oem104.inf
223
224
225Total attempted: 1
226Number successfully imported: 1
227```
228
229Alternatively, the `Windows` driver can be installed when prompted by `Windows` when the keyboard is attached. Do not let `Windows` search for a driver; specify the path to search for a driver and point it to the `atmel_usb_dfu.inf` file.
230
231##Building and Flashing the Planck firmware!
232If you did everything else right. This part should be a snap! Grab the latest sources from `github`, make the Plank firmware, then flash it.
233
234###Build Planck and Load the Firmware
235```
236$ cd ~/src
237$ git clone https://github.com/qmk/qmk_firmware.git
238$ cd qmk_firmware/keyboards/planck
239$ make
240```
241
242Make sure there are no errors. You should end up with this or something similar:
243```
244Creating load file for Flash: planck.hex
245avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature planck.elf planck.hex
246
247Creating load file for EEPROM: planck.eep
248avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
249--change-section-lma .eeprom=0 --no-change-warnings -O ihex planck.elf planck.eep || exit 0
250
251Creating Extended Listing: planck.lss
252avr-objdump -h -S -z planck.elf > planck.lss
253
254Creating Symbol Table: planck.sym
255avr-nm -n planck.elf > planck.sym
256
257Size after:
258 text data bss dec hex filename
259 18602 82 155 18839 4997 planck.elf
260
261-------- end --------
262```
263
264If you do not get the above, you **did not** build the firmware, and you will have nothing to flash. If you have the fresh clone from `github`, it was probably something gone wrong in this install process, go check and see what didn't work and threw errors or what steps you might have missed.
265
266But if everything went OK, you are ready to flash! Press the reset button on the bottom of the Planck, wait two seconds, then:
267```
268$ make dfu
269```
270.
271.
272.
273profit!!!
274
275
276
277
278
279##extra bits...
280
281###Installing Precompiled `dfu-programmer` Binaries (not recommended for `cygwin`)
282To install the `dfu-programmer` from the binaries, we must get if from [the `dfu-programmer` website](https://dfu-programmer.github.io/) ([0.7.2](http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip)).
283
284Copy this file into your `cygwin` home\src directory. (For me, it is `C:\cygwin64\home\Kevin\src`), extract the files, move `dfu-programmer.exe` to `~/local/avr/bin`. Most obnoxiously, the `libusb0_x86.dll` and `libusb0.sys` need to be moved from `./dfu-prog-usb-1.2.2/x86/` to a directory in the `Windows` `PATH` and the `cygwin` `PATH`. This is because the `dfu-programmer` binary is `mingw` based, not `cygwin` based, so the `dlls` do not cooperate. I achieved acceptable pathing by moving the files to `C:\cygwin64\home\Kevin\local\avr\bin` Then, in a `WINDOWS` command prompt running (Adjusting your path for username, etc. as needed):
285```
286C:\> set PATH=%PATH%;C:\cygwin64\home\Kevin\local\avr\bin
287```
288
289Then, rename `libusb0_x86.dll` to `libusb0.dll`.
290
291You can tell that you were successful by trying to execute 'dfu-programmer' from the 'cygwin' prompt:
292```
293$ which dfu-programmer
294/home/Kevin/local/avr/bin/dfu-programmer
295
296$ dfu-programmer
297dfu-programmer 0.7.2
298https://github.com/dfu-programmer/dfu-programmer
299Type 'dfu-programmer --help' for a list of commands
300 'dfu-programmer --targets' to list supported target devices
301```
302
303If you are not getting the above result, you will not be able to flash the firmware!
304- Try making sure your `PATH` variables are set correctly for both `Windows` and `cygwin`.
305- Make sure the `dll` is named correctly.
306- Do not extract it with `cygwin`'s `unzip` as it does not set the executable permission. If you did it anyway, do `chmod +x dfu-programmer.exe`.
307- Still have problems? Try building it instead.
308
309
310##Debugging Tools
311
312These tools are for debugging your firmware, etc. before flashing. Theoretically, it can save your memory from wearing out. However, these tool do not work 100% for the Planck firmware.
313
314### `gdb` for AVR
315`gdb` has a simulator for AVR but it does not support all instructions (like WDT), so it immediately crashes when running the Planck firmware (because `lufa.c` disables the WDT in the first few lines of execution). But it can still be useful in debugging example code and test cases, if you know how to use it.
316
317```
318$ cd ~/src
319$ git clone git://sourceware.org/git/binutils-gdb.git
320$ cd binutils-gdb
321$ mkdir obj-avr
322$ cd obj-avr
323$ ../configure --prefix=$PREFIX --target=avr --build=x86_64-unknown-cygwin --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --disable-nls --enable-static
324$ make
325$ make install
326```
327
328### `simulavr`
329`simulavr` is an AVR simulator. It runs the complied AVR elfs. `simulavr` does not support the `atmega32u4` device... it does `atmega32` but that is not good enough for the firmware (no PORTE and other things), so you cannot run the Planck firmware. I use it to simulate ideas I have for features in separate test projects.
330
331This one is a major pain in the butt because it has a lot of dependencies and it is buggy. I will do my best to explain it but... it was hard to figure out. A few things need to be changed in the 'Makefile' to make it work in `cygwin`.
332
333
334```
335$ cd ~/src
336$ git clone https://github.com/Traumflug/simulavr.git
337$ cd simulavr
338$ ./bootstrap
339$ ./configure --prefix=$PREFIX --enable-static --disable-tcl --disable-doxygen-doc
340```
341 Edit `src/Makefile.am` now so that `-no-undefined` is included (I did this by removing the SYS_MINGW conditional surrounding `libsim_la_LDFLAGS += -no-undefined` and `libsimulavr_la_LDFLAGS += -no-undefined \ libsimulavr_la_LIBADD += $(TCL_LIB)`. Also, `$(EXEEXT)` is added after `kbdgentables` in two places.
342
343```
344$ make
345$ make install
346```
347
348
349TODO:
350- git repos for all sources
351- command line magic for cygwin setup
352- better options for `dfu-drivers`
diff --git a/docs/Differences-from-TMK.md b/docs/differences_from_tmk.md
index 10ca329dc..10ca329dc 100644
--- a/docs/Differences-from-TMK.md
+++ b/docs/differences_from_tmk.md
diff --git a/docs/Dynamic-Macros.md b/docs/dynamic_macros.md
index 8fb54c322..8fb54c322 100644
--- a/docs/Dynamic-Macros.md
+++ b/docs/dynamic_macros.md
diff --git a/docs/eclipse.md b/docs/eclipse.md
new file mode 100644
index 000000000..ec5f2dc0d
--- /dev/null
+++ b/docs/eclipse.md
@@ -0,0 +1,84 @@
1[Eclipse](https://en.wikipedia.org/wiki/Eclipse_(software)) is an open-source [Integrated Development Environment](https://en.wikipedia.org/wiki/Integrated_development_environment) (IDE) widely used for Java development, but with an extensible plugin system that allows to customize it for other languages and usages.
2
3Using an IDE such as Eclipse provides many advantages over a plain text editor, such as:
4* intelligent code completion
5* convenient navigation in the code
6* refactoring tools
7* build automation (no need for the command-line)
8* a GUI for GIT
9* static code analysis
10* many other tools such as debugging, code formatting, showing call hierarchies etc.
11
12The purpose of the is page is to document how to set-up Eclipse for developing AVR software, and working on the QMK code base.
13
14Note that this set-up has been tested on Ubuntu 16.04 only for the moment.
15
16# Prerequisites
17## Build environment
18Before starting, you must have followed the [Getting Started](home.md#getting-started) section corresponding to your system. In particular, you must have been able to build the firmware with [the `make` command](../#the-make-command).
19
20## Java
21Eclipse is a Java application, so you will need to install Java 8 or more recent to be able to run it. You may choose between the JRE or the JDK, the latter being useful if you intend to do Java development.
22
23# Install Eclipse and its plugins
24Eclipse comes in [several flavours](http://www.eclipse.org/downloads/eclipse-packages/) depending on the target usage that you will have. There is no package comprising the AVR stack, so we will need to start from Eclipse CDT (C/C++ Development Tooling) and install the necessary plugins.
25
26## Download and install Eclipse CDT
27If you already have Eclipse CDT on your system, you can skip this step. However it is advised to keep it up-to-date for better support.
28
29If you have another Eclipse package installed, it is normally possible to [install the CDT plugin over it](https://eclipse.org/cdt/downloads.php). However it is probably better to reinstall it from scratch to keep it light and avoid the clutter of tools that you don't need for the projects you will be working on.
30
31Installation is very simple: follow the [5 Steps to Install Eclipse](https://eclipse.org/downloads/eclipse-packages/?show_instructions=TRUE), and choose **Eclipse IDE for C/C++ Developers** at Step 3.
32
33Alternatively, you can also directly [download Eclipse IDE for C/C++ Developers](http://www.eclipse.org/downloads/eclipse-packages/) ([direct link to current version](http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/neonr)) and extract the package to the location of your choice (this creates an `eclipse` folder).
34
35## First Launch
36When installation is complete, click the <kbd>Launch</kbd> button. (If you extracted the package manually, open the Eclipse installation folder and double-click the `eclipse` executable)
37
38When you are prompted with the Workspace Selector, select a directory that will hold Eclipse metadata and usually your projects. **Do not select the `qmk_firmware` directory**, this will be the project directory. Select the parent folder instead, or another (preferably empty) folder of your choice (the default is fine if you do not use it yet).
39
40Once started, click the <kbd>Workbench</kbd> button at the top right to switch to the workbench view (there is a also checkbox at the bottom to skip the welcome screen at startup).
41
42## Install the necessary plugins
43Note: you do not need to restart Eclipse after installing each plugin. Simply restart once all plugins are installed.
44
45### [The AVR plugin](http://avr-eclipse.sourceforge.net/)
46This is the most important plugin as it will allow Eclipse to _understand_ AVR C code. Follow [the instructions for using the update site](http://avr-eclipse.sourceforge.net/wiki/index.php/Plugin_Download#Update_Site), and agree with the security warning for unsigned content.
47
48### [ANSI Escape in Console](https://marketplace.eclipse.org/content/ansi-escape-console)
49This plugin is necessary to properly display the colored build output generated by the QMK makefile.
50
511. Open <kbd><kbd>Help</kbd> > <kbd>Eclipse Marketplace…</kbd></kbd>
522. Search for _ANSI Escape in Console_
533. Click the <samp>Install</samp> button of the plugin
544. Follow the instructions and agree again with the security warning for unsigned content.
55
56Once both plugins are installed, restart Eclipse as prompted.
57
58# Configure Eclipse for QMK
59## Importing the project
601. Click <kbd><kbd>File</kbd> > <kbd>New</kbd> > <kbd>Makefile Project with Existing Code</kbd></kbd>
612. On the next screen:
62 * Select the directory where you cloned the repository as _Existing Code Location_;
63 * (Optional) Give a different name to the project¹, e.g. _QMK_ or _Quantum_;
64 * Select the _AVR-GCC Toolchain_;
65 * Keep the rest as-is and click <kbd>Finish</kbd>
66
67 ![Importing QMK in Eclipse](http://i.imgur.com/oHYR1yW.png)
68
693. The project will now be loaded and indexed. Its files can be browsed easily through the _Project Explorer_ on the left.
70
71¹ There might be issues for importing the project with a custom name. If it does not work properly, try leaving the default project name (i.e. the name of the directory, probably `qmk_firmware`).
72
73## Build your keyboard
74We will now configure a make target that cleans the project and builds the keymap of your choice.
75
761. On the right side of the screen, select the <kbd>Make Target</kbd> tab
772. Expand the folder structure to the keyboard of your choice, e.g. `qmk_firmware/keyboards/ergodox`
783. Right-click on the keyboard folder and select <kbd>New…</kbd> (or select the folder and click the <kbd>New Make Target</kbd> icon above the tree)
794. Choose a name for your build target, e.g. _clean \<your keymap\>_
805. Make Target: this is the arguments that you give to `make` when building from the command line. If your target name does not match these arguments, uncheck <kbd>Same as target name</kbd> and input the correct arguments, e.g. `clean <your keymap>`
816. Leave the other options checked and click <kbd>OK</kbd>. Your make target will now appear under the selected keyboard.
827. (Optional) Toggle the <kbd>Hide Empty Folders</kbd> icon button above the targets tree to only show your build target.
838. Double-click the build target you created to trigger a build.
849. Select the <kbd>Console</kbd> view at the bottom to view the running build. \ No newline at end of file
diff --git a/docs/embedding.md b/docs/embedding.md
new file mode 100644
index 000000000..5c2f3b31e
--- /dev/null
+++ b/docs/embedding.md
@@ -0,0 +1,64 @@
1# WARNING: Until issue [#173](https://github.com/tmk/tmk_keyboard/issues/173) goes through, the [core][1] repository will not be up-to-date with the latest changes and fixes, but can still be used.
2
3If you want to use TMK for your own keyboard project, you've got three options for embedding the [core][1].
4The recommended option is [subtrees](#1-git-subtree).
5
6After adding the embed you'll need to [modify the Makefile](#modifications-to-the-makefile) of your project to point to the core correctly.
7
8## 1. git subtree
9
10In order to set up the subtree in your project, first add the core repository as a remote:
11```
12git remote add -f core https://github.com/tmk/tmk_core
13```
14
15Then add the core as a subtree (directory) in your local repository:
16```
17git subtree add -P tmk_core core master --squash
18```
19
20And that's it!
21
22When you want to update the subtree in your repository to match the master on [tmk_core][1], do this:
23```
24git subtree pull -P tmk_core core master --squash
25```
26
27## 2. git submodule
28
29In order to set up the submodule in your project, first add a new submodule:
30```
31git submodule add https://github.com/tmk/tmk_core tmk_core
32```
33
34Then pull, sync and update the submodule:
35```
36git pull
37git submodule sync --recursive
38git submodule update --init --recursive
39```
40
41And that's it!
42
43When you want to update the subtree in your repository to match the master on [tmk_core][1], follow the same steps as above.
44
45If you want to clone a repository from GitHub that has submodule(s) in it, pass <kbd>--recursive</kbd> when cloning, like so:
46`git clone --recursive https://github.com/<username>/<repository>`
47
48## 3. Manually (without git)
49
50*Note: This is not recommended in any way, but it's still possible.*
51
52Download a zipped version of the [tmk_core][1] repository using this link:
53<https://github.com/tmk/tmk_core/archive/master.zip>
54
55Extract the zip in your project's directory, then rename the folder to <kbd>tmk_core</kbd>.
56
57## Modifications to the *Makefile*
58
59The one thing you have to make sure to change in the *Makefile* (compared to [tmk_keyboard](https://github.com/tmk/tmk_keyboard) drivers' *[Makefile](https://github.com/tmk/tmk_keyboard/blob/master/keyboard/gh60/Makefile#L45)*) is the "TMK_DIR" variable, which needs to point to the embed directory:
60```Makefile
61TMK_DIR = ./tmk_core
62```
63
64[1]: https://github.com/tmk/tmk_core \ No newline at end of file
diff --git a/docs/faq.md b/docs/faq.md
new file mode 100644
index 000000000..0636d8b54
--- /dev/null
+++ b/docs/faq.md
@@ -0,0 +1,238 @@
1## READ FIRST
2- **README** of top directory : https://github.com/tmk/tmk_keyboard/blob/master/README.md
3- **README** of target project(keyboard/converter) directory.
4
5Note that you'll need to read **both**.
6
7
8# Build
9- [[FAQ/Build]]
10
11
12# Keymap
13- [[FAQ/Keymap]]
14
15
16# Debug Console
17## hid_listen can't recognize device
18When debug console of your device is not ready you will see like this:
19
20 Waiting for device:.........
21
22once the device is pluged in then *hid_listen* finds it you will get this message:
23
24 Waiting for new device:.........................
25 Listening:
26
27Check if you can't get this 'Listening:' message:
28- build with `CONSOLE_ENABLE=yes` in **Makefile**.
29
30You may need privilege to access the device on OS like Linux.
31- try `sudo hid_listen`
32
33## Can't get message on console
34Check:
35- *hid_listen* finds your device. See above.
36- Enable debug with pressing **Magic**+d. See [Magic Commands](https://github.com/tmk/tmk_keyboard#magic-commands).
37- set `debug_enable=true` usually in `matrix_init()` in **matrix.c**.
38- try using 'print' function instead of debug print. See **common/print.h**.
39- disconnect other devices with console function. See [Issue #97](https://github.com/tmk/tmk_keyboard/issues/97).
40
41## Linux or UNIX like system requires Super User privilege
42Just use 'sudo' to execute *hid_listen* with privilege.
43```
44$ sudo hid_listen
45```
46
47Or add an *udev rule* for TMK devices with placing a file in rules directory. The directory may vary on each system.
48
49File: /etc/udev/rules.d/52-tmk-keyboard.rules(in case of Ubuntu)
50```
51# tmk keyboard products https://github.com/tmk/tmk_keyboard
52SUBSYSTEMS=="usb", ATTRS{idVendor}=="feed", MODE:="0666"
53```
54
55***
56
57# Miscellaneous
58## NKRO Doesn't work
59First you have to compile frimware with this build option `NKRO_ENABLE` in **Makefile**.
60
61Try `Magic` **N** command(`LShift+RShift+N` by default) when **NKRO** still doesn't work. You can use this command to toggle between **NKRO** and **6KRO** mode temporarily. In some situations **NKRO** doesn't work you need to switch to **6KRO** mode, in particular when you are in BIOS.
62
63If your firmeare built with `BOOTMAGIC_ENABLE` you need to turn its switch on by `BootMagic` **N** command(`Space+N` by default). This setting is stored in EEPROM and keeped over power cycles.
64
65https://github.com/tmk/tmk_keyboard#boot-magic-configuration---virtual-dip-switch
66
67
68## TrackPoint needs reset circuit(PS/2 mouse support)
69Without reset circuit you will have inconsistent reuslt due to improper initialize of the hardware. See circuit schematic of TPM754.
70
71- http://geekhack.org/index.php?topic=50176.msg1127447#msg1127447
72- http://www.mikrocontroller.net/attachment/52583/tpm754.pdf
73
74
75## Can't read column of matrix beyond 16
76Use `1UL<<16` instead of `1<<16` in `read_cols()` in **matrix.h** when your columns goes beyond 16.
77
78In C `1` means one of **int** type which is **16bit** in case of AVR so you can't shift left more than 15. You will get unexpected zero when you say `1<<16`. You have to use **unsigned long** type with `1UL`.
79
80http://deskthority.net/workshop-f7/rebuilding-and-redesigning-a-classic-thinkpad-keyboard-t6181-60.html#p146279
81
82
83
84## Pull-up Resistor
85In some case converters needed to have pull-up resistors to work correctly. Place the resistor between VCC and signal line in parallel.
86
87For example:
88```
89Keyboard Conveter
90 ,------.
915V------+------|VCC |
92 | | |
93 R | |
94 | | |
95Signal--+------|PD0 |
96 | |
97GND------------|GND |
98 `------'
99R: 1K Ohm resistor
100```
101
102https://github.com/tmk/tmk_keyboard/issues/71
103
104
105## Arduino Micro's pin naming is confusing
106Note that Arduino Micro PCB marking is different from real AVR port name. D0 of Arduino Micro is not PD0, PD0 is D3. Check schematic yourself.
107http://arduino.cc/en/uploads/Main/arduino-micro-schematic.pdf
108
109
110
111## Bootloader jump doesn't work
112Properly configure bootloader size in **Makefile**. With wrong section size bootloader won't probably start with **Magic command** and **Boot Magic**.
113```
114# Size of Bootloaders in bytes:
115# Atmel DFU loader(ATmega32U4) 4096
116# Atmel DFU loader(AT90USB128) 8192
117# LUFA bootloader(ATmega32U4) 4096
118# Arduino Caterina(ATmega32U4) 4096
119# USBaspLoader(ATmega***) 2048
120# Teensy halfKay(ATmega32U4) 512
121# Teensy++ halfKay(AT90USB128) 2048
122OPT_DEFS += -DBOOTLOADER_SIZE=4096
123```
124AVR Boot section size are defined by setting **BOOTSZ** fuse in fact. Consult with your MCU datasheet.
125Note that **Word**(2 bytes) size and address are used in datasheet while TMK uses **Byte**.
126
127AVR Boot section is located at end of Flash memory like the followings.
128```
129byte Atmel/LUFA(ATMega32u4) byte Atmel(AT90SUB1286)
1300x0000 +---------------+ 0x00000 +---------------+
131 | | | |
132 | | | |
133 | Application | | Application |
134 | | | |
135 = = = =
136 | | 32KB-4KB | | 128KB-8KB
1370x6000 +---------------+ 0x1E000 +---------------+
138 | Bootloader | 4KB | Bootloader | 8KB
1390x7FFF +---------------+ 0x1FFFF +---------------+
140
141
142byte Teensy(ATMega32u4) byte Teensy++(AT90SUB1286)
1430x0000 +---------------+ 0x00000 +---------------+
144 | | | |
145 | | | |
146 | Application | | Application |
147 | | | |
148 = = = =
149 | | 32KB-512B | | 128KB-2KB
1500x7E00 +---------------+ 0x1FC00 +---------------+
151 | Bootloader | 512B | Bootloader | 2KB
1520x7FFF +---------------+ 0x1FFFF +---------------+
153```
154
155And see this discussion for further reference.
156https://github.com/tmk/tmk_keyboard/issues/179
157
158
159## Special Extra key doesn't work(System, Audio control keys)
160You need to define `EXTRAKEY_ENABLE` in **makefile** to use them in TMK.
161```
162EXTRAKEY_ENABLE = yes # Audio control and System control
163```
164http://deskthority.net/workshop-f7/tmk-keyboard-firmware-collection-t4478-60.html#p157919
165
166
167## Wakeup from sleep doesn't work
168In Windows check `Allow this device to wake the computer` setting in Power **Management property** tab of **Device Manager**. Also check BIOS setting.
169
170Pressing any key during sleep should wake host.
171
172
173## Using Arduino?
174**Note that Arduino pin naming is different from actual chip.** For example, Arduino pin `D0` is not `PD0`. Check circuit with its schematics yourself.
175
176- http://arduino.cc/en/uploads/Main/arduino-leonardo-schematic_3b.pdf
177- http://arduino.cc/en/uploads/Main/arduino-micro-schematic.pdf
178
179Arduino leonardo and micro have **ATMega32U4** and can be used for TMK, though Arduino bootloader may be a problem.
180
181
182## Using PF4-7 pins of USB AVR?
183You need to set JTD bit of MCUCR yourself to use PF4-7 as GPIO. Those pins are configured to serve JTAG function by default. MCUs like ATMega*U* or AT90USB* are affeteced with this.
184
185If you are using Teensy this isn't needed. Teensy is shipped with JTAGEN fuse bit unprogrammed to disable the function.
186
187See this code.
188```
189 // JTAG disable for PORT F. write JTD bit twice within four cycles.
190 MCUCR |= (1<<JTD);
191 MCUCR |= (1<<JTD);
192```
193https://github.com/tmk/tmk_keyboard/blob/master/keyboard/hbkb/matrix.c#L67
194
195And read **26.5.1 MCU Control Register – MCUCR** of ATMega32U4 datasheet.
196
197
198## Adding LED indicators of Lock keys
199You need your own LED indicators for CapsLock, ScrollLock and NumLock? See this post.
200
201http://deskthority.net/workshop-f7/tmk-keyboard-firmware-collection-t4478-120.html#p191560
202
203## Program Arduino Micro/Leonardo
204Push reset button and then run command like this within 8 seconds.
205
206```
207avrdude -patmega32u4 -cavr109 -b57600 -Uflash:w:adb_usb.hex -P/dev/ttyACM0
208```
209
210Device name will vary depending on your system.
211
212http://arduino.cc/en/Main/ArduinoBoardMicro
213https://geekhack.org/index.php?topic=14290.msg1563867#msg1563867
214
215
216## USB 3 compatibility
217I heard some people have a problem with USB 3 port, try USB 2 port.
218
219
220## Mac compatibility
221### OS X 10.11 and Hub
222https://geekhack.org/index.php?topic=14290.msg1884034#msg1884034
223
224
225## Problem on BIOS(UEFI)/Resume(Sleep&Wake)/Power cycles
226Some people reported their keyboard stops working on BIOS and/or after resume(power cycles).
227
228As of now root of its cause is not clear but some build options seem to be related. In Makefile try to disable those options like `CONSOLE_ENABLE`, `NKRO_ENABLE`, `SLEEP_LED_ENABLE` and/or others.
229
230https://github.com/tmk/tmk_keyboard/issues/266
231https://geekhack.org/index.php?topic=41989.msg1967778#msg1967778
232
233
234
235## FLIP doesn't work
236### AtLibUsbDfu.dll not found
237Remove current driver and reinstall one FLIP provides from DeviceManager.
238http://imgur.com/a/bnwzy \ No newline at end of file
diff --git a/docs/FAQ-Build.md b/docs/faq_build.md
index 75babb6ba..ba8b52af1 100644
--- a/docs/FAQ-Build.md
+++ b/docs/faq_build.md
@@ -1,5 +1,5 @@
1## READ FIRST 1## READ FIRST
2- https://github.com/jackhumbert/qmk_firmware/blob/master/doc/BUILD_GUIDE.md 2- https://github.com/qmk/qmk_firmware/blob/master/docs/build_guide.md
3 3
4In short, 4In short,
5 5
diff --git a/docs/FAQ-Keymap.md b/docs/faq_keymap.md
index 623726ab2..623726ab2 100644
--- a/docs/FAQ-Keymap.md
+++ b/docs/faq_keymap.md
diff --git a/docs/fuse.txt b/docs/fuse.txt
new file mode 100644
index 000000000..99ddd2d18
--- /dev/null
+++ b/docs/fuse.txt
@@ -0,0 +1,50 @@
1Atmega32u4 Fuse/Lock Bits for Planck/Atomic/Preonic
2=========================
3
4 Low Fuse: 0x5E
5 High Fuse: 0x99
6 Extended Fuse: 0xF3
7 Lock Byte: 0xFF
8
9
10ATMega168P Fuse/Lock Bits
11=========================
12This configuration is from usbasploader's Makefile.
13
14 HFUSE 0xD6
15 LFUSE 0xDF
16 EFUSE 0x00
17 LOCK 0x3F(intact)
18
19#---------------------------------------------------------------------
20# ATMega168P
21#---------------------------------------------------------------------
22# Fuse extended byte:
23# 0x00 = 0 0 0 0 0 0 0 0 <-- BOOTRST (boot reset vector at 0x1800)
24# \+/
25# +------- BOOTSZ (00 = 2k bytes)
26# Fuse high byte:
27# 0xd6 = 1 1 0 1 0 1 1 0
28# ^ ^ ^ ^ ^ \-+-/
29# | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V)
30# | | | | + --------- EESAVE (preserve EEPROM over chip erase)
31# | | | +-------------- WDTON (if 0: watchdog always on)
32# | | +---------------- SPIEN (allow serial programming)
33# | +------------------ DWEN (debug wire enable)
34# +-------------------- RSTDISBL (reset pin is enabled)
35# Fuse low byte:
36# 0xdf = 1 1 0 1 1 1 1 1
37# ^ ^ \ / \--+--/
38# | | | +------- CKSEL 3..0 (external >8M crystal)
39# | | +--------------- SUT 1..0 (crystal osc, BOD enabled)
40# | +------------------ CKOUT (if 0: Clock output enabled)
41# +-------------------- CKDIV8 (if 0: divide by 8)
42
43
44# Lock Bits
45# 0x3f = - - 1 1 1 1 1 1
46# \ / \-/ \-/
47# | | +----- LB 2..1 (No memory lock features enabled)
48# | +--------- BLB0 2..1 (No restrictions for SPM or LPM accessing the Application section)
49# +--------------- BLB1 2..1 (No restrictions for SPM or LPM accessing the Boot Loader section)
50
diff --git a/docs/Git-subtree.md b/docs/git_subtree.md
index 4fd7f8bea..4fd7f8bea 100644
--- a/docs/Git-subtree.md
+++ b/docs/git_subtree.md
diff --git a/docs/hand_wire.md b/docs/hand_wire.md
new file mode 100644
index 000000000..0d3372815
--- /dev/null
+++ b/docs/hand_wire.md
@@ -0,0 +1,321 @@
1# Quantum Hand-wiring Guide
2
3Parts list:
4* *x* keyswitches (MX, Matias, Gateron, etc)
5* *x* diodes
6* Keyboard plate (metal, plastic, cardboard, etc)
7* Wire (strained for wiring to the Teensy, anything for the rows/columns)
8* Soldering iron set at 600ºF or 315ºC (if temperature-controlled)
9* Resin-cored solder (leaded or lead-free)
10* Adequate ventilation/a fan
11* Tweezers (optional)
12* Wire cutters/snippers
13
14## How the matrix works (why we need diodes)
15
16The microcontroller (in this case, the Teensy 2.0) will be setup up via the firmware to send a logical 1 to the columns, one at a time, and read from the rows, all at once - this process is called matrix scanning. The matrix is a bunch of open switches that, by default, don't allow any current to pass through - the firmware will read this as no keys being pressed. As soon as you press one key down, the logical 1 that was coming from the column the keyswitch is attached to gets passed through the switch and to the corresponding row - check out the following 2x2 example:
17
18 Column 0 being scanned Column 1 being scanned
19 x x
20 col0 col1 col0 col1
21 | | | |
22 row0 ---(key0)---(key1) row0 ---(key0)---(key1)
23 | | | |
24 row1 ---(key2)---(key3) row1 ---(key2)---(key3)
25
26The `x` represents that the column/row associated has a value of 1, or is HIGH. Here, we see that no keys are being pressed, so no rows get an `x`. For one keyswitch, keep in mind that one side of the contacts is connected to its row, and the other, its column.
27
28When we press `key0`, `col0` gets connected to `row0`, so the values that the firmware receives for that row is `0b01` (the `0b` here means that this is a bit value, meaning all of the following digits are bits - 0 or 1 - and represent the keys in that column). We'll use this notation to show when a keyswitch has been pressed, to show that the column and row are being connected:
29
30 Column 0 being scanned Column 1 being scanned
31 x x
32 col0 col1 col0 col1
33 | | | |
34 x row0 ---(-+-0)---(key1) row0 ---(-+-0)---(key1)
35 | | | |
36 row1 ---(key2)---(key3) row1 ---(key2)---(key3)
37
38We can now see that `row0` has an `x`, so has the value of 1. As a whole, the data the firmware receives when `key0` is pressed is
39
40 col0: 0b01
41 col1: 0b00
42 │└row0
43 └row1
44
45A problem arises when you start pressing more than one key at a time. Looking at our matrix again, it should become pretty obvious:
46
47 Column 0 being scanned Column 1 being scanned
48 x x
49 col0 col1 col0 col1
50 | | | |
51 x row0 ---(-+-0)---(-+-1) x row0 ---(-+-0)---(-+-1)
52 | | | |
53 x row1 ---(key2)---(-+-3) x row1 ---(key2)---(-+-3)
54
55 Remember that this ^ is still connected to row1
56
57The data we get from that is:
58
59 col0: 0b11
60 col1: 0b11
61 │└row0
62 └row1
63
64Which isn't accurate, since we only have 3 keys pressed down, not all 4. This behavior is called ghosting, and only happens in odd scenarios like this, but can be much more common on a bigger keyboard. The way we can get around this is by placing a diode after the keyswitch, but before it connects to its row. A diode only allows current to pass through one way, which will protect our other columns/rows from being activated in the previous example. We'll represent a dioded matrix like this;
65
66 Column 0 being scanned Column 1 being scanned
67 x x
68 col0 col1 col0 col1
69 │ │ | │
70 (key0) (key1) (key0) (key1)
71 ! │ ! │ ! | ! │
72 row0 ─────┴────────┘ │ row0 ─────┴────────┘ │
73 │ │ | │
74 (key2) (key3) (key2) (key3)
75 ! ! ! !
76 row1 ─────┴────────┘ row1 ─────┴────────┘
77
78In practical applications, the black line of the diode will be placed facing the row, and away from the keyswitch - the `!` in this case is the diode, where the gap represents the black line. A good way to remember this is to think of this symbol: `>|`
79
80Now when we press the three keys, invoking what would be a ghosting scenario:
81
82 Column 0 being scanned Column 1 being scanned
83 x x
84 col0 col1 col0 col1
85 │ │ │ │
86 (┌─┤0) (┌─┤1) (┌─┤0) (┌─┤1)
87 ! │ ! │ ! │ ! │
88 x row0 ─────┴────────┘ │ x row0 ─────┴────────┘ │
89 │ │ │ │
90 (key2) (┌─┘3) (key2) (┌─┘3)
91 ! ! ! !
92 row1 ─────┴────────┘ x row1 ─────┴────────┘
93
94Things act as they should! Which will get us the following data:
95
96 col0: 0b01
97 col1: 0b11
98 │└row0
99 └row1
100
101The firmware can then use this correct data to detect what it should do, and eventually, what signals it needs to send to the OS.
102
103## The actual hand-wiring
104
105### Getting things in place
106
107When starting this, you should have all of your stabilisers and keyswitches already installed (and optionally keycaps). If you're using a Cherry-type stabiliser (plate-mounted only, obviously), you'll need to install that before your keyswitches. If you're using Costar ones, you can installed them afterwards.
108
109To make things easier on yourself, make sure all of the keyswitches are oriented the same way (if they can be - not all layouts support this). Despite this, it's important to remember that the contacts on the keyswitches are completely symmetrical. We'll be using the keyswitch's left side contact for wiring the rows, and the right side one for wiring the columns.
110
111Get your soldering iron heated-up and collect the rest of the materials from the part list at the beginning of the guide. Place your keyboard so that the bottoms of the keyswitches are accessible - it may be a good idea to place it on a cloth to protect your keyswitches/keycaps.
112
113Before continuing, plan out where you're going to place your Teensy. If you're working with a board that has a large (6.25u) spacebar, it may be a good idea to place it in-between switches against the plate. Otherwise, you may want to trim some of the leads on the keyswitches where you plan on putting it - this will make it a little harder to solder the wire/diodes, but give you more room to place the Teensy.
114
115### Preparing the diodes
116
117It's a little easier to solder the diodes in place if you bend them at a 90º angle immediately after the black line - this will help to make sure you put them on the right way (direction matters), and in the correct position. The diodes will look like this when bent (with longer leads):
118
119 ┌─────┬─┐
120 ───┤ │ ├─┐
121 └─────┴─┘ │
122
123
124We'll be using the long lead at the bent end to connect it to the elbow (bent part) of the next diode, creating the row.
125
126### Soldering the diodes
127
128Starting at the top-left switch, place the diode (with tweezers if you have them) on the switch so that the diode itself is vertically aligned, and the black line is facing toward you. The straight end of the diode should be touching the left contact on the switch, and the bent end should be facing to the right and resting on the switch there, like this:
129
130 │o
131 ┌┴┐ o
132 │ │ O
133 ├─┤
134 └┬┘
135 └─────────────
136
137Letting the diode rest, grab your solder, and touch both it and the soldering iron to the left contact at the same time - the rosin in the solder should make it easy for the solder to flow over both the diode and the keyswitch contact. The diode may move a little, and if it does, carefully position it back it place by grabbing the bent end of the diode - the other end will become hot very quickly. If you find that it's moving too much, using needle-nose pliers of some sort may help to keep the diode still when soldering.
138
139The smoke that the rosin releases is harmful, so be careful not to breath it or get it in your eyes/face.
140
141After soldering things in place, it may be helpful to blow on the joint to push the smoke away from your face, and cool the solder quicker. You should see the solder develop a matte (not shiney) surface as it solidifies. Keep in mind that it will still be very hot afterwards, and will take a couple minutes to be cool to touch. Blow on it will accelerate this process.
142
143When the first diode is complete, the next one will need to be soldered to both the keyswitch, and the previous diode at the new elbow. That will look something like this:
144
145 │o │o
146 ┌┴┐ o ┌┴┐ o
147 │ │ O │ │ O
148 ├─┤ ├─┤
149 └┬┘ └┬┘
150 └────────────────┴─────────────
151
152After completing a row, use the wire cutters to trim the excess wire from the tops of the diodes, and from the right side on the final switch. This process will need to completed for each row you have.
153
154When all of the diodes are completely soldered, it's a good idea to quickly inspect each one to ensure that your solder joints are solid and sturdy - repairing things after this is possible, but more difficult.
155
156### Soldering the columns
157
158You'll have some options in the next process - it's a good idea to insulate the column wires (since the diodes aren't), but if you're careful enough, you can use exposed wires for the columns - it's not recommended, though. If you're using single-cored wire, stripping the plastic off of the whole wire and feeding it back on is probably the best option, but can be difficult depending on the size and materials. You'll want to leave parts of the wire exposed where you're going to be solder it onto the keyswitch.
159
160If you're using stranded wire, it's probably easiest to just use a lot of small wires to connect each keyswitch along the column. It's possible to use one and melt through the insulation, but this isn't recommended, will produce even more harmful fumes, and can ruin your soldering iron.
161
162Before beginning to solder, it helps to have your wire pre-bent (if using single-cored), or at least have an idea of how you're going to route the column (especially if you're making a staggered board). Where you go in particular doesn't matter too much, as we'll be basing our keymap definitions on how it was wired - just make sure every key in a particular row is in a unique column, and that they're in order from left to right.
163
164If you're not using any insulation, you can try to keep the column wires elevated, and solder them near the tips of the keyswitch contacts - if the wires are sturdy enough, they won't short out to the row wiring an diodes.
165
166### Wiring things to the Teensy
167
168Now that the matrix itself is complete, it's time to connect what you've done to the Teensy. You'll be needing the number of pins equal to your number of columns + your number of rows. There are some pins on the Teensy that are special, like D6 (the LED on the chip), or some of the UART, SPI, I2C, or PWM channels, but only avoid those if you're planning something in addition to a keyboard. If you're unsure about wanting to add something later, you should have enough pins in total to avoid a couple.
169
170The pins you'll absolutely have to avoid are: GND, VCC, AREF, and RST - all the others are usable and accessible in the firmware.
171
172Place the Teensy where you plan to put it - you'll have to cut wires to length in the next step, and you'll want to make sure they reach.
173
174Starting with the first column on the right side, measure out how much wire you'll need to connect it to the first pin on the Teensy - it helps to pick a side that you'll be able to work down, to keep the wires from overlapping too much. It may help to leave a little bit of slack so things aren't too tight. Cut the piece of wire, and solder it to the Teensy, and then the column - you can solder it anywhere along the column, but it may be easiest at the keyswitch. Just be sure the wire doesn't separate from the keyswitch when soldering.
175
176As you move from column to column, it'll be helpful to write the locations of the pins down. We'll use this data to setup the matrix in the future.
177
178When you're done with the columns, start with the rows in the same process, from top to bottom, and write them all down. Again, you can solder anywhere along the row, as long as it's after the diode - soldering before the diode (on the keyswitch side) will cause that row not to work.
179
180As you move along, be sure that the Teensy is staying in place - recutting and soldering the wires is a pain!
181
182### Getting some basic firmware set-up
183
184From here, you should have a working keyboard with the correct firmware. Before we attach the Teensy permanently to the keyboard, let's quickly get some firmware loaded onto the Teensy so we can test each keyswitch.
185
186To start out, download [the firmware](https://github.com/qmk/qmk_firmware/) - we'll be using my (Jack's) fork of TMK called QMK/Quantum. We'll be doing a lot from the Terminal/command prompt, so get that open, along with a decent text editor like [Sublime Text](http://www.sublimetext.com/).
187
188The first thing we're going to do is create a new project using the script in the root directory of the firmware. In your terminal, run this command with `<project_name>` replaced by the name of your project - it'll need to be different from any other project in the `keyboards/` folder:
189
190 util/new_project.sh <project_name>
191
192You'll want to navigate to the `keyboards/<project_name>/` folder by typing, like the print-out from the script specifies:
193
194 cd keyboards/<project_name>
195
196#### config.h
197
198The first thing you're going to want to modify is the `config.h` file. Find `MATRIX_ROWS` and `MATRIX_COLS` and change their definitions to match the dimensions of your keyboard's matrix.
199
200Farther down are `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`. Change their definitions to match how you wired up your matrix (looking from the top of the keyboard, the rows run top-to-bottom and the columns run left-to-right). Likewise, change the definition of `UNUSED_PINS` to match the pins you did not use (this will save power).
201
202#### \<project_name\>.h
203
204The next file you'll want to look at is `<project_name>.h`. You're going to want to rewrite the `KEYMAP` definition - the format and syntax here is extremely important, so pay attention to how things are setup. The first half of the definition are considered the arguments - this is the format that you'll be following in your keymap later on, so you'll want to have as many k*xy* variables here as you do keys. The second half is the part that the firmware actually looks at, and will contain gaps depending on how you wired your matrix.
205
206We'll dive into how this will work with the following example. Say we have a keyboard like this:
207
208 ┌───┬───┬───┐
209 │ │ │ │
210 ├───┴─┬─┴───┤
211 │ │ │
212 └─────┴─────┘
213
214This can be described by saying the top row is 3 1u keys, and the bottom row is 2 1.5u keys. The difference between the two rows is important, because the bottom row has an unused column spot (3 v 2). Let's say that this is how we wired the columns:
215
216 ┌───┬───┬───┐
217 │ ┋ │ ┋ │ ┋ │
218 ├─┋─┴─┬─┴─┋─┤
219 │ ┋ │ ┋ │
220 └─────┴─────┘
221
222The middle column is unused on the bottom row in this example. Our `KEYMAP` definition would look like this:
223
224 #define KEYMAP( \
225 k00, k01, k02, \
226 k10, k11, \
227 ) \
228 { \
229 { k00, k01, k02 }, \
230 { k10, KC_NO, k11 }, \
231 }
232
233Notice how the top half is spaced to resemble our physical layout - this helps us understand which keys are associated with which columns. The bottom half uses the keycode `KC_NO` where there is no keyswitch wired in. It's easiest to keep the bottom half aligned in a grid to help us make sense of how the firmware actually sees the wiring.
234
235Let's say that instead, we wired our keyboard like this (a fair thing to do):
236
237 ┌───┬───┬───┐
238 │ ┋ │ ┋│ ┋ │
239 ├─┋─┴─┬┋┴───┤
240 │ ┋ │┋ │
241 └─────┴─────┘
242
243This would require our `KEYMAP` definition to look like this:
244
245 #define KEYMAP( \
246 k00, k01, k02, \
247 k10, k11, \
248 ) \
249 { \
250 { k00, k01, k02 }, \
251 { k10, k11, KC_NO }, \
252 }
253
254Notice how the `k11` and `KC_NO` switched places to represent the wiring, and the unused final column on the bottom row. Sometimes it'll make more sense to put a keyswitch on a particular column, but in the end, it won't matter, as long as all of them are accounted for. You can use this process to write out the `KEYMAP` for your entire keyboard - be sure to remember that your keyboard is actually backwards when looking at the underside of it.
255
256#### keymaps/default.c
257
258This is the actual keymap for your keyboard, and the main place you'll make changes as you perfect your layout. `default.c` is the file that gets pull by default when typing `make`, but you can make other files as well, and specify them by typing `make KEYMAP=<variant>`, which will pull `keymaps/<variant>.c`.
259
260The basis of a keymap is its layers - by default, layer 0 is active. You can activate other layers, the highest of which will be referenced first. Let's start with our base layer.
261
262Using our previous example, let's say we want to create the following layout:
263
264 ┌───┬───┬───┐
265 │ A │ 1 │ H │
266 ├───┴─┬─┴───┤
267 │ TAB │ SPC │
268 └─────┴─────┘
269
270This can be accomplished by using the following `keymaps` definition:
271
272 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
273 [0] = KEYMAP( /* Base */
274 KC_A, KC_1, KC_H, \
275 KC_TAB, KC_SPC \
276 ),
277 };
278
279Note that the layout of the keycodes is similar to the physical layout of our keyboard - this make it much easier to see what's going on. A lot of the keycodes should be fairly obvious, but for a full list of them, check out [tmk_code/doc/keycode.txt](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/doc/keycode.txt) - there are also a lot of aliases to condense your keymap file.
280
281It's also important to use the `KEYMAP` function we defined earlier - this is what allows the firmware to associate our intended readable keymap with the actual wiring.
282
283#### Compiling your firmware
284
285After you've written out your entire keymap, you're ready to get the firmware compiled and onto your Teensy. Before compiling, you'll need to get your [development environment set-up](build_guide.md) - you can skip the dfu-programmer instructions, but you'll need to download and install the [Teensy Loader](https://www.pjrc.com/teensy/loader.html) to get the firmware on your Teensy.
286
287Once everything is installed, running `make` in the terminal should get you some output, and eventually a `<project_name>.hex` file in that folder. If you're having trouble with this step, see the end of the guide for the trouble-shooting section.
288
289Once you have your `<project_name>.hex` file, open up the Teensy loader application, and click the file icon. From here, navigate to your `QMK/keyboards/<project_name>/` folder, and select the `<project_name>.hex` file. Plug in your keyboard and press the button on the Teensy - you should see the LED on the device turn off once you do. The Teensy Loader app will change a little, and the buttons should be clickable - click the download button (down arrow), and then the reset button (right arrow), and your keyboard should be ready to go!
290
291#### Testing your firmware
292
293Carefully flip your keyboard over, open up a new text document, and try typing - you should get the characters that you put into your keymap. Test each key, and note the ones that aren't working. Here's a quick trouble-shooting guide for non-working keys:
294
2950. Flip the keyboard back over and short the keyswitch's contacts with a piece wire - this will eliminate the possibility of the keyswitch being bad and needing to be replaced.
2961. Check the solder points on the keyswitch - these need to be plump and whole. If you touch it with a moderate amount of force and it comes apart, it's not strong enough.
2972. Check the solder joints on the diode - if the diode is loose, part of your row may register, while the other may not.
2983. Check the solder joints on the columns - if your column wiring is loose, part or all of the column may not work.
2994. Check the solder joints on both sides of the wires going to/from the Teensy - the wires need to be fully soldered and connect to both sides.
3005. Check the <project_name>.h file for errors and incorrectly placed `KC_NO`s - if you're unsure where they should be, instead duplicate a k*xy* variable.
3016. Check to make sure you actually compiled the firmware and flashed the Teensy correctly. Unless you got error messages in the terminal, or a pop-up during flashing, you probably did everything correctly.
302
303If you've done all of these things, keep in mind that sometimes you might have had multiple things affecting the keyswitch, so it doesn't hurt to test the keyswitch by shorting it out at the end.
304
305#### Securing the Teensy, finishing your hardware, getting fancier firmware
306
307Now that you have a working board, it's time to get things in their permanent positions. I've often used liberal amounts of hot glue to secure and insulate things, so if that's your style, start spreading that stuff like butter. Otherwise, double-sided tape is always an elegant solution, and electrical tape is a distant second. Due to the nature of these builds, a lot of this part is up to you and how you planned (or didn't plan) things out.
308
309There are a lot of possibilities inside the firmware - check out the [readme](https://github.com/qmk/qmk_firmware/blob/master/readme.md) for a full feature list, and dive into the different project (Planck, Ergodox EZ, etc) to see how people use all of them. You can always stop by [the OLKB subreddit for help!](http://reddit.com/r/olkb)
310
311## Trouble-shooting compiling
312
313### Windows
314
315#### fork: Resource temporarily unavailable
316
317http://www.avrfreaks.net/forum/windows-81-compilation-error
318
319### Mac
320
321### Linux
diff --git a/docs/HHKB-Alt-controller.md b/docs/hhkb_alt_controller.md
index c12d8d7ff..c12d8d7ff 100644
--- a/docs/HHKB-Alt-controller.md
+++ b/docs/hhkb_alt_controller.md
diff --git a/docs/home.md b/docs/home.md
new file mode 100644
index 000000000..df27ebdc5
--- /dev/null
+++ b/docs/home.md
@@ -0,0 +1,134 @@
1# Quantum Mechanical Keyboard Firmware
2
3You have found the QMK Firmware documentation site. This is a keyboard firmware based on the [tmk\_keyboard firmware](http://github.com/tmk/tmk_keyboard) \([view differences](differences_from_tmk.md)\) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.com), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/). It has also been ported to ARM chips using ChibiOS. You can use it to power your own hand-wired or custom keyboard PCB.
4
5# Getting started
6
7Before you are able to compile, you'll need to install an environment for AVR or ARM development. You'll find the instructions for any OS below. If you find another/better way to set things up from scratch, please consider [making a pull request](https://github.com/qmk/qmk_firmware/pulls) with your changes!
8
9* [Build Environment Setup](build_environment_setup.md)
10* [QMK Overview](qmk_overview.md)
11
12# Configuring QMK Firmware
13
14The QMK Firmware can be configured via the `keymaps` array data. For simply generating a [basic keycode](keycodes.md), you add it as an element of your `keymaps` array data. For more complicated actions, there are more advanced keycodes that are organized carefully to represent common operations, some of which can be found on the [Key Functions](key_functions.md) page.
15
16For more details of the `keymaps` array, see [Keymap Overview](keymap.md) page.
17
18## Space Cadet Shift: The future, built in
19
20Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds. Head on over to the [Space Cadet Shift](space_cadet_shift.md) page to read about it.
21
22## The Leader key: A new kind of modifier
23
24Most modifiers have to be held or toggled. But what if you had a key that indicated the start of a sequence? You could press that key and then rapidly press 1-3 more keys to trigger a macro, or enter a special layer, or anything else you might want to do. To learn more about it check out the [Leader Key](leader_key.md) page.
25
26## Tap Dance: A single key can do 3, 5, or 100 different things
27
28Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a colon. Hit it three times, and your keyboard's LEDs do a wild dance. That's just one example of what Tap Dance can do. Read more about it on the [Tap Dance](tap_dance.md) page.
29
30## Temporarily setting the default layer
31
32`DF(layer)` - sets default layer to _layer_. The default layer is the one at the "bottom" of the layer stack - the ultimate fallback layer. This currently does not persist over power loss. When you plug the keyboard back in, layer 0 will always be the default. It is theoretically possible to work around that, but that's not what `DF` does.
33
34## Macro shortcuts: Send a whole string when pressing just one key
35
36How would you like a single keypress to send a whole word, sentence, paragraph, or even document? Head on over to the [Macros](macros.md) page to read up on all aspects of Simple and Dynamic Macros.
37
38## Additional keycode aliases for software-implemented layouts \(Colemak, Dvorak, etc\)
39
40Everything is assuming you're in Qwerty \(in software\) by default, but there is built-in support for using a Colemak or Dvorak layout by including this at the top of your keymap:
41
42```
43#include <keymap_colemak.h>
44```
45
46If you use Dvorak, use `keymap_dvorak.h` instead of `keymap_colemak.h` for this line. After including this line, you will get access to:
47
48* `CM_*` for all of the Colemak-equivalent characters
49* `DV_*` for all of the Dvorak-equivalent characters
50
51These implementations assume you're using Colemak or Dvorak on your OS, not on your keyboard - this is referred to as a software-implemented layout. If your computer is in Qwerty and your keymap is in Colemak or Dvorak, this is referred to as a firmware-implemented layout, and you won't need these features.
52
53To give an example, if you're using software-implemented Colemak, and want to get an `F`, you would use `CM_F`. Using `KC_F` under these same circumstances would result in `T`.
54
55## Backlight Breathing
56
57In order to enable backlight breathing, the following line must be added to your config.h file.
58
59```
60#define BACKLIGHT_BREATHING
61```
62
63The following function calls are used to control the breathing effect.
64
65* `breathing_enable()` - Enable the free-running breathing effect.
66* `breathing_disable()` - Disable the free-running breathing effect immediately.
67* `breathing_self_disable()` - Disable the free-running breathing effect after the current effect ends.
68* `breathing_toggle()` - Toggle the free-running breathing effect.
69* `breathing_defaults()` - Reset the speed and brightness settings of the breathing effect.
70
71The following function calls are used to control the maximum brightness of the breathing effect.
72
73* `breathing_intensity_set(value)` - Set the brightness of the breathing effect when it is at its max value.
74* `breathing_intensity_default()` - Reset the brightness of the breathing effect to the default value based on the current backlight intensity.
75
76The following function calls are used to control the cycling speed of the breathing effect.
77
78* `breathing_speed_set(value)` - Set the speed of the breathing effect - how fast it cycles.
79* `breathing_speed_inc(value)` - Increase the speed of the breathing effect by a fixed value.
80* `breathing_speed_dec(value)` - Decrease the speed of the breathing effect by a fixed value.
81* `breathing_speed_default()` - Reset the speed of the breathing effect to the default value.
82
83The following example shows how to enable the backlight breathing effect when the FUNCTION layer macro button is pressed:
84
85```
86case MACRO_FUNCTION:
87 if (record->event.pressed)
88 {
89 breathing_speed_set(3);
90 breathing_enable();
91 layer_on(LAYER_FUNCTION);
92 }
93 else
94 {
95 breathing_speed_set(1);
96 breathing_self_disable();
97 layer_off(LAYER_FUNCTION);
98 }
99 break;
100```
101
102The following example shows how to pulse the backlight on-off-on when the RAISED layer macro button is pressed:
103
104```
105case MACRO_RAISED:
106 if (record->event.pressed)
107 {
108 layer_on(LAYER_RAISED);
109 breathing_speed_set(2);
110 breathing_pulse();
111 update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST);
112 }
113 else
114 {
115 layer_off(LAYER_RAISED);
116 update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST);
117 }
118 break;
119```
120
121## Other firmware shortcut keycodes
122
123* `RESET` - puts the MCU in DFU mode for flashing new firmware \(with `make dfu`\)
124* `DEBUG` - the firmware into debug mode - you'll need hid\_listen to see things
125* `BL_ON` - turns the backlight on
126* `BL_OFF` - turns the backlight off
127* `BL_<n>` - sets the backlight to level _n_
128* `BL_INC` - increments the backlight level by one
129* `BL_DEC` - decrements the backlight level by one
130* `BL_TOGG` - toggles the backlight
131* `BL_STEP` - steps through the backlight levels
132
133Enable the backlight from the Makefile.
134
diff --git a/docs/Key-Functions.md b/docs/key_functions.md
index 228fea8ac..c0f06f9c8 100644
--- a/docs/Key-Functions.md
+++ b/docs/key_functions.md
@@ -2,7 +2,7 @@
2 2
3Your keymap can include shortcuts to common operations (called "function actions" in tmk). 3Your keymap can include shortcuts to common operations (called "function actions" in tmk).
4 4
5These functions work the same way that their `ACTION_*` functions do - they're just quick aliases. To dig into all of the tmk `ACTION_*` functions, please see the [TMK documentation](https://github.com/qmk/qmk_firmware/blob/master/doc/keymap.md#2-action). 5These functions work the same way that their `ACTION_*` functions do - they're just quick aliases. To dig into all of the tmk `ACTION_*` functions, please see the [TMK documentation](keymap.md#2-action).
6 6
7Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` - the benefit here is being able to use more than 32 function actions (up to 4096), if you happen to need them. 7Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` - the benefit here is being able to use more than 32 function actions (up to 4096), if you happen to need them.
8 8
diff --git a/docs/keycodes.md b/docs/keycodes.md
new file mode 100644
index 000000000..5cf5c019d
--- /dev/null
+++ b/docs/keycodes.md
@@ -0,0 +1,228 @@
1# Overview
2
3When defining a [keymap](keymap.md) each key needs a valid key definition.
4
5This page documents the symbols that correspond to keycodes that are available to you in QMK.
6
7To customize your board, they can be used by themselves or as **action codes** in combination with one of the [many C macros](https://github.com/qmk/qmk_firmware/wiki#c-macros-for-action-code).
8
9The source of truth for these codes is [tmk_core/common/keycode.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/keycode.h) file in the qmk source code.
10
11# The Keycodes
12
13Keycodes in QMK are based on [HID Usage Keyboard/Keypad Page(0x07)](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) with following exceptions:
14
15* `KC_NO` = 0 for no action
16* `KC_TRNS` = 1 for layer transparency
17* internal special keycodes in the `0xA5-DF` range (tmk heritage).
18
19## Letters and Numbers
20
21|KC_1|KC_2|KC_3|KC_4|KC_5|KC_6|KC_7|KC_8|
22|----|----|----|----|----|----|----|----|
23|KC_9|KC_0|KC_F1|KC_F2|KC_F3|KC_F4|KC_F5|KC_F6|
24|KC_F7|KC_F8|KC_F9|KC_F10|KC_F11|KC_F12|KC_F13|KC_F14|
25|KC_F15|KC_F16|KC_F17|KC_F18|KC_F19|KC_F20|KC_F21|KC_F22|
26|KC_F23|KC_F24|KC_A|KC_B|KC_C|KC_D|KC_E|KC_F|
27|KC_G|KC_H|KC_I|KC_J|KC_K|KC_L|KC_M|KC_N|
28|KC_O|KC_P|KC_Q|KC_R|KC_S|KC_T|KC_U|KC_V|
29|KC_W|KC_X|KC_Y|KC_Z|||||
30
31## Punctuation
32
33|Long Name|Short Name|Description|
34|---------|----------|-----------|
35|KC_ENTER|KC_ENT|`Return (ENTER)`|
36|KC_ESCAPE|KC_ESC|`ESCAPE`|
37|KC_BSPACE|KC_BSPC|`DELETE (Backspace)`|
38|KC_TAB||`Tab`|
39|KC_SPACE|KC_SPC|Spacebar|
40|KC_MINUS|KC_MINS|`-` and `_`|
41|KC_EQUAL|KC_EQL|`=` and `+`|
42|KC_LBRACKET|KC_LBRC|`[` and `{`|
43|KC_RBRACKET|KC_RBRC|`]` and `}`|
44|KC_BSLASH|KC_BSLS|`\` and <code>&#124;</code> |
45|KC_NONUS_HASH|KC_NUHS|Non-US `#` and `~`|
46|KC_NONUS_BSLASH|KC_NUBS|Non-US `\` and <code>&#124;</code> |
47|KC_INT1|KC_RO|JIS `\` and <code>&#124;</code> |
48|KC_INT2|KC_KANA|International216|
49|KC_INT3|KC_JYEN|Yen Symbol (`¥`)|
50|KC_SCOLON|KC_SCLN|`;` and `:`|
51|KC_QUOTE|KC_QUOT|`‘` and `“`|
52|KC_GRAVE|KC_GRV|Grave Accent and Tilde|
53|KC_COMMA|KC_COMM|`,` and `<`|
54|KC_DOT||`.` and `>`|
55|KC_SLASH|KC_SLSH|`/` and `?`|
56|KC_CAPSLOCK|KC_CAPS|Caps Lock|
57
58## Modifiers
59
60|Long Name|Short Name|Description|
61|---------|----------|-----------|
62|KC_LCTRL|KC_LCTL|LeftControl|
63|KC_LSHIFT|KC_LSFT|LeftShift|
64|KC_LALT||LeftAlt|
65|KC_LGUI||Left GUI(Windows/Apple/Meta key)|
66|KC_RCTRL|KC_RCTL|RightControl|
67|KC_RSHIFT|KC_RSFT|RightShift|
68|KC_RALT||RightAlt|
69|KC_RGUI||Right GUI(Windows/Apple/Meta key)|
70|KC_LOCKING_CAPS||Locking Caps Lock|
71|KC_LOCKING_NUM||Locking Num Lock|
72|KC_LOCKING_SCROLL||Locking Scroll Lock|
73|KC_INT4|KC_HENK|JIS Henken|
74|KC_INT5|KC_MHEN|JIS Muhenken|
75
76## Commands
77
78|Long Name|Short Name|Description|
79|---------|----------|-----------|
80|KC_PSCREEN|KC_PSCR|PrintScreen|
81|KC_SCROLLLOCK|KC_SLCK|Scroll Lock|
82|KC_PAUSE|KC_PAUS|Pause|
83|KC_INSERT|KC_INS|Insert|
84|KC_HOME||Home|
85|KC_PGUP||PageUp|
86|KC_DELETE|KC_DEL|Delete Forward|
87|KC_END||End|
88|KC_PGDOWN|KC_PGDN|PageDown|
89|KC_RIGHT|KC_RGHT|RightArrow|
90|KC_LEFT||LeftArrow|
91|KC_DOWN||DownArrow|
92|KC_UP||UpArrow|
93|KC_APPLICATION|KC_APP|Application|
94|KC_POWER||Power|
95|KC_EXECUTE||Execute|
96|KC_HELP||Help|
97|KC_MENU||Menu|
98|KC_SELECT||Select|
99|KC_AGAIN||Again|
100|KC_UNDO||Undo|
101|KC_CUT||Cut|
102|KC_COPY||Copy|
103|KC_PASTE||Paste|
104|KC_FIND||Find|
105|KC_ALT_ERASE||Alternate Erase|
106|KC_SYSREQ||SysReq/Attention|
107|KC_CANCEL||Cancel|
108|KC_CLEAR||Clear|
109|KC_PRIOR||Prior|
110|KC_RETURN||Return|
111|KC_SEPARATOR||Separator|
112|KC_OUT||Out|
113|KC_OPER||Oper|
114|KC_CLEAR_AGAIN||Clear/Again|
115|KC_CRSEL||CrSel/Props|
116|KC_EXSEL||ExSel|
117|KC_SYSTEM_POWER|KC_PWR|System Power Down|
118|KC_SYSTEM_SLEEP|KC_SLEP|System Sleep|
119|KC_SYSTEM_WAKE|KC_WAKE|System Wake|
120|KC_MAIL|KC_MAIL||
121|KC_CALCULATOR|KC_CALC||
122|KC_MY_COMPUTER|KC_MYCM||
123|KC_WWW_SEARCH|KC_WSCH||
124|KC_WWW_HOME|KC_WHOM||
125|KC_WWW_BACK|KC_WBAK||
126|KC_WWW_FORWARD|KC_WFWD||
127|KC_WWW_STOP|KC_WSTP||
128|KC_WWW_REFRESH|KC_WREF||
129|KC_WWW_FAVORITES|KC_WFAV||
130
131## Media Keys
132
133Windows and Mac use different key codes for next track and previous track. Make sure you choose the keycode that corresponds to your OS.
134
135|Long Name|Short Name|Description|
136|---------|----------|-----------|
137|KC_STOP||Stop|
138|KC__MUTE||Mute|
139|KC__VOLUP||Volume Up|
140|KC__VOLDOWN||Volume Down|
141|KC_AUDIO_MUTE|KC_MUTE||
142|KC_AUDIO_VOL_UP|KC_VOLU||
143|KC_AUDIO_VOL_DOWN|KC_VOLD||
144|KC_MEDIA_NEXT_TRACK|KC_MNXT|Next Track (Windows)|
145|KC_MEDIA_PREV_TRACK|KC_MPRV|Previous Track (Windows)|
146|KC_MEDIA_FAST_FORWARD|KC_MFFD|Next Track (macOS)|
147|KC_MEDIA_REWIND|KC_MRWD|Previous Track (macOS)|
148|KC_MEDIA_STOP|KC_MSTP||
149|KC_MEDIA_PLAY_PAUSE|KC_MPLY||
150|KC_MEDIA_SELECT|KC_MSEL||
151
152## Numpad
153
154|Long Name|Short Name|Description|
155|---------|----------|-----------|
156|KC_NUMLOCK|KC_NLCK|Keypad Num Lock and Clear|
157|KC_KP_SLASH|KC_PSLS|Keypad /|
158|KC_KP_ASTERISK|KC_PAST|Keypad *|
159|KC_KP_MINUS|KC_PMNS|Keypad -|
160|KC_KP_PLUS|KC_PPLS|Keypad +|
161|KC_KP_ENTER|KC_PENT|Keypad ENTER|
162|KC_KP_1|KC_P1|Keypad 1 and End|
163|KC_KP_2|KC_P2|Keypad 2 and Down Arrow|
164|KC_KP_3|KC_P3|Keypad 3 and PageDn|
165|KC_KP_4|KC_P4|Keypad 4 and Left Arrow|
166|KC_KP_5|KC_P5|Keypad 5|
167|KC_KP_6|KC_P6|Keypad 6 and Right Arrow|
168|KC_KP_7|KC_P7|Keypad 7 and Home|
169|KC_KP_8|KC_P8|Keypad 8 and Up Arrow|
170|KC_KP_9|KC_P9|Keypad 9 and PageUp|
171|KC_KP_0|KC_P0|Keypad 0 and Insert|
172|KC_KP_DOT|KC_PDOT|Keypad . and Delete|
173|KC_KP_EQUAL|KC_PEQL|Keypad =|
174|KC_KP_COMMA|KC_PCMM|Keypad Comma|
175|KC_KP_EQUAL_AS400||Keypad Equal Sign|
176
177## Special Keys
178
179|Long Name|Short Name|Description|
180|---------|----------|-----------|
181|KC_NO||Ignore this key. (NOOP) |
182
183## Mousekey
184
185|Long Name|Short Name|Description|
186|---------|----------|-----------|
187|KC_MS_UP|KC_MS_U|Mouse Cursor Up|
188|KC_MS_DOWN|KC_MS_D|Mouse Cursor Down|
189|KC_MS_LEFT|KC_MS_L|Mouse Cursor Left|
190|KC_MS_RIGHT|KC_MS_R|Mouse Cursor Right|
191|KC_MS_BTN1|KC_BTN1|Mouse Button 1|
192|KC_MS_BTN2|KC_BTN2|Mouse Button 2|
193|KC_MS_BTN3|KC_BTN3|Mouse Button 3|
194|KC_MS_BTN4|KC_BTN4|Mouse Button 4|
195|KC_MS_BTN5|KC_BTN5|Mouse Button 5|
196|KC_MS_WH_UP|KC_WH_U|Mouse Wheel Up|
197|KC_MS_WH_DOWN|KC_WH_D|Mouse Wheel Down|
198|KC_MS_WH_LEFT|KC_WH_L|Mouse Wheel Left|
199|KC_MS_WH_RIGHT|KC_WH_R|Mouse Wheel Right|
200|KC_MS_ACCEL0|KC_ACL0|Mouse Acceleration 0|
201|KC_MS_ACCEL1|KC_ACL1|Mouse Acceleration 1|
202|KC_MS_ACCEL2|KC_ACL2|Mouse Acceleration 2|
203
204## Magic Keys
205
206The following keys can be used to turn on and off various "Magic" features. These include Boot Magic (holding certain keys down while plugging the keyboard in) and the Magic Key.
207
208|Long Name|Short Name|Description|
209|---------|----------|-----------|
210|MAGIC_SWAP_CONTROL_CAPSLOCK||Swap Capslock and Control|
211|MAGIC_CAPSLOCK_TO_CONTROL||Change Capslock to Control|
212|MAGIC_SWAP_ALT_GUI||Swap ALT and GUI|
213|MAGIC_SWAP_LALT_LGUI||Swap LALT and LGUI|
214|MAGIC_SWAP_RALT_RGUI||Swap RALT and RGUI|
215|MAGIC_NO_GUI||Disable off the GUI key|
216|MAGIC_SWAP_GRAVE_ESC||Swap the GRAVE (~ `) and Esc keys|
217|MAGIC_SWAP_BACKSLASH_BACKSPACE||Swap Backslash and Backspace|
218|MAGIC_UNSWAP_CONTROL_CAPSLOCK||Disable the Control/Caps Swap|
219|MAGIC_UNCAPSLOCK_TO_CONTROL||Turn Capslock back into Capslock|
220|MAGIC_UNSWAP_ALT_GUI||Turn the ALT/GUI swap off|
221|MAGIC_UNSWAP_LALT_LGUI||Turn the LALT/LGUI swap off|
222|MAGIC_UNSWAP_RALT_RGUI||Turn the RALT/RGUI swap off|
223|MAGIC_UNNO_GUI||Enable the GUI key|
224|MAGIC_UNSWAP_GRAVE_ESC||Turn the GRAVE/ESC swap off|
225|MAGIC_UNSWAP_BACKSLASH_BACKSPACE||Turn the Backslash/Backspace swap off|
226|MAGIC_HOST_NKRO||Turn NKRO on|
227|MAGIC_UNHOST_NKRO||Turn NKRO off|
228|MAGIC_TOGGLE_NKRO||Toggle NKRO on or off|
diff --git a/docs/keymap.md b/docs/keymap.md
new file mode 100644
index 000000000..53b17f401
--- /dev/null
+++ b/docs/keymap.md
@@ -0,0 +1,222 @@
1# Keymap Overview
2
3QMK keymaps are defined inside a C source file. The data structure is an array of arrays. The outer array is a list of layer arrays while the inner layer array is a list of keys. Most keyboards define a `KEYMAP()` macro to help you create this array of arrays.
4
5
6## Keymap and layers
7In QMK, **`const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS]`** holds multiple **layers** of keymap information in **16 bit** data holding the **action code**. You can define **32 layers** at most.
8
9For trivial key definitions, the higher 8 bits of the **action code** are all 0 and the lower 8 bits holds the USB HID usage code generated by the key as **keycode**.
10
11Respective layers can be validated simultaneously. Layers are indexed with 0 to 31 and higher layer has precedence.
12
13 Keymap: 32 Layers Layer: action code matrix
14 ----------------- ---------------------
15 stack of layers array_of_action_code[row][column]
16 ____________ precedence _______________________
17 / / | high / ESC / F1 / F2 / F3 ....
18 31 /___________// | /-----/-----/-----/-----
19 30 /___________// | / TAB / Q / W / E ....
20 29 /___________/ | /-----/-----/-----/-----
21 : _:_:_:_:_:__ | : /LCtrl/ A / S / D ....
22 : / : : : : : / | : / : : : :
23 2 /___________// | 2 `--------------------------
24 1 /___________// | 1 `--------------------------
25 0 /___________/ V low 0 `--------------------------
26
27
28Sometimes, the action code stored in keymap may be referred as keycode in some documents due to the TMK history.
29
30### Keymap layer status
31Keymap layer has its state in two 32 bit parameters:
32
33* **`default_layer_state`** indicates a base keymap layer(0-31) which is always valid and to be referred.
34* **`layer_state`** () has current on/off status of the layer on its each bit.
35
36Keymap has its state in two parameter **`default_layer`** indicates a base keymap layer(0-31) which is always valid and to be referred, **`keymap_stat`** is 16bit variable which has current on/off status of layers on its each bit.
37Keymap layer '0' is usually `default_layer` and which is the only valid layer and other layers is initially off after boot up firmware, though, you can configured them in `config.h`.
38To change `default_layer` will be useful when you switch key layout completely, say you want Colmak instead of Qwerty.
39
40 Initial state of Keymap Change base layout
41 ----------------------- ------------------
42
43 31 31
44 30 30
45 29 29
46 : :
47 : : ____________
48 2 ____________ 2 / /
49 1 / / ,->1 /___________/
50 ,->0 /___________/ | 0
51 | |
52 `--- default_layer = 0 `--- default_layer = 1
53 layer_state = 0x00000001 layer_state = 0x00000002
54
55On the other hand, you shall change `layer_state` to overlay base layer with some layers for feature such as navigation keys, function key(F1-F12), media keys or special actions.
56
57 Overlay feature layer
58 --------------------- bit|status
59 ____________ ---+------
60 31 / / 31 | 0
61 30 /___________// -----> 30 | 1
62 29 /___________/ -----> 29 | 1
63 : : | :
64 : ____________ : | :
65 2 / / 2 | 0
66 ,->1 /___________/ -----> 1 | 1
67 | 0 0 | 0
68 | +
69 `--- default_layer = 1 |
70 layer_state = 0x60000002 <-'
71
72
73
74### Layer Precedence and Transparency
75Note that ***higher layer has higher priority on stack of layers***, namely firmware falls down from top layer to bottom to look up keycode. Once it spots keycode other than **`KC_TRNS`**(transparent) on a layer it stops searching and lower layers aren't referred.
76
77You can place `KC_TRANS` on overlay layer changes just part of layout to fall back on lower or base layer.
78Key with `KC_TRANS` (`KC_TRNS` and `_______` are the alias) doesn't has its own keycode and refers to lower valid layers for keycode, instead.
79
80## Anatomy Of A `keymap.c`
81
82For this example we will walk through the [default Clueboard keymap](https://github.com/qmk/qmk_firmware/blob/master/keyboards/clueboard/keymaps/default/keymap.c). You'll find it helpful to open that file in another browser window so you can look at everything in context.
83
84There are 3 main sections of a `keymap.c` file you'll want to concern yourself with:
85
86* [The Definitions](#definitions)
87* [The Layer/Keymap Datastructure](#layers-and-keymaps)
88* [Custom Functions](#custom-functions), if any
89
90### Definitions
91
92At the top of the file you'll find this:
93
94 #include "clueboard.h"
95
96 // Helpful defines
97 #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))
98 #define _______ KC_TRNS
99
100 // Each layer gets a name for readability.
101 // The underscores don't mean anything - you can
102 // have a layer called STUFF or any other name.
103 // Layer names don't all need to be of the same
104 // length, and you can also skip them entirely
105 // and just use numbers.
106 #define _BL 0
107 #define _FL 1
108 #define _CL 2
109
110These 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.
111
112### Layers and Keymaps
113
114The main part of this file is the `keymaps[]` definition. This is where you list your layers and the contents of those layers. This part of the file begins with this definition:
115
116 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
117
118After this you'll find a list of KEYMAP() macros. A KEYMAP() is simply a list of keys to define a single layer. Typically you'll have one or more "base layers" (such as QWERTY, Dvorak, or Colemak) and then you'll layer on top of that one or more "function" layers. Due to the way layers are processed you can't overlay a "lower" layer on top of a "higher" layer.
119
120`keymaps[][MATRIX_ROWS][MATRIX_COLS]` in QMK holds the 16 bit action code (sometimes referred as the quantum keycode) in it. For the keycode representing typical keys, its high byte is 0 and its low byte is the USB HID usage ID for keyboard.
121
122> TMK from which QMK was forked uses `const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS]` instead and holds the 8 bit keycode. Some keycode values are reserved to induce execution of certain action codes via the `fn_actions[]` array.
123
124#### Base Layer
125
126Here is an example of the Clueboard's base layer:
127
128 /* Keymap _BL: Base Layer (Default Layer)
129 */
130 [_BL] = KEYMAP(
131 F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_GRV, KC_BSPC, KC_PGUP, \
132 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, \
133 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, \
134 KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_RSFT, KC_UP, \
135 KC_LCTL, KC_LGUI, KC_LALT, KC_MHEN, KC_SPC,KC_SPC, KC_HENK, KC_RALT, KC_RCTL, MO(_FL), KC_LEFT, KC_DOWN, KC_RGHT),
136
137Some interesting things to note about this:
138
139* From a C source point of view it's only a single array, but we have embedded whitespace to more easily visualize where each key is on the physical device.
140* Plain keyboard scancodes are prefixed with KC_, while "special" keys are not.
141* The upper left key activates custom function 0 (`F(0)`)
142* The "Fn" key is defined with `MO(_FL)`, which moves to the `_FL` layer while that key is being held down.
143
144#### Function Overlay Layer
145
146Our function layer is, from a code point of view, no different from the base layer. Conceptually, however, you will build that layer as an overlay, not a replacement. For many people this distinction does not matter, but as you build more complicated layering setups it matters more and more.
147
148 [_FL] = KEYMAP(
149 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_DEL, BL_STEP, \
150 _______, _______, _______,_______,_______,_______,_______,_______,KC_PSCR,KC_SLCK, KC_PAUS, _______, _______, _______, _______, \
151 _______, _______, MO(_CL),_______,_______,_______,_______,_______,_______,_______, _______, _______, _______, _______, \
152 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______, _______, _______, _______, _______, KC_PGUP, \
153 _______, _______, _______, _______, _______,_______, _______, _______, _______, MO(_FL), KC_HOME, KC_PGDN, KC_END),
154
155Some interesting things to note:
156
157* We have used our `_______` definition to turn `KC_TRNS` into `_______`. This makes it easier to spot the keys that have changed on this layer.
158* While in this layer if you press one of the `_______` keys it will activate the key in the next lowest active layer.
159
160### Custom Functions
161
162At the bottom of the file we've defined a single custom function. This function defines a key that sends `KC_ESC` when pressed without modifiers and `KC_GRAVE` when modifiers are held. There are a couple pieces that need to be in place for this to work, and we will go over both of them.
163
164#### `fn_actions[]`
165
166We define the `fn_actions[]` array to point to custom functions. `F(N)` in a keymap will call element N of that array. For the Clueboard's that looks like this:
167
168 const uint16_t PROGMEM fn_actions[] = {
169 [0] = ACTION_FUNCTION(0), // Calls action_function()
170 };
171
172In this case we've instructed QMK to call the `ACTION_FUNCTION` callback, which we will define in the next section.
173
174> This `fn_actions[]` interface is mostly for backward compatibility. In QMK, you don't need to use `fn_actions[]`. You can directly use `ACTION_FUNCTION(N)` or any other action code value itself normally generated by the macro in `keymaps[][MATRIX_ROWS][MATRIX_COLS]`. N in `F(N)` can only be 0 to 31. Use of the action code directly in `keymaps` unlocks this limitation.
175
176#### `action_function()`
177
178To actually handle the keypress event we define an `action_function()`. This function will be called when the key is pressed, and then again when the key is released. We have to handle both situations within our code, as well as determining whether to send/release `KC_ESC` or `KC_GRAVE`.
179
180 void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
181 static uint8_t mods_pressed;
182
183 switch (id) {
184 case 0:
185 /* Handle the combined Grave/Esc key
186 */
187 mods_pressed = get_mods()&GRAVE_MODS; // Check to see what mods are pressed
188
189 if (record->event.pressed) {
190 /* The key is being pressed.
191 */
192 if (mods_pressed) {
193 add_key(KC_GRV);
194 send_keyboard_report();
195 } else {
196 add_key(KC_ESC);
197 send_keyboard_report();
198 }
199 } else {
200 /* The key is being released.
201 */
202 if (mods_pressed) {
203 del_key(KC_GRV);
204 send_keyboard_report();
205 } else {
206 del_key(KC_ESC);
207 send_keyboard_report();
208 }
209 }
210 break;
211 }
212 }
213
214# Nitty Gritty Details
215
216This should have given you a basic overview for creating your own keymap. For more details see the following resources:
217
218* https://github.com/qmk/qmk_firmware/wiki/Keycodes
219* https://github.com/qmk/qmk_firmware/wiki/FAQ-Keymap
220* https://github.com/qmk/qmk_firmware/wiki/Keymap-examples
221
222We are actively working to improve these docs. If you have suggestions for how they could be made better please [file an issue](https://github.com/qmk/qmk_firmware/issues/new)! \ No newline at end of file
diff --git a/docs/Keymap-examples.md b/docs/keymap_examples.md
index 094011931..094011931 100644
--- a/docs/Keymap-examples.md
+++ b/docs/keymap_examples.md
diff --git a/docs/kiibohd.asciidoc b/docs/kiibohd.asciidoc
new file mode 100644
index 000000000..4a7ee64d8
--- /dev/null
+++ b/docs/kiibohd.asciidoc
@@ -0,0 +1,29 @@
1== KLL vs TMK
21. **Shift** = Memontary
31. Latch = One shot
41. Lock = Toggle
5
6## KLL terminology
7### Fall-through
8When a key is undefined on a particular layer, the key
9definition on the previously stacked layer will be used. Eventually
10the key definition will be set to using the default layer. If the None
11keyword is used, then the fall-through will stop and no action will
12take place.
13###Latch
14When referring to keyboards, a key function that is only enabled
15until the release of the next keypress.
16###Lock
17When referring to keyboards, a key function that is enabled until
18that key is pressed again (e.g. Caps Lock).
19### NKRO
20N-Key Rollover is the capability to press N number of keys at the
21same time on a keyboard and have them all register on the OS simultaneously.
22### Scan Code
23Row x Column code or native protocol code used by the keyboard.
24### Shift
25When referring to keyboards, a key function that is enabled while
26that key is held.
27### USB Code
28Keyboard Press/Release codes as defined by the USB HID
29Spec. \ No newline at end of file
diff --git a/docs/Leader-Key.md b/docs/leader_key.md
index bf4d5456d..bf4d5456d 100644
--- a/docs/Leader-Key.md
+++ b/docs/leader_key.md
diff --git a/docs/License-Clarification.md b/docs/license_clarification.md
index cf30619b9..cf30619b9 100644
--- a/docs/License-Clarification.md
+++ b/docs/license_clarification.md
diff --git a/docs/License-Clarification-Details.md b/docs/license_clarification_details.md
index 77ee688bb..77ee688bb 100644
--- a/docs/License-Clarification-Details.md
+++ b/docs/license_clarification_details.md
diff --git a/docs/macros.md b/docs/macros.md
new file mode 100644
index 000000000..1418d24ab
--- /dev/null
+++ b/docs/macros.md
@@ -0,0 +1,158 @@
1# Macros - Send multiple keystrokes when pressing just one key
2
3QMK has a number of ways to define and use macros. These can do anything you want- type common phrases for you, copypasta, repetitive game movements, or even help you code.
4
5**Security Note**: While it is possible to use macros to send passwords, credit card numbers, and other sensitive information it is a supremely bad idea to do so. Anyone who gets ahold of your keyboard will be able to access that information by opening a text editor.
6
7# Macro Definitions
8
9By default QMK assumes you don't have any macros. To define your macros you create an `action_get_macro()` function. For example:
10
11```c
12const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
13 if (record->event.pressed) {
14 switch(id) {
15 case 0:
16 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END);
17 case 1:
18 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END);
19 }
20 }
21 return MACRO_NONE;
22};
23```
24
25This defines two macros which will be run when the key they are assigned to is pressed. If you'd like them to run when the release is released instead you can change the if statement:
26
27```c
28 if (!record->event.pressed) {
29```
30
31## Macro Commands
32
33A macro can include the following commands:
34
35* I() change interval of stroke in milliseconds.
36* D() press key.
37* U() release key.
38* T() type key(press and release).
39* W() wait (milliseconds).
40* END end mark.
41
42## Sending strings
43
44Sometimes you just want a key to type out words or phrases. For the most common situations we've provided `SEND_STRING()`, which will type out your string for you instead of having to build a `MACRO()`. Right now it assumes a US keymap with a QWERTY layout, so if you are using something else it may not behave as you expect.
45
46For example:
47
48```c
49const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
50 if (record->event.pressed) {
51 switch(id) {
52 case 0:
53 SEND_STRING("QMK is the best thing ever!");
54 return false;
55 }
56 }
57 return MACRO_NONE;
58};
59```
60
61## Mapping a Macro to a key
62
63Use the `M()` function within your `KEYMAP()` to call a macro. For example, here is the keymap for a 2-key keyboard:
64
65```c
66const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
67 [0] = KEYMAP(
68 M(0), M(1)
69 ),
70};
71
72const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
73 if (record->event.pressed) {
74 switch(id) {
75 case 0:
76 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END);
77 case 1:
78 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END);
79 }
80 }
81 return MACRO_NONE;
82};
83```
84
85When you press the key on the left it will type "Hi!" and when you press the key on the right it will type "Bye!".
86
87## Naming your macros
88
89If you have a bunch of macros you want to refer to from your keymap while keeping the keymap easily readable you can name them using `#define` at the top of your file.
90
91```c
92#define M_HI M(0)
93#define M_BYE M(1)
94
95const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
96 [0] = KEYMAP(
97 M_HI, M_BYE
98 ),
99};
100```
101
102# Advanced macro functions
103
104While working within the `action_get_macro()` function block there are some functions you may find useful. Keep in mind that while you can write some fairly advanced code within a macro if your functionality gets too complex you may want to define a custom keycode instead. Macros are meant to be simple.
105
106#### `record->event.pressed`
107
108This is a boolean value that can be tested to see if the switch is being pressed or released. An example of this is
109
110```c
111 if (record->event.pressed) {
112 // on keydown
113 } else {
114 // on keyup
115 }
116```
117
118#### `register_code(<kc>);`
119
120This sends the `<kc>` keydown event to the computer. Some examples would be `KC_ESC`, `KC_C`, `KC_4`, and even modifiers such as `KC_LSFT` and `KC_LGUI`.
121
122#### `unregister_code(<kc>);`
123
124Parallel 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.
125
126#### `clear_keyboard();`
127
128This will clear all mods and keys currently pressed.
129
130#### `clear_mods();`
131
132This will clear all mods currently pressed.
133
134#### `clear_keyboard_but_mods();`
135
136This will clear all keys besides the mods currently pressed.
137
138# Advanced Example: Single-key copy/paste (hold to copy, tap to paste)
139
140This example defines a macro which sends `Ctrl-C` when pressed down, and `Ctrl-V` when released.
141
142```c
143const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
144 switch(id) {
145 case 0: {
146 if (record->event.pressed) {
147 return MACRO( D(LCTL), T(C), U(LCTL), END );
148 } else {
149 return MACRO( D(LCTL), T(V), U(LCTL), END );
150 }
151 break;
152 }
153 }
154 return MACRO_NONE;
155};
156```
157
158
diff --git a/docs/Make-Instructions.md b/docs/make_instructions.md
index 825632035..6f88f9106 100644
--- a/docs/Make-Instructions.md
+++ b/docs/make_instructions.md
@@ -164,4 +164,4 @@ If your keymap directory has a file called `Makefile` (note the filename), any M
164 164
165So let's say your keyboard's makefile has `BACKLIGHT_ENABLE = yes` (or maybe doesn't even list the `BACKLIGHT_ENABLE` option, which would cause it to be off). You want your particular keymap to not have the debug console, so you make a file called `Makefile` and specify `BACKLIGHT_ENABLE = no`. 165So let's say your keyboard's makefile has `BACKLIGHT_ENABLE = yes` (or maybe doesn't even list the `BACKLIGHT_ENABLE` option, which would cause it to be off). You want your particular keymap to not have the debug console, so you make a file called `Makefile` and specify `BACKLIGHT_ENABLE = no`.
166 166
167You can use the `doc/keymap_makefile_example.md` as a template/starting point. 167You can use the `docs/keymap_makefile_example.md` as a template/starting point.
diff --git a/docs/mbed-cortex-porting.md b/docs/mbed_cortex_porting.md
index b4b1314e6..b4b1314e6 100644
--- a/docs/mbed-cortex-porting.md
+++ b/docs/mbed_cortex_porting.md
diff --git a/docs/Memory-write-error,-use-debug-for-more-info.md b/docs/memory_write_error,_use_debug_for_more_info.md
index adef2601f..adef2601f 100644
--- a/docs/Memory-write-error,-use-debug-for-more-info.md
+++ b/docs/memory_write_error,_use_debug_for_more_info.md
diff --git a/docs/Modding-your-keyboard.md b/docs/modding_your_keyboard.md
index 2429570f5..2429570f5 100644
--- a/docs/Modding-your-keyboard.md
+++ b/docs/modding_your_keyboard.md
diff --git a/docs/Mouse-keys.md b/docs/mouse_keys.md
index 16e920fdb..16e920fdb 100644
--- a/docs/Mouse-keys.md
+++ b/docs/mouse_keys.md