Browse Source

convert docs to lowercase and underscores

pjones-keymap
Jack Humbert 2 years ago
parent
commit
ca01d94005
60 changed files with 2012 additions and 779 deletions
  1. 2
    1
      book.json
  2. 1
    1
      docs/BUILD_GUIDE.md
  3. 1
    1
      docs/Eclipse.md
  4. 1
    1
      docs/HAND_WIRE.md
  5. 9
    9
      docs/Home.md
  6. 1
    1
      docs/Keycodes.md
  7. 0
    62
      docs/Other-Projects.md
  8. 1
    1
      docs/PCB_GUIDE.md
  9. 0
    70
      docs/Porting-Your-Keyboard-to-QMK-(ARM-and-other-ChibiOS-CPUs).md
  10. 0
    59
      docs/Porting-your-keyboard-to-QMK.md
  11. 0
    14
      docs/Previously-Asked-Questions.asciidoc
  12. 0
    75
      docs/QMK-Overview.md
  13. 0
    1
      docs/Report-Descriptor.md
  14. 0
    28
      docs/SUMMARY.md
  15. 0
    24
      docs/Space-Cadet-Shift.md
  16. 0
    34
      docs/TMK-Based-Projects.md
  17. 0
    69
      docs/TMK-Own-Projects.md
  18. 4
    4
      docs/TMK_README.md
  19. 0
    144
      docs/Tap-Dance.md
  20. 0
    17
      docs/Test-for-ASCIIDOC.asciidoc
  21. 0
    11
      docs/USB-HID.md
  22. 0
    54
      docs/Unicode-and-additional-language-support.md
  23. 0
    68
      docs/Unit-testing.md
  24. 2
    2
      docs/VAGRANT_GUIDE.md
  25. 0
    21
      docs/_Sidebar.md
  26. 0
    0
      docs/adding_features_to_qmk.md
  27. 0
    0
      docs/becoming_a_qmk_collaborator.md
  28. 1
    1
      docs/build_environment_setup.md
  29. 103
    0
      docs/build_guide.md
  30. 1
    1
      docs/build_old.md
  31. 0
    0
      docs/compatible_microcontrollers.md
  32. 0
    0
      docs/custom_quantum_functions.md
  33. 352
    0
      docs/cygwin_guide.md
  34. 0
    0
      docs/differences_from_tmk.md
  35. 0
    0
      docs/dynamic_macros.md
  36. 84
    0
      docs/eclipse.md
  37. 64
    0
      docs/embedding.md
  38. 238
    0
      docs/faq.md
  39. 1
    1
      docs/faq_build.md
  40. 0
    0
      docs/faq_keymap.md
  41. 50
    0
      docs/fuse.txt
  42. 0
    0
      docs/git_subtree.md
  43. 321
    0
      docs/hand_wire.md
  44. 0
    0
      docs/hhkb_alt_controller.md
  45. 134
    0
      docs/home.md
  46. 1
    1
      docs/key_functions.md
  47. 228
    0
      docs/keycodes.md
  48. 222
    0
      docs/keymap.md
  49. 0
    0
      docs/keymap_examples.md
  50. 29
    0
      docs/kiibohd.asciidoc
  51. 0
    0
      docs/leader_key.md
  52. 0
    0
      docs/license_clarification.md
  53. 0
    0
      docs/license_clarification_details.md
  54. 158
    0
      docs/macros.md
  55. 1
    1
      docs/make_instructions.md
  56. 0
    0
      docs/mbed_cortex_porting.md
  57. 0
    0
      docs/memory_write_error,_use_debug_for_more_info.md
  58. 0
    0
      docs/modding_your_keyboard.md
  59. 0
    0
      docs/mouse_keys.md
  60. 2
    2
      keyboards/kc60/keymaps/stanleylai/readme.md

+ 2
- 1
book.json View File

@@ -1,6 +1,7 @@
{
"structure": {
"readme": "Home.md"
"readme": "home.md",
"summary": "_summary.md"
},
"plugins" : ["toolbar", "edit-link", "anchors"],
"pluginsConfig": {

+ 1
- 1
docs/BUILD_GUIDE.md View File

@@ -35,7 +35,7 @@ Debian/Ubuntu example:
sudo apt-get install gcc-avr avr-libc dfu-programmer

### Vagrant
If 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).
If 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).

## Verify Your Installation
1. 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.

+ 1
- 1
docs/Eclipse.md View File

@@ -15,7 +15,7 @@ Note that this set-up has been tested on Ubuntu 16.04 only for the moment.

# Prerequisites
## Build environment
Before 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).
Before 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).

## Java
Eclipse 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.

+ 1
- 1
docs/HAND_WIRE.md View File

@@ -282,7 +282,7 @@ It's also important to use the `KEYMAP` function we defined earlier - this is wh

#### Compiling your firmware

After 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.
After 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.

Once 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.


+ 9
- 9
docs/Home.md View File

@@ -1,31 +1,31 @@
# Quantum Mechanical Keyboard Firmware

You 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.
You 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.

# Getting started

Before 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!

* [Build Environment Setup](/Build-Environment-Setup.md)
* [QMK Overview](/QMK-Overview.md)
* [Build Environment Setup](build_environment_setup.md)
* [QMK Overview](qmk_overview.md)

# Configuring QMK Firmware

The 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.
The 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.

For more details of the `keymaps` array, see [Keymap Overview](/Keymap.md) page.
For more details of the `keymaps` array, see [Keymap Overview](keymap.md) page.

## Space Cadet Shift: The future, built in

Steve 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.
Steve 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.

## The Leader key: A new kind of modifier

Most 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.
Most 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.

## Tap Dance: A single key can do 3, 5, or 100 different things

Hit 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.
Hit 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.

## Temporarily setting the default layer

@@ -33,7 +33,7 @@ Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a co

## Macro shortcuts: Send a whole string when pressing just one key

How 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.
How 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.

## Additional keycode aliases for software-implemented layouts \(Colemak, Dvorak, etc\)


+ 1
- 1
docs/Keycodes.md View File

@@ -1,6 +1,6 @@
# Overview

When defining a [keymap](Keymap.md) each key needs a valid key definition.
When defining a [keymap](keymap.md) each key needs a valid key definition.

This page documents the symbols that correspond to keycodes that are available to you in QMK.


+ 0
- 62
docs/Other-Projects.md View File

@@ -1,62 +0,0 @@
Keyboard Firmware Projects other than TMK
================================
## PJRC USB Keyboard/Mouse Example[USB][PJRC][Teensy][AVR]
- <http://www.pjrc.com/teensy/usb_keyboard.html>
- <http://www.pjrc.com/teensy/usb_mouse.html>
## kbupgrade[USB][V-USB][AVR]
- <http://github.com/rhomann/kbupgrade>
- <http://geekhack.org/showwiki.php?title=Island:8406>
## c64key[USB][V-USB][AVR]
- <http://symlink.dk/projects/c64key/>
## rump[USB][V-USB][AVR]
- <http://mg8.org/rump/>
- <http://github.com/clee/rump>
## dulcimer[USB][V-USB][AVR]
- <http://www.schatenseite.de/dulcimer.html>
## humblehacker-keyboard[USB][LUFA][AVR][Ergo]
- <http://github.com/humblehacker>
- <http://www.humblehacker.com/keyboard/>
- <http://geekhack.org/showwiki.php?title=Island:6292>
## ps2avr[PS/2][AVR]
- <http://sourceforge.net/projects/ps2avr/>
## ErgoDox[Ergo][Split][USB][AVR]
- <http://geekhack.org/index.php?topic=22780.0>
- <https://github.com/benblazak/ergodox-firmware>
- <https://github.com/cub-uanic/tmk_keyboard>
## Suka's keyboard collection[Ergo][Split][3DPrinting][USB][AVR]
- <http://deskthority.net/workshop-f7/my-diy-keyboard-collection-or-how-i-became-a-kb-geek-t2534.html>
- <https://github.com/frobiac/adnw>
## bpiphany's AVR-Keyboard[PJRC][AVR][USB]
- <https://github.com/BathroomEpiphanies/AVR-Keyboard>
- <http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions>
- <http://deskthority.net/wiki/Phantom>
## USB-USB keyboard remapper[converter][USB-USB][AVR][Arduino]
- <http://forum.colemak.com/viewtopic.php?pid=10837>
- <https://github.com/darkytoothpaste/keymapper>
## USB-USB converter threads[converter][USB-USB]
- <http://deskthority.net/workshop-f7/is-remapping-a-usb-keyboard-using-teensy-possible-t2841-30.html>
- <http://geekhack.org/index.php?topic=19458.0>
## kbdbabel.org[converter][vintage][protocol][8051]
Great resource of vintage keyboard protocol information and code

