1
0
Fork 0

Trim trailing whitespace

This commit is contained in:
fauxpark 2017-12-09 16:56:58 +11:00 committed by Jack Humbert
parent af37bb2f78
commit bb53635f33
28 changed files with 88 additions and 88 deletions

View file

@ -75,7 +75,7 @@ Most of our style is pretty easy to pick up on, but right now it's not entirely
We have a few different types of changes in QMK, each requiring a different level of rigor. We'd like you to keep the following guidelines in mind no matter what type of change you're making. We have a few different types of changes in QMK, each requiring a different level of rigor. We'd like you to keep the following guidelines in mind no matter what type of change you're making.
* Separate PR's into logical units. For example, do not submit one PR covering two separate features, instead submit a separate PR for each feature. * Separate PR's into logical units. For example, do not submit one PR covering two separate features, instead submit a separate PR for each feature.
* Check for unnecessary whitespace with `git diff --check` before committing. * Check for unnecessary whitespace with `git diff --check` before committing.
* Make sure your code change actually compiles. * Make sure your code change actually compiles.
* Keymaps: Make sure that `make keyboard:your_new_keymap` does not return an error * Keymaps: Make sure that `make keyboard:your_new_keymap` does not return an error
@ -111,7 +111,7 @@ Most first-time QMK contributors start with their personal keymaps. We try to ke
Keyboards are the raison d'être for QMK. Some keyboards are community maintained, while others are maintained by the people responsible for making a particular keyboard. The `readme.md` should tell you who maintains a particular keyboard. If you have questions relating to a particular keyboard you can [Open An Issue](https://github.com/qmk/qmk_firmware/issues) and tag the maintainer in your question. Keyboards are the raison d'être for QMK. Some keyboards are community maintained, while others are maintained by the people responsible for making a particular keyboard. The `readme.md` should tell you who maintains a particular keyboard. If you have questions relating to a particular keyboard you can [Open An Issue](https://github.com/qmk/qmk_firmware/issues) and tag the maintainer in your question.
We also ask that you follow these guidelines: We also ask that you follow these guidelines:
* Write a `readme.md` using [the template](https://docs.qmk.fm/documentation_templates.html#). * Write a `readme.md` using [the template](https://docs.qmk.fm/documentation_templates.html#).
* Keep the number of commits reasonable or we will squash your PR * Keep the number of commits reasonable or we will squash your PR
@ -136,7 +136,7 @@ Here are some things to keep in mind when working on your feature or bug fix.
* **Consider revisions and different chip-bases** - there are several keyboards that have revisions that allow for slightly different configurations, and even different chip-bases. Try to make a feature supported in ARM and AVR, or automatically disabled on platforms it doesn't work on. * **Consider revisions and different chip-bases** - there are several keyboards that have revisions that allow for slightly different configurations, and even different chip-bases. Try to make a feature supported in ARM and AVR, or automatically disabled on platforms it doesn't work on.
* **Explain your feature** - Document it in `docs/`, either as a new file or as part of an existing file. If you don't document it other people won't be able to benefit from your hard work. * **Explain your feature** - Document it in `docs/`, either as a new file or as part of an existing file. If you don't document it other people won't be able to benefit from your hard work.
We also ask that you follow these guidelines: We also ask that you follow these guidelines:
* Keep the number of commits reasonable or we will squash your PR * Keep the number of commits reasonable or we will squash your PR
* Do not lump keyboards or keymaps in with core changes. Submit your core changes first. * Do not lump keyboards or keymaps in with core changes. Submit your core changes first.

View file

@ -1,6 +1,6 @@
# How to Customize Your Keyboard's Behavior # How to Customize Your Keyboard's Behavior
For a lot of people a custom keyboard is about more than sending button presses to your computer. You want to be able to do things that are more complex than simple button presses and macros. QMK has hooks that allow you to inject code, override functionality, and otherwise customize how your keyboard behaves in different situations. For a lot of people a custom keyboard is about more than sending button presses to your computer. You want to be able to do things that are more complex than simple button presses and macros. QMK has hooks that allow you to inject code, override functionality, and otherwise customize how your keyboard behaves in different situations.
This page does not assume any special knowledge about QMK, but reading [Understanding QMK](understanding_qmk.md) will help you understand what is going on at a more fundamental level. This page does not assume any special knowledge about QMK, but reading [Understanding QMK](understanding_qmk.md) will help you understand what is going on at a more fundamental level.
@ -66,7 +66,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
### `process_record_*` Function Documentation ### `process_record_*` Function Documentation
* Keyboard/Revision: `bool process_record_kb(uint16_t keycode, keyrecord_t *record)` * Keyboard/Revision: `bool process_record_kb(uint16_t keycode, keyrecord_t *record)`
* Keymap: `bool process_record_user(uint16_t keycode, keyrecord_t *record)` * Keymap: `bool process_record_user(uint16_t keycode, keyrecord_t *record)`
The `keycode` argument is whatever is defined in your keymap, eg `MO(1)`, `KC_L`, etc. You should use a `switch...case` block to handle these events. The `keycode` argument is whatever is defined in your keymap, eg `MO(1)`, `KC_L`, etc. You should use a `switch...case` block to handle these events.
@ -130,7 +130,7 @@ void led_set_kb(uint8_t usb_led) {
### `led_set_*` Function Documentation ### `led_set_*` Function Documentation
* Keyboard/Revision: `void led_set_kb(uint8_t usb_led)` * Keyboard/Revision: `void led_set_kb(uint8_t usb_led)`
* Keymap: `void led_set_user(uint8_t usb_led)` * Keymap: `void led_set_user(uint8_t usb_led)`
# Matrix Initialization Code # Matrix Initialization Code
@ -155,7 +155,7 @@ void matrix_init_kb(void) {
### `matrix_init_*` Function Documentation ### `matrix_init_*` Function Documentation
* Keyboard/Revision: `void matrix_init_kb(void)` * Keyboard/Revision: `void matrix_init_kb(void)`
* Keymap: `void matrix_init_user(void)` * Keymap: `void matrix_init_user(void)`
# Matrix Scanning Code # Matrix Scanning Code

View file

@ -6,7 +6,7 @@ This page covers questions about building QMK. If you have not yet you should re
You will need proper permission to operate a device. For Linux users see udev rules below. Easy way is to use `sudo` command, if you are not familiar with this command check its manual with `man sudo` or this page on line. You will need proper permission to operate a device. For Linux users see udev rules below. Easy way is to use `sudo` command, if you are not familiar with this command check its manual with `man sudo` or this page on line.
In short when your controller is ATMega32u4, In short when your controller is ATMega32u4,
$ sudo dfu-programmer atmega32u4 erase --force $ sudo dfu-programmer atmega32u4 erase --force
$ sudo dfu-programmer atmega32u4 flash your.hex $ sudo dfu-programmer atmega32u4 flash your.hex
$ sudo dfu-programmer atmega32u4 reset $ sudo dfu-programmer atmega32u4 reset
@ -81,11 +81,11 @@ make: *** [obj_alps64/protocol/lufa/lufa.o] Error 1
Note that Teensy2.0++ bootloader size is 2048byte. Some Makefiles may have wrong comment. Note that Teensy2.0++ bootloader size is 2048byte. Some Makefiles may have wrong comment.
``` ```
# Boot Section Size in *bytes* # Boot Section Size in *bytes*
# Teensy halfKay 512 # Teensy halfKay 512
# Teensy++ halfKay 2048 # Teensy++ halfKay 2048
# Atmel DFU loader 4096 (TMK Alt Controller) # Atmel DFU loader 4096 (TMK Alt Controller)
# LUFA bootloader 4096 # LUFA bootloader 4096
# USBaspLoader 2048 # USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=2048 OPT_DEFS += -DBOOTLOADER_SIZE=2048
``` ```

View file

@ -116,12 +116,12 @@ http://deskthority.net/workshop-f7/rebuilding-and-redesigning-a-classic-thinkpad
Properly configure bootloader size in **Makefile**. With wrong section size bootloader won't probably start with **Magic command** and **Boot Magic**. 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: # Size of Bootloaders in bytes:
# Atmel DFU loader(ATmega32U4) 4096 # Atmel DFU loader(ATmega32U4) 4096
# Atmel DFU loader(AT90USB128) 8192 # Atmel DFU loader(AT90USB128) 8192
# LUFA bootloader(ATmega32U4) 4096 # LUFA bootloader(ATmega32U4) 4096
# Arduino Caterina(ATmega32U4) 4096 # Arduino Caterina(ATmega32U4) 4096
# USBaspLoader(ATmega***) 2048 # USBaspLoader(ATmega***) 2048
# Teensy halfKay(ATmega32U4) 512 # Teensy halfKay(ATmega32U4) 512
# Teensy++ halfKay(AT90USB128) 2048 # Teensy++ halfKay(AT90USB128) 2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096 OPT_DEFS += -DBOOTLOADER_SIZE=4096
``` ```
@ -135,14 +135,14 @@ byte Atmel/LUFA(ATMega32u4) byte Atmel(AT90SUB1286)
| | | | | | | |
| | | | | | | |
| Application | | Application | | Application | | Application |
| | | | | | | |
= = = = = = = =
| | 32KB-4KB | | 128KB-8KB | | 32KB-4KB | | 128KB-8KB
0x6000 +---------------+ 0x1E000 +---------------+ 0x6000 +---------------+ 0x1E000 +---------------+
| Bootloader | 4KB | Bootloader | 8KB | Bootloader | 4KB | Bootloader | 8KB
0x7FFF +---------------+ 0x1FFFF +---------------+ 0x7FFF +---------------+ 0x1FFFF +---------------+
byte Teensy(ATMega32u4) byte Teensy++(AT90SUB1286) byte Teensy(ATMega32u4) byte Teensy++(AT90SUB1286)
0x0000 +---------------+ 0x00000 +---------------+ 0x0000 +---------------+ 0x00000 +---------------+
| | | | | | | |
@ -230,7 +230,7 @@ https://geekhack.org/index.php?topic=14290.msg1884034#msg1884034
## Problem on BIOS (UEFI)/Resume (Sleep & Wake)/Power Cycles ## Problem on BIOS (UEFI)/Resume (Sleep & Wake)/Power Cycles
Some people reported their keyboard stops working on BIOS and/or after resume(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. 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://github.com/tmk/tmk_keyboard/issues/266
https://geekhack.org/index.php?topic=41989.msg1967778#msg1967778 https://geekhack.org/index.php?topic=41989.msg1967778#msg1967778

View file

@ -48,7 +48,7 @@ For Modifier keys and layer actions you have to place `KC_TRANS` on same positio
## Mechanical Lock Switch Support ## Mechanical Lock Switch Support
This feature is for *mechanical lock switch* like [this Alps one](http://deskthority.net/wiki/Alps_SKCL_Lock). You can enable it by adding this to your `config.h`: This feature is for *mechanical lock switch* like [this Alps one](http://deskthority.net/wiki/Alps_SKCL_Lock). You can enable it by adding this to your `config.h`:
``` ```
#define LOCKING_SUPPORT_ENABLE #define LOCKING_SUPPORT_ENABLE
#define LOCKING_RESYNC_ENABLE #define LOCKING_RESYNC_ENABLE
@ -187,7 +187,7 @@ ___TO BE IMPROVED___
real_mods is intended to retains state of real/physical modifier key state, while real_mods is intended to retains state of real/physical modifier key state, while
weak_mods retains state of virtual or temporary modifiers which should not affect state real modifier key. weak_mods retains state of virtual or temporary modifiers which should not affect state real modifier key.
Let's say you hold down physical left shift key and type ACTION_MODS_KEY(LSHIFT, KC_A), Let's say you hold down physical left shift key and type ACTION_MODS_KEY(LSHIFT, KC_A),
with weak_mods, with weak_mods,
* (1) hold down left shift: real_mods |= MOD_BIT(LSHIFT) * (1) hold down left shift: real_mods |= MOD_BIT(LSHIFT)

View file

@ -41,7 +41,7 @@ If you are just getting started with QMK you will want to keep everything simple
### Intermediate Users ### Intermediate Users
Sometimes you need more than one base layer. For example, if you want to switch between QWERTY and Dvorak, switch between layouts for different countries, or switch your layout for different videogames. Your base layers should always be the lowest numbered layers. When you have multiple base layers you should always treat them as mutually exclusive. When one base layer is on the others are off. Sometimes you need more than one base layer. For example, if you want to switch between QWERTY and Dvorak, switch between layouts for different countries, or switch your layout for different videogames. Your base layers should always be the lowest numbered layers. When you have multiple base layers you should always treat them as mutually exclusive. When one base layer is on the others are off.
### Advanced Users ### Advanced Users

View file

@ -49,7 +49,7 @@ It's advised that you wrap all audio features in `#ifdef AUDIO_ENABLE` / `#endif
## Music Mode ## Music Mode
The music mode maps your columns to a chromatic scale, and your rows to octaves. This works best with ortholinear keyboards, but can be made to work with others. All keycodes less than `0xFF` get blocked, so you won't type while playing notes - if you have special keys/mods, those will still work. A work-around for this is to jump to a different layer with KC_NOs before (or after) enabling music mode. The music mode maps your columns to a chromatic scale, and your rows to octaves. This works best with ortholinear keyboards, but can be made to work with others. All keycodes less than `0xFF` get blocked, so you won't type while playing notes - if you have special keys/mods, those will still work. A work-around for this is to jump to a different layer with KC_NOs before (or after) enabling music mode.
Recording is experimental due to some memory issues - if you experience some weird behavior, unplugging/replugging your keyboard will fix things. Recording is experimental due to some memory issues - if you experience some weird behavior, unplugging/replugging your keyboard will fix things.

View file

@ -52,7 +52,7 @@ For users of the earlier versions of dynamic macros: It is still possible to fin
```c ```c
uint16_t macro_kc = (keycode == MO(_DYN) ? DYN_REC_STOP : keycode); uint16_t macro_kc = (keycode == MO(_DYN) ? DYN_REC_STOP : keycode);
if (!process_record_dynamic_macro(macro_kc, record)) { if (!process_record_dynamic_macro(macro_kc, record)) {
return false; return false;
} }

View file

@ -1,6 +1,6 @@
# Layouts: Using a Keymap with Multiple Keyboards # Layouts: Using a Keymap with Multiple Keyboards
The `layouts/` folder contains different physical key layouts that can apply to different keyboards. The `layouts/` folder contains different physical key layouts that can apply to different keyboards.
``` ```
layouts/ layouts/
@ -21,7 +21,7 @@ layouts/
| + ... | + ...
``` ```
The `layouts/default/` and `layouts/community/` are two examples of layout "repositories" - currently `default` will contain all of the information concerning the layout, and one default keymap named `default_<layout>`, for users to use as a reference. `community` contains all of the community keymaps, with the eventual goal of being split-off into a separate repo for users to clone into `layouts/`. QMK searches through all folders in `layouts/`, so it's possible to have multiple repositories here. The `layouts/default/` and `layouts/community/` are two examples of layout "repositories" - currently `default` will contain all of the information concerning the layout, and one default keymap named `default_<layout>`, for users to use as a reference. `community` contains all of the community keymaps, with the eventual goal of being split-off into a separate repo for users to clone into `layouts/`. QMK searches through all folders in `layouts/`, so it's possible to have multiple repositories here.
Each layout folder is named (`[a-z0-9_]`) after the physical aspects of the layout, in the most generic way possible, and contains a `readme.md` with the layout to be defined by the keyboard: Each layout folder is named (`[a-z0-9_]`) after the physical aspects of the layout, in the most generic way possible, and contains a `readme.md` with the layout to be defined by the keyboard:

View file

@ -1,6 +1,6 @@
# Macros # Macros
Macros allow you to send multiple keystrokes when pressing just one key. QMK has a number of ways to define and use macros. These can do anything you want: type common phrases for you, copypasta, repetitive game movements, or even help you code. Macros allow you to send multiple keystrokes when pressing just one key. QMK has a number of ways to define and use macros. These can do anything you want: type common phrases for you, copypasta, repetitive game movements, or even help you code.
{% hint style='danger' %} {% hint style='danger' %}
**Security Note**: While it is possible to use macros to send passwords, credit card numbers, and other sensitive information it is a supremely bad idea to do so. Anyone who gets a hold of your keyboard will be able to access that information by opening a text editor. **Security Note**: While it is possible to use macros to send passwords, credit card numbers, and other sensitive information it is a supremely bad idea to do so. Anyone who gets a hold of your keyboard will be able to access that information by opening a text editor.
@ -245,7 +245,7 @@ This will clear all keys besides the mods currently pressed.
## Advanced Example: Single-Key Copy/Paste ## Advanced Example: Single-Key Copy/Paste
This example defines a macro which sends `Ctrl-C` when pressed down, and `Ctrl-V` when released. This example defines a macro which sends `Ctrl-C` when pressed down, and `Ctrl-V` when released.
```c ```c
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {

View file

@ -135,7 +135,7 @@ These enable settings supported by the PS/2 mouse protocol: http://www.computer-
``` ```
/* Use remote mode instead of the default stream mode (see link) */ /* Use remote mode instead of the default stream mode (see link) */
#define PS2_MOUSE_USE_REMOTE_MODE #define PS2_MOUSE_USE_REMOTE_MODE
/* Enable the scrollwheel or scroll gesture on your mouse or touchpad */ /* Enable the scrollwheel or scroll gesture on your mouse or touchpad */
#define PS2_MOUSE_ENABLE_SCROLLING #define PS2_MOUSE_ENABLE_SCROLLING

View file

@ -187,9 +187,9 @@ enum {
SINGLE_TAP = 1, SINGLE_TAP = 1,
SINGLE_HOLD = 2, SINGLE_HOLD = 2,
DOUBLE_TAP = 3, DOUBLE_TAP = 3,
DOUBLE_HOLD = 4, DOUBLE_HOLD = 4,
DOUBLE_SINGLE_TAP = 5 //send SINGLE_TAP twice - NOT DOUBLE_TAP DOUBLE_SINGLE_TAP = 5 //send SINGLE_TAP twice - NOT DOUBLE_TAP
// Add more enums here if you want for triple, quadruple, etc. // Add more enums here if you want for triple, quadruple, etc.
}; };
typedef struct { typedef struct {
@ -209,14 +209,14 @@ int cur_dance (qk_tap_dance_state_t *state) {
if (state->interrupted) return DOUBLE_SINGLE_TAP; if (state->interrupted) return DOUBLE_SINGLE_TAP;
else if (state->pressed) return DOUBLE_HOLD; else if (state->pressed) return DOUBLE_HOLD;
else return DOUBLE_TAP; else return DOUBLE_TAP;
} }
else return 6; //magic number. At some point this method will expand to work for more presses else return 6; //magic number. At some point this method will expand to work for more presses
} }
//**************** Definitions needed for quad function to work *********************// //**************** Definitions needed for quad function to work *********************//
//instanalize an instance of 'tap' for the 'x' tap dance. //instanalize an instance of 'tap' for the 'x' tap dance.
static tap xtap_state = { static tap xtap_state = {
.is_press_action = true, .is_press_action = true,
.state = 0 .state = 0
}; };

View file

@ -68,11 +68,11 @@ Prints out the entire keymap for a certain layer
``` ```
> keymap 0 > keymap 0
0x002b, 0x0014, 0x001a, 0x0008, 0x0015, 0x0017, 0x001c, 0x0018, 0x000c, 0x0012, 0x0013, 0x002a, 0x002b, 0x0014, 0x001a, 0x0008, 0x0015, 0x0017, 0x001c, 0x0018, 0x000c, 0x0012, 0x0013, 0x002a,
0x0029, 0x0004, 0x0016, 0x0007, 0x0009, 0x000a, 0x000b, 0x000d, 0x000e, 0x000f, 0x0033, 0x0034, 0x0029, 0x0004, 0x0016, 0x0007, 0x0009, 0x000a, 0x000b, 0x000d, 0x000e, 0x000f, 0x0033, 0x0034,
0x00e1, 0x001d, 0x001b, 0x0006, 0x0019, 0x0005, 0x0011, 0x0010, 0x0036, 0x0037, 0x0038, 0x0028, 0x00e1, 0x001d, 0x001b, 0x0006, 0x0019, 0x0005, 0x0011, 0x0010, 0x0036, 0x0037, 0x0038, 0x0028,
0x5cd6, 0x00e0, 0x00e2, 0x00e3, 0x5cd4, 0x002c, 0x002c, 0x5cd5, 0x0050, 0x0051, 0x0052, 0x004f, 0x5cd6, 0x00e0, 0x00e2, 0x00e3, 0x5cd4, 0x002c, 0x002c, 0x5cd5, 0x0050, 0x0051, 0x0052, 0x004f,
> >
``` ```
### `exit` ### `exit`

View file

@ -18,7 +18,7 @@ All this only happens when you build a keymap named `<name>`, like this:
make planck:<name> make planck:<name>
For example, For example,
make planck:jack make planck:jack
@ -32,9 +32,9 @@ Please include authorship (your name, github username, email), and optionally [a
For a brief example, checkout `/users/_example/` , or for a more detailed examples check out [`template.h`](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/template.h) and [`template.c`](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/template.c) in `/users/drashna/` . For a brief example, checkout `/users/_example/` , or for a more detailed examples check out [`template.h`](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/template.h) and [`template.c`](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/template.c) in `/users/drashna/` .
### Consolidated Macros ### Consolidated Macros
If you wanted to consolidate macros and other functions into your userspace for all of your keymaps, you can do that. The issue is that you then cannot call any function defined in your userspace, or it gets complicated. To better handle this, you can call the functions here and create new functions to use in individual keymaps. If you wanted to consolidate macros and other functions into your userspace for all of your keymaps, you can do that. The issue is that you then cannot call any function defined in your userspace, or it gets complicated. To better handle this, you can call the functions here and create new functions to use in individual keymaps.
First, you'd want to go through all of your `keymap.c` files and replace `process_record_user` with `process_record_keymap` instead. This way, you can still use keyboard specific codes on those boards, and use your custom "global" keycodes as well. You'll also want to replace `SAFE_RANGE` with `NEW_SAFE_RANGE` so that you wont have any overlapping keycodes First, you'd want to go through all of your `keymap.c` files and replace `process_record_user` with `process_record_keymap` instead. This way, you can still use keyboard specific codes on those boards, and use your custom "global" keycodes as well. You'll also want to replace `SAFE_RANGE` with `NEW_SAFE_RANGE` so that you wont have any overlapping keycodes
@ -47,7 +47,7 @@ Once you've done that, you'll want to set the keycode definitions that you need
#include "quantum.h" #include "quantum.h"
// Define all of // Define all of
enum custom_keycodes { enum custom_keycodes {
KC_MAKE = SAFE_RANGE, KC_MAKE = SAFE_RANGE,
NEW_SAFE_RANGE //use "NEW_SAFE_RANGE" for keymap specific codes NEW_SAFE_RANGE //use "NEW_SAFE_RANGE" for keymap specific codes
@ -90,6 +90,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} }
``` ```
This will add a new `KC_MAKE` keycode that can be used in any of your keymaps. And this keycode will output `make <keyboard>:<keymap">`, making frequent compiling easier. And this will work with any keyboard and any keymap as it will output the current boards info, so that you don't have to type this out every time. This will add a new `KC_MAKE` keycode that can be used in any of your keymaps. And this keycode will output `make <keyboard>:<keymap">`, making frequent compiling easier. And this will work with any keyboard and any keymap as it will output the current boards info, so that you don't have to type this out every time.
Additionally, this should flash the newly compiled firmware automatically, using the correct utility, based on the bootloader settings (or default to just generating the HEX file). However, it should be noted that this may not work on all systems. AVRDUDE doesn't work on WSL, namely (and will dump the HEX in the ".build" folder instead). Additionally, this should flash the newly compiled firmware automatically, using the correct utility, based on the bootloader settings (or default to just generating the HEX file). However, it should be noted that this may not work on all systems. AVRDUDE doesn't work on WSL, namely (and will dump the HEX in the ".build" folder instead).

View file

@ -12,7 +12,7 @@ To ensure compatibility with the DFU bootloader, make sure this block is present
# Bootloader # Bootloader
# This definition is optional, and if your keyboard supports multiple bootloaders of # This definition is optional, and if your keyboard supports multiple bootloaders of
# different sizes, comment this out, and the correct address will be loaded # different sizes, comment this out, and the correct address will be loaded
# automatically (+60). See bootloader.mk for all options. # automatically (+60). See bootloader.mk for all options.
BOOTLOADER = atmel-dfu BOOTLOADER = atmel-dfu
@ -57,7 +57,7 @@ To ensure compatibility with the Caterina bootloader, make sure this block is pr
# Bootloader # Bootloader
# This definition is optional, and if your keyboard supports multiple bootloaders of # This definition is optional, and if your keyboard supports multiple bootloaders of
# different sizes, comment this out, and the correct address will be loaded # different sizes, comment this out, and the correct address will be loaded
# automatically (+60). See bootloader.mk for all options. # automatically (+60). See bootloader.mk for all options.
BOOTLOADER = caterina BOOTLOADER = caterina
@ -86,7 +86,7 @@ To ensure compatibility with the Halfkay bootloader, make sure this block is pre
# Bootloader # Bootloader
# This definition is optional, and if your keyboard supports multiple bootloaders of # This definition is optional, and if your keyboard supports multiple bootloaders of
# different sizes, comment this out, and the correct address will be loaded # different sizes, comment this out, and the correct address will be loaded
# automatically (+60). See bootloader.mk for all options. # automatically (+60). See bootloader.mk for all options.
BOOTLOADER = halfkay BOOTLOADER = halfkay

View file

@ -78,15 +78,15 @@ In addition to the Creators Update, you need Windows 10 Subystem for Linux, so i
### Git ### Git
If you already have cloned the repository on your Windows file system you can ignore this section. If you already have cloned the repository on your Windows file system you can ignore this section.
You will need to clone the repository to your Windows file system using the normal Git for Windows and **not** the WSL Git. So if you haven't installed Git before, [download](https://git-scm.com/download/win) and install it. Then [set it up](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup), it's important that you setup the e-mail and user name, especially if you are planning to contribute. You will need to clone the repository to your Windows file system using the normal Git for Windows and **not** the WSL Git. So if you haven't installed Git before, [download](https://git-scm.com/download/win) and install it. Then [set it up](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup), it's important that you setup the e-mail and user name, especially if you are planning to contribute.
Once Git is installed, open the Git Bash command and change the directory to where you want to clone QMK; note that you have to use forward slashes, and that your c drive is accessed like this `/c/path/to/where/you/want/to/go`. Then run `git clone --recurse-submodules https://github.com/qmk/qmk_firmware`, this will create a new folder `qmk_firmware` as a subfolder of the current one. Once Git is installed, open the Git Bash command and change the directory to where you want to clone QMK; note that you have to use forward slashes, and that your c drive is accessed like this `/c/path/to/where/you/want/to/go`. Then run `git clone --recurse-submodules https://github.com/qmk/qmk_firmware`, this will create a new folder `qmk_firmware` as a subfolder of the current one.
### Toolchain Setup ### Toolchain Setup
The Toolchain setup is done through the Windows Subsystem for Linux, and the process is fully automated. If you want to do everything manually, there are no other instructions than the scripts themselves, but you can always open issues and ask for more information. The Toolchain setup is done through the Windows Subsystem for Linux, and the process is fully automated. If you want to do everything manually, there are no other instructions than the scripts themselves, but you can always open issues and ask for more information.
1. Open "Bash On Ubuntu On Windows" from the start menu. 1. Open "Bash On Ubuntu On Windows" from the start menu.
2. Go to the directory where you cloned `qmk_firmware`. Note that the paths start with `/mnt/` in the WSL, so you have to write for example `cd /mnt/c/path/to/qmk_firmware`. 2. Go to the directory where you cloned `qmk_firmware`. Note that the paths start with `/mnt/` in the WSL, so you have to write for example `cd /mnt/c/path/to/qmk_firmware`.
3. Run `util/wsl_install.sh` and follow the on-screen instructions. 3. Run `util/wsl_install.sh` and follow the on-screen instructions.
4. Close the Bash command window, and re-open it. 4. Close the Bash command window, and re-open it.
5. You are ready to compile and flash the firmware! 5. You are ready to compile and flash the firmware!

View file

@ -4,7 +4,7 @@ The full syntax of the `make` command is `<keyboard_folder>:<keymap>:<target>`,
* `<keyboard_folder>` is the path of the keyboard, for example `planck` * `<keyboard_folder>` is the path of the keyboard, for example `planck`
* Use `all` to compile all keyboards * Use `all` to compile all keyboards
* Specify the path to compile a revision, for example `planck/rev4` or `planck/rev3` * Specify the path to compile a revision, for example `planck/rev4` or `planck/rev3`
* If the keyboard doesn't have any folders, it can be left out * If the keyboard doesn't have any folders, it can be left out
* To compile the default folder, you can leave it out * To compile the default folder, you can leave it out
* `<keymap>` is the name of the keymap, for example `algernon` * `<keymap>` is the name of the keymap, for example `algernon`
@ -14,7 +14,7 @@ The full syntax of the `make` command is `<keyboard_folder>:<keymap>:<target>`,
The `<target>` means the following The `<target>` means the following
* If no target is given, then it's the same as `all` below * If no target is given, then it's the same as `all` below
* `all` compiles as many keyboard/revision/keymap combinations as specified. For example, `make planck/rev4:default` will generate a single .hex, while `make planck/rev4:all` will generate a hex for every keymap available to the planck. * `all` compiles as many keyboard/revision/keymap combinations as specified. For example, `make planck/rev4:default` will generate a single .hex, while `make planck/rev4:all` will generate a hex for every keymap available to the planck.
* `dfu`, `teensy` or `dfu-util`, compile and upload the firmware to the keyboard. If the compilation fails, then nothing will be uploaded. The programmer to use depends on the keyboard. For most keyboards it's `dfu`, but for ChibiOS keyboards you should use `dfu-util`, and `teensy` for standard Teensys. To find out which command you should use for your keyboard, check the keyboard specific readme. * `dfu`, `teensy` or `dfu-util`, compile and upload the firmware to the keyboard. If the compilation fails, then nothing will be uploaded. The programmer to use depends on the keyboard. For most keyboards it's `dfu`, but for ChibiOS keyboards you should use `dfu-util`, and `teensy` for standard Teensys. To find out which command you should use for your keyboard, check the keyboard specific readme.
* **Note**: some operating systems need root access for these commands to work, so in that case you need to run for example `sudo make planck/rev4:default:dfu`. * **Note**: some operating systems need root access for these commands to work, so in that case you need to run for example `sudo make planck/rev4:default:dfu`.
* `clean`, cleans the build output folders to make sure that everything is built from scratch. Run this before normal compilation if you have some unexplainable problems. * `clean`, cleans the build output folders to make sure that everything is built from scratch. Run this before normal compilation if you have some unexplainable problems.
@ -30,7 +30,7 @@ The make command itself also has some additional options, type `make --help` for
Here are some examples commands Here are some examples commands
* `make all:all` builds everything (all keyboard folders, all keymaps). Running just `make` from the `root` will also run this. * `make all:all` builds everything (all keyboard folders, all keymaps). Running just `make` from the `root` will also run this.
* `make ergodox_infinity:algernon:clean` will clean the build output of the Ergodox Infinity keyboard. * `make ergodox_infinity:algernon:clean` will clean the build output of the Ergodox Infinity keyboard.
* `make planck/rev4:default:dfu COLOR=false` builds and uploads the keymap without color output. * `make planck/rev4:default:dfu COLOR=false` builds and uploads the keymap without color output.
## `rules.mk` Options ## `rules.mk` Options
@ -53,9 +53,9 @@ This allows you to use the system and audio control key codes.
`CONSOLE_ENABLE` `CONSOLE_ENABLE`
This allows you to print messages that can be read using [`hid_listen`](https://www.pjrc.com/teensy/hid_listen.html). This allows you to print messages that can be read using [`hid_listen`](https://www.pjrc.com/teensy/hid_listen.html).
By default, all debug (*dprint*) print (*print*, *xprintf*), and user print (*uprint*) messages will be enabled. This will eat up a significant portion of the flash and may make the keyboard .hex file too big to program. By default, all debug (*dprint*) print (*print*, *xprintf*), and user print (*uprint*) messages will be enabled. This will eat up a significant portion of the flash and may make the keyboard .hex file too big to program.
To disable debug messages (*dprint*) and reduce the .hex file size, include `#define NO_DEBUG` in your `config.h` file. To disable debug messages (*dprint*) and reduce the .hex file size, include `#define NO_DEBUG` in your `config.h` file.
@ -65,7 +65,7 @@ To disable print messages (*print*, *xprintf*) and **KEEP** user print messages
To see the text, open `hid_listen` and enjoy looking at your printed messages. To see the text, open `hid_listen` and enjoy looking at your printed messages.
**NOTE:** Do not include *uprint* messages in anything other than your keymap code. It must not be used within the QMK system framework. Otherwise, you will bloat other people's .hex files. **NOTE:** Do not include *uprint* messages in anything other than your keymap code. It must not be used within the QMK system framework. Otherwise, you will bloat other people's .hex files.
Consumes about 400 bytes. Consumes about 400 bytes.

View file

@ -167,4 +167,4 @@ The USB Host is your computer, or whatever device your keyboard is plugged into.
# Couldn't Find the Term You're Looking For? # Couldn't Find the Term You're Looking For?
[Open an issue](https://github.com/qmk/qmk_firmware/issues) with your question and the term in question could be added here. Better still, open a pull request with the definition. :) [Open an issue](https://github.com/qmk/qmk_firmware/issues) with your question and the term in question could be added here. Better still, open a pull request with the definition. :)

View file

@ -133,7 +133,7 @@ Starting at the top-left switch, place the diode (with tweezers if you have them
│o │o
┌┴┐ o ┌┴┐ o
│ │ O │ │ O
├─┤ ├─┤
└┬┘ └┬┘
└───────────── └─────────────
``` ```
@ -150,7 +150,7 @@ When the first diode is complete, the next one will need to be soldered to both
│o │o │o │o
┌┴┐ o ┌┴┐ o ┌┴┐ o ┌┴┐ o
│ │ O │ │ O │ │ O │ │ O
├─┤ ├─┤ ├─┤ ├─┤
└┬┘ └┬┘ └┬┘ └┬┘
└────────────────┴───────────── └────────────────┴─────────────
``` ```

View file

@ -91,7 +91,7 @@ All key positions and rotations are specified in relation to the top-left corner
* `RY` * `RY`
* The absolute position of the point to rotate the key around in the vertical axis. Default: `y` * The absolute position of the point to rotate the key around in the vertical axis. Default: `y`
* `KS` * `KS`
* Key Shape: define a polygon by providing a list of points, in Key Units. * Key Shape: define a polygon by providing a list of points, in Key Units.
* **Important**: These are relative to the top-left of the key, not absolute. * **Important**: These are relative to the top-left of the key, not absolute.
* Example ISO Enter: `[ [0,0], [1.5,0], [1.5,2], [0.25,2], [0.25,1], [0,1], [0,0] ]` * Example ISO Enter: `[ [0,0], [1.5,0], [1.5,2], [0.25,2], [0.25,1], [0,1], [0,0] ]`

View file

@ -17,8 +17,8 @@ If you're having trouble flashing/erasing your board, and running into cryptic e
atmel.c:1434: Error flashing the block: err -2. atmel.c:1434: Error flashing the block: err -2.
ERROR ERROR
Memory write error, use debug for more info. Memory write error, use debug for more info.
commands.c:360: Error writing memory data. (err -4) commands.c:360: Error writing memory data. (err -4)
You're likely going to need to ISP flash your board/device to get it working again. Luckily, this process is pretty straight-forward, provided you have any extra programmable keyboard, Arduino, or Teensy 2.0/Teensy 2.0++. There are also dedicated ISP flashers available for this, but most cost >$15, and it's assumed that if you are googling this error, this is the first you've heard about ISP flashing, and don't have one readily available (whereas you might have some other AVR board). __We'll be using a Teensy 2.0 with Windows 10 in this guide__ - if you are comfortable doing this on another system, please consider editing this guide and contributing those instructions! You're likely going to need to ISP flash your board/device to get it working again. Luckily, this process is pretty straight-forward, provided you have any extra programmable keyboard, Arduino, or Teensy 2.0/Teensy 2.0++. There are also dedicated ISP flashers available for this, but most cost >$15, and it's assumed that if you are googling this error, this is the first you've heard about ISP flashing, and don't have one readily available (whereas you might have some other AVR board). __We'll be using a Teensy 2.0 with Windows 10 in this guide__ - if you are comfortable doing this on another system, please consider editing this guide and contributing those instructions!
## Software Needed ## Software Needed
@ -37,7 +37,7 @@ This is pretty straight-forward - we'll be connecting like-things to like-things
Flasher B3 <-> Keyboard B3 (MISO) Flasher B3 <-> Keyboard B3 (MISO)
Flasher VCC <-> Keyboard VCC Flasher VCC <-> Keyboard VCC
Flasher GND <-> Keyboard GND Flasher GND <-> Keyboard GND
## The ISP Firmware ## The ISP Firmware
Make sure your keyboard is unplugged from any device, and plug in your Teensy. Make sure your keyboard is unplugged from any device, and plug in your Teensy.
@ -51,20 +51,20 @@ Then scroll down until you see something that looks like this block of code:
// Configure which pins to use: // Configure which pins to use:
// The standard pin configuration. // The standard pin configuration.
#ifndef ARDUINO_HOODLOADER2 #ifndef ARDUINO_HOODLOADER2
#define RESET 0 // Use 0 (B0) instead of 10 #define RESET 0 // Use 0 (B0) instead of 10
#define LED_HB 11 // Use 11 (LED on the Teensy 2.0) #define LED_HB 11 // Use 11 (LED on the Teensy 2.0)
#define LED_ERR 8 // This won't be used unless you have an LED hooked-up to 8 (D3) #define LED_ERR 8 // This won't be used unless you have an LED hooked-up to 8 (D3)
#define LED_PMODE 7 // This won't be used unless you have an LED hooked-up to 7 (D2) #define LED_PMODE 7 // This won't be used unless you have an LED hooked-up to 7 (D2)
And make the changes in the last four lines. If you're using something besides the Teensy 2.0, you'll want to choose something else that makes sense for `LED_HB`. We define `RESET` as `0`/`B0` because that's what's close - if you want to use another pin for some reason, [you can use the pinouts to choose something else](https://www.pjrc.com/teensy/pinout.html).
Once you've made your changes, you can click the Upload button (right arrow), which will open up the Teensy flasher app - you'll need to press the reset button on the Teensy the first time, but after that, it's automatic (you shouldn't be flashing this more than once, though). Once flashed, the orange LED on the Teensy will flash on and off, indicating it's ready for some action. And make the changes in the last four lines. If you're using something besides the Teensy 2.0, you'll want to choose something else that makes sense for `LED_HB`. We define `RESET` as `0`/`B0` because that's what's close - if you want to use another pin for some reason, [you can use the pinouts to choose something else](https://www.pjrc.com/teensy/pinout.html).
Once you've made your changes, you can click the Upload button (right arrow), which will open up the Teensy flasher app - you'll need to press the reset button on the Teensy the first time, but after that, it's automatic (you shouldn't be flashing this more than once, though). Once flashed, the orange LED on the Teensy will flash on and off, indicating it's ready for some action.
## The `.hex` File ## The `.hex` File
Before flashing your firmware, you're going to need to and do a little preparation. We'll be appending [this bootloader (also a .hex file)](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_atmega32u4_1_0_0.hex) to the end of our firmware by opening the original .hex file in a text editor, and removing the last line, which should be `:00000001FF` (this is an EOF message). After that's been removed, copy the entire bootloader's contents and paste it at the end of the original file, and save it. Before flashing your firmware, you're going to need to and do a little preparation. We'll be appending [this bootloader (also a .hex file)](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_atmega32u4_1_0_0.hex) to the end of our firmware by opening the original .hex file in a text editor, and removing the last line, which should be `:00000001FF` (this is an EOF message). After that's been removed, copy the entire bootloader's contents and paste it at the end of the original file, and save it.
It's possible to use other bootloaders here in the same way, but __you need a bootloader__, otherwise you'll have to ISP to write new firmware to your keyboard. It's possible to use other bootloaders here in the same way, but __you need a bootloader__, otherwise you'll have to ISP to write new firmware to your keyboard.
@ -75,7 +75,7 @@ Make sure your keyboard is unplugged from any device, and plug in your Teensy.
Open `cmd` and navigate to your where your modified .hex file is. We'll pretend this file is called `main.hex`, and that your Teensy 2.0 is on the `COM3` port - if you're unsure, you can open your Device Manager, and look for `Ports > USB Serial Device`. Use that COM port here. You can confirm it's the right port with: Open `cmd` and navigate to your where your modified .hex file is. We'll pretend this file is called `main.hex`, and that your Teensy 2.0 is on the `COM3` port - if you're unsure, you can open your Device Manager, and look for `Ports > USB Serial Device`. Use that COM port here. You can confirm it's the right port with:
avrdude -c avrisp -P COM3 -p atmega32u4 avrdude -c avrisp -P COM3 -p atmega32u4
and you should get something like the following output: and you should get something like the following output:
avrdude: AVR device initialized and ready to accept instructions avrdude: AVR device initialized and ready to accept instructions
@ -90,8 +90,8 @@ and you should get something like the following output:
Since our keyboard uses an `atmega32u4` (common), that is the chip we'll specify. This is the full command: Since our keyboard uses an `atmega32u4` (common), that is the chip we'll specify. This is the full command:
avrdude -c avrisp -P COM3 -p atmega32u4 -U flash:w:main.hex:i avrdude -c avrisp -P COM3 -p atmega32u4 -U flash:w:main.hex:i
You should see a couple of progress bars, then you should see: You should see a couple of progress bars, then you should see:
avrdude: verifying ... avrdude: verifying ...
@ -100,7 +100,7 @@ You should see a couple of progress bars, then you should see:
avrdude: safemode: Fuses OK avrdude: safemode: Fuses OK
avrdude done. Thank you. avrdude done. Thank you.
Which means everything should be ok! Your board may restart automatically, otherwise, unplug your Teensy and plug in your keyboard - you can leave your Teensy wired to your keyboard while testing things, but it's recommended that you desolder it/remove the wiring once you're sure everything works. Which means everything should be ok! Your board may restart automatically, otherwise, unplug your Teensy and plug in your keyboard - you can leave your Teensy wired to your keyboard while testing things, but it's recommended that you desolder it/remove the wiring once you're sure everything works.
If you have any questions/problems, feel free to [open an issue](https://github.com/qmk/qmk_firmware/issues/new)! If you have any questions/problems, feel free to [open an issue](https://github.com/qmk/qmk_firmware/issues/new)!

View file

@ -183,7 +183,7 @@ KC_RSHIFT KC_RSFT E5 Keyboard RightShift
KC_RALT E6 Keyboard RightAlt KC_RALT E6 Keyboard RightAlt
KC_RGUI E7 Keyboard Right GUI(Windows/Apple/Meta key) KC_RGUI E7 Keyboard Right GUI(Windows/Apple/Meta key)
/* /*
* Virtual keycodes * Virtual keycodes
*/ */
/* System Control */ /* System Control */

View file

@ -1,6 +1,6 @@
# US ANSI Shifted Symbols # US ANSI Shifted Symbols
These keycodes correspond to characters that are "shifted" on a standard US ANSI keyboards. They do not have dedicated keycodes but are instead typed by holding down shift and then sending a keycode. These keycodes correspond to characters that are "shifted" on a standard US ANSI keyboards. They do not have dedicated keycodes but are instead typed by holding down shift and then sending a keycode.
It's important to remember that all of these keycodes send a left shift - this may cause unintended actions if unaccounted for. The short code is preferred in most situations. It's important to remember that all of these keycodes send a left shift - this may cause unintended actions if unaccounted for. The short code is preferred in most situations.

View file

@ -35,8 +35,8 @@ The state of the Keymap layer is determined by two 32 bit parameters:
Keymap layer '0' is usually `default_layer`, wither other layers initially off after booting up the firmware, although this can configured differently in `config.h`. It is useful to change `default_layer` when you completely switch a key layout, for example, if you want to switch to Colemak instead of Qwerty. Keymap layer '0' is usually `default_layer`, wither other layers initially off after booting up the firmware, although this can configured differently in `config.h`. It is useful to change `default_layer` when you completely switch a key layout, for example, if you want to switch to Colemak instead of Qwerty.
Initial state of Keymap Change base layout Initial state of Keymap Change base layout
----------------------- ------------------ ----------------------- ------------------
31 31 31 31
30 30 30 30
@ -98,7 +98,7 @@ At the top of the file you'll find this:
// Each layer gets a name for readability. // Each layer gets a name for readability.
// The underscores don't mean anything - you can // The underscores don't mean anything - you can
// have a layer called STUFF or any other name. // have a layer called STUFF or any other name.
// Layer names don't all need to be of the same // Layer names don't all need to be of the same
// length, and you can also skip them entirely // length, and you can also skip them entirely
// and just use numbers. // and just use numbers.
#define _BL 0 #define _BL 0
@ -113,9 +113,9 @@ The main part of this file is the `keymaps[]` definition. This is where you list
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
After this you'll find a list of KEYMAP() macros. A KEYMAP() is simply a list of keys to define a single layer. Typically you'll have one or more "base layers" (such as QWERTY, Dvorak, or Colemak) and then you'll layer on top of that one or more "function" layers. Due to the way layers are processed you can't overlay a "lower" layer on top of a "higher" layer. After this you'll find a list of KEYMAP() macros. A KEYMAP() is simply a list of keys to define a single layer. Typically you'll have one or more "base layers" (such as QWERTY, Dvorak, or Colemak) and then you'll layer on top of that one or more "function" layers. Due to the way layers are processed you can't overlay a "lower" layer on top of a "higher" layer.
`keymaps[][MATRIX_ROWS][MATRIX_COLS]` in QMK holds the 16 bit action code (sometimes referred as the quantum keycode) in it. For the keycode representing typical keys, its high byte is 0 and its low byte is the USB HID usage ID for keyboard. `keymaps[][MATRIX_ROWS][MATRIX_COLS]` in QMK holds the 16 bit action code (sometimes referred as the quantum keycode) in it. For the keycode representing typical keys, its high byte is 0 and its low byte is the USB HID usage ID for keyboard.
> TMK from which QMK was forked uses `const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS]` instead and holds the 8 bit keycode. Some keycode values are reserved to induce execution of certain action codes via the `fn_actions[]` array. > TMK from which QMK was forked uses `const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS]` instead and holds the 8 bit keycode. Some keycode values are reserved to induce execution of certain action codes via the `fn_actions[]` array.
@ -153,11 +153,11 @@ Our function layer is, from a code point of view, no different from the base lay
Some interesting things to note: Some interesting things to note:
* We have used our `_______` definition to turn `KC_TRNS` into `_______`. This makes it easier to spot the keys that have changed on this layer. * We have used our `_______` definition to turn `KC_TRNS` into `_______`. This makes it easier to spot the keys that have changed on this layer.
* While in this layer if you press one of the `_______` keys it will activate the key in the next lowest active layer. * While in this layer if you press one of the `_______` keys it will activate the key in the next lowest active layer.
### Custom Functions ### Custom Functions
At the bottom of the file we've defined a single custom function. This function defines a key that sends `KC_ESC` when pressed without modifiers and `KC_GRAVE` when modifiers are held. There are a couple pieces that need to be in place for this to work, and we will go over both of them. At the bottom of the file we've defined a single custom function. This function defines a key that sends `KC_ESC` when pressed without modifiers and `KC_GRAVE` when modifiers are held. There are a couple pieces that need to be in place for this to work, and we will go over both of them.
#### `fn_actions[]` #### `fn_actions[]`

View file

@ -21,7 +21,7 @@ MCUSR MCU Status Register
SMCR Sleep Mode Control Register SMCR Sleep Mode Control Register
SE Sleep Enable SE Sleep Enable
SM2:0 SM2:0
#define set_sleep_mode(mode) \ #define set_sleep_mode(mode) \
#define SLEEP_MODE_IDLE (0) #define SLEEP_MODE_IDLE (0)
#define SLEEP_MODE_ADC _BV(SM0) #define SLEEP_MODE_ADC _BV(SM0)

View file

@ -2,7 +2,7 @@
Quantum keycodes allow for easier customisation of your keymap than the basic ones provide, without having to define custom actions. Quantum keycodes allow for easier customisation of your keymap than the basic ones provide, without having to define custom actions.
All keycodes within quantum are numbers between `0x0000` and `0xFFFF`. Within your `keymap.c` it may look like you have functions and other special cases, but ultimately the C preprocessor will translate those into a single 4 byte integer. QMK has reserved `0x0000` through `0x00FF` for standard keycodes. These are keycodes such as `KC_A`, `KC_1`, and `KC_LCTL`, which are basic keys defined in the USB HID specification. All keycodes within quantum are numbers between `0x0000` and `0xFFFF`. Within your `keymap.c` it may look like you have functions and other special cases, but ultimately the C preprocessor will translate those into a single 4 byte integer. QMK has reserved `0x0000` through `0x00FF` for standard keycodes. These are keycodes such as `KC_A`, `KC_1`, and `KC_LCTL`, which are basic keys defined in the USB HID specification.
On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are used to implement advanced quantum features. If you define your own custom keycodes they will be put into this range as well. On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are used to implement advanced quantum features. If you define your own custom keycodes they will be put into this range as well.

View file

@ -94,11 +94,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
} }
``` ```
Notice how all of these arguments match up with the first half of the `KEYMAP()` macro from the last section? This is how we take a keycode and map it to our Matrix Scan from earlier. Notice how all of these arguments match up with the first half of the `KEYMAP()` macro from the last section? This is how we take a keycode and map it to our Matrix Scan from earlier.
##### State Change Detection ##### State Change Detection
The matrix scanning described above tells us the state of the matrix at a given moment, but your computer only wants to know about changes, it doesn't care about the current state. QMK stores the results from the last matrix scan and compares the results from this matrix to determine when a key has been pressed or released. The matrix scanning described above tells us the state of the matrix at a given moment, but your computer only wants to know about changes, it doesn't care about the current state. QMK stores the results from the last matrix scan and compares the results from this matrix to determine when a key has been pressed or released.
Let's look at an example. We'll hop into the middle of a keyboard scanning loop to find that our previous scan looks like this: Let's look at an example. We'll hop into the middle of a keyboard scanning loop to find that our previous scan looks like this:
@ -150,7 +150,7 @@ The `process_record()` function itself is deceptively simple, but hidden within
* [`bool process_auto_shift(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_auto_shift.c#L47) * [`bool process_auto_shift(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_auto_shift.c#L47)
* [`bool process_unicode_map(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicodemap.c#L47) * [`bool process_unicode_map(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicodemap.c#L47)
* [Identify and process quantum specific keycodes](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L211) * [Identify and process quantum specific keycodes](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L211)
At any step during this chain of events a function (such as `process_record_kb()`) can `return false` to halt all further processing. At any step during this chain of events a function (such as `process_record_kb()`) can `return false` to halt all further processing.
<!-- <!--

View file

@ -52,7 +52,7 @@ In that model you would emulate the input, and expect a certain output from the
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. 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. 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 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 ```c