- <http://www.kbdbabel.org/>
## Haata's kiibohd Controller[converter][vintage][protocol][AVR][PJRC][Cortex]
A lots of vintage keyboard protocol supports
- <https://github.com/kiibohd/controller>
## Kinesis ergonomic keyboard firmware replacement[V-USB][LUFA][Ergo]
- <https://github.com/chrisandreae/kinesis-firmware>

+ 1
- 1
docs/PCB_GUIDE.md View File

@@ -119,7 +119,7 @@ A number of other keycodes have been added that you may find useful:

The 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.

The 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).
The 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).

### Macros


+ 0
- 70
docs/Porting-Your-Keyboard-to-QMK-(ARM-and-other-ChibiOS-CPUs).md View File

@@ -1,70 +0,0 @@
Setting 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:

```
$ util/new_project.sh simontester
######################################################
# /keyboards/simontester project created. To start
# working on things, cd into keyboards/simontester
######################################################
```



# END OF NEW ARM DOC, OLD ATMEL DOC FOLLOWS

## `/keyboards/<keyboard>/config.h`

The `USB Device descriptor parameter` block contains parameters are used to uniquely identify your keyboard, but they don't really matter to the machine.

Your `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.

The `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.

For 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.

`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.

`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.

`BACKLIGHT_LEVELS` is how many levels exist for your backlight - max is 15, and they are computed automatically from this number.

## `/keyboards/<keyboard>/Makefile`

The 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`.

```
# Boot Section Size in *bytes*
# Teensy halfKay 512
# Teensy++ halfKay 1024
# Atmel DFU loader 4096
# LUFA bootloader 4096
# USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=512
```

At 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).

## `/keyboards/<keyboard>/readme.md`

This 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>/.

## `/keyboards/<keyboard>/<keyboard>.c`

This 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)

## `/keyboards/<keyboard>/<keyboard>.h`

Here 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:

```
#define KEYMAP( \
k00, k01, k02, \
k10, k11 \
) \
{ \
{ k00, k01, k02 }, \
{ k10, KC_NO, k11 }, \
}
```

Each 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.

+ 0
- 59
docs/Porting-your-keyboard-to-QMK.md View File

@@ -1,59 +0,0 @@
If 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.

## `/keyboards/<keyboard>/config.h`

The `USB Device descriptor parameter` block contains parameters are used to uniquely identify your keyboard, but they don't really matter to the machine.

Your `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.

The `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.

For 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.

`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.

`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.

`BACKLIGHT_LEVELS` is how many levels exist for your backlight - max is 15, and they are computed automatically from this number.

## `/keyboards/<keyboard>/Makefile`

The 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`.

```
# Boot Section Size in *bytes*
# Teensy halfKay 512
# Teensy++ halfKay 1024
# Atmel DFU loader 4096
# LUFA bootloader 4096
# USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=512
```

At 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).

## `/keyboards/<keyboard>/readme.md`

This 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>/.

## `/keyboards/<keyboard>/<keyboard>.c`

This 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)

## `/keyboards/<keyboard>/<keyboard>.h`

Here 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:

```
#define KEYMAP( \
k00, k01, k02, \
k10, k11 \
) \
{ \
{ k00, k01, k02 }, \
{ k10, KC_NO, k11 }, \
}
```

Each 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.


+ 0
- 14
docs/Previously-Asked-Questions.asciidoc View File

@@ -1,14 +0,0 @@
= Previously Asked Questions
:toc:
:toc-placement: preamble

toc::[]

= Question thread
http://deskthority.net/workshop-f7/how-to-build-your-very-own-keyboard-firmware-t7177-270.html

= Questions
== Columns beyond 16(uint16_t) cannot be read
* https://github.com/tmk/tmk_keyboard/wiki/FAQ#cant-read-comlumn-of-matrix-beyond-16
* http://deskthority.net/workshop-f7/how-to-build-your-very-own-keyboard-firmware-t7177-270.html#p247051
* http://deskthority.net/workshop-f7/rebuilding-and-redesigning-a-classic-thinkpad-keyboard-t6181-60.html#p146279

+ 0
- 75
docs/QMK-Overview.md View File

@@ -1,75 +0,0 @@
# QMK Overview

This 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.

# Basic QMK structure

QMK 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.

## Keyboard project structure

Within 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:

* `keymaps/`: Different keymaps that can be built
* `rules.mk`: The file that sets the default "make" options. Do not edit this file directly, instead use a keymap specific `Makefile`.
* `config.h`: The file that sets the default compile time options. Do not edit this file directly, instead use a keymap specific `config.h`.

### Keymap structure

In 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.

* `config.h`: the options to configure your keymap
* `keymap.c`: all of your keymap code, required
* `Makefile`: the features of QMK that are enabled, required to run `make` in your keymap folder
* `readme.md`: a description of your keymap, how others might use it, and explanations of features
* 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.

# The `make` command

The `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.

**NOTE:** To abort a make command press `Ctrl-c`

For more details on the QMK build process see [Make Instructions](/Make-Instructions.md).

### Simple instructions for building and uploading a keyboard

**Most keyboards have more specific instructions in the keyboard specific readme.md file, so please check that first**

1. Enter the `root` folder
2. Run `make <keyboard>-<subproject>-<keymap>-<programmer>`

In the above commands, replace:

* `<keyboard>` with the name of your keyboard
* `<keymap>` with the name of your keymap
* `<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`.
* 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.
* `<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.
* 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.

**NOTE:** Some operating systems will refuse to program unless you run the make command as root for example `sudo make clueboard-default-dfu`

## Make Examples

* Build all Clueboard keymaps: `make clueboard`
* Build the default Planck keymap: `make planck-rev4-default`
* Build and flash your ergodox-ez: `make ergodox-ez-default-teensy`

# The `config.h` file

There are 2 `config.h` locations:

* keyboard (`/keyboards/<keyboard>/`)
* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/`)

The 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:

```c
#undef MY_SETTING
#define MY_SETTING 4
```

For a value of `4` for this imaginary setting. So we `undef` it first, then `define` it.

You can then override any settings, rather than having to copy and paste the whole thing.

+ 0
- 1
docs/Report-Descriptor.md View File

@@ -1 +0,0 @@
# Get Report Descriptor with lsusb

+ 0
- 28
docs/SUMMARY.md View File

@@ -1,28 +0,0 @@

### Getting started
* [Introduction](Home.md)
* [QMK Overview](QMK-Overview.md)
* [Build Environment Setup](Build-Environment-Setup.md)

### Making a keymap
* [Keymap overview](Keymap.md)
* [Custom Quantum Functions](Custom-Quantum-Functions.md)
* [Keycodes](Keycodes.md)
* [Layer switching](Key-Functions.md)
* [Leader Key](Leader-Key.md)
* [Macros](Macros.md)
* [Dynamic Macros](Dynamic-Macros.md)
* [Space Cadet](Space-Cadet-Shift.md)
* [Tap Dance](Tap-Dance.md)
* [Mouse keys](Mouse-keys.md)
* [FAQ: Creating a Keymap](FAQ-Keymap.md)
* [FAQ: Compiling QMK](FAQ-Build.md)
### For hardware makers and modders
* [Modding your keyboard](Modding-your-keyboard.md)
* [Porting your keyboard to QMK](Porting-your-keyboard-to-QMK.md)
* [Adding features to QMK](Adding-features-to-QMK.md)
### Other topics
* [General FAQ](FAQ.md)
* [Differences from TMK](Differences-from-TMK.md)

+ 0
- 24
docs/Space-Cadet-Shift.md View File

@@ -1,24 +0,0 @@
## Space Cadet Shift: The future, built in

Steve 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.

To 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.

It'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:

#define LSPO_KEY KC_9
#define RSPC_KEY KC_0

You can also choose between different rollover behaviors of the shift keys by defining:

#define DISABLE_SPACE_CADET_ROLLOVER

in 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.

The only other thing you're going to want to do is create a `Makefile` in your keymap directory and set the following:

```
COMMAND_ENABLE = no # Commands for debug and configuration
```

This is just to keep the keyboard from going into command mode when you hold both Shift keys at the same time.

+ 0
- 34
docs/TMK-Based-Projects.md View File

@@ -1,34 +0,0 @@
## TMK based projects
Add your project here!
See https://github.com/tmk/tmk_keyboard/issues/173

### keyboards
**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:
- https://github.com/VinnyCordeiro/tmk_keyboard

**Octagon V1**: Korean custom keyboard designed by Duck.
- https://github.com/xauser/tmk_keyboard/tree/xauser

**Compact L3**: Custom keyboard designed by LifeZone and LeeKu.
- https://github.com/xauser/tmk_keyboard/tree/xauser

**KMAC, 1,2 and Happy**: Custom keyboard designed by kbdmania.
- https://github.com/ageaenes/tmk_keyboard

**P60**: [DIY wired 60% keyboard](https://imgur.com/a/zwsDN) by [p3lim](https://github.com/p3lim).
- https://github.com/p3lim/keyboard_firmware

**Nerd, Kitten Paw, Lightsaber, Phantom, Lightpad, Ergodox** on [xauser](https://github.com/xauser)'s repository
- https://github.com/xauser/tmk_keyboard/tree/xauser

**ErgoDox** on [cub-unanic](https://github.com/cub-uanic)'s repository
- https://github.com/cub-uanic/tmk_keyboard/tree/master/keyboard/ergodox

**Atreus** by [technomancy](https://atreus.technomancy.us)
- https://github.com/technomancy/tmk_keyboard/tree/atreus/keyboard/atreus

**[mcdox](https://github.com/DavidMcEwan/mcdox)**
- https://github.com/DavidMcEwan/tmk_keyboard/tree/master/keyboard/mcdox


### converters

+ 0
- 69
docs/TMK-Own-Projects.md View File

@@ -1,69 +0,0 @@
## TMK own projects by hasu
Located in [tmk_keyboard](https://github.com/tmk/tmk_keyboard/tree/master/) repository.

### converter
* [ps2_usb] - [PS/2 keyboard to USB][GH_ps2]
* [adb_usb] - [ADB keyboard to USB][GH_adb]
* [m0110_usb] - [Macintosh 128K/512K/Plus keyboard to USB][GH_m0110]
* [terminal_usb] - [IBM Model M terminal keyboard(PS/2 scancode set3) to USB][GH_terminal]
* [news_usb] - [Sony NEWS keyboard to USB][GH_news]
* [x68k_usb] - [Sharp X68000 keyboard to USB][GH_x68k]
* [sun_usb] - [Sun] to USB(type4, 5 and 3?)
* [pc98_usb] - [PC98] to USB
* [usb_usb] - USB to USB(experimental)
* [ascii_usb] - ASCII(Serial console terminal) to USB
* [ibm4704_usb] - [IBM 4704 keyboard Converter][GH_ibm4704]
### keyboard
* [hhkb] - [Happy Hacking Keyboard pro][GH_hhkb]
* [gh60] - [GH60][GH60_diy] DIY 60% keyboard [prototype][GH60_proto]
* [hbkb] - [Happy Buckling spring keyboard][GH_hbkb](IBM Model M 60% mod)
* [hid_liber] - [HID liberation][HID_liber] controller (by alaricljs)
* [phantom] - [Phantom] keyboard (by Tranquilite)
* [IIgs_Standard] - Apple [IIGS] keyboard mod(by JeffreySung)
* [macway] - [Compact keyboard mod][GH_macway] [retired]
* [KMAC] - Korean custom keyboard
* [Lightsaber] - Korean custom keyboard
[ps2_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/ps2_usb/
[adb_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb/
[m0110_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/m0110_usb
[terminal_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/terminal_usb/
[news_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/news_usb/
[x68k_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/x68k_usb/
[sun_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/sun_usb/
[pc98_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/pc98_usb/
[usb_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/usb_usb/
[ascii_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/ascii_usb/
[ibm4704_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/ibm4704_usb
[hhkb]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/hhkb/
[gh60]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/gh60/
[hbkb]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/hbkb/
[hid_liber]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/hid_liber/
[phantom]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/phantom/
[IIgs_Standard]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/IIgs/
[macway]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/macway/
[KMAC]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/kmac/
[Lightsaber]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/lightsaber/
[GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930
[GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047
[GH_ps2]: http://geekhack.org/showwiki.php?title=Island:14618
[GH_adb]: http://geekhack.org/showwiki.php?title=Island:14290
[GH_hhkb_bt]: http://geekhack.org/showwiki.php?title=Island:20851
[GH_m0110]: http://geekhack.org/showwiki.php?title=Island:24965
[GH_news]: http://geekhack.org/showwiki.php?title=Island:25759
[GH_terminal]: http://geekhack.org/showwiki.php?title=Island:27272
[GH_x68k]: http://geekhack.org/showwiki.php?title=Island:29060
[GH_hbkb]: http://geekhack.org/showwiki.php?title=Island:29483
[GH_ibm4704]: http://geekhack.org/index.php?topic=54706.0
[HID_liber]: http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions
[Phantom]: http://geekhack.org/index.php?topic=26742
[GH60_diy]: http://geekhack.org/index.php?topic=34959
[GH60_proto]: http://geekhack.org/index.php?topic=37570.0
[PC98]: http://en.wikipedia.org/wiki/NEC_PC-9801
[Sun]: http://en.wikipedia.org/wiki/Sun-3
[IIGS]: http://en.wikipedia.org/wiki/Apple_IIGS


See other [[TMK Based Projects]]

+ 4
- 4
docs/TMK_README.md View File

@@ -113,13 +113,13 @@ Third party libraries like LUFA, PJRC and V-USB have their own license respectiv

Build Firmware and Program Controller
-------------------------------------
See [build environment setup](/readme.md#build-environment-setup), or the readme in the particular keyboards/* folder.
See [build environment setup](build_environment_setup.md), or the readme in the particular keyboards/* folder.



Change your keymap
------------------
See [doc/keymap.md](tmk_core/doc/keymap.md).
See [keymap.md](keymap.md).



@@ -159,7 +159,7 @@ Boot Magic Configuration - Virtual DIP Switch
Boot Magic are executed during boot up time. Press Magic key below then plug in keyboard cable.
Note 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.

To 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).
To 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).

#### General
- Skip reading EEPROM to start with default configuration(`ESC`)
@@ -240,4 +240,4 @@ Coding Style

Other Keyboard Firmware Projects
------------------
You can learn a lot about keyboard firmware from these. See [doc/other_projects.md](tmk_core/doc/other_projects.md).
You can learn a lot about keyboard firmware from these. See [docs/other_projects.md](other_projects.md).

+ 0
- 144
docs/Tap-Dance.md View File

@@ -1,144 +0,0 @@
# Tap Dance: A single key can do 3, 5, or 100 different things

Hit 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:

With 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.

To 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.

With `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.

The 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.

But lets start with how to use it, first!

First, 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.

This array specifies what actions shall be taken when a tap-dance key is in action. Currently, there are three possible options:

* `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.
* `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action.
* `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.

The 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.

And that's the bulk of it!

And now, on to the explanation of how it works!

The 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.

This 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.

Our next stop is `matrix_scan_tap_dance()`. This handles the timeout of tap-dance keys.

For 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.

### Examples

Here's a simple example for a single definition:

1. In your `makefile`, add `TAP_DANCE_ENABLE = yes`
2. In your `config.h` (which you can copy from `qmk_firmware/keyboards/planck/config.h` to your keymap directory), add `#define TAPPING_TERM 200`
3. In your `keymap.c` file, define the variables and definitions, then add to your keymap:

```c
//Tap Dance Declarations
enum {
TD_ESC_CAPS = 0
};

//Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
//Tap once for Esc, twice for Caps Lock
[TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS)
// Other declarations would go here, separated by commas, if you have them
};

//In Layer declaration, add tap dance item in place of a key code
TD(TD_ESC_CAPS)
```

Here's a more complex example involving custom actions:

```c
enum {
CT_SE = 0,
CT_CLN,
CT_EGG,
CT_FLSH,
};

/* Have the above three on the keymap, TD(CT_SE), etc... */

void dance_cln_finished (qk_tap_dance_state_t *state, void *user_data) {
if (state->count == 1) {
register_code (KC_RSFT);
register_code (KC_SCLN);
} else {
register_code (KC_SCLN);
}
}

void dance_cln_reset (qk_tap_dance_state_t *state, void *user_data) {
if (state->count == 1) {
unregister_code (KC_RSFT);
unregister_code (KC_SCLN);
} else {
unregister_code (KC_SCLN);
}
}

void dance_egg (qk_tap_dance_state_t *state, void *user_data) {
if (state->count >= 100) {
SEND_STRING ("Safety dance!");
reset_tap_dance (state);
}
}

// on each tap, light up one led, from right to left
// on the forth tap, turn them off from right to left
void dance_flsh_each(qk_tap_dance_state_t *state, void *user_data) {
switch (state->count) {
case 1:
ergodox_right_led_3_on();
break;
case 2:
ergodox_right_led_2_on();
break;
case 3:
ergodox_right_led_1_on();
break;
case 4:
ergodox_right_led_3_off();
_delay_ms(50);
ergodox_right_led_2_off();
_delay_ms(50);
ergodox_right_led_1_off();
}
}

// on the fourth tap, set the keyboard on flash state
void dance_flsh_finished(qk_tap_dance_state_t *state, void *user_data) {
if (state->count >= 4) {
reset_keyboard();
reset_tap_dance(state);
}
}

// if the flash state didnt happen, then turn off leds, left to right
void dance_flsh_reset(qk_tap_dance_state_t *state, void *user_data) {
ergodox_right_led_1_off();
_delay_ms(50);
ergodox_right_led_2_off();
_delay_ms(50);
ergodox_right_led_3_off();
}

qk_tap_dance_action_t tap_dance_actions[] = {
[CT_SE] = ACTION_TAP_DANCE_DOUBLE (KC_SPC, KC_ENT)
,[CT_CLN] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, dance_cln_finished, dance_cln_reset)
,[CT_EGG] = ACTION_TAP_DANCE_FN (dance_egg)
,[CT_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED (dance_flsh_each, dance_flsh_finished, dance_flsh_reset)
};
```

+ 0
- 17
docs/Test-for-ASCIIDOC.asciidoc View File

@@ -1,17 +0,0 @@



.Makefile
[source,Makefile]
----
# Build Options
# comment out to disable the options.
#
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
----

+ 0
- 11
docs/USB-HID.md View File

@@ -1,11 +0,0 @@
# Getting Report Descriptor
```
$ cd /sys/bus/usb/drivers/usbhid
$ ls
1-1.3.4:1.0 1-1.3.4:1.2 bind new_id uevent
1-1.3.4:1.1 1-1.3.4:1.3 module remove_id unbind
$ echo -n 1-1.4\:1.0 | sudo tee unbind
$ sudo lsusb -vvv -d 046d:c01d
$ echo -n 1-1.4\:1.0 | sudo tee bind
```


+ 0
- 54
docs/Unicode-and-additional-language-support.md View File

@@ -1,54 +0,0 @@
## Unicode support

There are three Unicode keymap definition method available in QMK:

### UNICODE_ENABLE

Supports Unicode input up to 0xFFFF. The keycode function is `UC(n)` in
keymap file, where *n* is a 4 digit hexadecimal.

### UNICODEMAP_ENABLE

Supports Unicode up to 0xFFFFFFFF. You need to maintain a separate mapping
table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file.
The keycode function is `X(n)` where *n* is the array index of the mapping
table.

### UCIS_ENABLE

TBD

Unicode input in QMK works by inputing a sequence of characters to the OS,
sort of like macro. Unfortunately, each OS has different ideas on how Unicode is inputted.

This is the current list of Unicode input method in QMK:

* 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.
* 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.
* 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.
* UC_WINC: Windows Unicode input using WinCompose. Requires [WinCompose](https://github.com/samhocevar/wincompose). Works reliably under many (all?) variations of Windows.

## Additional language support

In `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.

## International Characters on Windows

[AutoHotkey](https://autohotkey.com) allows Windows users to create custom hotkeys among others.

The method does not require Unicode support in the keyboard itself but depends instead of AutoHotkey running in the background.

First you need to select a modifier combination that is not in use by any of your programs.
CtrlAltWin is not used very widely and should therefore be perfect for this.
There is a macro defined for a mod-tab combo `LCAG_T`.
Add this mod-tab combo to a key on your keyboard, e.g.: `LCAG_T(KC_TAB)`.
This makes the key behave like a tab key if pressed and released immediately but changes it to the modifier if used with another key.

In the default script of AutoHotkey you can define custom hotkeys.

<^<!<#a::Send, ä
<^<!<#<+a::Send, Ä

The hotkeys above are for the combination CtrlAltGui and CtrlAltGuiShift plus the letter a.
AutoHotkey inserts the Text right of `Send, ` when this combination is pressed.


+ 0
- 68
docs/Unit-testing.md View File

@@ -1,68 +0,0 @@
# Unit Testing

If 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.

Instead I recommend these two books, explaining two different styles of Unit Testing in detail.

* "Test Driven Development: By Example: Kent Beck"
* "Growing Object-Oriented Software, Guided By Tests: Steve Freeman, Nat Pryce"

If 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.

## Google Test and Google Mock
It'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.

## Use of C++

Note 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.

One thing to remember, is that you have to append `extern "C"` around all of your C file includes.

## Adding tests for new or existing features

If 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.

1. If it doesn't already exist, add a test subfolder to the folder containing the feature.
2. Create a `testlist.mk` and a `rules.mk` file in that folder.
3. Include those files from the root folder `testlist.mk`and `build_test.mk` respectively.
4. 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.
5. Define the source files and required options in the `rules.mk` file.
* `_SRC` for source files
* `_DEFS` for additional defines
* `_INC` for additional include folders
6. 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.

Note 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)

## Running the tests

To 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.

## Debugging the tests

If 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.

## Full Integration tests

It'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.

In that model you would emulate the input, and expect a certain output from the emulated keyboard.

# Tracing variables

Sometimes 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.

To 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.

Then 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
```c
void matrix_init_user(void) {
ADD_TRACED_VARIABLE("layer", &layer_state, sizeof(layer_state));
}
```

This 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.

In 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.

Also 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.

+ 2
- 2
docs/VAGRANT_GUIDE.md View File

@@ -13,11 +13,11 @@ Other than having Vagrant and Virtualbox installed and possibly a restart of you

Build Firmware and Program Controller
-------------------------------------
See [/doc/BUIDE_GUIDE.md](/doc/BUILD_GUIDE.md), or the readme in the particular keyboards/* folder.
See [build_guide.md](build_guide.md), or the readme in the particular keyboards/* folder.

Change your keymap
------------------
See [/doc/keymap.md](/doc/keymap.md).
See [keymap.md](keymap.md).

## Flashing the firmware


+ 0
- 21
docs/_Sidebar.md View File

@@ -1,21 +0,0 @@
* [Wiki Home](/qmk/qmk_firmware/wiki)
* Getting started
* [QMK Overview](QMK-Overview)
* [Build Environment Setup](Build-Environment-Setup)
* [Overview for keymap creators](Keymap)
* [Keycodes](Keycodes)
* [Layer switching](Key-Functions)
* [Leader Key](Leader-Key)
* [Macros](Macros)
* [Space Cadet](Space-Cadet-Shift)
* [Tap Dance](Tap-Dance)
* [Mouse keys](Mouse-keys)
* [FAQ: Creating a Keymap](FAQ-Keymap)
* [FAQ: Compiling QMK](FAQ-Build)
* For hardware makers and modders
* [Modding your keyboard](Modding-your-keyboard)
* [Porting your keyboard to QMK](Porting-your-keyboard-to-QMK)
* [Adding features to QMK](Adding-features-to-QMK)
* [General FAQ](FAQ)



docs/Adding-features-to-QMK.md → docs/adding_features_to_qmk.md View File


docs/Becoming-a-QMK-Collaborator.md → docs/becoming_a_qmk_collaborator.md View File


docs/Build-Environment-Setup.md → docs/build_environment_setup.md View File

@@ -110,7 +110,7 @@ docker run -e keymap=default -e subproject=ez -e keyboard=ergobox --rm -v D:/Use
This will compile the targeted keyboard/keymap and leave it in your QMK directory for you to flash.

### Vagrant
If 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).
If 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).

## Verify Your Installation
1. 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.

+ 103
- 0
docs/build_guide.md View File

@@ -0,0 +1,103 @@
# This guide has now been included in the main readme - please reference that one instead.

## Build Environment Setup

### Windows (Vista and later)
1. If you have ever installed WinAVR, uninstall it.
2. 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**.
3. 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.
4. 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.
5. 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.
6. 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!
7. 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".

### Mac
If you're using [homebrew,](http://brew.sh/) you can use the following commands:

brew tap osx-cross/avr
brew install avr-libc
brew install dfu-programmer

This 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.

You can also try these instructions:

1. Install Xcode from the App Store.
2. Install the Command Line Tools from `Xcode->Preferences->Downloads`.
3. Install [DFU-Programmer][dfu-prog].

### Linux
Install AVR GCC, AVR libc, and dfu-progammer with your favorite package manager.

Debian/Ubuntu example:

sudo apt-get update
sudo apt-get install gcc-avr avr-libc dfu-programmer

### Vagrant
If 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).

## Verify Your Installation
1. 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.
2. 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.
3. 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`.
4. 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.

## Customizing, Building, and Deploying Your Firmware

### The Make command

The `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)).

By 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.

* The "root" (`/`) folder is the qmk_firmware folder, in which are `doc`, `keyboard`, `quantum`, etc.
* The "keyboard" folder is any keyboard project's folder, like `/keyboards/planck`.
* The "keymap" folder is any keymap's folder, like `/keyboards/planck/keymaps/default`.

Below is a list of the useful `make` commands in QMK:

* `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
* `make keyboard=<keyboard>` - specifies the keyboard (only to be used in root)
* `make keymap=<keymap>` - specifies the keymap (only to be used in root and keyboard folder - not needed when in keymap folder)
* `make quick` - skips the clean step (cannot be used immediately after modifying config.h or Makefiles)
* `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.
* `keyboard=` and `keymap=` are compatible with this
* `make all-keyboards` - builds all keymaps for all keyboards and outputs status of each (use in root)
* `make all-keyboards-default` - builds all default keymaps for all keyboards and outputs status of each (use in root)
* `make all-keymaps [keyboard=<keyboard>]` - builds all of the keymaps for whatever keyboard folder you're in, or specified by `<keyboard>`
* `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

Other, less useful functionality:

* `make COLOR=false` - turns off color output
* `make SILENT=true` - turns off output besides errors/warnings
* `make VERBOSE=true` - outputs all of the avr-gcc stuff (not interesting)

### The Makefile

There are 3 different `make` and `Makefile` locations:

* root (`/`)
* keyboard (`/keyboards/<keyboard>/`)
* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/`)

The 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.**

### The `config.h` file

There are 2 `config.h` locations:

* keyboard (`/keyboards/<keyboard>/`)
* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/`)

The 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:

```
#undef MY_SETTING
#define MY_SETTING 4
```

For a value of `4` for this imaginary setting. So we `undef` it first, then `define` it.

You can then override any settings, rather than having to copy and paste the whole thing.

+ 1
- 1
docs/build_old.md View File

@@ -1,7 +1,7 @@
Build Firmware and Program Controller
=====================================

## This guide may be out-dated - use doc/BUILD_GUIDE.md instead
## This guide may be out-dated - use [build_guide.md](build_guide.md) instead

Download and Install
--------------------

docs/Compatible-Microcontrollers.md → docs/compatible_microcontrollers.md View File


docs/Custom-Quantum-Functions.md → docs/custom_quantum_functions.md View File


+ 352
- 0
docs/cygwin_guide.md View File

@@ -0,0 +1,352 @@
#Planck Advanced (but not too advanced) `cygwin` Users Guide
If 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.

This 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`.

#####Do not skip steps. Do not move past a step until the previous step finishes successfully.

Based on [avr-libc installation guide](http://www.nongnu.org/avr-libc/user-manual/install_tools.html)

##Get the Required Packages
Download 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:
- devel/git
- devel/gcc-core
- devel/gcc-g++
- devel/flex
- devel/bison
- devel/make
- devel/texinfo
- devel/gettext-devel
- devel/automake
- devel/autoconfig
- devel/libtool
- text/gettext
- libs/libgcc1
- interpreters/m4
- web/wget
- archive/unzip

The following sources will be required:
- [gmp](https://gmplib.org/) (6.1.0)
- [mpfr](http://www.mpfr.org/) (3.1.4)
- [mpc](http://www.multiprecision.org/) (1.0.3)
- [binutils](https://www.sourceware.org/binutils/) (2.26)
- [gcc](https://gcc.gnu.org/) (5.3.0)
- [avr-libc](http://www.nongnu.org/avr-libc/) (2.0.0)

The `dfu-programmer` will be required to flash the new firmware
- [dfu-programmer](https://dfu-programmer.github.io/) (0.7.2)

The 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
```
$ mkdir ~/local
$ mkdir ~/local/avr
$ mkdir ~/src
$ cd ~/src
$ wget https://gmplib.org/download/gmp/gmp-6.1.0.tar.bz2
$ wget http://www.mpfr.org/mpfr-3.1.4/mpfr-3.1.4.tar.bz2
$ wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.26.tar.gz
$ wget http://mirror0.babylon.network/gcc/releases/gcc-5.3.0/gcc-5.3.0.tar.gz
$ wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-2.0.0.tar.bz2
$ tar -xjf gmp-6.1.0.tar.bz2
$ tar -xjf mpfr-3.1.4.tar.bz2
$ tar -zxf mpc-1.0.3.tar.gz
$ tar -zxf binutils-2.26.tar.gz
$ tar -zxf gcc-5.3.0.tar.gz
$ tar -xjf avr-libc-2.0.0.tar.bz2
```

##Setup the Build Environment
These 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.
```
$ PREFIX=$HOME/local/avr
$ export PREFIX
$ PATH=/usr/local/bin:/usr/local/lib:/usr/local/include:/bin:/lib:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS
$ PATH=$PATH:$PREFIX/bin:$PREFIX/lib
$ export PATH
```

##The `gcc` Required Math Library Packages
The 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.

###Build and Install `gmp`
```
$ cd ~/src/gmp-6.1.0
$ ./configure --enable-static --disable-shared
$ make
$ make check
$ make install
```

###Build and Install `mpfr`
```
$ cd ~/src/mpfr-3.1.4
$ ./configure --with-gmp-build=../gmp-6.1.0 --enable-static --disable-shared
$ make
$ make check
$ make install
```

###Build and Install `mpc`
```
$ cd ~/src/mpc-1.0.3
$ ./configure --with-gmp=/usr/local --with-mpfr=/usr/local --enable-static --disable-shared
$ make
$ make check
$ make install
```

##OPTIONAL Part
You 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).

###Build and Install `gcc` for Your Machine
```
$ cd ~/src/gcc-5.3.0
$ mkdir obj-local
$ cd obj-local
$ ../configure --enable-languages=c,c++ --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --enable-static --disable-shared
$ make
$ make install
```
##End OPTIONAL Part

###Build and Install `binutils` for Your Machine
```
$ cd ~/src/binutils-2.26
$ mkdir obj-local
$ cd obj-local
$ ../configure
$ make
$ make install
```

##Buliding `binutils`, `gcc`, and `avr-libc` for the AVR system
Now 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.

###Build `binutils` for AVR
If 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`
```
$ cd ~/src/binutils-2.26
$ mkdir obj-avr
$ cd obj-avr
$ ../configure --prefix=$PREFIX --target=avr --disable-nls
$ make
$ make install
```

###Build `gcc` for AVR
```
$ cd ~/src/gcc-5.3.0
$ mkdir obj-avr
$ cd obj-avr
$ ../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
$ make
$ make install
```

###Build `avr-libc` for AVR
For 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`.
```
$ cd ~/src/avr-libc-2.0.0
$ ./configure --prefix=$PREFIX --build=x86_64-unknown-cygwin --host=avr
$ make
$ make install
```

##Building 'dfu-programmer' for flashing the firmware via USB and installing the drivers
We 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.

### Build and Install the `libusb`
The `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.
```
$ cd ~/src
$ git clone https://github.com/libusb/libusb.git
$ cd libusb
$ ./bootstrap.sh
$ ./configure
$ make
$ make install
```

### Build and Install the `dfu-programmer`
```
$ cd ~/src
$ git clone https://github.com/dfu-programmer/dfu-programmer.git
$ cd dfu-programmer
$ ./bootstrap.sh
$ ./configure
$ make
$ make install
```

Verify the installation with:
```
$ which dfu-programmer
/usr/local/bin/dfu-programmer

$ dfu-programmer
dfu-programmer 0.7.2
https://github.com/dfu-programmer/dfu-programmer
Type 'dfu-programmer --help' for a list of commands
'dfu-programmer --targets' to list supported target devices
```
If you are not getting the above result, you will not be able to flash the firmware!

###Install the USB drivers
The 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).
```
$ cd ~/src
$ wget http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip
$ unzip dfu-programmer-win-0.7.2.zip -d dfu-programmer-win-0.7.2
```

or

The 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`.

Then, 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:
```
C:\> pnputil -i -a C:\cygwin64\home\Kevin\src\dfu-programmer-win-0.7.2\dfu-prog-usb-1.2.2\atmel_usb_dfu.inf
or
C:\> pnputil -i -a "C:\Program Files (x86)\Atmel\Flip 3.4.7\usb\atmel_usb_dfu.inf"
```

This should be the result:
```
Microsoft PnP Utility

Processing inf : atmel_usb_dfu.inf
Successfully installed the driver on a device on the system.
Driver package added successfully.
Published name : oem104.inf


Total attempted: 1
Number successfully imported: 1
```

Alternatively, 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.

##Building and Flashing the Planck firmware!
If you did everything else right. This part should be a snap! Grab the latest sources from `github`, make the Plank firmware, then flash it.

###Build Planck and Load the Firmware
```
$ cd ~/src
$ git clone https://github.com/qmk/qmk_firmware.git
$ cd qmk_firmware/keyboards/planck
$ make
```

Make sure there are no errors. You should end up with this or something similar:
```
Creating load file for Flash: planck.hex
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature planck.elf planck.hex

Creating load file for EEPROM: planck.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O ihex planck.elf planck.eep || exit 0

Creating Extended Listing: planck.lss
avr-objdump -h -S -z planck.elf > planck.lss

Creating Symbol Table: planck.sym
avr-nm -n planck.elf > planck.sym

Size after:
text data bss dec hex filename
18602 82 155 18839 4997 planck.elf

-------- end --------
```

If 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.

But if everything went OK, you are ready to flash! Press the reset button on the bottom of the Planck, wait two seconds, then:
```
$ make dfu
```
.
.
.
profit!!!





##extra bits...

###Installing Precompiled `dfu-programmer` Binaries (not recommended for `cygwin`)
To 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)).

Copy 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):
```
C:\> set PATH=%PATH%;C:\cygwin64\home\Kevin\local\avr\bin
```

Then, rename `libusb0_x86.dll` to `libusb0.dll`.
You can tell that you were successful by trying to execute 'dfu-programmer' from the 'cygwin' prompt:
```
$ which dfu-programmer
/home/Kevin/local/avr/bin/dfu-programmer

$ dfu-programmer
dfu-programmer 0.7.2
https://github.com/dfu-programmer/dfu-programmer
Type 'dfu-programmer --help' for a list of commands
'dfu-programmer --targets' to list supported target devices
```

If you are not getting the above result, you will not be able to flash the firmware!
- Try making sure your `PATH` variables are set correctly for both `Windows` and `cygwin`.
- Make sure the `dll` is named correctly.
- 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`.
- Still have problems? Try building it instead.


##Debugging Tools

These 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.

### `gdb` for AVR
`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.

```
$ cd ~/src
$ git clone git://sourceware.org/git/binutils-gdb.git
$ cd binutils-gdb
$ mkdir obj-avr
$ cd obj-avr
$ ../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
$ make
$ make install
```

### `simulavr`
`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.

This 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`.


```
$ cd ~/src
$ git clone https://github.com/Traumflug/simulavr.git
$ cd simulavr
$ ./bootstrap
$ ./configure --prefix=$PREFIX --enable-static --disable-tcl --disable-doxygen-doc
```
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.

```
$ make
$ make install
```


TODO:
- git repos for all sources
- command line magic for cygwin setup
- better options for `dfu-drivers`

docs/Differences-from-TMK.md → docs/differences_from_tmk.md View File


docs/Dynamic-Macros.md → docs/dynamic_macros.md View File


+ 84
- 0
docs/eclipse.md View File

@@ -0,0 +1,84 @@
[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.

Using an IDE such as Eclipse provides many advantages over a plain text editor, such as:
* intelligent code completion
* convenient navigation in the code
* refactoring tools
* build automation (no need for the command-line)
* a GUI for GIT
* static code analysis
* many other tools such as debugging, code formatting, showing call hierarchies etc.

The purpose of the is page is to document how to set-up Eclipse for developing AVR software, and working on the QMK code base.

Note that this set-up has been tested on Ubuntu 16.04 only for the moment.

# Prerequisites
## Build environment
Before 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).

## Java
Eclipse 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.

# Install Eclipse and its plugins
Eclipse 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.

## Download and install Eclipse CDT
If 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.

If 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.

Installation 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.

Alternatively, 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).

## First Launch
When 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)

When 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).

Once 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).

## Install the necessary plugins
Note: you do not need to restart Eclipse after installing each plugin. Simply restart once all plugins are installed.

### [The AVR plugin](http://avr-eclipse.sourceforge.net/)
This 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.

### [ANSI Escape in Console](https://marketplace.eclipse.org/content/ansi-escape-console)
This plugin is necessary to properly display the colored build output generated by the QMK makefile.

1. Open <kbd><kbd>Help</kbd> > <kbd>Eclipse Marketplace…</kbd></kbd>
2. Search for _ANSI Escape in Console_
3. Click the <samp>Install</samp> button of the plugin
4. Follow the instructions and agree again with the security warning for unsigned content.

Once both plugins are installed, restart Eclipse as prompted.

# Configure Eclipse for QMK
## Importing the project
1. Click <kbd><kbd>File</kbd> > <kbd>New</kbd> > <kbd>Makefile Project with Existing Code</kbd></kbd>
2. On the next screen:
* Select the directory where you cloned the repository as _Existing Code Location_;
* (Optional) Give a different name to the project¹, e.g. _QMK_ or _Quantum_;
* Select the _AVR-GCC Toolchain_;
* Keep the rest as-is and click <kbd>Finish</kbd>

![Importing QMK in Eclipse](http://i.imgur.com/oHYR1yW.png)

3. The project will now be loaded and indexed. Its files can be browsed easily through the _Project Explorer_ on the left.

¹ 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`).

## Build your keyboard
We will now configure a make target that cleans the project and builds the keymap of your choice.

1. On the right side of the screen, select the <kbd>Make Target</kbd> tab
2. Expand the folder structure to the keyboard of your choice, e.g. `qmk_firmware/keyboards/ergodox`
3. 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)
4. Choose a name for your build target, e.g. _clean \<your keymap\>_
5. 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>`
6. Leave the other options checked and click <kbd>OK</kbd>. Your make target will now appear under the selected keyboard.
7. (Optional) Toggle the <kbd>Hide Empty Folders</kbd> icon button above the targets tree to only show your build target.
8. Double-click the build target you created to trigger a build.
9. Select the <kbd>Console</kbd> view at the bottom to view the running build.

+ 64
- 0
docs/embedding.md View File

@@ -0,0 +1,64 @@
# 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.

If you want to use TMK for your own keyboard project, you've got three options for embedding the [core][1].
The recommended option is [subtrees](#1-git-subtree).

After adding the embed you'll need to [modify the Makefile](#modifications-to-the-makefile) of your project to point to the core correctly.

## 1. git subtree

In order to set up the subtree in your project, first add the core repository as a remote:
```
git remote add -f core https://github.com/tmk/tmk_core
```

Then add the core as a subtree (directory) in your local repository:
```
git subtree add -P tmk_core core master --squash
```

And that's it!

When you want to update the subtree in your repository to match the master on [tmk_core][1], do this:
```
git subtree pull -P tmk_core core master --squash
```

## 2. git submodule

In order to set up the submodule in your project, first add a new submodule:
```
git submodule add https://github.com/tmk/tmk_core tmk_core
```

Then pull, sync and update the submodule:
```
git pull
git submodule sync --recursive
git submodule update --init --recursive
```

And that's it!

When you want to update the subtree in your repository to match the master on [tmk_core][1], follow the same steps as above.

If you want to clone a repository from GitHub that has submodule(s) in it, pass <kbd>--recursive</kbd> when cloning, like so:
`git clone --recursive https://github.com/<username>/<repository>`

## 3. Manually (without git)

*Note: This is not recommended in any way, but it's still possible.*

Download a zipped version of the [tmk_core][1] repository using this link:
<https://github.com/tmk/tmk_core/archive/master.zip>

Extract the zip in your project's directory, then rename the folder to <kbd>tmk_core</kbd>.

## Modifications to the *Makefile*

The 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:
```Makefile
TMK_DIR = ./tmk_core
```

[1]: https://github.com/tmk/tmk_core

+ 238
- 0
docs/faq.md View File

@@ -0,0 +1,238 @@
## READ FIRST
- **README** of top directory : https://github.com/tmk/tmk_keyboard/blob/master/README.md
- **README** of target project(keyboard/converter) directory.

Note that you'll need to read **both**.


# Build
- [[FAQ/Build]]


# Keymap
- [[FAQ/Keymap]]


# Debug Console
## hid_listen can't recognize device
When debug console of your device is not ready you will see like this:

Waiting for device:.........

once the device is pluged in then *hid_listen* finds it you will get this message:

Waiting for new device:.........................
Listening:

Check if you can't get this 'Listening:' message:
- build with `CONSOLE_ENABLE=yes` in **Makefile**.

You may need privilege to access the device on OS like Linux.
- try `sudo hid_listen`

## Can't get message on console
Check:
- *hid_listen* finds your device. See above.
- Enable debug with pressing **Magic**+d. See [Magic Commands](https://github.com/tmk/tmk_keyboard#magic-commands).
- set `debug_enable=true` usually in `matrix_init()` in **matrix.c**.
- try using 'print' function instead of debug print. See **common/print.h**.
- disconnect other devices with console function. See [Issue #97](https://github.com/tmk/tmk_keyboard/issues/97).

## Linux or UNIX like system requires Super User privilege
Just use 'sudo' to execute *hid_listen* with privilege.
```
$ sudo hid_listen
```

Or add an *udev rule* for TMK devices with placing a file in rules directory. The directory may vary on each system.

File: /etc/udev/rules.d/52-tmk-keyboard.rules(in case of Ubuntu)
```
# tmk keyboard products https://github.com/tmk/tmk_keyboard
SUBSYSTEMS=="usb", ATTRS{idVendor}=="feed", MODE:="0666"
```

***

# Miscellaneous
## NKRO Doesn't work
First you have to compile frimware with this build option `NKRO_ENABLE` in **Makefile**.

Try `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.

If 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.

https://github.com/tmk/tmk_keyboard#boot-magic-configuration---virtual-dip-switch


## TrackPoint needs reset circuit(PS/2 mouse support)
Without reset circuit you will have inconsistent reuslt due to improper initialize of the hardware. See circuit schematic of TPM754.

- http://geekhack.org/index.php?topic=50176.msg1127447#msg1127447
- http://www.mikrocontroller.net/attachment/52583/tpm754.pdf


## Can't read column of matrix beyond 16
Use `1UL<<16` instead of `1<<16` in `read_cols()` in **matrix.h** when your columns goes beyond 16.

In 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`.

http://deskthority.net/workshop-f7/rebuilding-and-redesigning-a-classic-thinkpad-keyboard-t6181-60.html#p146279



## Pull-up Resistor
In some case converters needed to have pull-up resistors to work correctly. Place the resistor between VCC and signal line in parallel.

For example:
```
Keyboard Conveter
,------.
5V------+------|VCC |
| | |
R | |
| | |
Signal--+------|PD0 |
| |
GND------------|GND |
`------'
R: 1K Ohm resistor
```

https://github.com/tmk/tmk_keyboard/issues/71


## Arduino Micro's pin naming is confusing
Note 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.
http://arduino.cc/en/uploads/Main/arduino-micro-schematic.pdf



## Bootloader jump doesn't work
Properly configure bootloader size in **Makefile**. With wrong section size bootloader won't probably start with **Magic command** and **Boot Magic**.
```
# Size of Bootloaders in bytes:
# Atmel DFU loader(ATmega32U4) 4096
# Atmel DFU loader(AT90USB128) 8192
# LUFA bootloader(ATmega32U4) 4096
# Arduino Caterina(ATmega32U4) 4096
# USBaspLoader(ATmega***) 2048
# Teensy halfKay(ATmega32U4) 512
# Teensy++ halfKay(AT90USB128) 2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096
```
AVR Boot section size are defined by setting **BOOTSZ** fuse in fact. Consult with your MCU datasheet.
Note that **Word**(2 bytes) size and address are used in datasheet while TMK uses **Byte**.

AVR Boot section is located at end of Flash memory like the followings.
```
byte Atmel/LUFA(ATMega32u4) byte Atmel(AT90SUB1286)
0x0000 +---------------+ 0x00000 +---------------+
| | | |
| | | |
| Application | | Application |
| | | |
= = = =
| | 32KB-4KB | | 128KB-8KB
0x6000 +---------------+ 0x1E000 +---------------+
| Bootloader | 4KB | Bootloader | 8KB
0x7FFF +---------------+ 0x1FFFF +---------------+

byte Teensy(ATMega32u4) byte Teensy++(AT90SUB1286)
0x0000 +---------------+ 0x00000 +---------------+
| | | |
| | | |
| Application | | Application |
| | | |
= = = =
| | 32KB-512B | | 128KB-2KB
0x7E00 +---------------+ 0x1FC00 +---------------+
| Bootloader | 512B | Bootloader | 2KB
0x7FFF +---------------+ 0x1FFFF +---------------+
```

And see this discussion for further reference.
https://github.com/tmk/tmk_keyboard/issues/179


## Special Extra key doesn't work(System, Audio control keys)
You need to define `EXTRAKEY_ENABLE` in **makefile** to use them in TMK.
```
EXTRAKEY_ENABLE = yes # Audio control and System control
```
http://deskthority.net/workshop-f7/tmk-keyboard-firmware-collection-t4478-60.html#p157919


## Wakeup from sleep doesn't work
In Windows check `Allow this device to wake the computer` setting in Power **Management property** tab of **Device Manager**. Also check BIOS setting.

Pressing any key during sleep should wake host.


## Using Arduino?
**Note that Arduino pin naming is different from actual chip.** For example, Arduino pin `D0` is not `PD0`. Check circuit with its schematics yourself.

- http://arduino.cc/en/uploads/Main/arduino-leonardo-schematic_3b.pdf
- http://arduino.cc/en/uploads/Main/arduino-micro-schematic.pdf

Arduino leonardo and micro have **ATMega32U4** and can be used for TMK, though Arduino bootloader may be a problem.


## Using PF4-7 pins of USB AVR?
You 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.

If you are using Teensy this isn't needed. Teensy is shipped with JTAGEN fuse bit unprogrammed to disable the function.

See this code.
```
// JTAG disable for PORT F. write JTD bit twice within four cycles.
MCUCR |= (1<<JTD);
MCUCR |= (1<<JTD);
```
https://github.com/tmk/tmk_keyboard/blob/master/keyboard/hbkb/matrix.c#L67

And read **26.5.1 MCU Control Register – MCUCR** of ATMega32U4 datasheet.


## Adding LED indicators of Lock keys
You need your own LED indicators for CapsLock, ScrollLock and NumLock? See this post.

http://deskthority.net/workshop-f7/tmk-keyboard-firmware-collection-t4478-120.html#p191560

## Program Arduino Micro/Leonardo
Push reset button and then run command like this within 8 seconds.

```
avrdude -patmega32u4 -cavr109 -b57600 -Uflash:w:adb_usb.hex -P/dev/ttyACM0
```

Device name will vary depending on your system.

http://arduino.cc/en/Main/ArduinoBoardMicro
https://geekhack.org/index.php?topic=14290.msg1563867#msg1563867


## USB 3 compatibility
I heard some people have a problem with USB 3 port, try USB 2 port.


## Mac compatibility
### OS X 10.11 and Hub
https://geekhack.org/index.php?topic=14290.msg1884034#msg1884034


## Problem on BIOS(UEFI)/Resume(Sleep&Wake)/Power cycles
Some people reported their keyboard stops working on BIOS and/or after resume(power cycles).

As 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.

https://github.com/tmk/tmk_keyboard/issues/266
https://geekhack.org/index.php?topic=41989.msg1967778#msg1967778



## FLIP doesn't work
### AtLibUsbDfu.dll not found
Remove current driver and reinstall one FLIP provides from DeviceManager.
http://imgur.com/a/bnwzy

docs/FAQ-Build.md → docs/faq_build.md View File

@@ -1,5 +1,5 @@
## READ FIRST
- https://github.com/jackhumbert/qmk_firmware/blob/master/doc/BUILD_GUIDE.md
- https://github.com/qmk/qmk_firmware/blob/master/docs/build_guide.md

In short,


docs/FAQ-Keymap.md → docs/faq_keymap.md View File


+ 50
- 0
docs/fuse.txt View File

@@ -0,0 +1,50 @@
Atmega32u4 Fuse/Lock Bits for Planck/Atomic/Preonic
=========================

Low Fuse: 0x5E
High Fuse: 0x99
Extended Fuse: 0xF3
Lock Byte: 0xFF


ATMega168P Fuse/Lock Bits
=========================
This configuration is from usbasploader's Makefile.

HFUSE 0xD6
LFUSE 0xDF
EFUSE 0x00
LOCK 0x3F(intact)

#---------------------------------------------------------------------
# ATMega168P
#---------------------------------------------------------------------
# Fuse extended byte:
# 0x00 = 0 0 0 0 0 0 0 0 <-- BOOTRST (boot reset vector at 0x1800)
# \+/
# +------- BOOTSZ (00 = 2k bytes)
# Fuse high byte:
# 0xd6 = 1 1 0 1 0 1 1 0
# ^ ^ ^ ^ ^ \-+-/
# | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V)
# | | | | + --------- EESAVE (preserve EEPROM over chip erase)
# | | | +-------------- WDTON (if 0: watchdog always on)
# | | +---------------- SPIEN (allow serial programming)
# | +------------------ DWEN (debug wire enable)
# +-------------------- RSTDISBL (reset pin is enabled)
# Fuse low byte:
# 0xdf = 1 1 0 1 1 1 1 1
# ^ ^ \ / \--+--/
# | | | +------- CKSEL 3..0 (external >8M crystal)
# | | +--------------- SUT 1..0 (crystal osc, BOD enabled)
# | +------------------ CKOUT (if 0: Clock output enabled)
# +-------------------- CKDIV8 (if 0: divide by 8)


# Lock Bits
# 0x3f = - - 1 1 1 1 1 1
# \ / \-/ \-/
# | | +----- LB 2..1 (No memory lock features enabled)
# | +--------- BLB0 2..1 (No restrictions for SPM or LPM accessing the Application section)
# +--------------- BLB1 2..1 (No restrictions for SPM or LPM accessing the Boot Loader section)


docs/Git-subtree.md → docs/git_subtree.md View File


+ 321
- 0
docs/hand_wire.md View File

@@ -0,0 +1,321 @@
# Quantum Hand-wiring Guide

Parts list:
* *x* keyswitches (MX, Matias, Gateron, etc)
* *x* diodes
* Keyboard plate (metal, plastic, cardboard, etc)
* Wire (strained for wiring to the Teensy, anything for the rows/columns)
* Soldering iron set at 600ºF or 315ºC (if temperature-controlled)
* Resin-cored solder (leaded or lead-free)
* Adequate ventilation/a fan
* Tweezers (optional)
* Wire cutters/snippers

## How the matrix works (why we need diodes)

The 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:

Column 0 being scanned Column 1 being scanned
x x
col0 col1 col0 col1
| | | |
row0 ---(key0)---(key1) row0 ---(key0)---(key1)
| | | |
row1 ---(key2)---(key3) row1 ---(key2)---(key3)

The `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.

When 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:

Column 0 being scanned Column 1 being scanned
x x
col0 col1 col0 col1
| | | |
x row0 ---(-+-0)---(key1) row0 ---(-+-0)---(key1)
| | | |
row1 ---(key2)---(key3) row1 ---(key2)---(key3)

We 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

col0: 0b01
col1: 0b00
│└row0
└row1

A problem arises when you start pressing more than one key at a time. Looking at our matrix again, it should become pretty obvious:

Column 0 being scanned Column 1 being scanned
x x
col0 col1 col0 col1
| | | |
x row0 ---(-+-0)---(-+-1) x row0 ---(-+-0)---(-+-1)
| | | |
x row1 ---(key2)---(-+-3) x row1 ---(key2)---(-+-3)

Remember that this ^ is still connected to row1

The data we get from that is:

col0: 0b11
col1: 0b11
│└row0
└row1

Which 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;

Column 0 being scanned Column 1 being scanned
x x
col0 col1 col0 col1
│ │ | │
(key0) (key1) (key0) (key1)
! │ ! │ ! | ! │
row0 ─────┴────────┘ │ row0 ─────┴────────┘ │
│ │ | │
(key2) (key3) (key2) (key3)
! ! ! !
row1 ─────┴────────┘ row1 ─────┴────────┘

In 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: `>|`

Now when we press the three keys, invoking what would be a ghosting scenario:

Column 0 being scanned Column 1 being scanned
x x
col0 col1 col0 col1
│ │ │ │
(┌─┤0) (┌─┤1) (┌─┤0) (┌─┤1)
! │ ! │ ! │ ! │
x row0 ─────┴────────┘ │ x row0 ─────┴────────┘ │
│ │ │ │
(key2) (┌─┘3) (key2) (┌─┘3)
! ! ! !
row1 ─────┴────────┘ x row1 ─────┴────────┘

Things act as they should! Which will get us the following data:

col0: 0b01
col1: 0b11
│└row0
└row1

The firmware can then use this correct data to detect what it should do, and eventually, what signals it needs to send to the OS.

## The actual hand-wiring

### Getting things in place

When 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.

To 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.

Get 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.