From d5244c6cf4939301b18ecf07650df6a6f9800e07 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Thu, 29 Jun 2017 00:15:07 -0400 Subject: restructure keycode docs --- docs/quantum_keycodes.md | 274 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 274 insertions(+) create mode 100644 docs/quantum_keycodes.md (limited to 'docs/quantum_keycodes.md') diff --git a/docs/quantum_keycodes.md b/docs/quantum_keycodes.md new file mode 100644 index 0000000000..81eb647017 --- /dev/null +++ b/docs/quantum_keycodes.md @@ -0,0 +1,274 @@ +# Quantum Keycodes + +Something important to realise with keycodes is that they are all numbers between `0x0` and `0xFFFF` - even though they may look like functions, words, or phrases, they are all shortcuts to some number. This allows us to define all of what they do in different places, and store keymaps in a relatively small place (arrays). If you try to "call" a keycode by placing it somewhere besides a keymap, it may compile, but it won't do anything useful. + +All keycodes on this page have a value above `0xFF` (values less are considered the [basic keycodes](basic_keycodes.md)) and won't work with any of the mod/layer-tap keys listed at the bottom. + +* `SAFE_RANGE` is always the last keycode in the quantum list, and where custom lists can begin +* `RESET` puts the keyboard into DFU mode for flashing +* `DEBUG` toggles debug mode +* Shortcuts for bootmagic options (work when bootmagic is off) + * `MAGIC_SWAP_CONTROL_CAPSLOCK` + * `MAGIC_CAPSLOCK_TO_CONTROL` + * `MAGIC_SWAP_LALT_LGUI` + * `MAGIC_SWAP_RALT_RGUI` + * `MAGIC_NO_GUI` + * `MAGIC_SWAP_GRAVE_ESC` + * `MAGIC_SWAP_BACKSLASH_BACKSPACE` + * `MAGIC_HOST_NKRO` + * `MAGIC_SWAP_ALT_GUI`/`AG_SWAP` + * `MAGIC_UNSWAP_CONTROL_CAPSLOCK` + * `MAGIC_UNCAPSLOCK_TO_CONTROL` + * `MAGIC_UNSWAP_LALT_LGUI` + * `MAGIC_UNSWAP_RALT_RGUI` + * `MAGIC_UNNO_GUI` + * `MAGIC_UNSWAP_GRAVE_ESC` + * `MAGIC_UNSWAP_BACKSLASH_BACKSPACE` + * `MAGIC_UNHOST_NKRO` + * `MAGIC_UNSWAP_ALT_GUI`/`AG_NORM` + * `MAGIC_TOGGLE_NKRO` +* `KC_GESC`/`GRAVE_ESC` acts as escape when pressed normally but when pressed with a mod will send a `~` +* `KC_LSPO` left shift when held, open paranthesis when tapped +* `KC_RSPC` right shift when held, close paranthesis when tapped +* `KC_LEAD` the leader key + +* `FUNC(n)`/`F(n)` to call `fn_action` n +* `M(n)` to call macro n +* `MACROTAP(n)` to macro-tap n idk FIXME + +## Audio + +```c +#ifdef AUDIO_ENABLE + AU_ON, + AU_OFF, + AU_TOG, + + #ifdef FAUXCLICKY_ENABLE + FC_ON, + FC_OFF, + FC_TOG, + #endif + + // Music mode on/off/toggle + MU_ON, + MU_OFF, + MU_TOG, + + // Music voice iterate + MUV_IN, + MUV_DE, +#endif +``` + +## Midi + +#if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) + MI_ON, // send midi notes when music mode is enabled + MI_OFF, // don't send midi notes when music mode is enabled +#endif + +MIDI_TONE_MIN, +MIDI_TONE_MAX + +MI_C = MIDI_TONE_MIN, +MI_Cs, +MI_Db = MI_Cs, +MI_D, +MI_Ds, +MI_Eb = MI_Ds, +MI_E, +MI_F, +MI_Fs, +MI_Gb = MI_Fs, +MI_G, +MI_Gs, +MI_Ab = MI_Gs, +MI_A, +MI_As, +MI_Bb = MI_As, +MI_B, + +MIDI_TONE_KEYCODE_OCTAVES > 1 + +where x = 1-5: +MI_C_x, +MI_Cs_x, +MI_Db_x = MI_Cs_x, +MI_D_x, +MI_Ds_x, +MI_Eb_x = MI_Ds_x, +MI_E_x, +MI_F_x, +MI_Fs_x, +MI_Gb_x = MI_Fs_x, +MI_G_x, +MI_Gs_x, +MI_Ab_x = MI_Gs_x, +MI_A_x, +MI_As_x, +MI_Bb_x = MI_As_x, +MI_B_x, + +MI_OCT_Nx 1-2 +MI_OCT_x 0-7 +MIDI_OCTAVE_MIN = MI_OCT_N2, +MIDI_OCTAVE_MAX = MI_OCT_7, +MI_OCTD, // octave down +MI_OCTU, // octave up + +MI_TRNS_Nx 1-6 +MI_TRNS_x 0-6 +MIDI_TRANSPOSE_MIN = MI_TRNS_N6, +MIDI_TRANSPOSE_MAX = MI_TRNS_6, +MI_TRNSD, // transpose down +MI_TRNSU, // transpose up + +MI_VEL_x 1-10 +MIDI_VELOCITY_MIN = MI_VEL_1, +MIDI_VELOCITY_MAX = MI_VEL_10, +MI_VELD, // velocity down +MI_VELU, // velocity up + +MI_CHx 1-16 +MIDI_CHANNEL_MIN = MI_CH1 +MIDI_CHANNEL_MAX = MI_CH16, +MI_CHD, // previous channel +MI_CHU, // next channel + +MI_ALLOFF, // all notes off + +MI_SUS, // sustain +MI_PORT, // portamento +MI_SOST, // sostenuto +MI_SOFT, // soft pedal +MI_LEG, // legato + +MI_MOD, // modulation +MI_MODSD, // decrease modulation speed +MI_MODSU, // increase modulation speed +#endif // MIDI_ADVANCED + +## Backlight + +* `BL_x` where x = 0-15 +* `BL_ON = BL_9` +* `BL_OFF = BL_0` +* `BL_DEC` +* `BL_INC` +* `BL_TOGG` +* `BL_STEP` + +## RGB WS2818 LEDs + +* `RGB_TOG` toggle on/off +* `RGB_MOD` cycle between modes +* `RGB_HUI` hue increase +* `RGB_HUD` hue decrease +* `RGB_SAI` saturation increase +* `RGB_SAD` saturation decrease +* `RGB_VAI` value increase +* `RGB_VAD` value decrease + +## Thermal Printer (experimental) + +* `PRINT_ON` +* `PRINT_OFF` + +## Keyboard output selection + +* `OUT_AUTO` auto mode +* `OUT_USB` usb only +* `OUT_BT` bluetooth (when `BLUETOOTH_ENABLE`) + +## Modifiers + +* `KC_HYPR` LCTL + LSFT + LALT + LGUI - `MOD_HYPR` is the bit version +* `KC_MEH` LCTL + LSFT + LALT - `MOD_MEH` is the bit version + +### Modifiers with keys + +* `LCTL(kc)` LCTL + kc +* `LSFT(kc)`/`S(kc)` LSFT + kc +* `LALT(kc)` LALT + kc +* `LGUI(kc)` LGUI + kc +* `RCTL(kc)` RCTL + kc +* `RSFT(kc)` RSFT + kc +* `RALT(kc)` RALT + kc +* `RGUI(kc)` RGUI + kc + +* `HYPR(kc)` LCTL + LSFT + LALT + LGUI + kc +* `MEH(kc)` LCTL + LSFT + LALT + kc +* `LCAG(kc)` LCTL + LALT + LGUI + kc +* `ALTG(kc)` RCTL + RALT + kc +* `SCMD(kc)`/`SWIN(kc)` LGUI + LSFT + kc +* `LCA(kc)` LCTL + LALT + kc + +* `OSM(mod)` use mod for one keypress - use mod bits with this + +> Mod bits are the 4-letter part of the keycode prefixed with `MOD_`, e.g. `MOD_LCTL` + +### Mod-tap keys + +These keycodes will press the mod(s) when held, and the key when tapped. They only work with [basic keycodes](basic_keycodes.md). + +* `CTL_T(kc)`/`LCTL_T(kc)` LCTL when held, kc when tapped +* `RCTL_T(kc)` RCTL when held, kc when tapped + +* `SFT_T(kc)`/`LSFT_T(kc)` LSFT when held, kc when tapped +* `RSFT_T(kc)` RSFT when held, kc when tapped + +* `ALT_T(kc)`/`LALT_T(kc)` LALT when held, kc when tapped +* `RALT_T(kc)`/`ALGR_T(kc)` RALT when held, kc when tapped + +* `GUI_T(kc)`/`LGUI_T(kc)` LGUI when held, kc when tapped +* `RGUI_T(kc)` RGUI when held, kc when tapped + +* `C_S_T(kc)` LCTL + LSFT when held, kc when tapped +* `MEH_T(kc)` LCTL + LSFT + LALT when held, kc when tapped +* `LCAG_T(kc)` LCTL + LALT + LGUI when held, kc when tapped +* `RCAG_T(kc)` RCTL + RALT + RGUI when held, kc when tapped +* `ALL_T(kc)` LCTL + LSFT + LALT + LGUI when held, kc tapped [more info](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/) +* `SCMD_T(kc)`/`SWIN_T(kc)` LGUI + LSFT when held, kc when tapped +* `LCA_T(kc)` LCTL + LALT when held, kc when tapped + +## Shifted symbols + +It's important to remember that all of the keycodes also send a left shift - this may cause unintended actions if unaccounted for. The 4-letter code is preferred in most situations. + +* `KC_TILD`/`KC_TILDE` tilde `~` +* `KC_EXLM`/`KC_EXCLAIM` exclamation mark `!` +* `KC_AT` at sign `@` +* `KC_HASH` hash sign `#` +* `KC_DLR`/`KC_DOLLAR` dollar sign `$` +* `KC_PERC`/`KC_PERCENT` percent sign `%` +* `KC_CIRC`/`KC_CIRCUMFLEX` circumflex `^` +* `KC_AMPR`/`KC_AMPERSAND` ampersand `&` +* `KC_ASTR`/`KC_ASTERISK` asterisk `*` +* `KC_LPRN`/`KC_LEFT_PAREN` left parenthesis `(` +* `KC_RPRN`/`KC_RIGHT_PAREN` right parenthesis `)` +* `KC_UNDS`/`KC_UNDERSCORE` underscore `_` +* `KC_PLUS` plus sign `+` +* `KC_LCBR`/`KC_LEFT_CURLY_BRACE` left curly brace `{` +* `KC_RCBR`/`KC_RIGHT_CURLY_BRACE` right curly brace `}` +* `KC_LT`/`KC_LABK`/`KC_LEFT_ANGLE_BRACKET` left angle bracket `<` +* `KC_GT`/`KC_RABK`/`KC_RIGHT_ANGLE_BRACKET` right angle bracket `>` +* `KC_COLN`/`KC_COLON` colon `:` +* `KC_PIPE` pipe `|` +* `KC_QUES`/`KC_QUESTION` question mark `?` +* `KC_DQT`/`KC_DOUBLE_QUOTE`/`KC_DQUO` double quote `"` + +## Layer adjustments + +* `LT(layer, kc)` turn on layer (0-15) when held, kc ([basic keycodes](basic_keycodes.md)) when tapped +* `TO(layer)` turn on layer when depressed +* `MO(layer)` momentarily turn on layer when depressed (requires `KC_TRNS` on destination layer) +* `DF(layer)` sets the base (default) layer +* `TG(layer)` toggle layer on/off +* `OSL(layer)` switch to layer for one keycode +* `TT(layer)` tap toggle? idk FIXME + +## Unicode + +* `UNICODE(n)`/`UC(n)` if `UNICODE_ENABLE`, this will send characters up to `0x7FFF` +* `X(n)` if `UNICODEMAP_ENABLE`, also sends unicode via a different method \ No newline at end of file -- cgit v1.2.3 From 910d32c07e5d130bbe59abe11be5459b2381f011 Mon Sep 17 00:00:00 2001 From: skullY Date: Wed, 28 Jun 2017 23:52:08 -0700 Subject: Flesh out the quantum_keycodes documentation --- docs/quantum_keycodes.md | 357 ++++++++++++++++++++++++++++------------------- 1 file changed, 216 insertions(+), 141 deletions(-) (limited to 'docs/quantum_keycodes.md') diff --git a/docs/quantum_keycodes.md b/docs/quantum_keycodes.md index 81eb647017..e9edad03ed 100644 --- a/docs/quantum_keycodes.md +++ b/docs/quantum_keycodes.md @@ -1,42 +1,50 @@ # Quantum Keycodes -Something important to realise with keycodes is that they are all numbers between `0x0` and `0xFFFF` - even though they may look like functions, words, or phrases, they are all shortcuts to some number. This allows us to define all of what they do in different places, and store keymaps in a relatively small place (arrays). If you try to "call" a keycode by placing it somewhere besides a keymap, it may compile, but it won't do anything useful. - -All keycodes on this page have a value above `0xFF` (values less are considered the [basic keycodes](basic_keycodes.md)) and won't work with any of the mod/layer-tap keys listed at the bottom. - -* `SAFE_RANGE` is always the last keycode in the quantum list, and where custom lists can begin -* `RESET` puts the keyboard into DFU mode for flashing -* `DEBUG` toggles debug mode -* Shortcuts for bootmagic options (work when bootmagic is off) - * `MAGIC_SWAP_CONTROL_CAPSLOCK` - * `MAGIC_CAPSLOCK_TO_CONTROL` - * `MAGIC_SWAP_LALT_LGUI` - * `MAGIC_SWAP_RALT_RGUI` - * `MAGIC_NO_GUI` - * `MAGIC_SWAP_GRAVE_ESC` - * `MAGIC_SWAP_BACKSLASH_BACKSPACE` - * `MAGIC_HOST_NKRO` - * `MAGIC_SWAP_ALT_GUI`/`AG_SWAP` - * `MAGIC_UNSWAP_CONTROL_CAPSLOCK` - * `MAGIC_UNCAPSLOCK_TO_CONTROL` - * `MAGIC_UNSWAP_LALT_LGUI` - * `MAGIC_UNSWAP_RALT_RGUI` - * `MAGIC_UNNO_GUI` - * `MAGIC_UNSWAP_GRAVE_ESC` - * `MAGIC_UNSWAP_BACKSLASH_BACKSPACE` - * `MAGIC_UNHOST_NKRO` - * `MAGIC_UNSWAP_ALT_GUI`/`AG_NORM` - * `MAGIC_TOGGLE_NKRO` -* `KC_GESC`/`GRAVE_ESC` acts as escape when pressed normally but when pressed with a mod will send a `~` -* `KC_LSPO` left shift when held, open paranthesis when tapped -* `KC_RSPC` right shift when held, close paranthesis when tapped -* `KC_LEAD` the leader key - -* `FUNC(n)`/`F(n)` to call `fn_action` n -* `M(n)` to call macro n -* `MACROTAP(n)` to macro-tap n idk FIXME - -## Audio +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. Keycodes above `0x00FF` may not be used with any of the mod/layer-tap keys listed + +# Quantum keycodes + +|Name|Description| +|----|-----------| +|`RESET`|Put the keyboard into DFU mode for flashing| +|`DEBUG`|Toggles debug mode| +|`KC_GESC`/`GRAVE_ESC`|Acts as escape when pressed normally but when pressed with Shift or GUI will send a `~`| +|`KC_LSPO`|Left shift when held, open paranthesis when tapped| +|`KC_RSPC`|Right shift when held, close paranthesis when tapped| +|`KC_LEAD`|The [leader key](leader_key.md)| +|`FUNC(n)`/`F(n)`|Call `fn_action(n)`| +|`M(n)`|to call macro n| +|`MACROTAP(n)`|to macro-tap n idk FIXME| + +# Bootmagic Keycodes + +Shortcuts for bootmagic options (these work even when bootmagic is off.) + +|Name|Description| +|----|-----------| +|`MAGIC_SWAP_CONTROL_CAPSLOCK`|Swap Capslock and Left Control| +|`MAGIC_CAPSLOCK_TO_CONTROL`|Treat Capslock like a Control Key| +|`MAGIC_SWAP_LALT_LGUI`|Swap the left Alt and GUI keys| +|`MAGIC_SWAP_RALT_RGUI`|Swap the right Alt and GUI keys| +|`MAGIC_NO_GUI`|Disable the GUI key| +|`MAGIC_SWAP_GRAVE_ESC`|Swap the Grave and Esc key.| +|`MAGIC_SWAP_BACKSLASH_BACKSPACE`|Swap backslack and backspace| +|`MAGIC_HOST_NKRO`|Force NKRO on| +|`MAGIC_SWAP_ALT_GUI`/`AG_SWAP`|Swap Alt and Gui on both sides| +|`MAGIC_UNSWAP_CONTROL_CAPSLOCK`|Disable the Control/Capslock swap| +|`MAGIC_UNCAPSLOCK_TO_CONTROL`|Disable treating Capslock like Control | +|`MAGIC_UNSWAP_LALT_LGUI`|Disable Left Alt and GUI switching| +|`MAGIC_UNSWAP_RALT_RGUI`|Disable Right Alt and GUI switching| +|`MAGIC_UNNO_GUI`|Enable the GUI key | +|`MAGIC_UNSWAP_GRAVE_ESC`|Disable the Grave/Esc swap | +|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`|Disable the backslash/backspace swap| +|`MAGIC_UNHOST_NKRO`|Force NKRO off| +|`MAGIC_UNSWAP_ALT_GUI`/`AG_NORM`|Disable the Alt/GUI switching| +|`MAGIC_TOGGLE_NKRO`|Turn NKRO on or off| + +# Audio ```c #ifdef AUDIO_ENABLE @@ -126,7 +134,7 @@ MI_TRNSU, // transpose up MI_VEL_x 1-10 MIDI_VELOCITY_MIN = MI_VEL_1, -MIDI_VELOCITY_MAX = MI_VEL_10, +MIDI_VELOCITY_MAX = MI_VEL_9, MI_VELD, // velocity down MI_VELU, // velocity up @@ -149,126 +157,193 @@ MI_MODSD, // decrease modulation speed MI_MODSU, // increase modulation speed #endif // MIDI_ADVANCED -## Backlight +# Backlight -* `BL_x` where x = 0-15 -* `BL_ON = BL_9` -* `BL_OFF = BL_0` -* `BL_DEC` -* `BL_INC` -* `BL_TOGG` -* `BL_STEP` +These keycodes control the backlight. Most keyboards use this for single color in-switch lighting. -## RGB WS2818 LEDs +|Name|Description| +|----|-----------| +|`BL_x`|Set a specific backlight level between 0-9| +|`BL_ON`|An alias for `BL_9`| +|`BL_OFF`|An alias for `BL_0`| +|`BL_DEC`|Turn the backlight level down by 1| +|`BL_INC`|Turn the backlight level up by 1| +|`BL_TOGG`|Toggle the backlight on or off| +|`BL_STEP`|Step through backlight levels, wrapping around to 0 when you reach the top.| -* `RGB_TOG` toggle on/off -* `RGB_MOD` cycle between modes -* `RGB_HUI` hue increase -* `RGB_HUD` hue decrease -* `RGB_SAI` saturation increase -* `RGB_SAD` saturation decrease -* `RGB_VAI` value increase -* `RGB_VAD` value decrease +# RGBLIGHT WS2818 LEDs + +This controls the `RGBLIGHT` functionality. Most keyboards use WS2812 (and compatible) LEDs for underlight or case lighting. + +|Name|Description| +|----|-----------| +|`RGB_TOG`|toggle on/off| +|`RGB_MOD`|cycle through modes| +|`RGB_HUI`|hue increase| +|`RGB_HUD`|hue decrease| +|`RGB_SAI`|saturation increase| +|`RGB_SAD`|saturation decrease| +|`RGB_VAI`|value increase| +|`RGB_VAD`|value decrease| ## Thermal Printer (experimental) -* `PRINT_ON` -* `PRINT_OFF` +|Name|Description| +|----|-----------| +|`PRINT_ON`|Start printing everything the user types| +|`PRINT_OFF`|Stop printing everything the user types| ## Keyboard output selection -* `OUT_AUTO` auto mode -* `OUT_USB` usb only -* `OUT_BT` bluetooth (when `BLUETOOTH_ENABLE`) +This is used when multiple keyboard outputs can be selected. Currently this only allows for switching between USB and Bluetooth on keyboards that support both. + +|Name|Description| +|----|-----------| +|`OUT_AUTO`|auto mode| +|`OUT_USB`|usb only| +|`OUT_BT`|bluetooth (when `BLUETOOTH_ENABLE`)| + +# Modifiers -## Modifiers +These are special keycodes that simulate pressing several modifiers at once. -* `KC_HYPR` LCTL + LSFT + LALT + LGUI - `MOD_HYPR` is the bit version -* `KC_MEH` LCTL + LSFT + LALT - `MOD_MEH` is the bit version +|Name|Description| +|----|-----------| +|`KC_HYPR`|Hold down LCTL + LSFT + LALT + LGUI| +|`KC_MEH`|Hold down LCTL + LSFT + LALT| -### Modifiers with keys +/* FIXME: Should we have these in QMK too? + * |`KC_LCAG`|`LCTL` + `LALT` + `LGUI`| + * |`KC_ALTG`|`RCTL` + `RALT`| + * |`KC_SCMD`/`KC_SWIN`|`LGUI` + `LSFT`| + * |`KC_LCA`|`LCTL` + `LALT`| + */ -* `LCTL(kc)` LCTL + kc -* `LSFT(kc)`/`S(kc)` LSFT + kc -* `LALT(kc)` LALT + kc -* `LGUI(kc)` LGUI + kc -* `RCTL(kc)` RCTL + kc -* `RSFT(kc)` RSFT + kc -* `RALT(kc)` RALT + kc -* `RGUI(kc)` RGUI + kc +## Modifiers with keys -* `HYPR(kc)` LCTL + LSFT + LALT + LGUI + kc -* `MEH(kc)` LCTL + LSFT + LALT + kc -* `LCAG(kc)` LCTL + LALT + LGUI + kc -* `ALTG(kc)` RCTL + RALT + kc -* `SCMD(kc)`/`SWIN(kc)` LGUI + LSFT + kc -* `LCA(kc)` LCTL + LALT + kc +|Name|Description| +|----|-----------| +|`LCTL(kc)`|`LCTL` + `kc`| +|`LSFT(kc)`/`S(kc)`|`LSFT` + `kc`| +|`LALT(kc)`|`LALT` + `kc`| +|`LGUI(kc)`|`LGUI` + `kc`| +|`RCTL(kc)`|`RCTL` + `kc`| +|`RSFT(kc)`|`RSFT` + `kc`| +|`RALT(kc)`|`RALT` + `kc`| +|`RGUI(kc)`|`RGUI` + `kc`| +|`HYPR(kc)`|`LCTL` + `LSFT` + `LALT` + `LGUI` + `kc`| +|`MEH(kc)`|`LCTL` + `LSFT` + `LALT` + `kc`| +|`LCAG(kc)`|`LCTL` + `LALT` + `LGUI` + `kc`| +|`ALTG(kc)`|`RCTL` + `RALT` + `kc`| +|`SCMD(kc)`/`SWIN(kc)`|`LGUI` + `LSFT` + `kc`| +|`LCA(kc)`|`LCTL` + `LALT` + `kc`| -* `OSM(mod)` use mod for one keypress - use mod bits with this +## One Shot Keys -> Mod bits are the 4-letter part of the keycode prefixed with `MOD_`, e.g. `MOD_LCTL` +Most modifiers work by being held down while you push another key. You can use `OSM()` to setup a "One Shot" modifier. When you tap a one shot mod it will remain is a pressed state until you press another key. -### Mod-tap keys +To specify a your modifier you need to pass the `MOD` form of the key. For example, if you want to setup a One Shot Control you would use `OSM(MOD_LCTL)`. + +|Name|Description| +|----|-----------| +|`OSM(mod)`|use mod for one keypress| +|`OSL(layer)`|switch to layer for one keypress| + +## Mod-tap keys These keycodes will press the mod(s) when held, and the key when tapped. They only work with [basic keycodes](basic_keycodes.md). -* `CTL_T(kc)`/`LCTL_T(kc)` LCTL when held, kc when tapped -* `RCTL_T(kc)` RCTL when held, kc when tapped - -* `SFT_T(kc)`/`LSFT_T(kc)` LSFT when held, kc when tapped -* `RSFT_T(kc)` RSFT when held, kc when tapped - -* `ALT_T(kc)`/`LALT_T(kc)` LALT when held, kc when tapped -* `RALT_T(kc)`/`ALGR_T(kc)` RALT when held, kc when tapped - -* `GUI_T(kc)`/`LGUI_T(kc)` LGUI when held, kc when tapped -* `RGUI_T(kc)` RGUI when held, kc when tapped - -* `C_S_T(kc)` LCTL + LSFT when held, kc when tapped -* `MEH_T(kc)` LCTL + LSFT + LALT when held, kc when tapped -* `LCAG_T(kc)` LCTL + LALT + LGUI when held, kc when tapped -* `RCAG_T(kc)` RCTL + RALT + RGUI when held, kc when tapped -* `ALL_T(kc)` LCTL + LSFT + LALT + LGUI when held, kc tapped [more info](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/) -* `SCMD_T(kc)`/`SWIN_T(kc)` LGUI + LSFT when held, kc when tapped -* `LCA_T(kc)` LCTL + LALT when held, kc when tapped - -## Shifted symbols - -It's important to remember that all of the keycodes also send a left shift - this may cause unintended actions if unaccounted for. The 4-letter code is preferred in most situations. - -* `KC_TILD`/`KC_TILDE` tilde `~` -* `KC_EXLM`/`KC_EXCLAIM` exclamation mark `!` -* `KC_AT` at sign `@` -* `KC_HASH` hash sign `#` -* `KC_DLR`/`KC_DOLLAR` dollar sign `$` -* `KC_PERC`/`KC_PERCENT` percent sign `%` -* `KC_CIRC`/`KC_CIRCUMFLEX` circumflex `^` -* `KC_AMPR`/`KC_AMPERSAND` ampersand `&` -* `KC_ASTR`/`KC_ASTERISK` asterisk `*` -* `KC_LPRN`/`KC_LEFT_PAREN` left parenthesis `(` -* `KC_RPRN`/`KC_RIGHT_PAREN` right parenthesis `)` -* `KC_UNDS`/`KC_UNDERSCORE` underscore `_` -* `KC_PLUS` plus sign `+` -* `KC_LCBR`/`KC_LEFT_CURLY_BRACE` left curly brace `{` -* `KC_RCBR`/`KC_RIGHT_CURLY_BRACE` right curly brace `}` -* `KC_LT`/`KC_LABK`/`KC_LEFT_ANGLE_BRACKET` left angle bracket `<` -* `KC_GT`/`KC_RABK`/`KC_RIGHT_ANGLE_BRACKET` right angle bracket `>` -* `KC_COLN`/`KC_COLON` colon `:` -* `KC_PIPE` pipe `|` -* `KC_QUES`/`KC_QUESTION` question mark `?` -* `KC_DQT`/`KC_DOUBLE_QUOTE`/`KC_DQUO` double quote `"` - -## Layer adjustments - -* `LT(layer, kc)` turn on layer (0-15) when held, kc ([basic keycodes](basic_keycodes.md)) when tapped -* `TO(layer)` turn on layer when depressed -* `MO(layer)` momentarily turn on layer when depressed (requires `KC_TRNS` on destination layer) -* `DF(layer)` sets the base (default) layer -* `TG(layer)` toggle layer on/off -* `OSL(layer)` switch to layer for one keycode -* `TT(layer)` tap toggle? idk FIXME - -## Unicode - -* `UNICODE(n)`/`UC(n)` if `UNICODE_ENABLE`, this will send characters up to `0x7FFF` -* `X(n)` if `UNICODEMAP_ENABLE`, also sends unicode via a different method \ No newline at end of file +|Name|Description| +|----|-----------| +|`CTL_T(kc)`/`LCTL_T(kc)`|`LCTL` when held, `kc` when tapped| +|`RCTL_T(kc)`|`RCTL` when held, `kc` when tapped| +|`SFT_T(kc)`/`LSFT_T(kc)`|`LSFT` when held, `kc` when tapped| +|`RSFT_T(kc)`|`RSFT` when held, `kc` when tapped| +|`ALT_T(kc)`/`LALT_T(kc)`|`LALT` when held, `kc` when tapped| +|`RALT_T(kc)`/`ALGR_T(kc)`|`RALT` when held, `kc` when tapped| +|`GUI_T(kc)`/`LGUI_T(kc)`|`LGUI` when held, `kc` when tapped| +|`RGUI_T(kc)`|`RGUI` when held, `kc` when tapped| +|`C_S_T(kc)`|`LCTL` + `LSFT` when held, `kc` when tapped| +|`MEH_T(kc)`|`LCTL` + `LSFT` + `LALT` when held, `kc` when tapped| +|`LCAG_T(kc)`|`LCTL` + `LALT` + `LGUI` when held, `kc` when tapped| +|`RCAG_T(kc)`|`RCTL` + `RALT` + `RGUI` when held, `kc` when tapped| +|`ALL_T(kc)`|`LCTL` + `LSFT` + `LALT` + `LGUI` when held, `kc` when tapped [more info](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)| +|`SCMD_T(kc)`/`SWIN_T(kc)`|`LGUI` + `LSFT` when held, `kc` when tapped| +|`LCA_T(kc)`|`LCTL` + `LALT` when held, `kc` when tapped| + +# 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. + +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. + +|Short Name|Long Name|Description| +|----------|---------|-----------| +|`KC_TILD`|`KC_TILDE`|tilde `~`| +|`KC_EXLM`|`KC_EXCLAIM`|exclamation mark `!`| +|`KC_AT`||at sign `@`| +|`KC_HASH`||hash sign `#`| +|`KC_DLR`|`KC_DOLLAR`|dollar sign `$`| +|`KC_PERC`|`KC_PERCENT`|percent sign `%`| +|`KC_CIRC`|`KC_CIRCUMFLEX`|circumflex `^`| +|`KC_AMPR`|`KC_AMPERSAND`|ampersand `&`| +|`KC_ASTR`|`KC_ASTERISK`|asterisk `*`| +|`KC_LPRN`|`KC_LEFT_PAREN`|left parenthesis `(`| +|`KC_RPRN`|`KC_RIGHT_PAREN`|right parenthesis `)`| +|`KC_UNDS`|`KC_UNDERSCORE`|underscore `_`| +|`KC_PLUS`||plus sign `+`| +|`KC_LCBR`|`KC_LEFT_CURLY_BRACE`|left curly brace `{`| +|`KC_RCBR`|`KC_RIGHT_CURLY_BRACE`|right curly brace `}`| +|`KC_LT`/`KC_LABK`|`KC_LEFT_ANGLE_BRACKET`|left angle bracket `<`| +|`KC_GT`/`KC_RABK`|`KC_RIGHT_ANGLE_BRACKET`|right angle bracket `>`| +|`KC_COLN`|`KC_COLON`|colon `:`| +|`KC_PIPE`||pipe `\|`| +|`KC_QUES`|`KC_QUESTION`|question mark `?`| +|`KC_DQT`/`KC_DQUO`|`KC_DOUBLE_QUOTE`|double quote `"`| + +# Layer Changes + +These are keycodes that can be used to change the current layer. + +|Name|Description| +|----|-----------| +|`LT(layer, kc)`|turn on layer (0-15) when held, kc ([basic keycodes](basic_keycodes.md)) when tapped| +|`TO(layer)`|turn on layer when depressed| +|`MO(layer)`|momentarily turn on layer when depressed (requires `KC_TRNS` on destination layer)| +|`DF(layer)`|sets the base (default) layer| +|`TG(layer)`|toggle layer on/off| +|`TT(layer)`|tap toggle? idk FIXME| +|`OSL(layer)`|switch to layer for one keycode| + +# Unicode + +These keycodes can be used in conjuction with the [Unicode](unicode_and_additional_language_support.md) support. + +|`UNICODE(n)`/`UC(n)`|if `UNICODE_ENABLE`, this will send characters up to `0x7FFF`| +|`X(n)`|if `UNICODEMAP_ENABLE`, also sends unicode via a different method| + +# `SAFE_RANGE`, or safely defining custom keycodes + +Sometimes you want to define your own custom keycodes to make your keymap easier to read. QMK provides `SAFE_RANGE` to help you do that. `SAFE_RANGE` is the first available keycode in the `0x0000`-`0xFFFF` range and you can use it when creating your own custom keycode enum: + +``` +enum my_keycodes { + FOO = SAFE_RANGE, + BAR +}; +``` + +You can then use `process_record_user()` to do something with your keycode: + +``` +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case FOO: + // Do something here + break; + case BAR: + // Do something here + break; + } +} +``` -- cgit v1.2.3 From d8e29b53fe5d57f2102b77f0ce9932cdb8b021b2 Mon Sep 17 00:00:00 2001 From: skullY Date: Mon, 3 Jul 2017 01:30:36 -0700 Subject: Update a bunch of docs --- docs/README.md | 17 ++--- docs/_summary.md | 3 +- docs/adding_features_to_qmk.md | 17 +++-- docs/build_environment_setup.md | 30 ++++---- docs/custom_quantum_functions.md | 6 +- docs/differences_from_tmk.md | 7 -- docs/documentation_best_practices.md | 39 +++++++++++ docs/eclipse.md | 4 +- docs/faq.md | 70 ++++++------------- docs/faq_build.md | 63 ++--------------- docs/faq_keymap.md | 94 ++++++------------------- docs/glossary.md | 31 +++++++-- docs/key_functions.md | 23 ++++--- docs/macros.md | 8 ++- docs/make_instructions.md | 6 +- docs/quantum_keycodes.md | 26 +++---- docs/tap_dance.md | 8 ++- docs/understanding_qmk.md | 128 +++++++++++++++-------------------- 18 files changed, 253 insertions(+), 327 deletions(-) delete mode 100644 docs/differences_from_tmk.md create mode 100644 docs/documentation_best_practices.md (limited to 'docs/quantum_keycodes.md') diff --git a/docs/README.md b/docs/README.md index 3346df2a03..06597a2b69 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,23 +1,16 @@ # Quantum Mechanical Keyboard Firmware -## Getting started - -* [What is QMK Firmware?](#what-is-qmk-firmware) -* [How to get it](#how-to-get-it) -* [How to compile](#how-to-compile) -* [How to customize](#how-to-customize) - -### What is QMK Firmware? {#what-is-qmk-firmware} +## What is QMK Firmware? {#what-is-qmk-firmware} QMK (*Quantum Mechanical Keyboard*) is an open source community that maintains QMK Firmware, QMK Flasher, qmk.fm, and these docs. QMK Firmware is a keyboard firmware based on the [tmk\_keyboard](http://github.com/tmk/tmk_keyboard) 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. -### How to get it {#how-to-get-it} +## How to get it {#how-to-get-it} If you plan on contributing a keymap, keyboard, or features to QMK, the easiest thing to do is [fork the repo through Github](https://github.com/qmk/qmk_firmware#fork-destination-box), and clone your repo locally to make your changes, push them, then open a [Pull Request](https://github.com/qmk/qmk_firmware/pulls) from your fork. Otherwise, you can either download it directly ([zip](https://github.com/qmk/qmk_firmware/zipball/master), [tar](https://github.com/qmk/qmk_firmware/tarball/master)), or clone it via git (`git@github.com:qmk/qmk_firmware.git`), or https (`https://github.com/qmk/qmk_firmware.git`). -### How to compile {#how-to-compile} +## How to compile {#how-to-compile} Before you are able to compile, you'll need to [install an environment](build_environment_setup.md) for AVR or/and ARM development. Once that is complete, you'll use the `make` command to build a keyboard and keymap with the following notation: @@ -27,6 +20,6 @@ This would build the `rev4` revision of the `planck` with the `default` keymap. make preonic-default -### How to customize {#how-to-customize} +## How to customize {#how-to-customize} -QMK has lots of [features](features/README.md) to explore, and a good deal of [reference documentation](reference/README.md) to dig through. Most features are taken advantage of by modifying your [keymap](keymap.md), and changing the [keycodes](keycodes.md). \ No newline at end of file +QMK has lots of [features](features/README.md) to explore, and a good deal of [reference documentation](reference/README.md) to dig through. Most features are taken advantage of by modifying your [keymap](keymap.md), and changing the [keycodes](keycodes.md). diff --git a/docs/_summary.md b/docs/_summary.md index 1b87399fbe..975a92376a 100644 --- a/docs/_summary.md +++ b/docs/_summary.md @@ -23,15 +23,16 @@ * [Quantum Keycodes](quantum_keycodes.md) * [The Config File](config_options.md) * [Customizing Functionality](custom_quantum_functions.md) + * [Documentation Best Practices](documentation_best_practices.md) * For makers and modders * [Adding a keyboard to QMK](adding_a_keyboard_to_qmk.md) * [Porting your keyboard to QMK](porting_your_keyboard_to_qmk.md) * [Modding your keyboard](modding_your_keyboard.md) + * [Understanding QMK](understanding_qmk.md) * [Adding features to QMK](adding_features_to_qmk.md) * [ISP flashing guide](isp_flashing_guide.md) * Other topics * [General FAQ](faq.md) - * [Differences from TMK](differences_from_tmk.md) * [Using Eclipse with QMK](eclipse.md) diff --git a/docs/adding_features_to_qmk.md b/docs/adding_features_to_qmk.md index f6f7cba208..fb036496c7 100644 --- a/docs/adding_features_to_qmk.md +++ b/docs/adding_features_to_qmk.md @@ -1,7 +1,16 @@ -If you have an idea for a custom feature or extra hardware connection, we'd love to accept it into QMK! These are generally done via [pull request](https://github.com/qmk/qmk_firmware/pulls) after forking, and here are some things to keep in mind when creating one: +# How To Add Features To QMK -* **Disable by default** - memory is a pretty limited on most chips QMK supports, and it's important that current keymaps aren't broken, so please allow your feature to be turned **on**, rather than being turned off. If you think it should be on by default, or reduces the size of the code, [open an issue](https://github.com/qmk/qmk_firmware/issues) for everyone to discuss it! +If you have an idea for a custom feature or extra hardware connection, we'd love to accept it into QMK! + +Before you put a lot of work into building your new feature you should make sure you are implementing it in the best way. You can get a basic understanding of QMK by reading [Understaning QMK](understanding_qmk.html), which will take you on a tour of the QMK program flow. From here you should talk to us to get a sense of the best way to implement your idea. There are two main ways to do this: + +* [Chat on Gitter](https://gitter.im/qmk/qmk_firmware) +* [Open an Issue](https://github.com/qmk/qmk_firmware/issues/new) + +Once you have implemented your new feature you will generally submit a [pull request](https://github.com/qmk/qmk_firmware/pulls). Here are some things to keep in mind when creating one: + +* **Disabled by default** - memory is a pretty limited on most chips QMK supports, and it's important that current keymaps aren't broken, so please allow your feature to be turned **on**, rather than being turned off. If you think it should be on by default, or reduces the size of the code, please talk with us about it. * **Compile locally before submitting** - hopefully this one is obvious, but things need to compile! Our Travis system will catch any issues, but it's generally faster for you to compile a few keyboards locally instead of waiting for the results to come back. * **Consider subprojects and different chip-bases** - there are several keyboards that have subprojects that have allow for slightly different configurations, and even different chip-bases. Try to make a feature supported in ARM and AVR, or automatically disabled in one that doesn't work. -* **Explain your feature** - submitting a markdown write-up of what your feature does with your PR may be needed, and it will allow a collaborator to easily copy it into the wiki for documentation (after proofing and editing). -* **Don't refactor code** - to maintain a clear vision of how things are laid out in QMK, we try to plan out refactors in-depth, and have a collaborator make the changes. If you have an idea for refactoring, or suggestions, [open an issue](https://github.com/qmk/qmk_firmware/issues). \ No newline at end of file +* **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. +* **Don't refactor code** - to maintain a clear vision of how things are laid out in QMK, we try to plan out refactors in-depth, and have a collaborator make the changes. If you have an idea for refactoring, or suggestions, [open an issue](https://github.com/qmk/qmk_firmware/issues). diff --git a/docs/build_environment_setup.md b/docs/build_environment_setup.md index 442038a58d..2282e9d131 100644 --- a/docs/build_environment_setup.md +++ b/docs/build_environment_setup.md @@ -1,19 +1,25 @@ -### Windows 10 +# Build Environment Setup -#### Creators Update +This page describes setting up the build environment for QMK. These instructions cover AVR processors (such as the atmega32u4.) + + + +# Windows 10 + +## Creators Update If you have Windows 10 with Creators Update or later, you can build and flash the firmware directly. Before the Creators Update, only building was possible. If you don't have it yet or if are unsure, follow [these instructions](https://support.microsoft.com/en-us/instantanswers/d4efb316-79f0-1aa1-9ef3-dcada78f3fa0/get-the-windows-10-creators-update). -#### Windows Subsystem for Linux +## Windows Subsystem for Linux In addition to the Creators Update, you need Windows 10 Subystem for Linux, so install it following [these instructions](http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/). If you already have the Windows 10 Subsystem for Linux from the Anniversary update it's recommended that you [upgrade](https://betanews.com/2017/04/14/upgrade-windows-subsystem-for-linux/) it to 16.04LTS, because some keyboards don't compile with the toolchains included in 14.04LTS. Note that you need to know what your are doing if you chose the `sudo do-release-upgrade` method. -#### Git +## Git 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. 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. 1. Open "Bash On Ubuntu On Windows" from the start menu. @@ -22,13 +28,13 @@ The Toolchain setup is done through the Windows Subsystem for Linux, and the pro 4. Close the Bash command window, and re-open it. 5. You are ready to compile and flash the firmware! -#### Some important things to keep in mind +## Some important things to keep in mind * You can run `util/wsl_install.sh` again to get all the newest updates. * Your QMK repository need to be on a Windows file system path, since WSL can't run executables outside it. * The WSL Git is **not** compatible with the Windows Git, so use the Windows Git Bash or a windows Git GUI for all Git operations * You can edit files either inside WSL or normally using Windows, but note that if you edit makefiles or shell scripts, make sure you are using an editor that saves the files with Unix line endings. Otherwise the compilation might not work. -### Windows (Vista and later) +# 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. If you are going to flash Infinity based keyboards you will need to install dfu-util, refer to the instructions by [Input Club](https://github.com/kiibohd/controller/wiki/Loading-DFU-Firmware). @@ -40,7 +46,7 @@ The Toolchain setup is done through the Windows Subsystem for Linux, and the pro If you have trouble and want to ask for help, it is useful to generate a *Win_Check_Output.txt* file by running `Win_Check.bat` in the `\util` folder. -### Mac +# Mac If you're using [homebrew,](http://brew.sh/) you can use the following commands: brew tap osx-cross/avr @@ -59,7 +65,7 @@ If you are going to flash Infinity based keyboards you will also need dfu-util brew install dfu-util -### Linux +# Linux To ensure you are always up to date, you can just run `sudo util/install_dependencies.sh`. That should always install all the dependencies needed. **This will run `apt-get upgrade`.** @@ -91,7 +97,7 @@ Debian/Ubuntu example: sudo apt-get update sudo apt-get install gcc unzip wget zip gcc-avr binutils-avr avr-libc dfu-programmer dfu-util gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi -### Docker +# Docker If this is a bit complex for you, Docker might be the turn-key solution you need. After installing [Docker](https://www.docker.com/products/docker), run the following command at the root of the QMK folder to build a keyboard/keymap: @@ -109,10 +115,10 @@ 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 +# 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 +# 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`. diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md index 0d6def45bf..c017c0cdb3 100644 --- a/docs/custom_quantum_functions.md +++ b/docs/custom_quantum_functions.md @@ -34,9 +34,9 @@ enum my_keycodes { }; ``` -## Programming The Behavior Of A Keycode +## Programming The Behavior Of Any Keycode -When you want to override the behavior of an existing key, or define the behavior for a new key, you should use the `process_record_{kb,user}()` functions. These are called by QMK during key processing before the actual key event is handled. If these functions return `true` QMK will process the keycodes as usual. That can be handy for extending the functionality of a key rather than replacing it. If these functions return `false` QMK will skip the normal key handling, and it will be up you to send and key up or down events that are required. +When you want to override the behavior of an existing key, or define the behavior for a new key, you should use the `process_record_kb()' and `process_record_user()` functions. These are called by QMK during key processing before the actual key event is handled. If these functions return `true` QMK will process the keycodes as usual. That can be handy for extending the functionality of a key rather than replacing it. If these functions return `false` QMK will skip the normal key handling, and it will be up you to send any key up or down events that are required. These function are called every time a key is pressed or released. @@ -57,7 +57,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case KC_ENTER: // Play a tone when enter is pressed if (record->event.pressed) { - PLAY_NOTE_ARRAY(tone_enter); + PLAY_NOTE_ARRAY(tone_qwerty); } return true; // Let QMK send the enter press/release events } diff --git a/docs/differences_from_tmk.md b/docs/differences_from_tmk.md deleted file mode 100644 index 10ca329dc9..0000000000 --- a/docs/differences_from_tmk.md +++ /dev/null @@ -1,7 +0,0 @@ -Understanding the essential changes made on the [tmk_keyboard firmware](http://github.com/tmk/tmk_keyboard) should help you understand the QMK Firmware. - -| Firmware |TMK |QMK | -|------------------------------|-----------------------|-------------------------| -| Maintainer |hasu (@tmk) |Jack Humbert et al. | -| Build path customization | `TMK_DIR = ...` | `include .../Makefile` | -| `keymaps` array data | 3D array of `uint8_t` holding **keycode** | 3D array of `uint16_t` holding **keycode** | diff --git a/docs/documentation_best_practices.md b/docs/documentation_best_practices.md new file mode 100644 index 0000000000..1c06387f74 --- /dev/null +++ b/docs/documentation_best_practices.md @@ -0,0 +1,39 @@ +# Documentation Best Practices + +This page exists to document best practices when writing documentation for QMK. Following these guidelines will help to keep a consistent tone and style, which will in turn help other people more easily understand QMK. + +# Page Opening + +Your documentation page should generally start with an H1 heading, followed by a 1 paragrah description of what the user will find on this page. Keep in mind that this heading and paragraph will sit next to the Table of Contents, so keep the heading short and avoid long strings with no whitespace. + +Example: + +``` +# My Page Title + +This page covers my super cool feature. You can use this feature to make coffee, squeeze fresh oj, and have an egg mcmuffin and hashbrowns delivered from your local macca's by drone. +``` + +# Headings + +Your page should generally have multiple "H1" headings. Only H1 and H2 headings will included in the Table of Contents, so plan them out appropriately. Excess width should be avoided in H1 and H2 headings to prevent the Table of Contents from getting too wide. + +# Styled Hint Blocks + +You can have styled hint blocks drawn around text to draw attention to it. + +{% hint style='info' %} +This uses \{\% hint style='info' \%\} +{% endhint %} + +{% hint style='tip' %} +This uses \{\% hint style='tip' \%\} +{% endhint %} + +{% hint style='danger' %} +This uses \{\% hint style='danger' \%\} +{% endhint %} + +{% hint style='working' %} +This uses \{\% hint style='working' \%\} +{% endhint %} diff --git a/docs/eclipse.md b/docs/eclipse.md index ec5f2dc0d1..a63b84607f 100644 --- a/docs/eclipse.md +++ b/docs/eclipse.md @@ -1,3 +1,5 @@ +# Setting Up Eclipse for QMK Development + [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: @@ -81,4 +83,4 @@ We will now configure a make target that cleans the project and builds the keyma 6. Leave the other options checked and click OK. Your make target will now appear under the selected keyboard. 7. (Optional) Toggle the Hide Empty Folders 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 Console view at the bottom to view the running build. \ No newline at end of file +9. Select the Console view at the bottom to view the running build. diff --git a/docs/faq.md b/docs/faq.md index 0636d8b544..c46861030c 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -1,31 +1,33 @@ -## READ FIRST -- **README** of top directory : https://github.com/tmk/tmk_keyboard/blob/master/README.md -- **README** of target project(keyboard/converter) directory. +# Frequently Asked Questions -Note that you'll need to read **both**. +## What is QMK? +[QMK](https://github.com/qmk), short for Quantum Mechanical Keyboard, is a group of people building tools for custom keyboards. We started with the [QMK firmware](https://github.com/qmk/qmk_firmware), a heavily modified fork of [TMK](https://github.com/tmk/tmk_keyboard). -# Build -- [[FAQ/Build]] +## What Differences Are There Between QMK and TMK? +TMK was originally designed and implemented by [Jun Wako](https://github.com/tmk). QMK started as [Jack Humbert's](https://github.com/jackhumbert) fork of TMK for the Planck. After a while Jack's fork had diverged quite a bit from TMK, and in 2015 Jack decided to rename his fork to QMK. -# Keymap -- [[FAQ/Keymap]] +From a technical standpoint QMK builds upon TMK by adding several new features. Most notably QMK has expanded the number of available keycodes and uses these to implement advanced features like `S()`, `LCTL()`, and `MO()`. You can see a complete list of these keycodes in [Quantum Keycodes](quantum_keycodes.html). +From a project and community management standpoint TMK prefers to have keyboards maintained in separate forks while QMK prefers to have keyboards maintained in one central repository. # 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:......... +``` +Waiting for device:......... +``` once the device is pluged in then *hid_listen* finds it you will get this message: - Waiting for new device:......................... - Listening: +``` +Waiting for new device:......................... +Listening: +``` -Check if you can't get this 'Listening:' message: -- build with `CONSOLE_ENABLE=yes` in **Makefile**. +If you can't get this 'Listening:' message try building with `CONSOLE_ENABLE=yes` in [Makefile] You may need privilege to access the device on OS like Linux. - try `sudo hid_listen` @@ -73,41 +75,13 @@ Without reset circuit you will have inconsistent reuslt due to improper initiali ## 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. +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`. +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**. ``` @@ -157,20 +131,20 @@ 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. +You need to define `EXTRAKEY_ENABLE` in `rules.mk` to use them in QMK. + ``` 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 @@ -235,4 +209,4 @@ 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 \ No newline at end of file +http://imgur.com/a/bnwzy diff --git a/docs/faq_build.md b/docs/faq_build.md index ba8b52af15..ebe8caccd1 100644 --- a/docs/faq_build.md +++ b/docs/faq_build.md @@ -1,5 +1,6 @@ -## READ FIRST -- https://github.com/qmk/qmk_firmware/blob/master/docs/build_guide.md +# Frequently Asked Build Questions + +This page covers questions about building QMK. If you have not yet you should read the [Build Guide](https://github.com/qmk/qmk_firmware/blob/master/docs/build_guide.md). In short, @@ -8,12 +9,10 @@ In short, $ make [-f Makefile.] [KEYMAP=...] dfu -## Can't program on Linux and Mac +## Can't program on Linux 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. -https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/sudo.8.html - In short when your controller is ATMega32u4, $ sudo dfu-programmer atmega32u4 erase --force @@ -26,63 +25,14 @@ or just But to run `make` with root privilege is not good idea. Use former method as possible. -## Do 'make clean' before 'make' -You'll need `make clean` after you edit **config.h** or change options like `KEYMAP`. - -Frist remove all files made in previous build, - - $ make clean - -then build new firmware. - - $ make [KEYMAP=...] - -Also you can always try `make clean` when you get other strange result during build. - - ## WINAVR is obsolete It is no longer recommended and may cause some problem. See [Issue #99](https://github.com/tmk/tmk_keyboard/issues/99). -## USB stack: LUFA or PJRC? -Use **LUFA**. - -**PJRC** stack won't be supported actively anymore. There is no reason to hesitate to use LUFA except for binary size(about 1KB lager?). But **PJRC** is still very useful for debug and development purpose. -See also [Issue #50](https://github.com/tmk/tmk_keyboard/issues/50) and [Issue #58](https://github.com/tmk/tmk_keyboard/issues/58). - -## Edit configuration but not change -You will need followings after editing `CONSOLE_ENABLE`, `NKRO_ENABLE`, `EXTRAKEY_ENABLE` or `MOUSEKEY_ENABLE` option in **Makefile**. - -### 1. make clean -This will be needed when you edit **config.h**. - -### 2. Remove Drivers from Device Manager(Windows) -**Windows only.** Linux, OSX and other OS's doesn't require this. It looks like Windows keeps using driver installed when device was connected first time even after the device changes its configuration. To load proper drivers for new configuration you need to remove existent drivers from **Drvice Manager**. - -### 3. Build with different VID:PID -**Windows only.** If method 2. does't work fou you try this. Change Vendor ID or Product ID in **config.h** and build firmware. Windows should recognize it as whole new device and start drivers install process. - -### 4. Just try other ports -This will be useful and the easiest workaround for **Windows**. - - - ## USB VID and PID You can use any ID you want with editing `config.h`. Using any presumably unused ID will be no problem in fact except for very least chance of collision with other product. -For example TMK uses following numbers by default. -``` -keyboard: -hhkb: FEED:CAFE -gh60: FEED:6060 - -converter: -x68k: FEED:6800 -ps2: FEED:6512 -adb: FEED:0ADB -ibm4704: FEED:4704 -pc98: FEED:9898 -``` +Most boards in QMK use `0xFEED` as the vendor ID. You should look through other keyboards to make sure you pick a unique Product ID. Also see this. https://github.com/tmk/tmk_keyboard/issues/150 @@ -112,7 +62,6 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="feed", MODE:="0666" ``` - ## Cortex: cstddef: No such file or directory GCC 4.8 of Ubuntu 14.04 had this problem and had to update to 4.9 with this PPA. https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded @@ -148,4 +97,4 @@ Note that Teensy2.0++ bootloader size is 2048byte. Some Makefiles may have wrong # LUFA bootloader 4096 # USBaspLoader 2048 OPT_DEFS += -DBOOTLOADER_SIZE=2048 -``` \ No newline at end of file +``` diff --git a/docs/faq_keymap.md b/docs/faq_keymap.md index 623726ab2e..d6442ac53a 100644 --- a/docs/faq_keymap.md +++ b/docs/faq_keymap.md @@ -1,10 +1,13 @@ -## READ FIRST -https://github.com/tmk/tmk_core/blob/master/doc/keymap.md +# Frequently Asked Keymap Questions -## How to get keycode -See [Keycodes](Keycodes). Keycodes are actually defined in [common/keycode.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/keycode.h). +This page covers questions people often have about keymaps. If you haven't you should read [Keymap Overview](keymap.html) first. -## Sysrq key +## What Keycodes Can I Use? +See [Basic Keycodes](keycodes.html) and [Quantum Keycodes](quantum_keycodes.html) for most of the keys you can define. + +Keycodes are actually defined in [common/keycode.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/keycode.h). + +## `KC_SYSREQ` isn't working Use keycode for Print Screen(`KC_PSCREEN` or `KC_PSCR`) instead of `KC_SYSREQ`. Key combination of 'Alt + Print Screen' is recognized as 'System request'. See [issue #168](https://github.com/tmk/tmk_keyboard/issues/168) and @@ -16,7 +19,7 @@ Use `KC_PWR` instead of `KC_POWER` or vice versa. - `KC_PWR` works with Windows and Linux, not with OSX. - `KC_POWER` works with OSX and Linux, not with Windows. -http://geekhack.org/index.php?topic=14290.msg1327264#msg1327264 +More info: http://geekhack.org/index.php?topic=14290.msg1327264#msg1327264 ## Oneshot modifier Solves my personal 'the' problem. I often got 'the' or 'THe' wrongly instead of 'The'. Oneshot Shift mitgates this for me. @@ -32,15 +35,17 @@ For Modifier keys and layer actions you have to place `KC_TRANS` on same positio ## Mechanical Lock Switch Support -https://github.com/tmk/tmk_keyboard#mechanical-locking-support - -This feature is for *mechanical lock switch* like this Alps one. -http://deskthority.net/wiki/Alps_SKCL_Lock -Using enabling this feature and using keycodes `LCAP`, `LNUM` or `LSCR` in keymap you can use physical locking CapsLock, NumLock or ScrollLock keys as you expected. +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_RESYNC_ENABLE +``` -Old vintage mechanical keyboards occasionally have lock switches but modern ones don't have. ***You don't need this feature in most case and just use keycodes `CAPS`, `NLCK` and `SLCK`.*** +After enabling this feature use keycodes `KC_LCAP`, `KC_LNUM` and `KC_LSCR` in your keymap instead. +Old vintage mechanical keyboards occasionally have lock switches but modern ones don't have. ***You don't need this feature in most case and just use keycodes `KC_CAPS`, `KC_NLCK` and `KC_SLCK`.*** ## Input special charactors other than ASCII like Cédille 'Ç' NO UNIVERSAL METHOD TO INPUT THOSE WORKS OVER ALL SYSTEMS. You have to define **MACRO** in way specific to your OS or layout. @@ -111,68 +116,12 @@ https://github.com/tekezo/Karabiner/issues/403 ## Esc and `~ on a key -You can define FC660 and Poker style ESC with `ACTION_LAYER_MODS`. -https://github.com/tmk/tmk_core/blob/master/doc/keymap.md#35-momentary-switching-with-modifiers - -``` -#include "keymap_common.h" - - -/* Leopold FC660 - * https://elitekeyboards.com/products.php?sub=leopold,compact&pid=fc660c - * Shift + Esc = ~ - * Fn + Esc = ` - * - * Votex Poker II - * https://adprice.fedorapeople.org/poker2_manual.pdf - * Fn + Esc = ` - * Fn + Shift + Esc = ~ - */ -const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* 0: qwerty */ - [0] = KEYMAP( \ - ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NUHS,BSPC, \ - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ - LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \ - FN0, NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,ESC, \ - LCTL,LGUI,LALT, SPC, RALT,FN1, RGUI,RCTL), - [1] = KEYMAP( \ - GRV, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,\ - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ - TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), - [2] = KEYMAP( \ - GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,TRNS, \ - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,\ - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ - TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), -}; - -const uint16_t PROGMEM fn_actions[] = { - // https://github.com/tmk/tmk_core/blob/master/doc/keymap.md#35-momentary-switching-with-modifiers - [0] = ACTION_LAYER_MODS(1, MOD_LSFT), - [1] = ACTION_LAYER_MOMENTARY(2), -}; -``` - -Otherwise, you can write code, see this. -https://github.com/p3lim/keyboard_firmware/commit/fd799c12b69a5ab5addd1d4c03380a1b8ef8e9dc - - -## 32 Fn keys are not enough? -### actionmap -It uses 16 bit codes and has no limitation of 32 Fn at the expense of memory space. TMK keymap is actually is 8 bit codes as subset of the actionmap. -https://github.com/tmk/tmk_keyboard/issues?utf8=%E2%9C%93&q=is%3Aissue+actionmap - -### extension for modified keys -https://geekhack.org/index.php?topic=41989.msg1885526#msg1885526 - +Use `GRAVE_ESC` or `KC_GESC` in your keymap. ## Arrow on Right Modifier keys with Dual-Role This turns right modifer keys into arrow keys when the keys are tapped while still modifiers when the keys are hold. In TMK the dual-role function is dubbed **TAP**. ``` + #include "keymap_common.h" @@ -211,18 +160,16 @@ const uint16_t PROGMEM fn_actions[] = { ``` - Dual-role key: https://en.wikipedia.org/wiki/Modifier_key#Dual-role_keys ## Eject on Mac OSX -`EJCT` keycode works on OSX. https://github.com/tmk/tmk_keyboard/issues/250 +`KC_EJCT` keycode works on OSX. https://github.com/tmk/tmk_keyboard/issues/250 It seems Windows 10 ignores the code and Linux/Xorg recognizes but has no mapping by default. Not sure what keycode Eject is on genuine Apple keyboard actually. HHKB uses `F20` for Eject key(`Fn+f`) on Mac mode but this is not same as Apple Eject keycode probably. - ## What's weak_mods and real_mods in action_util.c ___TO BE IMPROVED___ @@ -262,4 +209,3 @@ if (timer_elapsed(key_timer) < 100) { ``` It's best to declare the `static uint16_t key_timer;` at the top of the file, outside of any code blocks you're using it in. - diff --git a/docs/glossary.md b/docs/glossary.md index f69b1709bc..fac1952a6d 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -1,10 +1,29 @@ # Glossary of QMK terms -git -: versioning software used at the commandline +## Dynamic Macro +A macro which has been recorded on the keyboard and which will be lost when the keyboard is unplugged or the computer rebooted. -keymap -: an array of keycodes mapped to a physical keyboard layout, which are processed on key presses and releases +## git +Versioning software used at the commandline -matrix -: a wiring pattern of columns and rows (and usually diodes) that enables the MCU to detect keypresses with a fewer number of pins \ No newline at end of file +## Keycode +A 2-byte number that represents a particular key. `0x00`-`0xFF` are used for [Basic Keycodes](keycodes.html) while `0x100`-`0xFFFF` are used for [Quantum Keycodes](quantum_keycodes.html). + +## Keymap +An array of keycodes mapped to a physical keyboard layout, which are processed on key presses and releases + +## Matrix +A wiring pattern of columns and rows (and usually diodes) that enables the MCU to detect keypresses with a fewer number of pins + +## Macro +A feature that lets you send muiltple keypress events (hid reports) after having pressed only a single key. + +## Mousekeys +A feature that lets you control your mouse cursor and click from your keyboard. + +* [Mousekeys Documentation](mouse_keys.html) + +## Tap Dance +A feature that lets you assign muiltple keycodes to the same key based on how many times you press it. + +* [Tap Dance Documentation](tap_dance.html) diff --git a/docs/key_functions.md b/docs/key_functions.md index 74b80b42f1..8a579f3058 100644 --- a/docs/key_functions.md +++ b/docs/key_functions.md @@ -2,20 +2,18 @@ Your keymap can include shortcuts to common operations (called "function actions" in tmk). -These functions work the same way that their `ACTION_*` functions do - they're just quick aliases. To dig into all of the tmk `ACTION_*` functions, please see the [TMK documentation](keymap.md#2-action). +These functions work the same way that their `ACTION_*` functions do - they're just quick aliases. To dig into all of the qmk `ACTION_*` functions, please see the [Keymap documentation](keymap.md#2-action). Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` - the benefit here is being able to use more than 32 function actions (up to 4096), if you happen to need them. -### Limits of these aliases +## Limits of these aliases -Currently, the keycodes able to used with these functions are limited to the TMK ones, meaning you can't use keycodes like `KC_TILD`, or anything greater than 0xFF. For a full list of the keycodes able to be used, [see this list](keycode.txt). +Currently, the keycodes able to used with these functions are limited to the [Basic Keycodes](keycodes.html), meaning you can't use keycodes like `KC_TILD`, or anything greater than 0xFF. For a full list of the keycodes able to be used, [see this list](keycodes.html). -### Switching and toggling layers +# Switching and toggling layers `MO(layer)` - momentary switch to *layer*. As soon as you let go of the key, the layer is deactivated and you pop back out to the previous layer. When you apply this to a key, that same key must be set as `KC_TRNS` on the destination layer. Otherwise, you won't make it back to the original layer when you release the key (and you'll get a keycode sent). You can only switch to layers *above* your current layer. If you're on layer 0 and you use `MO(1)`, that will switch to layer 1 just fine. But if you include `MO(3)` on layer 5, that won't do anything for you -- because layer 3 is lower than layer 5 on the stack. -`OSL(layer)` - momentary switch to *layer*, as a one-shot operation. So if you have a key that's defined as `OSL(1)`, and you tap that key, then only the very next keystroke would come from layer 1. You would drop back to layer zero immediately after that one keystroke. That's handy if you have a layer full of custom shortcuts -- for example, a dedicated key for closing a window. So you tap your one-shot layer mod, then tap that magic 'close window' key, and keep typing like a boss. Layer 1 would remain active as long as you hold that key down, too (so you can use it like a momentary toggle-layer key with extra powers). - `LT(layer, kc)` - momentary switch to *layer* when held, and *kc* when tapped. Like `MO()`, this only works upwards in the layer stack (`layer` must be higher than the current layer). `TG(layer)` - toggles a layer on or off. As with `MO()`, you should set this key as `KC_TRNS` in the destination layer so that tapping it again actually toggles back to the original layer. Only works upwards in the layer stack. @@ -25,7 +23,7 @@ Currently, the keycodes able to used with these functions are limited to the TMK `TT(layer)` - Layer Tap-Toggle. If you hold the key down, the layer becomes active, and then deactivates when you let go. And if you tap it, the layer simply becomes active (toggles on). It needs 5 taps by default, but you can set it by defining `TAPPING_TOGGLE`, for example, `#define TAPPING_TOGGLE 1` for just one tap. -### Fun with modifier keys +# Modifier keys * `LSFT(kc)` - applies left Shift to *kc* (keycode) - `S(kc)` is an alias * `RSFT(kc)` - applies right Shift to *kc* @@ -43,6 +41,8 @@ You can also chain these, like this: LALT(LCTL(KC_DEL)) -- this makes a key that sends Alt, Control, and Delete in a single keypress. +# Shifted Keycodes + The following shortcuts automatically add `LSFT()` to keycodes to get commonly used symbols. Their long names are also available and documented in `quantum/quantum_keycodes.h`. KC_TILD ~ @@ -67,8 +67,15 @@ The following shortcuts automatically add `LSFT()` to keycodes to get commonly u KC_PIPE | KC_COLN : +# One Shot + `OSM(mod)` - this is a "one shot" modifier. So let's say you have your left Shift key defined as `OSM(MOD_LSFT)`. Tap it, let go, and Shift is "on" -- but only for the next character you'll type. So to write "The", you don't need to hold down Shift -- you tap it, tap t, and move on with life. And if you hold down the left Shift key, it just works as a left Shift key, as you would expect (so you could type THE). There's also a magical, secret way to "lock" a modifier by tapping it multiple times. If you want to learn more about that, open an issue. :) +`OSL(layer)` - momentary switch to *layer*, as a one-shot operation. So if you have a key that's defined as `OSL(1)`, and you tap that key, then only the very next keystroke would come from layer 1. You would drop back to layer zero immediately after that one keystroke. That's handy if you have a layer full of custom shortcuts -- for example, a dedicated key for closing a window. So you tap your one-shot layer mod, then tap that magic 'close window' key, and keep typing like a boss. Layer 1 would remain active as long as you hold that key down, too (so you can use it like a momentary toggle-layer key with extra powers). + + +# Mod Tap + `MT(mod, kc)` - is *mod* (modifier key - MOD_LCTL, MOD_LSFT) when held, and *kc* when tapped. In other words, you can have a key that sends Esc (or the letter O or whatever) when you tap it, but works as a Control key or a Shift key when you hold it down. These are the values you can use for the `mod` in `MT()` and `OSM()`: @@ -97,7 +104,7 @@ We've added shortcuts to make common modifier/tap (mod-tap) mappings more compac * `LCAG_T(kc)` - is CtrlAltGui when held and *kc* when tapped * `MEH_T(kc)` - is like Hyper, but not as cool -- does not include the Cmd/Win key, so just sends Alt+Ctrl+Shift. -##### Permissive Hold +# Permissive Hold As of [PR#1359](https://github.com/qmk/qmk_firmware/pull/1359/), there is a new `config.h` option: diff --git a/docs/macros.md b/docs/macros.md index 1418d24ab4..3d5b05b4ac 100644 --- a/docs/macros.md +++ b/docs/macros.md @@ -1,8 +1,10 @@ -# Macros - Send multiple keystrokes when pressing just one key +# Macros -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' %} **Security Note**: While it is possible to use macros to send passwords, credit card numbers, and other sensitive information it is a supremely bad idea to do so. Anyone who gets ahold of your keyboard will be able to access that information by opening a text editor. +{% endhint %} # Macro Definitions @@ -135,7 +137,7 @@ This will clear all mods currently pressed. This will clear all keys besides the mods currently pressed. -# Advanced Example: Single-key copy/paste (hold to copy, tap to paste) +# Advanced Example: Single-key copy/paste This example defines a macro which sends `Ctrl-C` when pressed down, and `Ctrl-V` when released. diff --git a/docs/make_instructions.md b/docs/make_instructions.md index 6f88f91069..64c1cb0f00 100644 --- a/docs/make_instructions.md +++ b/docs/make_instructions.md @@ -48,7 +48,7 @@ Here are some examples commands * `make ergodox-infinity-algernon-clean` will clean the build output of the Ergodox Infinity keyboard. This example uses the full syntax and can be run from any folder with a `Makefile` * `make dfu COLOR=false` from within a keymap folder, builds and uploads the keymap, but without color output. -## The `Makefile` +# The `Makefile` There are 5 different `make` and `Makefile` locations: @@ -62,7 +62,7 @@ The root contains the code used to automatically figure out which keymap or keym For keyboards and subprojects, the make files are split in two parts `Makefile` and `rules.mk`. All settings can be found in the `rules.mk` file, while the `Makefile` is just there for support and including the root `Makefile`. Keymaps contain just one `Makefile` for simplicity. -### Makefile options +## Makefile options Set these variables to `no` to disable them, and `yes` to enable them. @@ -158,7 +158,7 @@ This enables using the Quantum SYSEX API to send strings (somewhere?) This consumes about 5390 bytes. -### Customizing Makefile options on a per-keymap basis +## Customizing Makefile options on a per-keymap basis If your keymap directory has a file called `Makefile` (note the filename), any Makefile options you set in that file will take precedence over other Makefile options for your particular keyboard. diff --git a/docs/quantum_keycodes.md b/docs/quantum_keycodes.md index e9edad03ed..a59d8fbc88 100644 --- a/docs/quantum_keycodes.md +++ b/docs/quantum_keycodes.md @@ -4,7 +4,7 @@ All keycodes within quantum are numbers between `0x0000` and `0xFFFF`. Within yo 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. Keycodes above `0x00FF` may not be used with any of the mod/layer-tap keys listed -# Quantum keycodes +## QMK keycodes |Name|Description| |----|-----------| @@ -18,7 +18,7 @@ On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are |`M(n)`|to call macro n| |`MACROTAP(n)`|to macro-tap n idk FIXME| -# Bootmagic Keycodes +## Bootmagic Keycodes Shortcuts for bootmagic options (these work even when bootmagic is off.) @@ -44,7 +44,7 @@ Shortcuts for bootmagic options (these work even when bootmagic is off.) |`MAGIC_UNSWAP_ALT_GUI`/`AG_NORM`|Disable the Alt/GUI switching| |`MAGIC_TOGGLE_NKRO`|Turn NKRO on or off| -# Audio +## Audio ```c #ifdef AUDIO_ENABLE @@ -69,7 +69,7 @@ Shortcuts for bootmagic options (these work even when bootmagic is off.) #endif ``` -## Midi +### Midi #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) MI_ON, // send midi notes when music mode is enabled @@ -157,7 +157,7 @@ MI_MODSD, // decrease modulation speed MI_MODSU, // increase modulation speed #endif // MIDI_ADVANCED -# Backlight +## Backlight These keycodes control the backlight. Most keyboards use this for single color in-switch lighting. @@ -171,7 +171,7 @@ These keycodes control the backlight. Most keyboards use this for single color i |`BL_TOGG`|Toggle the backlight on or off| |`BL_STEP`|Step through backlight levels, wrapping around to 0 when you reach the top.| -# RGBLIGHT WS2818 LEDs +## RGBLIGHT WS2818 LEDs This controls the `RGBLIGHT` functionality. Most keyboards use WS2812 (and compatible) LEDs for underlight or case lighting. @@ -203,7 +203,7 @@ This is used when multiple keyboard outputs can be selected. Currently this only |`OUT_USB`|usb only| |`OUT_BT`|bluetooth (when `BLUETOOTH_ENABLE`)| -# Modifiers +## Modifiers These are special keycodes that simulate pressing several modifiers at once. @@ -219,7 +219,7 @@ These are special keycodes that simulate pressing several modifiers at once. * |`KC_LCA`|`LCTL` + `LALT`| */ -## Modifiers with keys +### Modifiers with keys |Name|Description| |----|-----------| @@ -238,7 +238,7 @@ These are special keycodes that simulate pressing several modifiers at once. |`SCMD(kc)`/`SWIN(kc)`|`LGUI` + `LSFT` + `kc`| |`LCA(kc)`|`LCTL` + `LALT` + `kc`| -## One Shot Keys +### One Shot Keys Most modifiers work by being held down while you push another key. You can use `OSM()` to setup a "One Shot" modifier. When you tap a one shot mod it will remain is a pressed state until you press another key. @@ -249,7 +249,7 @@ To specify a your modifier you need to pass the `MOD` form of the key. For examp |`OSM(mod)`|use mod for one keypress| |`OSL(layer)`|switch to layer for one keypress| -## Mod-tap keys +### Mod-tap keys These keycodes will press the mod(s) when held, and the key when tapped. They only work with [basic keycodes](basic_keycodes.md). @@ -271,7 +271,7 @@ These keycodes will press the mod(s) when held, and the key when tapped. They on |`SCMD_T(kc)`/`SWIN_T(kc)`|`LGUI` + `LSFT` when held, `kc` when tapped| |`LCA_T(kc)`|`LCTL` + `LALT` when held, `kc` when tapped| -# 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. @@ -301,7 +301,7 @@ It's important to remember that all of these keycodes send a left shift - this m |`KC_QUES`|`KC_QUESTION`|question mark `?`| |`KC_DQT`/`KC_DQUO`|`KC_DOUBLE_QUOTE`|double quote `"`| -# Layer Changes +## Layer Changes These are keycodes that can be used to change the current layer. @@ -315,7 +315,7 @@ These are keycodes that can be used to change the current layer. |`TT(layer)`|tap toggle? idk FIXME| |`OSL(layer)`|switch to layer for one keycode| -# Unicode +## Unicode These keycodes can be used in conjuction with the [Unicode](unicode_and_additional_language_support.md) support. diff --git a/docs/tap_dance.md b/docs/tap_dance.md index 25827a6485..38b2ee9993 100644 --- a/docs/tap_dance.md +++ b/docs/tap_dance.md @@ -1,5 +1,7 @@ # 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. @@ -34,7 +36,9 @@ Our next stop is `matrix_scan_tap_dance()`. This handles the timeout of tap-danc 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 +# Examples + +## Simple Example Here's a simple example for a single definition: @@ -59,6 +63,8 @@ qk_tap_dance_action_t tap_dance_actions[] = { TD(TD_ESC_CAPS) ``` +## Complex Example + Here's a more complex example involving custom actions: ```c diff --git a/docs/understanding_qmk.md b/docs/understanding_qmk.md index f01d50416c..28927f0eff 100644 --- a/docs/understanding_qmk.md +++ b/docs/understanding_qmk.md @@ -1,7 +1,5 @@ # Understanding QMK's Code - - This document attempts to explain how the QMK firmware works from a very high level. It assumes you understand basic programming concepts but does not (except where needed to demonstrate) assume familiarity with C. It assumes that you have a basic understanding of the following documents: * [QMK Overview](qmk_overview.md) @@ -12,45 +10,27 @@ This document attempts to explain how the QMK firmware works from a very high le You can think of QMK as no different from any other computer program. It is started, performs its tasks, and then ends. The entry point for the program is the `main()` function, just like it is on any other C program. However, for a newcomer to QMK it can be confusing because the `main()` function appears in multiple places, and it can be hard to tell which one to look at. -The reason for this is the different platforms that QMK supports. The most common platform is `lufa`, which runs on AVR processors such at the atmega32u4. We also support `chibios`, `pjrc`, `vusb`, and `bluefruit`, and may support more in the future. +The reason for this is the different platforms that QMK supports. The most common platform is `lufa`, which runs on AVR processors such at the atmega32u4. We also support `chibios` and `vusb`. -Let's focus on AVR processors for the moment, which use the `lufa` platform. You can find the `main()` function in [tmk_core/protocol/lufa/lufa.c](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/protocol/lufa/lufa.c#L1129). If you browse through that function you'll find that it initializes any hardware that has been configured (including USB to the host) and then it starts the core part of the program with a [`while(1)`](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/protocol/lufa/lufa.c#L1182). This is [The Main Loop](#the_main_loop). +We'll focus on AVR processors for the moment, which use the `lufa` platform. You can find the `main()` function in [tmk_core/protocol/lufa/lufa.c](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/protocol/lufa/lufa.c#L1129). If you browse through that function you'll find that it initializes any hardware that has been configured (including USB to the host) and then it starts the core part of the program with a [`while(1)`](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/protocol/lufa/lufa.c#L1182). This is [The Main Loop](#the_main_loop). ## The Main Loop -This section of code is called "The Main Loop" because it's responsible for looping over the same set of instructions forever. This is where QMK dispatches out to the functions responsible for making the keyboard do everything it is supposed to. At first glance it can look like a lot of functionality but most of the time the code will be disabled by `#define`'s. - -### USB Suspend - -``` - #if !defined(NO_USB_STARTUP_CHECK) - while (USB_DeviceState == DEVICE_STATE_Suspended) { - print("[s]"); - suspend_power_down(); - if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) { - USB_Device_SendRemoteWakeup(); - } - } - #endif -``` - -This section of code handles the USB suspend state. This state is entered when the computer the keyboard is plugged into is suspended. In this state we don't do anything but wait for the computer we're plugged into to wake up. - -### `keyboard_task()` +This section of code is called "The Main Loop" because it's responsible for looping over the same set of instructions forever. This is where QMK dispatches out to the functions responsible for making the keyboard do everything it is supposed to do. At first glance it can look like a lot of functionality but most of the time the code will be disabled by `#define`'s. ``` keyboard_task(); ``` -This is where all the keyboard specific functionality is dispatched. The source code for `keyboard_task()` can be found in [tmk_core/common/keyboard.c](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/keyboard.c#L154), and it is responsible for detecting changes in the matrix and turning LED's on and off. +This is where all the keyboard specific functionality is dispatched. The source code for `keyboard_task()` can be found in [tmk_core/common/keyboard.c](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/keyboard.c#L154), and it is responsible for detecting changes in the matrix and turning status LED's on and off. Within `keyboard_task()` you'll find code to handle: -* Matrix Scanning +* [Matrix Scanning](#matrix-scanning) * Mouse Handling * Serial Link(s) * Visualizer -* Keyboard state LED's (Caps Lock, Num Lock, Scroll Lock) +* Keyboard status LED's (Caps Lock, Num Lock, Scroll Lock) #### Matrix Scanning @@ -60,18 +40,18 @@ While there are different strategies for doing the actual matrix detection, they ``` - { - {0,0,0,0}, - {0,0,0,0}, - {0,0,0,0}, - {0,0,0,0}, - {0,0,0,0} - } +{ + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0} +} ``` That datastructure is a direct representation of the matrix for a 4 row by 5 column numpad. When a key is pressed that key's position within the matrix will be returned as `1` instead of `0`. -Matrix Scanning runs many times per second. The exact rate varies but typically it runs at least 10 times per second to avoid perceptable lag. +Matrix Scanning runs many times per second. The exact rate varies but typically it runs at least 10 times per second to avoid perceptible lag. ##### Matrix to Physical Layout Map @@ -114,67 +94,65 @@ 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 basically where 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 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 look 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: ``` - { - {0,0,0,0}, - {0,0,0,0}, - {0,0,0,0}, - {0,0,0,0}, - {0,0,0,0} - } +{ + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0} +} ``` And when our current scan completes it will look like this: ``` - { - {1,0,0,0}, - {0,0,0,0}, - {0,0,0,0}, - {0,0,0,0}, - {0,0,0,0} - } +{ + {1,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0} +} ``` Comparing against our keymap we can see that the pressed key is KC_NLCK. From here we dispatch to the `process_record` set of functions. -(FIXME: Feels like this section could be fleshed out more.) - -(FIXME: Magic happens between here and process_record) + ##### Process Record -The `process_record()` function itself is deceptively simple, but hidden within is a gateway to overriding functionality at various levels of QMK. The chain of events looks something like this: - -* `void process_record(keyrecord_t *record)` - * `bool process_record_quantum(keyrecord_t *record)` - * Map this record to a keycode - * `bool process_record_kb(uint16_t keycode, keyrecord_t *record)` - * `bool process_record_user(uint16_t keycode, keyrecord_t *record)` - * `bool process_midi(uint16_t keycode, keyrecord_t *record)` - * `bool process_audio(uint16_t keycode, keyrecord_t *record)` - * `bool process_music(uint16_t keycode, keyrecord_t *record)` - * `bool process_tap_dance(uint16_t keycode, keyrecord_t *record)` - * `bool process_leader(uint16_t keycode, keyrecord_t *record)` - * `bool process_chording(uint16_t keycode, keyrecord_t *record)` - * `bool process_combo(uint16_t keycode, keyrecord_t *record)` - * `bool process_unicode(uint16_t keycode, keyrecord_t *record)` - * `bool process_ucis(uint16_t keycode, keyrecord_t *record)` - * `bool process_printer(uint16_t keycode, keyrecord_t *record)` - * `bool process_unicode_map(uint16_t keycode, keyrecord_t *record)` - * Identify and process quantum specific keycodes - * Identify and process standard keycodes +The `process_record()` function itself is deceptively simple, but hidden within is a gateway to overriding functionality at various levels of QMK. The chain of events is described below, using cluecard whenever we need to look at the keyboard/keymap level functions. + +* [`void process_record(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/action.c#L128) + * [`bool process_record_quantum(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L140) + * [Map this record to a keycode](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L143) + * [`bool process_record_kb(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/cluecard/cluecard.c#L20) + * [`bool process_record_user(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/cluecard/keymaps/default/keymap.c#L58) + * [`bool process_midi(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_midi.c#L102) + * [`bool process_audio(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_audio.c#L10) + * [`bool process_music(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_music.c#L69) + * [`bool process_tap_dance(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_tap_dance.c#L75) + * [`bool process_leader(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_leader.c#L32) + * [`bool process_chording(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_chording.c#L41) + * [`bool process_combo(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_combo.c#L115) + * [`bool process_unicode(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicode.c#L22) + * [`bool process_ucis(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_ucis.c#L91) + * [`bool process_printer(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_printer.c#L77) + * [`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) -At any step during this chain of events a function (such as `process_record_kb()`) can `return false` and processing of that keypress will end immediately. +At any step during this chain of events a function (such as `process_record_kb()`) can `return false` to halt all further processing. + -- cgit v1.2.3 From 03eb6a3e86ad1ff70d7b82250f03ceb8e2cf239b Mon Sep 17 00:00:00 2001 From: skullY Date: Fri, 7 Jul 2017 13:28:31 -0700 Subject: comment out unformatted audio/midi sections --- docs/quantum_keycodes.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/quantum_keycodes.md') diff --git a/docs/quantum_keycodes.md b/docs/quantum_keycodes.md index a59d8fbc88..36dbda7a9c 100644 --- a/docs/quantum_keycodes.md +++ b/docs/quantum_keycodes.md @@ -44,6 +44,8 @@ Shortcuts for bootmagic options (these work even when bootmagic is off.) |`MAGIC_UNSWAP_ALT_GUI`/`AG_NORM`|Disable the Alt/GUI switching| |`MAGIC_TOGGLE_NKRO`|Turn NKRO on or off| + + ## Backlight These keycodes control the backlight. Most keyboards use this for single color in-switch lighting. -- cgit v1.2.3 From 5fc4a664dc0be3f380aba9480b710b9047f29fad Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Sun, 6 Aug 2017 02:09:34 -0700 Subject: Added initial key lock documentation. --- docs/_summary.md | 1 + docs/key_lock.md | 11 +++++++++++ docs/make_instructions.md | 4 ++++ docs/quantum_keycodes.md | 1 + 4 files changed, 17 insertions(+) create mode 100644 docs/key_lock.md (limited to 'docs/quantum_keycodes.md') diff --git a/docs/_summary.md b/docs/_summary.md index 723377de98..0f65de0dde 100644 --- a/docs/_summary.md +++ b/docs/_summary.md @@ -17,6 +17,7 @@ * [Mouse keys](mouse_keys.md) * [Unicode](unicode.md) * [Stenography](stenography.md) + * [Key Lock](key_lock.md) * Reference * [Glossary](glossary.md) diff --git a/docs/key_lock.md b/docs/key_lock.md new file mode 100644 index 0000000000..03cea20890 --- /dev/null +++ b/docs/key_lock.md @@ -0,0 +1,11 @@ +## Key Lock: Holding down keys for you + +Sometimes, you need to hold down a specific key for a long period of time. Whether this is while typing in ALL CAPS, or playing a video game that hasn't implemented auto-run, Key Lock is here to help. Key Lock adds a new keycode, `KC_LOCK`, that will hold down the next key you hit for you. The key is released when you hit it again. Here's an example: let's say you need to type in all caps for a few sentences. You hit KC_LOCK, and then shift. Now, shift will be considered held until you hit it again. You can think of key lock as caps lock, but supercharged. + +Here's how to use it: + +1. Pick a key on your keyboard. This will be the key lock key. Assign it the keycode `KC_LOCK`. This will be a single-action key: you won't be able to use it for anything else. +2. Enable key lock by including `KEY_LOCK_ENABLE = yes` in your Makefile. +3. That's it! + +Important: switching layers does not cancel the key lock. Additionally, key lock is only able to hold standard action keys. This does not include any of the QMK special functions, or shifted versions of keys such as KC_LPRN. If it's in the [basic_keycodes](basic_keycodes.md) list, it can be held. If it's not, then it can't be. diff --git a/docs/make_instructions.md b/docs/make_instructions.md index 64c1cb0f00..299c5785b2 100644 --- a/docs/make_instructions.md +++ b/docs/make_instructions.md @@ -158,6 +158,10 @@ This enables using the Quantum SYSEX API to send strings (somewhere?) This consumes about 5390 bytes. +`KEY_LOCK_ENABLE` + +This enables [key lock](key_lock.md). This consumes an additional 260 bytes. + ## Customizing Makefile options on a per-keymap basis If your keymap directory has a file called `Makefile` (note the filename), any Makefile options you set in that file will take precedence over other Makefile options for your particular keyboard. diff --git a/docs/quantum_keycodes.md b/docs/quantum_keycodes.md index 36dbda7a9c..f13801ef59 100644 --- a/docs/quantum_keycodes.md +++ b/docs/quantum_keycodes.md @@ -17,6 +17,7 @@ On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are |`FUNC(n)`/`F(n)`|Call `fn_action(n)`| |`M(n)`|to call macro n| |`MACROTAP(n)`|to macro-tap n idk FIXME| +|`KC_LOCK`|The [lock key](key_lock.md)| ## Bootmagic Keycodes -- cgit v1.2.3 From b7d43ee25371604929ee87dd7bc17430ff0f7a8c Mon Sep 17 00:00:00 2001 From: discursivemoth Date: Sun, 13 Aug 2017 15:20:04 -0400 Subject: correct tilde to grave --- docs/quantum_keycodes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/quantum_keycodes.md') diff --git a/docs/quantum_keycodes.md b/docs/quantum_keycodes.md index f13801ef59..0f2b8e72fa 100644 --- a/docs/quantum_keycodes.md +++ b/docs/quantum_keycodes.md @@ -10,7 +10,7 @@ On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are |----|-----------| |`RESET`|Put the keyboard into DFU mode for flashing| |`DEBUG`|Toggles debug mode| -|`KC_GESC`/`GRAVE_ESC`|Acts as escape when pressed normally but when pressed with Shift or GUI will send a `~`| +|`KC_GESC`/`GRAVE_ESC`|Acts as escape when pressed normally but when pressed with Shift or GUI will send a ```| |`KC_LSPO`|Left shift when held, open paranthesis when tapped| |`KC_RSPC`|Right shift when held, close paranthesis when tapped| |`KC_LEAD`|The [leader key](leader_key.md)| -- cgit v1.2.3 From 9b879b1267cd5cbebf4d73595c7ca4ed52fe5ef4 Mon Sep 17 00:00:00 2001 From: skullY Date: Sun, 6 Aug 2017 17:51:42 -0700 Subject: break up keymaps and quantum keycodes into files by feature --- docs/_summary.md | 31 ++-- docs/basic_keycodes.md | 6 + docs/feature_audio.md | 118 +++++++++++++ docs/feature_backlight.md | 17 ++ docs/feature_bluetooth.md | 13 ++ docs/feature_bootmagic.md | 29 ++++ docs/feature_common_shortcuts.md | 4 +- docs/feature_rgblight.md | 18 ++ docs/feature_thermal_printer.md | 10 ++ docs/keycodes.md | 360 +++++++++++++++++++++++++++++++++++++-- docs/keycodes_us_ansi_shifted.md | 31 ++++ docs/quantum_keycodes.md | 340 +----------------------------------- 12 files changed, 616 insertions(+), 361 deletions(-) create mode 100644 docs/feature_audio.md create mode 100644 docs/feature_backlight.md create mode 100644 docs/feature_bluetooth.md create mode 100644 docs/feature_bootmagic.md create mode 100644 docs/feature_rgblight.md create mode 100644 docs/feature_thermal_printer.md create mode 100644 docs/keycodes_us_ansi_shifted.md (limited to 'docs/quantum_keycodes.md') diff --git a/docs/_summary.md b/docs/_summary.md index 4c4711064e..071ce56310 100644 --- a/docs/_summary.md +++ b/docs/_summary.md @@ -13,27 +13,36 @@ * [Features](features.md) * [Common Shortcuts](feature_common_shortcuts.md) - * [Layer Switching](feature_common_shortcuts.md#switching-and-toggling-layers) - * [Modifier Keys](feature_common_shortcuts.md#modifier-keys) - * [Shifted Keycodes](feature_common_shortcuts.md#shifted-keycodes) - * [One Shot Keys](feature_common_shortcuts.md#one-shot-keys) - * [Mod Tap](feature_common_shortcuts.md#mod-tap) + * [Backlight](feature_backlight.md) + * [Bootmagic](feature_bootmagic.md) + * [Dynamic Macros](dynamic_macros.md) + * [Key Lock](key_lock.md) * [Leader Key](leader_key.md) * [Macros](macros.md) - * [Dynamic Macros](dynamic_macros.md) + * [Mouse keys](mouse_keys.md) * [Space Cadet](space_cadet_shift.md) * [Tap Dance](tap_dance.md) - * [Mouse keys](mouse_keys.md) - * [Unicode](unicode.md) + * [Thermal Printer](feature_thermal_printer.md) * [Stenography](stenography.md) - * [Key Lock](key_lock.md) + * [Unicode](unicode.md) * Reference * [Glossary](glossary.md) * [Keymap overview](keymap.md) * [Keycodes](keycodes.md) - * [Basic Keycodes](basic_keycodes.md) - * [Quantum Keycodes](quantum_keycodes.md) + * [Basic](basic_keycodes.md) + * [Quantum](quantum_keycodes.md) + * [Backlight](feature_backlight.md#backlight-keycodes) + * [Bluetooth](feature_bluetooth.md#bluetooth-keycodes) + * [Bootmagic](feature_bootmagic.md#bootmagic-keycodes) + * [Layer Switching](feature_common_shortcuts.md#switching-and-toggling-layers) + * [Mod+Key](feature_common_shortcuts.md#modifier-keys) + * [Mod Tap](feature_common_shortcuts.md#mod-tap) + * [One Shot Keys](feature_common_shortcuts.md#one-shot-keys) + * [Shifted Keys](feature_common_shortcuts.md#shifted-keycodes) + * [RGB Light](feature_rgblight.md#rgblight-keycodes) + * [Thermal Printer](feature_thermal_printer.md#thermal-printer-keycodes) + * [US ANSI Shifted Keys](keycodes_us_ansi_shifted.md) * [The `config.h` File](config_options.md) * [Customizing Functionality](custom_quantum_functions.md) * [Documentation Best Practices](documentation_best_practices.md) diff --git a/docs/basic_keycodes.md b/docs/basic_keycodes.md index 4f84647a2a..b1f69ab167 100644 --- a/docs/basic_keycodes.md +++ b/docs/basic_keycodes.md @@ -1,5 +1,11 @@ # Basic keycodes +Basic keycodes are based on [HID Usage Keyboard/Keypad Page(0x07)](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) with following exceptions: + +* `KC_NO` = 0 for no action +* `KC_TRNS` = 1 for layer transparency +* internal special keycodes in the `0xA5-DF` range (tmk heritage). + ## Letters and Numbers |KC_1|KC_2|KC_3|KC_4|KC_5|KC_6|KC_7|KC_8| diff --git a/docs/feature_audio.md b/docs/feature_audio.md new file mode 100644 index 0000000000..6b476880d1 --- /dev/null +++ b/docs/feature_audio.md @@ -0,0 +1,118 @@ +# Audio + + diff --git a/docs/feature_backlight.md b/docs/feature_backlight.md new file mode 100644 index 0000000000..c419b7cccb --- /dev/null +++ b/docs/feature_backlight.md @@ -0,0 +1,17 @@ +# Backlighting + + + +## Backlight Keycodes + +These keycodes control the backlight. Most keyboards use this for single color in-switch lighting. + +|Name|Description| +|----|-----------| +|`BL_x`|Set a specific backlight level between 0-9| +|`BL_ON`|An alias for `BL_9`| +|`BL_OFF`|An alias for `BL_0`| +|`BL_DEC`|Turn the backlight level down by 1| +|`BL_INC`|Turn the backlight level up by 1| +|`BL_TOGG`|Toggle the backlight on or off| +|`BL_STEP`|Step through backlight levels, wrapping around to 0 when you reach the top.| diff --git a/docs/feature_bluetooth.md b/docs/feature_bluetooth.md new file mode 100644 index 0000000000..d586278579 --- /dev/null +++ b/docs/feature_bluetooth.md @@ -0,0 +1,13 @@ +# Bluetooth + + + +## Bluetooth Keycodes + +This is used when multiple keyboard outputs can be selected. Currently this only allows for switching between USB and Bluetooth on keyboards that support both. + +|Name|Description| +|----|-----------| +|`OUT_AUTO`|auto mode| +|`OUT_USB`|usb only| +|`OUT_BT`|bluetooth| diff --git a/docs/feature_bootmagic.md b/docs/feature_bootmagic.md new file mode 100644 index 0000000000..3cf7d8d2a9 --- /dev/null +++ b/docs/feature_bootmagic.md @@ -0,0 +1,29 @@ +# Bootmagic + + + +## Bootmagic Keycodes + +Shortcuts for bootmagic options. You can use these even when bootmagic is off. + +|Name|Description| +|----|-----------| +|`MAGIC_SWAP_CONTROL_CAPSLOCK`|Swap Capslock and Left Control| +|`MAGIC_CAPSLOCK_TO_CONTROL`|Treat Capslock like a Control Key| +|`MAGIC_SWAP_LALT_LGUI`|Swap the left Alt and GUI keys| +|`MAGIC_SWAP_RALT_RGUI`|Swap the right Alt and GUI keys| +|`MAGIC_NO_GUI`|Disable the GUI key| +|`MAGIC_SWAP_GRAVE_ESC`|Swap the Grave and Esc key.| +|`MAGIC_SWAP_BACKSLASH_BACKSPACE`|Swap backslack and backspace| +|`MAGIC_HOST_NKRO`|Force NKRO on| +|`MAGIC_SWAP_ALT_GUI`/`AG_SWAP`|Swap Alt and Gui on both sides| +|`MAGIC_UNSWAP_CONTROL_CAPSLOCK`|Disable the Control/Capslock swap| +|`MAGIC_UNCAPSLOCK_TO_CONTROL`|Disable treating Capslock like Control | +|`MAGIC_UNSWAP_LALT_LGUI`|Disable Left Alt and GUI switching| +|`MAGIC_UNSWAP_RALT_RGUI`|Disable Right Alt and GUI switching| +|`MAGIC_UNNO_GUI`|Enable the GUI key | +|`MAGIC_UNSWAP_GRAVE_ESC`|Disable the Grave/Esc swap | +|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`|Disable the backslash/backspace swap| +|`MAGIC_UNHOST_NKRO`|Force NKRO off| +|`MAGIC_UNSWAP_ALT_GUI`/`AG_NORM`|Disable the Alt/GUI switching| +|`MAGIC_TOGGLE_NKRO`|Turn NKRO on or off| diff --git a/docs/feature_common_shortcuts.md b/docs/feature_common_shortcuts.md index 6a20ee64eb..e911420261 100644 --- a/docs/feature_common_shortcuts.md +++ b/docs/feature_common_shortcuts.md @@ -25,7 +25,9 @@ These functions allow you to activate layers in various ways. * `TO(layer)` - Goes to a layer. This code is special, because it lets you go either up or down the stack -- just goes directly to the layer you want. So while other codes only let you go _up_ the stack (from layer 0 to layer 3, for example), `TO(2)` is going to get you to layer 2, no matter where you activate it from -- even if you're currently on layer 5. This gets activated on keydown (as soon as the key is pressed). * `TT(layer)` - Layer Tap-Toggle. If you hold the key down, the layer becomes active, and then deactivates when you let go. And if you tap it, the layer simply becomes active (toggles on). It needs 5 taps by default, but you can set it by defining `TAPPING_TOGGLE`, for example, `#define TAPPING_TOGGLE 2` for just two taps. -Care must be taken when switching layers, it's possible to lock yourself in a layer with no way to deactivate that layer (without unplugging your keyboard.) We've created some guidelines to help users avoid the most common problems. +## Working With Layers + +Care must be taken when switching layers, it's possible to lock yourself into a layer with no way to deactivate that layer (without unplugging your keyboard.) We've created some guidelines to help users avoid the most common problems. ### Beginners diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md new file mode 100644 index 0000000000..8bbe06b971 --- /dev/null +++ b/docs/feature_rgblight.md @@ -0,0 +1,18 @@ +# RGB Lighting + + + +## RGB Lighting Keycodes + +This controls the RGB Lighting functionality. Most keyboards use WS2812 (and compatible) LEDs for underlight or case lighting. + +|Name|Description| +|----|-----------| +|`RGB_TOG`|toggle on/off| +|`RGB_MOD`|cycle through modes| +|`RGB_HUI`|hue increase| +|`RGB_HUD`|hue decrease| +|`RGB_SAI`|saturation increase| +|`RGB_SAD`|saturation decrease| +|`RGB_VAI`|value increase| +|`RGB_VAD`|value decrease| diff --git a/docs/feature_thermal_printer.md b/docs/feature_thermal_printer.md new file mode 100644 index 0000000000..0c5d15116a --- /dev/null +++ b/docs/feature_thermal_printer.md @@ -0,0 +1,10 @@ +# Thermal Printer + + + +## Thermal Printer Keycodes + +|Name|Description| +|----|-----------| +|`PRINT_ON`|Start printing everything the user types| +|`PRINT_OFF`|Stop printing everything the user types| diff --git a/docs/keycodes.md b/docs/keycodes.md index 7c5cae8b31..b9e1f42f77 100644 --- a/docs/keycodes.md +++ b/docs/keycodes.md @@ -1,17 +1,351 @@ # 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. This is a reference only. Where possible keys link to the page documenting their functionality. -This page documents the symbols that correspond to keycodes that are available to you in QMK. +## Keycode Index -## Basic keycodes (`0x00` - `0xFF`) - -[Basic keycodes](basic_keycodes.md) in QMK are based on [HID Usage Keyboard/Keypad Page(0x07)](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) with following exceptions: - -* `KC_NO` = 0 for no action -* `KC_TRNS` = 1 for layer transparency -* internal special keycodes in the `0xA5-DF` range (tmk heritage). - -## Quantum keycodes (`0x0100` - `0xFFFF`) - -[Quantum keycodes](quantum_keycodes.md) allow for easier customisation of your keymap than the basic ones provide, without having to define custom actions. +|Long Name|Short Name|Description| +|---------|----------|-----------| +|`KC_1`|||| +|`KC_2`|||| +|`KC_3`|||| +|`KC_4`|||| +|`KC_5`|||| +|`KC_6`|||| +|`KC_7`|||| +|`KC_8`|||| +|`KC_9`|||| +|`KC_0`|||| +|`KC_F1`|||| +|`KC_F2`|||| +|`KC_F3`|||| +|`KC_F4`|||| +|`KC_F5`|||| +|`KC_F6`|||| +|`KC_F7`|||| +|`KC_F8`|||| +|`KC_F9`|||| +|`KC_F10`|||| +|`KC_F11`|||| +|`KC_F12`|||| +|`KC_F13`|||| +|`KC_F14`|||| +|`KC_F15`|||| +|`KC_F16`|||| +|`KC_F17`|||| +|`KC_F18`|||| +|`KC_F19`|||| +|`KC_F20`|||| +|`KC_F21`|||| +|`KC_F22`|||| +|`KC_F23`|||| +|`KC_F24`|||| +|`KC_A`|||| +|`KC_B`|||| +|`KC_C`|||| +|`KC_D`|||| +|`KC_E`|||| +|`KC_F`|||| +|`KC_G`|||| +|`KC_H`|||| +|`KC_I`|||| +|`KC_J`|||| +|`KC_K`|||| +|`KC_L`|||| +|`KC_M`|||| +|`KC_N`|||| +|`KC_O`|||| +|`KC_P`|||| +|`KC_Q`|||| +|`KC_R`|||| +|`KC_S`|||| +|`KC_T`|||| +|`KC_U`|||| +|`KC_V`|||| +|`KC_W`|||| +|`KC_X`|||| +|`KC_Y`|||| +|`KC_Z`|||| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|`KC_ENTER`|`KC_ENT`|`Return (ENTER)`| +|`KC_ESCAPE`|`KC_ESC`|`ESCAPE`| +|`KC_BSPACE`|`KC_BSPC`|`DELETE (Backspace)`| +|`KC_TAB`||`Tab`| +|`KC_SPACE`|`KC_SPC`|Spacebar| +|`KC_MINUS`|`KC_MINS`|`-` and `_`| +|`KC_EQUAL`|`KC_EQL`|`=` and `+`| +|`KC_LBRACKET`|`KC_LBRC`|`[` and `{`| +|`KC_RBRACKET`|`KC_RBRC`|`]` and `}`| +|`KC_BSLASH`|`KC_BSLS`|`\` and | | +|`KC_NONUS_HASH`|`KC_NUHS`|Non-US `#` and `~`| +|`KC_NONUS_BSLASH`|`KC_NUBS`|Non-US `\` and | | +|`KC_INT1`|`KC_RO`|JIS `\` and | | +|`KC_INT2`|`KC_KANA`|International216| +|`KC_INT3`|`KC_JYEN`|Yen Symbol (`¥`)| +|`KC_SCOLON`|`KC_SCLN`|`;` and `:`| +|`KC_QUOTE`|`KC_QUOT`|`‘` and `“`| +|`KC_GRAVE`|`KC_GRV`|Grave Accent and Tilde| +|`KC_COMMA`|`KC_COMM`|`,` and `<`| +|`KC_DOT`||`.` and `>`| +|`KC_SLASH`|`KC_SLSH`|`/` and `?`| +|`KC_CAPSLOCK`|`KC_CAPS`|Caps Lock| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|`KC_LCTRL`|`KC_LCTL`|LeftControl| +|`KC_LSHIFT`|`KC_LSFT`|LeftShift| +|`KC_LALT`||LeftAlt| +|`KC_LGUI`||Left GUI(Windows/Apple/Meta key)| +|`KC_RCTRL`|`KC_RCTL`|RightControl| +|`KC_RSHIFT`|`KC_RSFT`|RightShift| +|`KC_RALT`||RightAlt| +|`KC_RGUI`||Right GUI(Windows/Apple/Meta key)| +|`KC_LOCKING_CAPS`|`KC_LCAP`|Locking Caps Lock| +|`KC_LOCKING_NUM`|`KC_LNUM`|Locking Num Lock| +|`KC_LOCKING_SCROLL`|`KC_LSCR`|Locking Scroll Lock| +|`KC_INT4`|`KC_HENK`|JIS Henken| +|`KC_INT5`|`KC_MHEN`|JIS Muhenken| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|`KC_PSCREEN`|`KC_PSCR`|PrintScreen| +|`KC_SCROLLLOCK`|`KC_SLCK`|Scroll Lock| +|`KC_PAUSE`|`KC_PAUS`|Pause| +|`KC_INSERT`|`KC_INS`|Insert| +|`KC_HOME`||Home| +|`KC_PGUP`||PageUp| +|`KC_DELETE`|`KC_DEL`|Delete Forward| +|`KC_END`||End| +|`KC_PGDOWN`|`KC_PGDN`|PageDown| +|`KC_RIGHT`|`KC_RGHT`|RightArrow| +|`KC_LEFT`||LeftArrow| +|`KC_DOWN`||DownArrow| +|`KC_UP`||UpArrow| +|`KC_APPLICATION`|`KC_APP`|Application| +|`KC_POWER`||Power| +|`KC_EXECUTE`||Execute| +|`KC_HELP`||Help| +|`KC_MENU`||Menu| +|`KC_SELECT`||Select| +|`KC_AGAIN`||Again| +|`KC_UNDO`||Undo| +|`KC_CUT`||Cut| +|`KC_COPY`||Copy| +|`KC_PASTE`||Paste| +|`KC_FIND`||Find| +|`KC_ALT_ERASE`||Alternate Erase| +|`KC_SYSREQ`||SysReq/Attention| +|`KC_CANCEL`||Cancel| +|`KC_CLEAR`||Clear| +|`KC_PRIOR`||Prior| +|`KC_RETURN`||Return| +|`KC_SEPARATOR`||Separator| +|`KC_OUT`||Out| +|`KC_OPER`||Oper| +|`KC_CLEAR_AGAIN`||Clear/Again| +|`KC_CRSEL`||CrSel/Props| +|`KC_EXSEL`||ExSel| +|`KC_SYSTEM_POWER`|`KC_PWR`|System Power Down| +|`KC_SYSTEM_SLEEP`|`KC_SLEP`|System Sleep| +|`KC_SYSTEM_WAKE`|`KC_WAKE`|System Wake| +|`KC_MAIL`|`KC_MAIL`|| +|`KC_CALCULATOR`|`KC_CALC`|| +|`KC_MY_COMPUTER`|`KC_MYCM`|| +|`KC_WWW_SEARCH`|`KC_WSCH`|| +|`KC_WWW_HOME`|`KC_WHOM`|| +|`KC_WWW_BACK`|`KC_WBAK`|| +|`KC_WWW_FORWARD`|`KC_WFWD`|| +|`KC_WWW_STOP`|`KC_WSTP`|| +|`KC_WWW_REFRESH`|`KC_WREF`|| +|`KC_WWW_FAVORITES`|`KC_WFAV`|| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|`KC_STOP`||Stop| +|`KC__MUTE`||Mute| +|`KC__VOLUP`||Volume Up| +|`KC__VOLDOWN`||Volume Down| +|`KC_AUDIO_MUTE`|`KC_MUTE`|| +|`KC_AUDIO_VOL_UP`|`KC_VOLU`|| +|`KC_AUDIO_VOL_DOWN`|`KC_VOLD`|| +|`KC_MEDIA_NEXT_TRACK`|`KC_MNXT`|Next Track (Windows)| +|`KC_MEDIA_PREV_TRACK`|`KC_MPRV`|Previous Track (Windows)| +|`KC_MEDIA_FAST_FORWARD`|`KC_MFFD`|Next Track (macOS)| +|`KC_MEDIA_REWIND`|`KC_MRWD`|Previous Track (macOS)| +|`KC_MEDIA_STOP`|`KC_MSTP`|| +|`KC_MEDIA_PLAY_PAUSE`|`KC_MPLY`|| +|`KC_MEDIA_SELECT`|`KC_MSEL`|| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|`KC_NUMLOCK`|`KC_NLCK`|Keypad Num Lock and Clear| +|`KC_KP_SLASH`|`KC_PSLS`|Keypad /| +|`KC_KP_ASTERISK`|`KC_PAST`|Keypad *| +|`KC_KP_MINUS`|`KC_PMNS`|Keypad -| +|`KC_KP_PLUS`|`KC_PPLS`|Keypad +| +|`KC_KP_ENTER`|`KC_PENT`|Keypad ENTER`| +|`KC_KP_1`|`KC_P1`|Keypad 1 and End| +|`KC_KP_2`|`KC_P2`|Keypad 2 and Down Arrow| +|`KC_KP_3`|`KC_P3`|Keypad 3 and PageDn| +|`KC_KP_4`|`KC_P4`|Keypad 4 and Left Arrow| +|`KC_KP_5`|`KC_P5`|Keypad 5| +|`KC_KP_6`|`KC_P6`|Keypad 6 and Right Arrow| +|`KC_KP_7`|`KC_P7`|Keypad 7 and Home| +|`KC_KP_8`|`KC_P8`|Keypad 8 and Up Arrow| +|`KC_KP_9`|`KC_P9`|Keypad 9 and PageUp| +|`KC_KP_0`|`KC_P0`|Keypad 0 and Insert| +|`KC_KP_DOT`|`KC_PDOT`|Keypad . and Delete| +|`KC_KP_EQUAL`|`KC_PEQL`|Keypad =| +|`KC_KP_COMMA`|`KC_PCMM`|Keypad Comma| +|`KC_KP_EQUAL_AS400`||Keypad Equal Sign| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|`KC_NO`||Ignore this key. (NOOP) | +|`KC_TRNS`||Make this key transparent to find the key on a lower layer.| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|[`KC_MS_UP`](mouse_keys.md)|`KC_MS_U`|Mouse Cursor Up| +|[`KC_MS_DOWN`](mouse_keys.md)|`KC_MS_D`|Mouse Cursor Down| +|[`KC_MS_LEFT`](mouse_keys.md)|`KC_MS_L`|Mouse Cursor Left| +|[`KC_MS_RIGHT`](mouse_keys.md)|`KC_MS_R`|Mouse Cursor Right| +|[`KC_MS_BTN1`](mouse_keys.md)|`KC_BTN1`|Mouse Button 1| +|[`KC_MS_BTN2`](mouse_keys.md)|`KC_BTN2`|Mouse Button 2| +|[`KC_MS_BTN3`](mouse_keys.md)|`KC_BTN3`|Mouse Button 3| +|[`KC_MS_BTN4`](mouse_keys.md)|`KC_BTN4`|Mouse Button 4| +|[`KC_MS_BTN5`](mouse_keys.md)|`KC_BTN5`|Mouse Button 5| +|[`KC_MS_WH_UP`](mouse_keys.md)|`KC_WH_U`|Mouse Wheel Up| +|[`KC_MS_WH_DOWN`](mouse_keys.md)|`KC_WH_D`|Mouse Wheel Down| +|[`KC_MS_WH_LEFT`](mouse_keys.md)|`KC_WH_L`|Mouse Wheel Left| +|[`KC_MS_WH_RIGHT`](mouse_keys.md)|`KC_WH_R`|Mouse Wheel Right| +|[`KC_MS_ACCEL0`](mouse_keys.md)|`KC_ACL0`|Mouse Acceleration 0| +|[`KC_MS_ACCEL1`](mouse_keys.md)|`KC_ACL1`|Mouse Acceleration 1| +|[`KC_MS_ACCEL2`](mouse_keys.md)|`KC_ACL2`|Mouse Acceleration 2| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|[`RESET`](quantum_keycodes.md#qmk-keycodes)||Put the keyboard into DFU mode for flashing| +|[`DEBUG`](quantum_keycodes.md#qmk-keycodes)||Toggles debug mode| +|[`KC_GESC`](quantum_keycodes.md#qmk-keycodes)|`GRAVE_ESC`|Acts as escape when pressed normally but when pressed with Shift or GUI will send a `~`| +|[`KC_LSPO`](quantum_keycodes.md#qmk-keycodes)||Left shift when held, open paranthesis when tapped| +|[`KC_RSPC`](quantum_keycodes.md#qmk-keycodes)||Right shift when held, close paranthesis when tapped| +|[`KC_LEAD`](quantum_keycodes.md#qmk-keycodes)||The [leader key](leader_key.md)| +|[`FUNC(n)`](quantum_keycodes.md#qmk-keycodes)|`F(n)`|Call `fn_action(n)`| +|[`M(n)`](quantum_keycodes.md#qmk-keycodes)||to call macro n| +|[`MACROTAP(n)`](quantum_keycodes.md#qmk-keycodes)||to macro-tap n idk FIXME`| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|[`MAGIC_SWAP_CONTROL_CAPSLOCK`](feature_bootmagic.md)||Swap Capslock and Left Control| +|[`MAGIC_CAPSLOCK_TO_CONTROL`](feature_bootmagic.md)||Treat Capslock like a Control Key| +|[`MAGIC_SWAP_LALT_LGUI`](feature_bootmagic.md)||Swap the left Alt and GUI keys| +|[`MAGIC_SWAP_RALT_RGUI`](feature_bootmagic.md)||Swap the right Alt and GUI keys| +|[`MAGIC_NO_GUI`](feature_bootmagic.md)||Disable the GUI key| +|[`MAGIC_SWAP_GRAVE_ESC`](feature_bootmagic.md)||Swap the Grave and Esc key.| +|[`MAGIC_SWAP_BACKSLASH_BACKSPACE`](feature_bootmagic.md)||Swap backslack and backspace| +|[`MAGIC_HOST_NKRO`](feature_bootmagic.md)||Force NKRO on| +|[`MAGIC_SWAP_ALT_GUI`/`AG_SWAP`](feature_bootmagic.md)||Swap Alt and Gui on both sides| +|[`MAGIC_UNSWAP_CONTROL_CAPSLOCK`](feature_bootmagic.md)||Disable the Control/Capslock swap| +|[`MAGIC_UNCAPSLOCK_TO_CONTROL`](feature_bootmagic.md)||Disable treating Capslock like Control | +|[`MAGIC_UNSWAP_LALT_LGUI`](feature_bootmagic.md)||Disable Left Alt and GUI switching| +|[`MAGIC_UNSWAP_RALT_RGUI`](feature_bootmagic.md)||Disable Right Alt and GUI switching| +|[`MAGIC_UNNO_GUI`](feature_bootmagic.md)||Enable the GUI key | +|[`MAGIC_UNSWAP_GRAVE_ESC`](feature_bootmagic.md)||Disable the Grave/Esc swap | +|[`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`](feature_bootmagic.md)||Disable the backslash/backspace swap| +|[`MAGIC_UNHOST_NKRO`](feature_bootmagic.md)||Force NKRO off| +|[`MAGIC_UNSWAP_ALT_GUI`/`AG_NORM`](feature_bootmagic.md)||Disable the Alt/GUI switching| +|[`MAGIC_TOGGLE_NKRO`](feature_bootmagic.md)||Turn NKRO on or off| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|[`BL_x`](feature_backlight.md)||Set a specific backlight level between 0-9| +|[`BL_ON`](feature_backlight.md)||An alias for `BL_9`| +|[`BL_OFF`](feature_backlight.md)||An alias for `BL_0`| +|[`BL_DEC`](feature_backlight.md)||Turn the backlight level down by 1| +|[`BL_INC`](feature_backlight.md)||Turn the backlight level up by 1| +|[`BL_TOGG`](feature_backlight.md)||Toggle the backlight on or off| +|[`BL_STEP`](feature_backlight.md)||Step through backlight levels, wrapping around to 0 when you reach the top.| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|[`RGB_TOG`](feature_rgblight.md)||toggle on/off| +|[`RGB_MOD`](feature_rgblight.md)||cycle through modes| +|[`RGB_HUI`](feature_rgblight.md)||hue increase| +|[`RGB_HUD`](feature_rgblight.md)||hue decrease| +|[`RGB_SAI`](feature_rgblight.md)||saturation increase| +|[`RGB_SAD`](feature_rgblight.md)||saturation decrease| +|[`RGB_VAI`](feature_rgblight.md)||value increase| +|[`RGB_VAD`](feature_rgblight.md)||value decrease| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|[`PRINT_ON`](feature_thermal_printer.md)||Start printing everything the user types| +|[`PRINT_OFF`](feature_thermal_printer.md)||Stop printing everything the user types| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|[`OUT_AUTO`](feature_bluetooth.md)||auto mode| +|[`OUT_USB`](feature_bluetooth.md)||usb only| +|[`OUT_BT`](feature_bluetooth.md)||bluetooth (when `BLUETOOTH_ENABLE`)| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|[`KC_HYPR`](quantum_keycodes.md#modifiers)||Hold down LCTL + LSFT + LALT + LGUI`| +|[`KC_MEH`](quantum_keycodes.md#modifiers)||Hold down LCTL + LSFT + LALT`| +|[`LCTL(kc)`](quantum_keycodes.md#modifiers)||`LCTL` + `kc`| +|[`LSFT(kc)`](quantum_keycodes.md#modifiers)|[`S(kc)`](quantum_keycodes.md#modifiers)|`LSFT` + `kc`| +|[`LALT(kc)`](quantum_keycodes.md#modifiers)||`LALT` + `kc`| +|[`LGUI(kc)`](quantum_keycodes.md#modifiers)||`LGUI` + `kc`| +|[`RCTL(kc)`](quantum_keycodes.md#modifiers)||`RCTL` + `kc`| +|[`RSFT(kc)`](quantum_keycodes.md#modifiers)||`RSFT` + `kc`| +|[`RALT(kc)`](quantum_keycodes.md#modifiers)||`RALT` + `kc`| +|[`RGUI(kc)`](quantum_keycodes.md#modifiers)||`RGUI` + `kc`| +|[`HYPR(kc)`](quantum_keycodes.md#modifiers)||`LCTL` + `LSFT` + `LALT` + `LGUI` + `kc`| +|[`MEH(kc)`](quantum_keycodes.md#modifiers)||`LCTL` + `LSFT` + `LALT` + `kc`| +|[`LCAG(kc)`](quantum_keycodes.md#modifiers)||`LCTL` + `LALT` + `LGUI` + `kc`| +|[`ALTG(kc)`](quantum_keycodes.md#modifiers)||`RCTL` + `RALT` + `kc`| +|[`SCMD(kc)`](quantum_keycodes.md#modifiers)|[`SWIN(kc)`](quantum_keycodes.md#modifiers)|`LGUI` + `LSFT` + `kc`| +|[`LCA(kc)`](quantum_keycodes.md#modifiers)||`LCTL` + `LALT` + `kc`| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|[`CTL_T(kc)`](quantum_keycodes.md#mod-tap-keys)|[`LCTL_T(kc)`](quantum_keycodes.md#mod-tap-keys)|`LCTL` when held, `kc` when tapped| +|[`RCTL_T(kc)`](quantum_keycodes.md#mod-tap-keys)||[`RCTL` when held, `kc` when tapped| +|[`SFT_T(kc)`](quantum_keycodes.md#mod-tap-keys)|[`LSFT_T(kc)`](quantum_keycodes.md#mod-tap-keys)|`LSFT` when held, `kc` when tapped| +|[`RSFT_T(kc)`](quantum_keycodes.md#mod-tap-keys)||[`RSFT` when held, `kc` when tapped| +|[`ALT_T(kc)`](quantum_keycodes.md#mod-tap-keys)|[`LALT_T(kc)`](quantum_keycodes.md#mod-tap-keys)|`LALT` when held, `kc` when tapped| +|[`RALT_T(kc)`](quantum_keycodes.md#mod-tap-keys)|[`ALGR_T(kc)`](quantum_keycodes.md#mod-tap-keys)|`RALT` when held, `kc` when tapped| +|[`GUI_T(kc)`](quantum_keycodes.md#mod-tap-keys)|[`LGUI_T(kc)`](quantum_keycodes.md#mod-tap-keys)|`LGUI` when held, `kc` when tapped| +|[`RGUI_T(kc)`](quantum_keycodes.md#mod-tap-keys)||`RGUI` when held, `kc` when tapped| +|[`C_S_T(kc)`](quantum_keycodes.md#mod-tap-keys)||`LCTL` + `LSFT` when held, `kc` when tapped| +|[`MEH_T(kc)`](quantum_keycodes.md#mod-tap-keys)||`LCTL` + `LSFT` + `LALT` when held, `kc` when tapped| +|[`LCAG_T(kc)`](quantum_keycodes.md#mod-tap-keys)||`LCTL` + `LALT` + `LGUI` when held, `kc` when tapped| +|[`RCAG_T(kc)`](quantum_keycodes.md#mod-tap-keys)||`RCTL` + `RALT` + `RGUI` when held, `kc` when tapped| +|[`ALL_T(kc)`](quantum_keycodes.md#mod-tap-keys)||`LCTL` + `LSFT` + `LALT` + `LGUI` when held, `kc` when tapped [more info](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)| +|[`SCMD_T(kc)`](quantum_keycodes.md#mod-tap-keys)|[`SWIN_T(kc)`](quantum_keycodes.md#mod-tap-keys)|`LGUI` + `LSFT` when held, `kc` when tapped| +|[`LCA_T(kc)`](quantum_keycodes.md#mod-tap-keys)||`LCTL` + `LALT` when held, `kc` when tapped| +|Short Name|Long Name|Description| +|----------|---------|-----------| +|[`KC_TILD`](keycodes_us_ansi_shifted.md)|`KC_TILDE`|tilde `~`| +|[`KC_EXLM`](keycodes_us_ansi_shifted.md)|`KC_EXCLAIM`|exclamation mark `!`| +|[`KC_AT`](keycodes_us_ansi_shifted.md)||at sign `@`| +|[`KC_HASH`](keycodes_us_ansi_shifted.md)||hash sign `#`| +|[`KC_DLR`](keycodes_us_ansi_shifted.md)|`KC_DOLLAR`|dollar sign `$`| +|[`KC_PERC`](keycodes_us_ansi_shifted.md)|`KC_PERCENT`|percent sign `%`| +|[`KC_CIRC`](keycodes_us_ansi_shifted.md)|`KC_CIRCUMFLEX`|circumflex `^`| +|[`KC_AMPR`](keycodes_us_ansi_shifted.md)|`KC_AMPERSAND`|ampersand `&`| +|[`KC_ASTR`](keycodes_us_ansi_shifted.md)|`KC_ASTERISK`|asterisk `*`| +|[`KC_LPRN`](keycodes_us_ansi_shifted.md)|`KC_LEFT_PAREN`|left parenthesis `(`| +|[`KC_RPRN`](keycodes_us_ansi_shifted.md)|`KC_RIGHT_PAREN`|right parenthesis `)`| +|[`KC_UNDS`](keycodes_us_ansi_shifted.md)|`KC_UNDERSCORE`|underscore `_`| +|[`KC_PLUS`](keycodes_us_ansi_shifted.md)||plus sign `+`| +|[`KC_LCBR`](keycodes_us_ansi_shifted.md)|`KC_LEFT_CURLY_BRACE`|left curly brace `{`| +|[`KC_RCBR`](keycodes_us_ansi_shifted.md)|`KC_RIGHT_CURLY_BRACE`|right curly brace `}`| +|[`KC_LT`/`KC_LABK`](keycodes_us_ansi_shifted.md)|`KC_LEFT_ANGLE_BRACKET`|left angle bracket `<`| +|[`KC_GT`/`KC_RABK`](keycodes_us_ansi_shifted.md)|`KC_RIGHT_ANGLE_BRACKET`|right angle bracket `>`| +|[`KC_COLN`](keycodes_us_ansi_shifted.md)|`KC_COLON`|colon `:`| +|[`KC_PIPE`](keycodes_us_ansi_shifted.md)||pipe `\|`| +|[`KC_QUES`](keycodes_us_ansi_shifted.md)|`KC_QUESTION`|question mark `?`| +|[`KC_DQT`/`KC_DQUO`](keycodes_us_ansi_shifted.md)|`KC_DOUBLE_QUOTE`|double quote `"`| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|[`LT(layer, kc)`](feature_common_shortcuts.md#switching-and-toggling-layers)||turn on layer (0-15) when held, kc ([basic keycodes](basic_keycodes.md)) when tapped| +|[`TO(layer)`](feature_common_shortcuts.md#switching-and-toggling-layers)||turn on layer when depressed| +|[`MO(layer)`](feature_common_shortcuts.md#switching-and-toggling-layers)||momentarily turn on layer when depressed (requires `KC_TRNS` on destination layer)| +|[`DF(layer)`](feature_common_shortcuts.md#switching-and-toggling-layers)||sets the base (default) layer| +|[`TG(layer)`](feature_common_shortcuts.md#switching-and-toggling-layers)||toggle layer on/off| +|[`TT(layer)](feature_common_shortcuts.md#switching-and-toggling-layers)`||tap toggle? idk FIXME`| +|[`OSM(mod)`](quantum_keycodes.md#one-shot-keys)||hold mod for one keypress| +|[`OSL(layer)`](quantum_keycodes.md#one-shot-keys)||switch to layer for one keypress| +|Long Name|Short Name|Description| +|---------|----------|-----------| +|[`UNICODE(n)`](unicode.md)|[`UC(n)`](unicode.md)|if `UNICODE_ENABLE`, this will send characters up to `0x7FFF`| +|[`X(n)`](unicode.md)||if `UNICODEMAP_ENABLE`, also sends unicode via a different method| diff --git a/docs/keycodes_us_ansi_shifted.md b/docs/keycodes_us_ansi_shifted.md new file mode 100644 index 0000000000..6c7ef4caaa --- /dev/null +++ b/docs/keycodes_us_ansi_shifted.md @@ -0,0 +1,31 @@ +# 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. + +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. + +## US ANSI Shifted Keycodes + +|Short Name|Long Name|Description| +|----------|---------|-----------| +|`KC_TILD`|`KC_TILDE`|tilde `~`| +|`KC_EXLM`|`KC_EXCLAIM`|exclamation mark `!`| +|`KC_AT`||at sign `@`| +|`KC_HASH`||hash sign `#`| +|`KC_DLR`|`KC_DOLLAR`|dollar sign `$`| +|`KC_PERC`|`KC_PERCENT`|percent sign `%`| +|`KC_CIRC`|`KC_CIRCUMFLEX`|circumflex `^`| +|`KC_AMPR`|`KC_AMPERSAND`|ampersand `&`| +|`KC_ASTR`|`KC_ASTERISK`|asterisk `*`| +|`KC_LPRN`|`KC_LEFT_PAREN`|left parenthesis `(`| +|`KC_RPRN`|`KC_RIGHT_PAREN`|right parenthesis `)`| +|`KC_UNDS`|`KC_UNDERSCORE`|underscore `_`| +|`KC_PLUS`||plus sign `+`| +|`KC_LCBR`|`KC_LEFT_CURLY_BRACE`|left curly brace `{`| +|`KC_RCBR`|`KC_RIGHT_CURLY_BRACE`|right curly brace `}`| +|`KC_LT`/`KC_LABK`|`KC_LEFT_ANGLE_BRACKET`|left angle bracket `<`| +|`KC_GT`/`KC_RABK`|`KC_RIGHT_ANGLE_BRACKET`|right angle bracket `>`| +|`KC_COLN`|`KC_COLON`|colon `:`| +|`KC_PIPE`||pipe `\|`| +|`KC_QUES`|`KC_QUESTION`|question mark `?`| +|`KC_DQT`/`KC_DQUO`|`KC_DOUBLE_QUOTE`|double quote `"`| diff --git a/docs/quantum_keycodes.md b/docs/quantum_keycodes.md index 0f2b8e72fa..2e17ae4b7b 100644 --- a/docs/quantum_keycodes.md +++ b/docs/quantum_keycodes.md @@ -1,8 +1,10 @@ # Quantum Keycodes +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. -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. Keycodes above `0x00FF` may not be used with any of the mod/layer-tap keys listed +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. ## QMK keycodes @@ -14,341 +16,7 @@ On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are |`KC_LSPO`|Left shift when held, open paranthesis when tapped| |`KC_RSPC`|Right shift when held, close paranthesis when tapped| |`KC_LEAD`|The [leader key](leader_key.md)| +|`KC_LOCK`|The [lock key](key_lock.md)| |`FUNC(n)`/`F(n)`|Call `fn_action(n)`| |`M(n)`|to call macro n| |`MACROTAP(n)`|to macro-tap n idk FIXME| -|`KC_LOCK`|The [lock key](key_lock.md)| - -## Bootmagic Keycodes - -Shortcuts for bootmagic options (these work even when bootmagic is off.) - -|Name|Description| -|----|-----------| -|`MAGIC_SWAP_CONTROL_CAPSLOCK`|Swap Capslock and Left Control| -|`MAGIC_CAPSLOCK_TO_CONTROL`|Treat Capslock like a Control Key| -|`MAGIC_SWAP_LALT_LGUI`|Swap the left Alt and GUI keys| -|`MAGIC_SWAP_RALT_RGUI`|Swap the right Alt and GUI keys| -|`MAGIC_NO_GUI`|Disable the GUI key| -|`MAGIC_SWAP_GRAVE_ESC`|Swap the Grave and Esc key.| -|`MAGIC_SWAP_BACKSLASH_BACKSPACE`|Swap backslack and backspace| -|`MAGIC_HOST_NKRO`|Force NKRO on| -|`MAGIC_SWAP_ALT_GUI`/`AG_SWAP`|Swap Alt and Gui on both sides| -|`MAGIC_UNSWAP_CONTROL_CAPSLOCK`|Disable the Control/Capslock swap| -|`MAGIC_UNCAPSLOCK_TO_CONTROL`|Disable treating Capslock like Control | -|`MAGIC_UNSWAP_LALT_LGUI`|Disable Left Alt and GUI switching| -|`MAGIC_UNSWAP_RALT_RGUI`|Disable Right Alt and GUI switching| -|`MAGIC_UNNO_GUI`|Enable the GUI key | -|`MAGIC_UNSWAP_GRAVE_ESC`|Disable the Grave/Esc swap | -|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`|Disable the backslash/backspace swap| -|`MAGIC_UNHOST_NKRO`|Force NKRO off| -|`MAGIC_UNSWAP_ALT_GUI`/`AG_NORM`|Disable the Alt/GUI switching| -|`MAGIC_TOGGLE_NKRO`|Turn NKRO on or off| - - - -## Backlight - -These keycodes control the backlight. Most keyboards use this for single color in-switch lighting. - -|Name|Description| -|----|-----------| -|`BL_x`|Set a specific backlight level between 0-9| -|`BL_ON`|An alias for `BL_9`| -|`BL_OFF`|An alias for `BL_0`| -|`BL_DEC`|Turn the backlight level down by 1| -|`BL_INC`|Turn the backlight level up by 1| -|`BL_TOGG`|Toggle the backlight on or off| -|`BL_STEP`|Step through backlight levels, wrapping around to 0 when you reach the top.| - -## RGBLIGHT WS2818 LEDs - -This controls the `RGBLIGHT` functionality. Most keyboards use WS2812 (and compatible) LEDs for underlight or case lighting. - -|Name|Description| -|----|-----------| -|`RGB_TOG`|toggle on/off| -|`RGB_MOD`|cycle through modes| -|`RGB_HUI`|hue increase| -|`RGB_HUD`|hue decrease| -|`RGB_SAI`|saturation increase| -|`RGB_SAD`|saturation decrease| -|`RGB_VAI`|value increase| -|`RGB_VAD`|value decrease| - -## Thermal Printer (experimental) - -|Name|Description| -|----|-----------| -|`PRINT_ON`|Start printing everything the user types| -|`PRINT_OFF`|Stop printing everything the user types| - -## Keyboard output selection - -This is used when multiple keyboard outputs can be selected. Currently this only allows for switching between USB and Bluetooth on keyboards that support both. - -|Name|Description| -|----|-----------| -|`OUT_AUTO`|auto mode| -|`OUT_USB`|usb only| -|`OUT_BT`|bluetooth (when `BLUETOOTH_ENABLE`)| - -## Modifiers - -These are special keycodes that simulate pressing several modifiers at once. - -|Name|Description| -|----|-----------| -|`KC_HYPR`|Hold down LCTL + LSFT + LALT + LGUI| -|`KC_MEH`|Hold down LCTL + LSFT + LALT| - -/* FIXME: Should we have these in QMK too? - * |`KC_LCAG`|`LCTL` + `LALT` + `LGUI`| - * |`KC_ALTG`|`RCTL` + `RALT`| - * |`KC_SCMD`/`KC_SWIN`|`LGUI` + `LSFT`| - * |`KC_LCA`|`LCTL` + `LALT`| - */ - -### Modifiers with keys - -|Name|Description| -|----|-----------| -|`LCTL(kc)`|`LCTL` + `kc`| -|`LSFT(kc)`/`S(kc)`|`LSFT` + `kc`| -|`LALT(kc)`|`LALT` + `kc`| -|`LGUI(kc)`|`LGUI` + `kc`| -|`RCTL(kc)`|`RCTL` + `kc`| -|`RSFT(kc)`|`RSFT` + `kc`| -|`RALT(kc)`|`RALT` + `kc`| -|`RGUI(kc)`|`RGUI` + `kc`| -|`HYPR(kc)`|`LCTL` + `LSFT` + `LALT` + `LGUI` + `kc`| -|`MEH(kc)`|`LCTL` + `LSFT` + `LALT` + `kc`| -|`LCAG(kc)`|`LCTL` + `LALT` + `LGUI` + `kc`| -|`ALTG(kc)`|`RCTL` + `RALT` + `kc`| -|`SCMD(kc)`/`SWIN(kc)`|`LGUI` + `LSFT` + `kc`| -|`LCA(kc)`|`LCTL` + `LALT` + `kc`| - -### One Shot Keys - -Most modifiers work by being held down while you push another key. You can use `OSM()` to setup a "One Shot" modifier. When you tap a one shot mod it will remain is a pressed state until you press another key. - -To specify a your modifier you need to pass the `MOD` form of the key. For example, if you want to setup a One Shot Control you would use `OSM(MOD_LCTL)`. - -|Name|Description| -|----|-----------| -|`OSM(mod)`|use mod for one keypress| -|`OSL(layer)`|switch to layer for one keypress| - -### Mod-tap keys - -These keycodes will press the mod(s) when held, and the key when tapped. They only work with [basic keycodes](basic_keycodes.md). - -|Name|Description| -|----|-----------| -|`CTL_T(kc)`/`LCTL_T(kc)`|`LCTL` when held, `kc` when tapped| -|`RCTL_T(kc)`|`RCTL` when held, `kc` when tapped| -|`SFT_T(kc)`/`LSFT_T(kc)`|`LSFT` when held, `kc` when tapped| -|`RSFT_T(kc)`|`RSFT` when held, `kc` when tapped| -|`ALT_T(kc)`/`LALT_T(kc)`|`LALT` when held, `kc` when tapped| -|`RALT_T(kc)`/`ALGR_T(kc)`|`RALT` when held, `kc` when tapped| -|`GUI_T(kc)`/`LGUI_T(kc)`|`LGUI` when held, `kc` when tapped| -|`RGUI_T(kc)`|`RGUI` when held, `kc` when tapped| -|`C_S_T(kc)`|`LCTL` + `LSFT` when held, `kc` when tapped| -|`MEH_T(kc)`|`LCTL` + `LSFT` + `LALT` when held, `kc` when tapped| -|`LCAG_T(kc)`|`LCTL` + `LALT` + `LGUI` when held, `kc` when tapped| -|`RCAG_T(kc)`|`RCTL` + `RALT` + `RGUI` when held, `kc` when tapped| -|`ALL_T(kc)`|`LCTL` + `LSFT` + `LALT` + `LGUI` when held, `kc` when tapped [more info](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)| -|`SCMD_T(kc)`/`SWIN_T(kc)`|`LGUI` + `LSFT` when held, `kc` when tapped| -|`LCA_T(kc)`|`LCTL` + `LALT` when held, `kc` when tapped| - -## 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. - -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. - -|Short Name|Long Name|Description| -|----------|---------|-----------| -|`KC_TILD`|`KC_TILDE`|tilde `~`| -|`KC_EXLM`|`KC_EXCLAIM`|exclamation mark `!`| -|`KC_AT`||at sign `@`| -|`KC_HASH`||hash sign `#`| -|`KC_DLR`|`KC_DOLLAR`|dollar sign `$`| -|`KC_PERC`|`KC_PERCENT`|percent sign `%`| -|`KC_CIRC`|`KC_CIRCUMFLEX`|circumflex `^`| -|`KC_AMPR`|`KC_AMPERSAND`|ampersand `&`| -|`KC_ASTR`|`KC_ASTERISK`|asterisk `*`| -|`KC_LPRN`|`KC_LEFT_PAREN`|left parenthesis `(`| -|`KC_RPRN`|`KC_RIGHT_PAREN`|right parenthesis `)`| -|`KC_UNDS`|`KC_UNDERSCORE`|underscore `_`| -|`KC_PLUS`||plus sign `+`| -|`KC_LCBR`|`KC_LEFT_CURLY_BRACE`|left curly brace `{`| -|`KC_RCBR`|`KC_RIGHT_CURLY_BRACE`|right curly brace `}`| -|`KC_LT`/`KC_LABK`|`KC_LEFT_ANGLE_BRACKET`|left angle bracket `<`| -|`KC_GT`/`KC_RABK`|`KC_RIGHT_ANGLE_BRACKET`|right angle bracket `>`| -|`KC_COLN`|`KC_COLON`|colon `:`| -|`KC_PIPE`||pipe `\|`| -|`KC_QUES`|`KC_QUESTION`|question mark `?`| -|`KC_DQT`/`KC_DQUO`|`KC_DOUBLE_QUOTE`|double quote `"`| - -## Layer Changes - -These are keycodes that can be used to change the current layer. - -|Name|Description| -|----|-----------| -|`LT(layer, kc)`|turn on layer (0-15) when held, kc ([basic keycodes](basic_keycodes.md)) when tapped| -|`TO(layer)`|turn on layer when depressed| -|`MO(layer)`|momentarily turn on layer when depressed (requires `KC_TRNS` on destination layer)| -|`DF(layer)`|sets the base (default) layer| -|`TG(layer)`|toggle layer on/off| -|`TT(layer)`|tap toggle? idk FIXME| -|`OSL(layer)`|switch to layer for one keycode| - -## Unicode - -These keycodes can be used in conjuction with the [Unicode](unicode_and_additional_language_support.md) support. - -|`UNICODE(n)`/`UC(n)`|if `UNICODE_ENABLE`, this will send characters up to `0x7FFF`| -|`X(n)`|if `UNICODEMAP_ENABLE`, also sends unicode via a different method| - -# `SAFE_RANGE`, or safely defining custom keycodes - -Sometimes you want to define your own custom keycodes to make your keymap easier to read. QMK provides `SAFE_RANGE` to help you do that. `SAFE_RANGE` is the first available keycode in the `0x0000`-`0xFFFF` range and you can use it when creating your own custom keycode enum: - -``` -enum my_keycodes { - FOO = SAFE_RANGE, - BAR -}; -``` - -You can then use `process_record_user()` to do something with your keycode: - -``` -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case FOO: - // Do something here - break; - case BAR: - // Do something here - break; - } -} -``` -- cgit v1.2.3 From 9d1a08e38ac9937cff4e61abfd0acc26ad5fdf4a Mon Sep 17 00:00:00 2001 From: skullY Date: Sun, 6 Aug 2017 20:57:57 -0700 Subject: Doc updates from going through every file --- docs/README.md | 2 +- docs/_summary.md | 8 +- docs/adding_features_to_qmk.md | 4 +- docs/basic_how_keyboards_work.md | 72 ------- docs/basic_keycodes.md | 192 ----------------- docs/documentation_best_practices.md | 20 ++ docs/faq_build.md | 21 +- docs/faq_debug.md | 39 ++++ docs/faq_general.md | 4 +- docs/faq_keymap.md | 4 +- docs/feature_audio.md | 86 ++++++++ docs/feature_bluetooth.md | 6 +- docs/feature_common_shortcuts.md | 2 +- docs/feature_leader_key.md | 37 ++++ docs/feature_ps2_mouse.md | 238 +++++++++++++++++++++ docs/feature_rgblight.md | 31 +++ docs/features.md | 2 +- docs/getting_started_build_tools.md | 2 +- docs/getting_started_make_guide.md | 6 +- docs/hand_wire.md | 6 +- docs/how_keyboards_work.md | 72 +++++++ docs/keycodes.md | 42 +--- docs/keycodes_basic.md | 192 +++++++++++++++++ docs/keymap.md | 7 +- docs/leader_key.md | 37 ---- docs/macros.md | 2 +- docs/modding_your_keyboard.md | 403 ----------------------------------- docs/porting_your_keyboard_to_qmk.md | 4 +- docs/quantum_keycodes.md | 4 +- docs/understanding_qmk.md | 2 +- 30 files changed, 759 insertions(+), 788 deletions(-) delete mode 100644 docs/basic_how_keyboards_work.md delete mode 100644 docs/basic_keycodes.md create mode 100644 docs/feature_leader_key.md create mode 100644 docs/feature_ps2_mouse.md create mode 100644 docs/how_keyboards_work.md create mode 100644 docs/keycodes_basic.md delete mode 100644 docs/leader_key.md delete mode 100644 docs/modding_your_keyboard.md (limited to 'docs/quantum_keycodes.md') diff --git a/docs/README.md b/docs/README.md index 06597a2b69..09317d6520 100644 --- a/docs/README.md +++ b/docs/README.md @@ -22,4 +22,4 @@ This would build the `rev4` revision of the `planck` with the `default` keymap. ## How to customize {#how-to-customize} -QMK has lots of [features](features/README.md) to explore, and a good deal of [reference documentation](reference/README.md) to dig through. Most features are taken advantage of by modifying your [keymap](keymap.md), and changing the [keycodes](keycodes.md). +QMK has lots of [features](features.md) to explore, and a good deal of [reference documentation](http://docs.qmk.fm) to dig through. Most features are taken advantage of by modifying your [keymap](keymap.md), and changing the [keycodes](keycodes.md). diff --git a/docs/_summary.md b/docs/_summary.md index 071ce56310..c73b8a0edf 100644 --- a/docs/_summary.md +++ b/docs/_summary.md @@ -17,9 +17,10 @@ * [Bootmagic](feature_bootmagic.md) * [Dynamic Macros](dynamic_macros.md) * [Key Lock](key_lock.md) - * [Leader Key](leader_key.md) + * [Leader Key](feature_leader_key.md) * [Macros](macros.md) * [Mouse keys](mouse_keys.md) + * [PS2 Mouse](feature_ps2_mouse.md) * [Space Cadet](space_cadet_shift.md) * [Tap Dance](tap_dance.md) * [Thermal Printer](feature_thermal_printer.md) @@ -30,7 +31,7 @@ * [Glossary](glossary.md) * [Keymap overview](keymap.md) * [Keycodes](keycodes.md) - * [Basic](basic_keycodes.md) + * [Basic](keycodes_basic.md) * [Quantum](quantum_keycodes.md) * [Backlight](feature_backlight.md#backlight-keycodes) * [Bluetooth](feature_bluetooth.md#bluetooth-keycodes) @@ -40,6 +41,7 @@ * [Mod Tap](feature_common_shortcuts.md#mod-tap) * [One Shot Keys](feature_common_shortcuts.md#one-shot-keys) * [Shifted Keys](feature_common_shortcuts.md#shifted-keycodes) + * [Stenography](stenography.md#keycode-reference) * [RGB Light](feature_rgblight.md#rgblight-keycodes) * [Thermal Printer](feature_thermal_printer.md#thermal-printer-keycodes) * [US ANSI Shifted Keys](keycodes_us_ansi_shifted.md) @@ -57,7 +59,7 @@ * [Porting your keyboard to QMK](porting_your_keyboard_to_qmk.md) * For a Deeper Understanding - * [How Keyboards Work](basic_how_keyboards_work.md) + * [How Keyboards Work](how_keyboards_work.md) * [Understanding QMK](understanding_qmk.md) * Other Topics diff --git a/docs/adding_features_to_qmk.md b/docs/adding_features_to_qmk.md index fb036496c7..e031ddbb7b 100644 --- a/docs/adding_features_to_qmk.md +++ b/docs/adding_features_to_qmk.md @@ -11,6 +11,6 @@ Once you have implemented your new feature you will generally submit a [pull req * **Disabled by default** - memory is a pretty limited on most chips QMK supports, and it's important that current keymaps aren't broken, so please allow your feature to be turned **on**, rather than being turned off. If you think it should be on by default, or reduces the size of the code, please talk with us about it. * **Compile locally before submitting** - hopefully this one is obvious, but things need to compile! Our Travis system will catch any issues, but it's generally faster for you to compile a few keyboards locally instead of waiting for the results to come back. -* **Consider subprojects and different chip-bases** - there are several keyboards that have subprojects that have allow for slightly different configurations, and even different chip-bases. Try to make a feature supported in ARM and AVR, or automatically disabled in one that doesn't work. +* **Consider subprojects and different chip-bases** - there are several keyboards that have subprojects 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. -* **Don't refactor code** - to maintain a clear vision of how things are laid out in QMK, we try to plan out refactors in-depth, and have a collaborator make the changes. If you have an idea for refactoring, or suggestions, [open an issue](https://github.com/qmk/qmk_firmware/issues). +* **Don't refactor code** - to maintain a clear vision of how things are laid out in QMK, we try to plan out refactors in-depth, and have a collaborator make the changes. If you have an idea for refactoring, or suggestions, [open an issue](https://github.com/qmk/qmk_firmware/issues), we'd love to talk about how QMK can be improved. diff --git a/docs/basic_how_keyboards_work.md b/docs/basic_how_keyboards_work.md deleted file mode 100644 index 3969c5680d..0000000000 --- a/docs/basic_how_keyboards_work.md +++ /dev/null @@ -1,72 +0,0 @@ -# How keys are registered, and interpreted by computers - -In this file, you can will learn the concepts of how keyboards work over USB, -and you'll be able to better understand what you can expect from changing your -firmware directly. - -## Schematic view - -Whenever you type on 1 particular key, here is the chain of actions taking -place: - -``` text -+------+ +-----+ +----------+ +----------+ +----+ -| User |-------->| Key |------>| Firmware |----->| USB wire |---->| OS | -+------+ +-----+ +----------+ +----------+ |----+ -``` - -This scheme is a very simple view of what's going on, and more details follow -in the next sections. - -## 1. You Press a Key - -Whenever you press a key, the firmware of your keyboard can register this event. -It can register when the key is pressed, held and released. - -This usually happens with a periodic scan of key presses. This speed often is limited by the mechanical key response time, the protocol to transfer those key presses (here USB HID), and by the software it is used in. - -## 2. What the Firmware Sends - -The [HID specification](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) tells what a keyboard can actually send through USB to have a chance to be properly recognised. This includes a pre-defined list of scancodes which are simple numbers from `0x00` to `0xE7`. The firmware assigns a scancode to each key of the keyboard. - -The firmware does not send actually letters or characters, but only scancodes. -Thus, by modifying the firmware, you only can modify what scancode is sent over -USB for a given key. - -## 3. What the Operating System Does - -Once the keycode reaches the operating system, a piece of software has to have -it match an actual character thanks to a keyboard layout. For example, if your -layout is set to QWERTY, a sample of the matching table is as follow: - -| keycode | character | -|---------|-----------| -| 0x04 | a/A | -| 0x05 | b/B | -| 0x06 | c/C | -| ... | ... | -| 0x1C | y/Y | -| 0x1D | z/Z | -| ... | ... | - -## Back to the firmware - -As the layout is generally fixed (unless you create your own), the firmware can actually call a keycode by its layout name directly to ease things for you. This is exactly what is done here with `KC_A` actually representing `0x04` in QWERTY. The full list can be found in `keycode.txt`. - -## List of Characters You Can Send - -Putting aside shortcuts, having a limited set of keycodes mapped to a limited layout means that **the list of characters you can assign to a given key only is the ones present in the layout**. - -For example, this means that if you have a QWERTY US layout, and you want to assign 1 key to produce `€` (euro currency symbol), you are unable to do so, because the QWERTY US layout does not have such mapping. You could fix that by using a QWERTY UK layout, or a QWERTY US International. - -You may wonder why a keyboard layout containing all of Unicode is not devised then? The limited number of keycode available through USB simply disallow such a thing. - -## How to (Maybe) Enter Unicode Characters - -You can have the firmware send *sequences of keys* to use the [software Unicode Input Method](https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_code_input) of the target operating system, thus effectively entering characters independently of the layout defined in the OS. - -Yet, it does come with multiple disadvantages: - - - Tied to a specific OS a a time (need recompilation when changing OS); - - Within a given OS, does not work in all software; - - Limited to a subset of Unicode on some systems. diff --git a/docs/basic_keycodes.md b/docs/basic_keycodes.md deleted file mode 100644 index b1f69ab167..0000000000 --- a/docs/basic_keycodes.md +++ /dev/null @@ -1,192 +0,0 @@ -# Basic keycodes - -Basic keycodes are based on [HID Usage Keyboard/Keypad Page(0x07)](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) with following exceptions: - -* `KC_NO` = 0 for no action -* `KC_TRNS` = 1 for layer transparency -* internal special keycodes in the `0xA5-DF` range (tmk heritage). - -## Letters and Numbers - -|KC_1|KC_2|KC_3|KC_4|KC_5|KC_6|KC_7|KC_8| -|----|----|----|----|----|----|----|----| -|KC_9|KC_0|KC_F1|KC_F2|KC_F3|KC_F4|KC_F5|KC_F6| -|KC_F7|KC_F8|KC_F9|KC_F10|KC_F11|KC_F12|KC_F13|KC_F14| -|KC_F15|KC_F16|KC_F17|KC_F18|KC_F19|KC_F20|KC_F21|KC_F22| -|KC_F23|KC_F24|KC_A|KC_B|KC_C|KC_D|KC_E|KC_F| -|KC_G|KC_H|KC_I|KC_J|KC_K|KC_L|KC_M|KC_N| -|KC_O|KC_P|KC_Q|KC_R|KC_S|KC_T|KC_U|KC_V| -|KC_W|KC_X|KC_Y|KC_Z||||| - -## Punctuation - -|Long Name|Short Name|Description| -|---------|----------|-----------| -|KC_ENTER|KC_ENT|`Return (ENTER)`| -|KC_ESCAPE|KC_ESC|`ESCAPE`| -|KC_BSPACE|KC_BSPC|`DELETE (Backspace)`| -|KC_TAB||`Tab`| -|KC_SPACE|KC_SPC|Spacebar| -|KC_MINUS|KC_MINS|`-` and `_`| -|KC_EQUAL|KC_EQL|`=` and `+`| -|KC_LBRACKET|KC_LBRC|`[` and `{`| -|KC_RBRACKET|KC_RBRC|`]` and `}`| -|KC_BSLASH|KC_BSLS|`\` and | | -|KC_NONUS_HASH|KC_NUHS|Non-US `#` and `~`| -|KC_NONUS_BSLASH|KC_NUBS|Non-US `\` and | | -|KC_INT1|KC_RO|JIS `\` and | | -|KC_INT2|KC_KANA|International216| -|KC_INT3|KC_JYEN|Yen Symbol (`¥`)| -|KC_SCOLON|KC_SCLN|`;` and `:`| -|KC_QUOTE|KC_QUOT|`‘` and `“`| -|KC_GRAVE|KC_GRV|Grave Accent and Tilde| -|KC_COMMA|KC_COMM|`,` and `<`| -|KC_DOT||`.` and `>`| -|KC_SLASH|KC_SLSH|`/` and `?`| -|KC_CAPSLOCK|KC_CAPS|Caps Lock| - -## Modifiers - -|Long Name|Short Name|Description| -|---------|----------|-----------| -|KC_LCTRL|KC_LCTL|LeftControl| -|KC_LSHIFT|KC_LSFT|LeftShift| -|KC_LALT||LeftAlt| -|KC_LGUI||Left GUI(Windows/Apple/Meta key)| -|KC_RCTRL|KC_RCTL|RightControl| -|KC_RSHIFT|KC_RSFT|RightShift| -|KC_RALT||RightAlt| -|KC_RGUI||Right GUI(Windows/Apple/Meta key)| -|KC_LOCKING_CAPS|KC_LCAP|Locking Caps Lock| -|KC_LOCKING_NUM|KC_LNUM|Locking Num Lock| -|KC_LOCKING_SCROLL|KC_LSCR|Locking Scroll Lock| -|KC_INT4|KC_HENK|JIS Henken| -|KC_INT5|KC_MHEN|JIS Muhenken| - -## Commands - -|Long Name|Short Name|Description| -|---------|----------|-----------| -|KC_PSCREEN|KC_PSCR|PrintScreen| -|KC_SCROLLLOCK|KC_SLCK|Scroll Lock| -|KC_PAUSE|KC_PAUS|Pause| -|KC_INSERT|KC_INS|Insert| -|KC_HOME||Home| -|KC_PGUP||PageUp| -|KC_DELETE|KC_DEL|Delete Forward| -|KC_END||End| -|KC_PGDOWN|KC_PGDN|PageDown| -|KC_RIGHT|KC_RGHT|RightArrow| -|KC_LEFT||LeftArrow| -|KC_DOWN||DownArrow| -|KC_UP||UpArrow| -|KC_APPLICATION|KC_APP|Application| -|KC_POWER||Power| -|KC_EXECUTE||Execute| -|KC_HELP||Help| -|KC_MENU||Menu| -|KC_SELECT||Select| -|KC_AGAIN||Again| -|KC_UNDO||Undo| -|KC_CUT||Cut| -|KC_COPY||Copy| -|KC_PASTE||Paste| -|KC_FIND||Find| -|KC_ALT_ERASE||Alternate Erase| -|KC_SYSREQ||SysReq/Attention| -|KC_CANCEL||Cancel| -|KC_CLEAR||Clear| -|KC_PRIOR||Prior| -|KC_RETURN||Return| -|KC_SEPARATOR||Separator| -|KC_OUT||Out| -|KC_OPER||Oper| -|KC_CLEAR_AGAIN||Clear/Again| -|KC_CRSEL||CrSel/Props| -|KC_EXSEL||ExSel| -|KC_SYSTEM_POWER|KC_PWR|System Power Down| -|KC_SYSTEM_SLEEP|KC_SLEP|System Sleep| -|KC_SYSTEM_WAKE|KC_WAKE|System Wake| -|KC_MAIL|KC_MAIL|| -|KC_CALCULATOR|KC_CALC|| -|KC_MY_COMPUTER|KC_MYCM|| -|KC_WWW_SEARCH|KC_WSCH|| -|KC_WWW_HOME|KC_WHOM|| -|KC_WWW_BACK|KC_WBAK|| -|KC_WWW_FORWARD|KC_WFWD|| -|KC_WWW_STOP|KC_WSTP|| -|KC_WWW_REFRESH|KC_WREF|| -|KC_WWW_FAVORITES|KC_WFAV|| - -## Media Keys - -Windows and Mac use different key codes for next track and previous track. Make sure you choose the keycode that corresponds to your OS. - -|Long Name|Short Name|Description| -|---------|----------|-----------| -|KC_STOP||Stop| -|KC__MUTE||Mute| -|KC__VOLUP||Volume Up| -|KC__VOLDOWN||Volume Down| -|KC_AUDIO_MUTE|KC_MUTE|| -|KC_AUDIO_VOL_UP|KC_VOLU|| -|KC_AUDIO_VOL_DOWN|KC_VOLD|| -|KC_MEDIA_NEXT_TRACK|KC_MNXT|Next Track (Windows)| -|KC_MEDIA_PREV_TRACK|KC_MPRV|Previous Track (Windows)| -|KC_MEDIA_FAST_FORWARD|KC_MFFD|Next Track (macOS)| -|KC_MEDIA_REWIND|KC_MRWD|Previous Track (macOS)| -|KC_MEDIA_STOP|KC_MSTP|| -|KC_MEDIA_PLAY_PAUSE|KC_MPLY|| -|KC_MEDIA_SELECT|KC_MSEL|| - -## Numpad - -|Long Name|Short Name|Description| -|---------|----------|-----------| -|KC_NUMLOCK|KC_NLCK|Keypad Num Lock and Clear| -|KC_KP_SLASH|KC_PSLS|Keypad /| -|KC_KP_ASTERISK|KC_PAST|Keypad *| -|KC_KP_MINUS|KC_PMNS|Keypad -| -|KC_KP_PLUS|KC_PPLS|Keypad +| -|KC_KP_ENTER|KC_PENT|Keypad ENTER| -|KC_KP_1|KC_P1|Keypad 1 and End| -|KC_KP_2|KC_P2|Keypad 2 and Down Arrow| -|KC_KP_3|KC_P3|Keypad 3 and PageDn| -|KC_KP_4|KC_P4|Keypad 4 and Left Arrow| -|KC_KP_5|KC_P5|Keypad 5| -|KC_KP_6|KC_P6|Keypad 6 and Right Arrow| -|KC_KP_7|KC_P7|Keypad 7 and Home| -|KC_KP_8|KC_P8|Keypad 8 and Up Arrow| -|KC_KP_9|KC_P9|Keypad 9 and PageUp| -|KC_KP_0|KC_P0|Keypad 0 and Insert| -|KC_KP_DOT|KC_PDOT|Keypad . and Delete| -|KC_KP_EQUAL|KC_PEQL|Keypad =| -|KC_KP_COMMA|KC_PCMM|Keypad Comma| -|KC_KP_EQUAL_AS400||Keypad Equal Sign| - -## Special Keys - -|Long Name|Short Name|Description| -|---------|----------|-----------| -|KC_NO||Ignore this key. (NOOP) | - -## Mousekey - -|Long Name|Short Name|Description| -|---------|----------|-----------| -|KC_MS_UP|KC_MS_U|Mouse Cursor Up| -|KC_MS_DOWN|KC_MS_D|Mouse Cursor Down| -|KC_MS_LEFT|KC_MS_L|Mouse Cursor Left| -|KC_MS_RIGHT|KC_MS_R|Mouse Cursor Right| -|KC_MS_BTN1|KC_BTN1|Mouse Button 1| -|KC_MS_BTN2|KC_BTN2|Mouse Button 2| -|KC_MS_BTN3|KC_BTN3|Mouse Button 3| -|KC_MS_BTN4|KC_BTN4|Mouse Button 4| -|KC_MS_BTN5|KC_BTN5|Mouse Button 5| -|KC_MS_WH_UP|KC_WH_U|Mouse Wheel Up| -|KC_MS_WH_DOWN|KC_WH_D|Mouse Wheel Down| -|KC_MS_WH_LEFT|KC_WH_L|Mouse Wheel Left| -|KC_MS_WH_RIGHT|KC_WH_R|Mouse Wheel Right| -|KC_MS_ACCEL0|KC_ACL0|Mouse Acceleration 0| -|KC_MS_ACCEL1|KC_ACL1|Mouse Acceleration 1| -|KC_MS_ACCEL2|KC_ACL2|Mouse Acceleration 2| diff --git a/docs/documentation_best_practices.md b/docs/documentation_best_practices.md index f30793181c..059b25bcd3 100644 --- a/docs/documentation_best_practices.md +++ b/docs/documentation_best_practices.md @@ -75,3 +75,23 @@ You can add some colors. What about a warning message? What about an error message? **[error [ERROR] This is not the error you are looking for] ``` + +# Documenting Features + +If you create a new feature for QMK, create a documentation page for it. It doesn't have to be very long, a few sentances describing your feature and a table listing any relevant keycodes is enough. Here is a basic template: + +```markdown +# My Cool Feature + +This page describes my cool feature. You can use my cool feature to make coffee and order cream and sugar to be delivered via drone. + +## My Cool Feature Keycodes + +|Long Name|Short Name|Description| +|---------|----------|-----------| +|KC_COFFEE||Make Coffee| +|KC_CREAM||Order Cream| +|KC_SUGAR||Order Sugar| +``` + +Place your documentation into `docs/feature_.md`, and add that file to the appropriate place in `docs/_summary.md`. If you have added any keycodes be sure to add them to `docs/keycodes.md` with a link back to your feature page. diff --git a/docs/faq_build.md b/docs/faq_build.md index ebe8caccd1..353e805948 100644 --- a/docs/faq_build.md +++ b/docs/faq_build.md @@ -1,17 +1,9 @@ # Frequently Asked Build Questions -This page covers questions about building QMK. If you have not yet you should read the [Build Guide](https://github.com/qmk/qmk_firmware/blob/master/docs/build_guide.md). - -In short, - - $ make [-f Makefile.] [KEYMAP=...] clean - $ make [-f Makefile.] [KEYMAP=...] - $ make [-f Makefile.] [KEYMAP=...] dfu - +This page covers questions about building QMK. If you have not yet you should read the [Build Environment Setup](build_environment_setup.md) and [Make Instructions](make_instructions.md) guides. ## Can't program on Linux -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, @@ -21,16 +13,16 @@ In short when your controller is ATMega32u4, or just - $ sudo make dfu + $ sudo make --dfu -But to run `make` with root privilege is not good idea. Use former method as possible. +But to run `make` with root privilege is not good idea. Use former method if possible. ## WINAVR is obsolete It is no longer recommended and may cause some problem. -See [Issue #99](https://github.com/tmk/tmk_keyboard/issues/99). +See [TMK Issue #99](https://github.com/tmk/tmk_keyboard/issues/99). ## USB VID and PID -You can use any ID you want with editing `config.h`. Using any presumably unused ID will be no problem in fact except for very least chance of collision with other product. +You can use any ID you want with editing `config.h`. Using any presumably unused ID will be no problem in fact except for very low chance of collision with other product. Most boards in QMK use `0xFEED` as the vendor ID. You should look through other keyboards to make sure you pick a unique Product ID. @@ -41,7 +33,6 @@ You can buy a really unique VID:PID here. I don't think you need this for person - http://www.obdev.at/products/vusb/license.html - http://www.mcselec.com/index.php?page=shop.product_details&flypage=shop.flypage&product_id=92&option=com_phpshop&Itemid=1 - ## Linux udev rules On Linux you need proper privilege to access device file of MCU, you'll have to use `sudo` when flashing firmware. You can circumvent this with placing these files in `/etc/udev/rules.d/`. diff --git a/docs/faq_debug.md b/docs/faq_debug.md index 9e76ac4094..3f7cfe7477 100644 --- a/docs/faq_debug.md +++ b/docs/faq_debug.md @@ -48,6 +48,45 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="feed", MODE:="0666" *** # Miscellaneous +## Safety Considerations + +You probably don't want to "brick" your keyboard, making it impossible +to rewrite firmware onto it. Here are some of the parameters to show +what things are (and likely aren't) too risky. + +- If your keyboard map does not include RESET, then, to get into DFU + mode, you will need to press the reset button on the PCB, which + requires unscrewing the bottom. +- Messing with tmk_core / common files might make the keyboard + inoperable +- Too large a .hex file is trouble; `make dfu` will erase the block, + test the size (oops, wrong order!), which errors out, failing to + flash the keyboard, leaving it in DFU mode. + - To this end, note that the maximum .hex file size on Planck is + 7000h (28672 decimal) + +``` +Linking: .build/planck_rev4_cbbrowne.elf [OK] +Creating load file for Flash: .build/planck_rev4_cbbrowne.hex [OK] + +Size after: + text data bss dec hex filename + 0 22396 0 22396 577c planck_rev4_cbbrowne.hex +``` + + - The above file is of size 22396/577ch, which is less than + 28672/7000h + - As long as you have a suitable alternative .hex file around, you + can retry, loading that one + - Some of the options you might specify in your keyboard's Makefile + consume extra memory; watch out for BOOTMAGIC_ENABLE, + MOUSEKEY_ENABLE, EXTRAKEY_ENABLE, CONSOLE_ENABLE, API_SYSEX_ENABLE +- DFU tools do /not/ allow you to write into the bootloader (unless + you throw in extra fruitsalad of options), so there is little risk + there. +- EEPROM has around a 100000 write cycle. You shouldn't rewrite the + firmware repeatedly and continually; that'll burn the EEPROM + eventually. ## NKRO Doesn't work First you have to compile frimware with this build option `NKRO_ENABLE` in **Makefile**. diff --git a/docs/faq_general.md b/docs/faq_general.md index efa564743c..fcc40e0a1f 100644 --- a/docs/faq_general.md +++ b/docs/faq_general.md @@ -12,9 +12,9 @@ TMK was originally designed and implemented by [Jun Wako](https://github.com/tmk). QMK started as [Jack Humbert's](https://github.com/jackhumbert) fork of TMK for the Planck. After a while Jack's fork had diverged quite a bit from TMK, and in 2015 Jack decided to rename his fork to QMK. -From a technical standpoint QMK builds upon TMK by adding several new features. Most notably QMK has expanded the number of available keycodes and uses these to implement advanced features like `S()`, `LCTL()`, and `MO()`. You can see a complete list of these keycodes in [Quantum Keycodes](quantum_keycodes.html). +From a technical standpoint QMK builds upon TMK by adding several new features. Most notably QMK has expanded the number of available keycodes and uses these to implement advanced features like `S()`, `LCTL()`, and `MO()`. You can see a complete list of these keycodes in [Keycodes](keycodes.md). -From a project and community management standpoint TMK maintains all the officially supported keyboards by himself, with a bit of community support. Separate community maintained forks exist or can be created for other keyboards. Only a few keymaps are provided by default, so users typically don't share keymaps with each other. QMK encourages sharing of both keyboards and keymaps through a centrally managed repository, accepting all pull requests that follows the quality standards. These are mostly community maintained, but the QMK team also helps when necessary. +From a project and community management standpoint TMK maintains all the officially supported keyboards by himself, with a bit of community support. Separate community maintained forks exist or can be created for other keyboards. Only a few keymaps are provided by default, so users typically don't share keymaps with each other. QMK encourages sharing of both keyboards and keymaps through a centrally managed repository, accepting all pull requests that follow the quality standards. These are mostly community maintained, but the QMK team also helps when necessary. Both approaches have their merits and their drawbacks, and code flows freely between TMK and QMK when it makes sense. diff --git a/docs/faq_keymap.md b/docs/faq_keymap.md index 9f54f2213f..eb49a36996 100644 --- a/docs/faq_keymap.md +++ b/docs/faq_keymap.md @@ -1,9 +1,9 @@ # Keymap FAQ -This page covers questions people often have about keymaps. If you haven't you should read [Keymap Overview](keymap.html) first. +This page covers questions people often have about keymaps. If you haven't you should read [Keymap Overview](keymap.md) first. ## What Keycodes Can I Use? -See [Basic Keycodes](keycodes.html) and [Quantum Keycodes](quantum_keycodes.html) for most of the keys you can define. +See [Keycodes](keycodes.md) for an index of keycodes available to you. These link to more extensive documentation when available. Keycodes are actually defined in [common/keycode.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/keycode.h). diff --git a/docs/feature_audio.md b/docs/feature_audio.md index 6b476880d1..c142ff69c2 100644 --- a/docs/feature_audio.md +++ b/docs/feature_audio.md @@ -1,5 +1,91 @@ # Audio +Your keyboard can make sounds! If you've got a Planck, Preonic, or basically any AVR keyboard that allows access to the C6 or B5 port (`#define C6_AUDIO` and/or `#define B5_AUDIO`), you can hook up a simple speaker and make it beep. You can use those beeps to indicate layer transitions, modifiers, special keys, or just to play some funky 8bit tunes. + +If you add `AUDIO_ENABLE = yes` to your `rules.mk`, there's a couple different sounds that will automatically be enabled without any other configuration: + +``` +STARTUP_SONG // plays when the keyboard starts up (audio.c) +GOODBYE_SONG // plays when you press the RESET key (quantum.c) +AG_NORM_SONG // plays when you press AG_NORM (quantum.c) +AG_SWAP_SONG // plays when you press AG_SWAP (quantum.c) +MUSIC_ON_SONG // plays when music mode is activated (process_music.c) +MUSIC_OFF_SONG // plays when music mode is deactivated (process_music.c) +CHROMATIC_SONG // plays when the chromatic music mode is selected (process_music.c) +GUITAR_SONG // plays when the guitar music mode is selected (process_music.c) +VIOLIN_SONG // plays when the violin music mode is selected (process_music.c) +MAJOR_SONG // plays when the major music mode is selected (process_music.c) +``` + +You can override the default songs by doing something like this in your `config.h`: + +```c +#ifdef AUDIO_ENABLE + #define STARTUP_SONG SONG(STARTUP_SOUND) +#endif +``` + +A full list of sounds can be found in [quantum/audio/song_list.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/audio/song_list.h) - feel free to add your own to this list! All available notes can be seen in [quantum/audio/musical_notes.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/audio/musical_notes.h). + +To play a custom sound at a particular time, you can define a song like this (near the top of the file): + +```c +float my_song[][2] = SONG(QWERTY_SOUND); +``` + +And then play your song like this: + +```c +PLAY_SONG(my_song); +``` + +Alternatively, you can play it in a loop like this: + +```c +PLAY_LOOP(my_song); +``` + +It's advised that you wrap all audio features in `#ifdef AUDIO_ENABLE` / `#endif` to avoid causing problems when audio isn't built into the keyboard. + +## 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. + +Keycodes available: + +* `MU_ON` - Turn music mode on +* `MU_OFF` - Turn music mode off +* `MU_TOG` - Toggle music mode +* `MU_MOD` - Cycle through the music modes: + * `CHROMATIC_MODE` - Chromatic scale, row changes the octave + * `GUITAR_MODE` - Chromatic scale, but the row changes the string (+5 st) + * `VIOLIN_MODE` - Chromatic scale, but the row changes the string (+7 st) + * `MAJOR_MODE` - Major scale + +In music mode, the following keycodes work differently, and don't pass through: + +* `LCTL` - start a recording +* `LALT` - stop recording/stop playing +* `LGUI` - play recording +* `KC_UP` - speed-up playback +* `KC_DOWN` - slow-down playback + +By default, `MUSIC_MASK` is set to `keycode < 0xFF` which means keycodes less than `0xFF` are turned into notes, and don't output anything. You can change this by defining this in your `config.h` like this: + + #define MUSIC_MASK keycode != KC_NO + +Which will capture all keycodes - be careful, this will get you stuck in music mode until you restart your keyboard! + +The pitch standard (`PITCH_STANDARD_A`) is 440.0f by default - to change this, add something like this to your `config.h`: + + #define PITCH_STANDARD_A 432.0f + +## MIDI functionalty + +This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile. + +## Bluetooth functionality + +This requires [some hardware changes](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts), but can be enabled via the Makefile. The firmware will still output characters via USB, so be aware of this when charging via a computer. It would make sense to have a switch on the Bluefruit to turn it off at will. + + ## Bluetooth Keycodes diff --git a/docs/feature_common_shortcuts.md b/docs/feature_common_shortcuts.md index e911420261..a3dde8b670 100644 --- a/docs/feature_common_shortcuts.md +++ b/docs/feature_common_shortcuts.md @@ -13,7 +13,7 @@ This will allow you to use `FN_CAPS` and `ALT_TAB` in your `KEYMAP()`, keeping i ### Limits of these aliases -Currently, the keycodes able to used with these functions are limited to the [Basic Keycodes](keycodes.html), meaning you can't use keycodes like `KC_TILD`, or anything greater than 0xFF. For a full list of the keycodes able to be used see [Keycodes](keycodes.html). +Currently, the keycodes able to used with these functions are limited to the [Basic Keycodes](keycodes_basic.html), meaning you can't use keycodes like `KC_TILD`, or anything greater than 0xFF. For a full list of the keycodes able to be used see [Basic Keycodes](keycodes_basic.html). ## Switching and toggling layers diff --git a/docs/feature_leader_key.md b/docs/feature_leader_key.md new file mode 100644 index 0000000000..bf4d5456d1 --- /dev/null +++ b/docs/feature_leader_key.md @@ -0,0 +1,37 @@ +# The Leader key: A new kind of modifier + +If you've ever used Vim, you know what a Leader key is. If not, you're about to discover a wonderful concept. :) Instead of hitting Alt+Shift+W for example (holding down three keys at the same time), what if you could hit a _sequence_ of keys instead? So you'd hit our special modifier (the Leader key), followed by W and then C (just a rapid succession of keys), and something would happen. + +That's what `KC_LEAD` does. Here's an example: + +1. Pick a key on your keyboard you want to use as the Leader key. Assign it the keycode `KC_LEAD`. This key would be dedicated just for this -- it's a single action key, can't be used for anything else. +2. Include the line `#define LEADER_TIMEOUT 300` somewhere in your keymap.c file, probably near the top. The 300 there is 300ms -- that's how long you have for the sequence of keys following the leader. You can tweak this value for comfort, of course. +3. Within your `matrix_scan_user` function, do something like this: + +``` +LEADER_EXTERNS(); + +void matrix_scan_user(void) { + LEADER_DICTIONARY() { + leading = false; + leader_end(); + + SEQ_ONE_KEY(KC_F) { + register_code(KC_S); + unregister_code(KC_S); + } + SEQ_TWO_KEYS(KC_A, KC_S) { + register_code(KC_H); + unregister_code(KC_H); + } + SEQ_THREE_KEYS(KC_A, KC_S, KC_D) { + register_code(KC_LGUI); + register_code(KC_S); + unregister_code(KC_S); + unregister_code(KC_LGUI); + } + } +} +``` + +As you can see, you have three function. you can use - `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS` and `SEQ_THREE_KEYS` for longer sequences. Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously. \ No newline at end of file diff --git a/docs/feature_ps2_mouse.md b/docs/feature_ps2_mouse.md new file mode 100644 index 0000000000..8629b28cff --- /dev/null +++ b/docs/feature_ps2_mouse.md @@ -0,0 +1,238 @@ +## PS/2 Mouse Support + +Its possible to hook up a PS/2 mouse (for example touchpads or trackpoints) to your keyboard as a composite device. + +To hook up a Trackpoint, you need to obtain a Trackpoint module (i.e. harvest from a Thinkpad keyboard), identify the function of each pin of the module, and make the necessary circuitry between controller and Trackpoint module. For more information, please refer to [Trackpoint Hardware](https://deskthority.net/wiki/TrackPoint_Hardware) page on Deskthority Wiki. + +There are three available modes for hooking up PS/2 devices: USART (best), interrupts (better) or busywait (not recommended). + +### Busywait version + +Note: This is not recommended, you may encounter jerky movement or unsent inputs. Please use interrupt or USART version if possible. + +In rules.mk: + +``` +PS2_MOUSE_ENABLE = yes +PS2_USE_BUSYWAIT = yes +``` + +In your keyboard config.h: + +``` +#ifdef PS2_USE_BUSYWAIT +# define PS2_CLOCK_PORT PORTD +# define PS2_CLOCK_PIN PIND +# define PS2_CLOCK_DDR DDRD +# define PS2_CLOCK_BIT 1 +# define PS2_DATA_PORT PORTD +# define PS2_DATA_PIN PIND +# define PS2_DATA_DDR DDRD +# define PS2_DATA_BIT 2 +#endif +``` + +### Interrupt version + +The following example uses D2 for clock and D5 for data. You can use any INT or PCINT pin for clock, and any pin for data. + +In rules.mk: + +``` +PS2_MOUSE_ENABLE = yes +PS2_USE_INT = yes +``` + +In your keyboard config.h: + +``` +#ifdef PS2_USE_INT +#define PS2_CLOCK_PORT PORTD +#define PS2_CLOCK_PIN PIND +#define PS2_CLOCK_DDR DDRD +#define PS2_CLOCK_BIT 2 +#define PS2_DATA_PORT PORTD +#define PS2_DATA_PIN PIND +#define PS2_DATA_DDR DDRD +#define PS2_DATA_BIT 5 + +#define PS2_INT_INIT() do { \ + EICRA |= ((1< +## RGB Under Glow Mod + +![Planck with RGB Underglow](https://raw.githubusercontent.com/qmk/qmk_firmware/master/keyboards/planck/keymaps/yang/planck-with-rgb-underglow.jpg) + +Here is a quick demo on Youtube (with NPKC KC60) (https://www.youtube.com/watch?v=VKrpPAHlisY). + +For this mod, you need an unused pin wiring to DI of WS2812 strip. After wiring the VCC, GND, and DI, you can enable the underglow in your Makefile. + + RGBLIGHT_ENABLE = yes + +In order to use the underglow animation functions, you need to have `#define RGBLIGHT_ANIMATIONS` in your `config.h`. + +Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the `F4` pin by default: + + #define RGB_DI_PIN F4 // The pin your RGB strip is wired to + #define RGBLIGHT_ANIMATIONS // Require for fancier stuff (not compatible with audio) + #define RGBLED_NUM 14 // Number of LEDs + #define RGBLIGHT_HUE_STEP 10 + #define RGBLIGHT_SAT_STEP 17 + #define RGBLIGHT_VAL_STEP 17 + +You'll need to edit `RGB_DI_PIN` to the pin you have your `DI` on your RGB strip wired to. + +The firmware supports 5 different light effects, and the color (hue, saturation, brightness) can be customized in most effects. To control the underglow, you need to modify your keymap file to assign those functions to some keys/key combinations. For details, please check this keymap. `keyboards/planck/keymaps/yang/keymap.c` + +### WS2812 Wiring + +![WS2812 Wiring](https://raw.githubusercontent.com/qmk/qmk_firmware/master/keyboards/planck/keymaps/yang/WS2812-wiring.jpg) + +Please note the USB port can only supply a limited amount of power to the keyboard (500mA by standard, however, modern computer and most usb hubs can provide 700+mA.). According to the data of NeoPixel from Adafruit, 30 WS2812 LEDs require a 5V 1A power supply, LEDs used in this mod should not more than 20. + ## RGB Lighting Keycodes This controls the RGB Lighting functionality. Most keyboards use WS2812 (and compatible) LEDs for underlight or case lighting. diff --git a/docs/features.md b/docs/features.md index 0de6622938..c5965f4c0e 100644 --- a/docs/features.md +++ b/docs/features.md @@ -7,7 +7,7 @@ Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) ## 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](feature_leader_key.md) page. ## Tap Dance: A single key can do 3, 5, or 100 different things diff --git a/docs/getting_started_build_tools.md b/docs/getting_started_build_tools.md index 49ffdaf69f..e46b7f2e53 100644 --- a/docs/getting_started_build_tools.md +++ b/docs/getting_started_build_tools.md @@ -86,7 +86,7 @@ The Toolchain setup is done through the Windows Subsystem for Linux, and the pro * The WSL Git is **not** compatible with the Windows Git, so use the Windows Git Bash or a windows Git GUI for all Git operations * You can edit files either inside WSL or normally using Windows, but note that if you edit makefiles or shell scripts, make sure you are using an editor that saves the files with Unix line endings. Otherwise the compilation might not work. -## Windows (Vista and later) +## Windows (Vista and later) (Deprecated) These are the old instructions for Windows Vista and later. We recommend you use [MSYS2 as outlined above](#windows-with-msys2-recommended). diff --git a/docs/getting_started_make_guide.md b/docs/getting_started_make_guide.md index 299c5785b2..fac801082f 100644 --- a/docs/getting_started_make_guide.md +++ b/docs/getting_started_make_guide.md @@ -21,7 +21,7 @@ As mentioned above, there are some shortcuts, when you are in a: * `keyboard` folder, the command will automatically fill the `` part. So you only need to type `--` * `subproject` folder, it will fill in both `` and `` * `keymap` folder, then `` and `` will be filled in. If you need to specify the `` use the following syntax `-` - * Note in order to support this shortcut, the keymap needs its own Makefile (see the example [here](https://github.com/qmk/qmk_firmware/blob/master/doc/keymap_makefile_example.mk)) + * Note in order to support this shortcut, the keymap needs its own Makefile * `keymap` folder of a `subproject`, then everything except the `` will be filled in The `` means the following @@ -142,7 +142,7 @@ This allows you to interface with a Bluefruit EZ-key to send keycodes wirelessly `AUDIO_ENABLE` -This allows you output audio on the C6 pin (needs abstracting). See the [audio section](#audio-output-from-a-speaker) for more information. +This allows you output audio on the C6 pin (needs abstracting). See the [audio page](feature_audio.md) for more information. `FAUXCLICKY_ENABLE` @@ -150,7 +150,7 @@ Uses buzzer to emulate clicky switches. A cheap imitation of the Cherry blue swi `VARIABLE_TRACE` -Use this to debug changes to variable values, see the [tracing variables](#tracing-variables) section for more information. +Use this to debug changes to variable values, see the [tracing variables](unit_testing.md#tracing-variables) section of the Unit Testing page for more information. `API_SYSEX_ENABLE` diff --git a/docs/hand_wire.md b/docs/hand_wire.md index 9f63095426..263cd59948 100644 --- a/docs/hand_wire.md +++ b/docs/hand_wire.md @@ -298,13 +298,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; ``` -Note that the layout of the keycodes is similar to the physical layout of our keyboard - this make it much easier to see what's going on. A lot of the keycodes should be fairly obvious, but for a full list of them, check out [tmk_code/doc/keycode.txt](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/doc/keycode.txt) - there are also a lot of aliases to condense your keymap file. +Note that the layout of the keycodes is similar to the physical layout of our keyboard - this make it much easier to see what's going on. A lot of the keycodes should be fairly obvious, but for a full list of them, check out [Keycodes](keycodes.md) - there are also a lot of aliases to condense your keymap file. It's also important to use the `KEYMAP` function we defined earlier - this is what allows the firmware to associate our intended readable keymap with the actual wiring. ## 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](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](getting_started_build_tools.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 `.hex` file in that folder. If you're having trouble with this step, see the end of the guide for the trouble-shooting section. @@ -328,4 +328,4 @@ If you've done all of these things, keep in mind that sometimes you might have h Now that you have a working board, it's time to get things in their permanent positions. I've often used liberal amounts of hot glue to secure and insulate things, so if that's your style, start spreading that stuff like butter. Otherwise, double-sided tape is always an elegant solution, and electrical tape is a distant second. Due to the nature of these builds, a lot of this part is up to you and how you planned (or didn't plan) things out. -There are a lot of possibilities inside the firmware - check out the [readme](https://github.com/qmk/qmk_firmware/blob/master/readme.md) for a full feature list, and dive into the different project (Planck, Ergodox EZ, etc) to see how people use all of them. You can always stop by [the OLKB subreddit for help!](http://reddit.com/r/olkb) +There are a lot of possibilities inside the firmware - explore [docs.qmk.fm](http://docs.qmk.fm) for a full feature list, and dive into the different project (Planck, Clueboard, Ergodox EZ, etc) to see how people use all of them. You can always stop by [the OLKB subreddit for help!](http://reddit.com/r/olkb) diff --git a/docs/how_keyboards_work.md b/docs/how_keyboards_work.md new file mode 100644 index 0000000000..3969c5680d --- /dev/null +++ b/docs/how_keyboards_work.md @@ -0,0 +1,72 @@ +# How keys are registered, and interpreted by computers + +In this file, you can will learn the concepts of how keyboards work over USB, +and you'll be able to better understand what you can expect from changing your +firmware directly. + +## Schematic view + +Whenever you type on 1 particular key, here is the chain of actions taking +place: + +``` text ++------+ +-----+ +----------+ +----------+ +----+ +| User |-------->| Key |------>| Firmware |----->| USB wire |---->| OS | ++------+ +-----+ +----------+ +----------+ |----+ +``` + +This scheme is a very simple view of what's going on, and more details follow +in the next sections. + +## 1. You Press a Key + +Whenever you press a key, the firmware of your keyboard can register this event. +It can register when the key is pressed, held and released. + +This usually happens with a periodic scan of key presses. This speed often is limited by the mechanical key response time, the protocol to transfer those key presses (here USB HID), and by the software it is used in. + +## 2. What the Firmware Sends + +The [HID specification](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) tells what a keyboard can actually send through USB to have a chance to be properly recognised. This includes a pre-defined list of scancodes which are simple numbers from `0x00` to `0xE7`. The firmware assigns a scancode to each key of the keyboard. + +The firmware does not send actually letters or characters, but only scancodes. +Thus, by modifying the firmware, you only can modify what scancode is sent over +USB for a given key. + +## 3. What the Operating System Does + +Once the keycode reaches the operating system, a piece of software has to have +it match an actual character thanks to a keyboard layout. For example, if your +layout is set to QWERTY, a sample of the matching table is as follow: + +| keycode | character | +|---------|-----------| +| 0x04 | a/A | +| 0x05 | b/B | +| 0x06 | c/C | +| ... | ... | +| 0x1C | y/Y | +| 0x1D | z/Z | +| ... | ... | + +## Back to the firmware + +As the layout is generally fixed (unless you create your own), the firmware can actually call a keycode by its layout name directly to ease things for you. This is exactly what is done here with `KC_A` actually representing `0x04` in QWERTY. The full list can be found in `keycode.txt`. + +## List of Characters You Can Send + +Putting aside shortcuts, having a limited set of keycodes mapped to a limited layout means that **the list of characters you can assign to a given key only is the ones present in the layout**. + +For example, this means that if you have a QWERTY US layout, and you want to assign 1 key to produce `€` (euro currency symbol), you are unable to do so, because the QWERTY US layout does not have such mapping. You could fix that by using a QWERTY UK layout, or a QWERTY US International. + +You may wonder why a keyboard layout containing all of Unicode is not devised then? The limited number of keycode available through USB simply disallow such a thing. + +## How to (Maybe) Enter Unicode Characters + +You can have the firmware send *sequences of keys* to use the [software Unicode Input Method](https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_code_input) of the target operating system, thus effectively entering characters independently of the layout defined in the OS. + +Yet, it does come with multiple disadvantages: + + - Tied to a specific OS a a time (need recompilation when changing OS); + - Within a given OS, does not work in all software; + - Limited to a subset of Unicode on some systems. diff --git a/docs/keycodes.md b/docs/keycodes.md index b9e1f42f77..c601ad4ced 100644 --- a/docs/keycodes.md +++ b/docs/keycodes.md @@ -66,8 +66,6 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This |`KC_X`|||| |`KC_Y`|||| |`KC_Z`|||| -|Long Name|Short Name|Description| -|---------|----------|-----------| |`KC_ENTER`|`KC_ENT`|`Return (ENTER)`| |`KC_ESCAPE`|`KC_ESC`|`ESCAPE`| |`KC_BSPACE`|`KC_BSPC`|`DELETE (Backspace)`| @@ -90,8 +88,6 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This |`KC_DOT`||`.` and `>`| |`KC_SLASH`|`KC_SLSH`|`/` and `?`| |`KC_CAPSLOCK`|`KC_CAPS`|Caps Lock| -|Long Name|Short Name|Description| -|---------|----------|-----------| |`KC_LCTRL`|`KC_LCTL`|LeftControl| |`KC_LSHIFT`|`KC_LSFT`|LeftShift| |`KC_LALT`||LeftAlt| @@ -105,8 +101,6 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This |`KC_LOCKING_SCROLL`|`KC_LSCR`|Locking Scroll Lock| |`KC_INT4`|`KC_HENK`|JIS Henken| |`KC_INT5`|`KC_MHEN`|JIS Muhenken| -|Long Name|Short Name|Description| -|---------|----------|-----------| |`KC_PSCREEN`|`KC_PSCR`|PrintScreen| |`KC_SCROLLLOCK`|`KC_SLCK`|Scroll Lock| |`KC_PAUSE`|`KC_PAUS`|Pause| @@ -157,8 +151,6 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This |`KC_WWW_STOP`|`KC_WSTP`|| |`KC_WWW_REFRESH`|`KC_WREF`|| |`KC_WWW_FAVORITES`|`KC_WFAV`|| -|Long Name|Short Name|Description| -|---------|----------|-----------| |`KC_STOP`||Stop| |`KC__MUTE`||Mute| |`KC__VOLUP`||Volume Up| @@ -173,8 +165,6 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This |`KC_MEDIA_STOP`|`KC_MSTP`|| |`KC_MEDIA_PLAY_PAUSE`|`KC_MPLY`|| |`KC_MEDIA_SELECT`|`KC_MSEL`|| -|Long Name|Short Name|Description| -|---------|----------|-----------| |`KC_NUMLOCK`|`KC_NLCK`|Keypad Num Lock and Clear| |`KC_KP_SLASH`|`KC_PSLS`|Keypad /| |`KC_KP_ASTERISK`|`KC_PAST`|Keypad *| @@ -195,12 +185,8 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This |`KC_KP_EQUAL`|`KC_PEQL`|Keypad =| |`KC_KP_COMMA`|`KC_PCMM`|Keypad Comma| |`KC_KP_EQUAL_AS400`||Keypad Equal Sign| -|Long Name|Short Name|Description| -|---------|----------|-----------| |`KC_NO`||Ignore this key. (NOOP) | |`KC_TRNS`||Make this key transparent to find the key on a lower layer.| -|Long Name|Short Name|Description| -|---------|----------|-----------| |[`KC_MS_UP`](mouse_keys.md)|`KC_MS_U`|Mouse Cursor Up| |[`KC_MS_DOWN`](mouse_keys.md)|`KC_MS_D`|Mouse Cursor Down| |[`KC_MS_LEFT`](mouse_keys.md)|`KC_MS_L`|Mouse Cursor Left| @@ -217,19 +203,15 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This |[`KC_MS_ACCEL0`](mouse_keys.md)|`KC_ACL0`|Mouse Acceleration 0| |[`KC_MS_ACCEL1`](mouse_keys.md)|`KC_ACL1`|Mouse Acceleration 1| |[`KC_MS_ACCEL2`](mouse_keys.md)|`KC_ACL2`|Mouse Acceleration 2| -|Long Name|Short Name|Description| -|---------|----------|-----------| |[`RESET`](quantum_keycodes.md#qmk-keycodes)||Put the keyboard into DFU mode for flashing| |[`DEBUG`](quantum_keycodes.md#qmk-keycodes)||Toggles debug mode| |[`KC_GESC`](quantum_keycodes.md#qmk-keycodes)|`GRAVE_ESC`|Acts as escape when pressed normally but when pressed with Shift or GUI will send a `~`| |[`KC_LSPO`](quantum_keycodes.md#qmk-keycodes)||Left shift when held, open paranthesis when tapped| |[`KC_RSPC`](quantum_keycodes.md#qmk-keycodes)||Right shift when held, close paranthesis when tapped| -|[`KC_LEAD`](quantum_keycodes.md#qmk-keycodes)||The [leader key](leader_key.md)| +|[`KC_LEAD`](feature_leader_key.md)||The leader key| |[`FUNC(n)`](quantum_keycodes.md#qmk-keycodes)|`F(n)`|Call `fn_action(n)`| |[`M(n)`](quantum_keycodes.md#qmk-keycodes)||to call macro n| |[`MACROTAP(n)`](quantum_keycodes.md#qmk-keycodes)||to macro-tap n idk FIXME`| -|Long Name|Short Name|Description| -|---------|----------|-----------| |[`MAGIC_SWAP_CONTROL_CAPSLOCK`](feature_bootmagic.md)||Swap Capslock and Left Control| |[`MAGIC_CAPSLOCK_TO_CONTROL`](feature_bootmagic.md)||Treat Capslock like a Control Key| |[`MAGIC_SWAP_LALT_LGUI`](feature_bootmagic.md)||Swap the left Alt and GUI keys| @@ -249,8 +231,6 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This |[`MAGIC_UNHOST_NKRO`](feature_bootmagic.md)||Force NKRO off| |[`MAGIC_UNSWAP_ALT_GUI`/`AG_NORM`](feature_bootmagic.md)||Disable the Alt/GUI switching| |[`MAGIC_TOGGLE_NKRO`](feature_bootmagic.md)||Turn NKRO on or off| -|Long Name|Short Name|Description| -|---------|----------|-----------| |[`BL_x`](feature_backlight.md)||Set a specific backlight level between 0-9| |[`BL_ON`](feature_backlight.md)||An alias for `BL_9`| |[`BL_OFF`](feature_backlight.md)||An alias for `BL_0`| @@ -258,8 +238,6 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This |[`BL_INC`](feature_backlight.md)||Turn the backlight level up by 1| |[`BL_TOGG`](feature_backlight.md)||Toggle the backlight on or off| |[`BL_STEP`](feature_backlight.md)||Step through backlight levels, wrapping around to 0 when you reach the top.| -|Long Name|Short Name|Description| -|---------|----------|-----------| |[`RGB_TOG`](feature_rgblight.md)||toggle on/off| |[`RGB_MOD`](feature_rgblight.md)||cycle through modes| |[`RGB_HUI`](feature_rgblight.md)||hue increase| @@ -268,17 +246,11 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This |[`RGB_SAD`](feature_rgblight.md)||saturation decrease| |[`RGB_VAI`](feature_rgblight.md)||value increase| |[`RGB_VAD`](feature_rgblight.md)||value decrease| -|Long Name|Short Name|Description| -|---------|----------|-----------| |[`PRINT_ON`](feature_thermal_printer.md)||Start printing everything the user types| |[`PRINT_OFF`](feature_thermal_printer.md)||Stop printing everything the user types| -|Long Name|Short Name|Description| -|---------|----------|-----------| |[`OUT_AUTO`](feature_bluetooth.md)||auto mode| |[`OUT_USB`](feature_bluetooth.md)||usb only| |[`OUT_BT`](feature_bluetooth.md)||bluetooth (when `BLUETOOTH_ENABLE`)| -|Long Name|Short Name|Description| -|---------|----------|-----------| |[`KC_HYPR`](quantum_keycodes.md#modifiers)||Hold down LCTL + LSFT + LALT + LGUI`| |[`KC_MEH`](quantum_keycodes.md#modifiers)||Hold down LCTL + LSFT + LALT`| |[`LCTL(kc)`](quantum_keycodes.md#modifiers)||`LCTL` + `kc`| @@ -295,8 +267,6 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This |[`ALTG(kc)`](quantum_keycodes.md#modifiers)||`RCTL` + `RALT` + `kc`| |[`SCMD(kc)`](quantum_keycodes.md#modifiers)|[`SWIN(kc)`](quantum_keycodes.md#modifiers)|`LGUI` + `LSFT` + `kc`| |[`LCA(kc)`](quantum_keycodes.md#modifiers)||`LCTL` + `LALT` + `kc`| -|Long Name|Short Name|Description| -|---------|----------|-----------| |[`CTL_T(kc)`](quantum_keycodes.md#mod-tap-keys)|[`LCTL_T(kc)`](quantum_keycodes.md#mod-tap-keys)|`LCTL` when held, `kc` when tapped| |[`RCTL_T(kc)`](quantum_keycodes.md#mod-tap-keys)||[`RCTL` when held, `kc` when tapped| |[`SFT_T(kc)`](quantum_keycodes.md#mod-tap-keys)|[`LSFT_T(kc)`](quantum_keycodes.md#mod-tap-keys)|`LSFT` when held, `kc` when tapped| @@ -312,8 +282,6 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This |[`ALL_T(kc)`](quantum_keycodes.md#mod-tap-keys)||`LCTL` + `LSFT` + `LALT` + `LGUI` when held, `kc` when tapped [more info](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)| |[`SCMD_T(kc)`](quantum_keycodes.md#mod-tap-keys)|[`SWIN_T(kc)`](quantum_keycodes.md#mod-tap-keys)|`LGUI` + `LSFT` when held, `kc` when tapped| |[`LCA_T(kc)`](quantum_keycodes.md#mod-tap-keys)||`LCTL` + `LALT` when held, `kc` when tapped| -|Short Name|Long Name|Description| -|----------|---------|-----------| |[`KC_TILD`](keycodes_us_ansi_shifted.md)|`KC_TILDE`|tilde `~`| |[`KC_EXLM`](keycodes_us_ansi_shifted.md)|`KC_EXCLAIM`|exclamation mark `!`| |[`KC_AT`](keycodes_us_ansi_shifted.md)||at sign `@`| @@ -335,17 +303,13 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This |[`KC_PIPE`](keycodes_us_ansi_shifted.md)||pipe `\|`| |[`KC_QUES`](keycodes_us_ansi_shifted.md)|`KC_QUESTION`|question mark `?`| |[`KC_DQT`/`KC_DQUO`](keycodes_us_ansi_shifted.md)|`KC_DOUBLE_QUOTE`|double quote `"`| -|Long Name|Short Name|Description| -|---------|----------|-----------| -|[`LT(layer, kc)`](feature_common_shortcuts.md#switching-and-toggling-layers)||turn on layer (0-15) when held, kc ([basic keycodes](basic_keycodes.md)) when tapped| +|[`LT(layer, kc)`](feature_common_shortcuts.md#switching-and-toggling-layers)||turn on layer (0-15) when held, kc ([basic keycodes](keycodes_basic.md)) when tapped| |[`TO(layer)`](feature_common_shortcuts.md#switching-and-toggling-layers)||turn on layer when depressed| |[`MO(layer)`](feature_common_shortcuts.md#switching-and-toggling-layers)||momentarily turn on layer when depressed (requires `KC_TRNS` on destination layer)| |[`DF(layer)`](feature_common_shortcuts.md#switching-and-toggling-layers)||sets the base (default) layer| |[`TG(layer)`](feature_common_shortcuts.md#switching-and-toggling-layers)||toggle layer on/off| -|[`TT(layer)](feature_common_shortcuts.md#switching-and-toggling-layers)`||tap toggle? idk FIXME`| +|[`TT(layer)`](feature_common_shortcuts.md#switching-and-toggling-layers)||tap toggle? idk FIXME`| |[`OSM(mod)`](quantum_keycodes.md#one-shot-keys)||hold mod for one keypress| |[`OSL(layer)`](quantum_keycodes.md#one-shot-keys)||switch to layer for one keypress| -|Long Name|Short Name|Description| -|---------|----------|-----------| |[`UNICODE(n)`](unicode.md)|[`UC(n)`](unicode.md)|if `UNICODE_ENABLE`, this will send characters up to `0x7FFF`| |[`X(n)`](unicode.md)||if `UNICODEMAP_ENABLE`, also sends unicode via a different method| diff --git a/docs/keycodes_basic.md b/docs/keycodes_basic.md new file mode 100644 index 0000000000..b1f69ab167 --- /dev/null +++ b/docs/keycodes_basic.md @@ -0,0 +1,192 @@ +# Basic keycodes + +Basic keycodes are based on [HID Usage Keyboard/Keypad Page(0x07)](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) with following exceptions: + +* `KC_NO` = 0 for no action +* `KC_TRNS` = 1 for layer transparency +* internal special keycodes in the `0xA5-DF` range (tmk heritage). + +## Letters and Numbers + +|KC_1|KC_2|KC_3|KC_4|KC_5|KC_6|KC_7|KC_8| +|----|----|----|----|----|----|----|----| +|KC_9|KC_0|KC_F1|KC_F2|KC_F3|KC_F4|KC_F5|KC_F6| +|KC_F7|KC_F8|KC_F9|KC_F10|KC_F11|KC_F12|KC_F13|KC_F14| +|KC_F15|KC_F16|KC_F17|KC_F18|KC_F19|KC_F20|KC_F21|KC_F22| +|KC_F23|KC_F24|KC_A|KC_B|KC_C|KC_D|KC_E|KC_F| +|KC_G|KC_H|KC_I|KC_J|KC_K|KC_L|KC_M|KC_N| +|KC_O|KC_P|KC_Q|KC_R|KC_S|KC_T|KC_U|KC_V| +|KC_W|KC_X|KC_Y|KC_Z||||| + +## Punctuation + +|Long Name|Short Name|Description| +|---------|----------|-----------| +|KC_ENTER|KC_ENT|`Return (ENTER)`| +|KC_ESCAPE|KC_ESC|`ESCAPE`| +|KC_BSPACE|KC_BSPC|`DELETE (Backspace)`| +|KC_TAB||`Tab`| +|KC_SPACE|KC_SPC|Spacebar| +|KC_MINUS|KC_MINS|`-` and `_`| +|KC_EQUAL|KC_EQL|`=` and `+`| +|KC_LBRACKET|KC_LBRC|`[` and `{`| +|KC_RBRACKET|KC_RBRC|`]` and `}`| +|KC_BSLASH|KC_BSLS|`\` and | | +|KC_NONUS_HASH|KC_NUHS|Non-US `#` and `~`| +|KC_NONUS_BSLASH|KC_NUBS|Non-US `\` and | | +|KC_INT1|KC_RO|JIS `\` and | | +|KC_INT2|KC_KANA|International216| +|KC_INT3|KC_JYEN|Yen Symbol (`¥`)| +|KC_SCOLON|KC_SCLN|`;` and `:`| +|KC_QUOTE|KC_QUOT|`‘` and `“`| +|KC_GRAVE|KC_GRV|Grave Accent and Tilde| +|KC_COMMA|KC_COMM|`,` and `<`| +|KC_DOT||`.` and `>`| +|KC_SLASH|KC_SLSH|`/` and `?`| +|KC_CAPSLOCK|KC_CAPS|Caps Lock| + +## Modifiers + +|Long Name|Short Name|Description| +|---------|----------|-----------| +|KC_LCTRL|KC_LCTL|LeftControl| +|KC_LSHIFT|KC_LSFT|LeftShift| +|KC_LALT||LeftAlt| +|KC_LGUI||Left GUI(Windows/Apple/Meta key)| +|KC_RCTRL|KC_RCTL|RightControl| +|KC_RSHIFT|KC_RSFT|RightShift| +|KC_RALT||RightAlt| +|KC_RGUI||Right GUI(Windows/Apple/Meta key)| +|KC_LOCKING_CAPS|KC_LCAP|Locking Caps Lock| +|KC_LOCKING_NUM|KC_LNUM|Locking Num Lock| +|KC_LOCKING_SCROLL|KC_LSCR|Locking Scroll Lock| +|KC_INT4|KC_HENK|JIS Henken| +|KC_INT5|KC_MHEN|JIS Muhenken| + +## Commands + +|Long Name|Short Name|Description| +|---------|----------|-----------| +|KC_PSCREEN|KC_PSCR|PrintScreen| +|KC_SCROLLLOCK|KC_SLCK|Scroll Lock| +|KC_PAUSE|KC_PAUS|Pause| +|KC_INSERT|KC_INS|Insert| +|KC_HOME||Home| +|KC_PGUP||PageUp| +|KC_DELETE|KC_DEL|Delete Forward| +|KC_END||End| +|KC_PGDOWN|KC_PGDN|PageDown| +|KC_RIGHT|KC_RGHT|RightArrow| +|KC_LEFT||LeftArrow| +|KC_DOWN||DownArrow| +|KC_UP||UpArrow| +|KC_APPLICATION|KC_APP|Application| +|KC_POWER||Power| +|KC_EXECUTE||Execute| +|KC_HELP||Help| +|KC_MENU||Menu| +|KC_SELECT||Select| +|KC_AGAIN||Again| +|KC_UNDO||Undo| +|KC_CUT||Cut| +|KC_COPY||Copy| +|KC_PASTE||Paste| +|KC_FIND||Find| +|KC_ALT_ERASE||Alternate Erase| +|KC_SYSREQ||SysReq/Attention| +|KC_CANCEL||Cancel| +|KC_CLEAR||Clear| +|KC_PRIOR||Prior| +|KC_RETURN||Return| +|KC_SEPARATOR||Separator| +|KC_OUT||Out| +|KC_OPER||Oper| +|KC_CLEAR_AGAIN||Clear/Again| +|KC_CRSEL||CrSel/Props| +|KC_EXSEL||ExSel| +|KC_SYSTEM_POWER|KC_PWR|System Power Down| +|KC_SYSTEM_SLEEP|KC_SLEP|System Sleep| +|KC_SYSTEM_WAKE|KC_WAKE|System Wake| +|KC_MAIL|KC_MAIL|| +|KC_CALCULATOR|KC_CALC|| +|KC_MY_COMPUTER|KC_MYCM|| +|KC_WWW_SEARCH|KC_WSCH|| +|KC_WWW_HOME|KC_WHOM|| +|KC_WWW_BACK|KC_WBAK|| +|KC_WWW_FORWARD|KC_WFWD|| +|KC_WWW_STOP|KC_WSTP|| +|KC_WWW_REFRESH|KC_WREF|| +|KC_WWW_FAVORITES|KC_WFAV|| + +## Media Keys + +Windows and Mac use different key codes for next track and previous track. Make sure you choose the keycode that corresponds to your OS. + +|Long Name|Short Name|Description| +|---------|----------|-----------| +|KC_STOP||Stop| +|KC__MUTE||Mute| +|KC__VOLUP||Volume Up| +|KC__VOLDOWN||Volume Down| +|KC_AUDIO_MUTE|KC_MUTE|| +|KC_AUDIO_VOL_UP|KC_VOLU|| +|KC_AUDIO_VOL_DOWN|KC_VOLD|| +|KC_MEDIA_NEXT_TRACK|KC_MNXT|Next Track (Windows)| +|KC_MEDIA_PREV_TRACK|KC_MPRV|Previous Track (Windows)| +|KC_MEDIA_FAST_FORWARD|KC_MFFD|Next Track (macOS)| +|KC_MEDIA_REWIND|KC_MRWD|Previous Track (macOS)| +|KC_MEDIA_STOP|KC_MSTP|| +|KC_MEDIA_PLAY_PAUSE|KC_MPLY|| +|KC_MEDIA_SELECT|KC_MSEL|| + +## Numpad + +|Long Name|Short Name|Description| +|---------|----------|-----------| +|KC_NUMLOCK|KC_NLCK|Keypad Num Lock and Clear| +|KC_KP_SLASH|KC_PSLS|Keypad /| +|KC_KP_ASTERISK|KC_PAST|Keypad *| +|KC_KP_MINUS|KC_PMNS|Keypad -| +|KC_KP_PLUS|KC_PPLS|Keypad +| +|KC_KP_ENTER|KC_PENT|Keypad ENTER| +|KC_KP_1|KC_P1|Keypad 1 and End| +|KC_KP_2|KC_P2|Keypad 2 and Down Arrow| +|KC_KP_3|KC_P3|Keypad 3 and PageDn| +|KC_KP_4|KC_P4|Keypad 4 and Left Arrow| +|KC_KP_5|KC_P5|Keypad 5| +|KC_KP_6|KC_P6|Keypad 6 and Right Arrow| +|KC_KP_7|KC_P7|Keypad 7 and Home| +|KC_KP_8|KC_P8|Keypad 8 and Up Arrow| +|KC_KP_9|KC_P9|Keypad 9 and PageUp| +|KC_KP_0|KC_P0|Keypad 0 and Insert| +|KC_KP_DOT|KC_PDOT|Keypad . and Delete| +|KC_KP_EQUAL|KC_PEQL|Keypad =| +|KC_KP_COMMA|KC_PCMM|Keypad Comma| +|KC_KP_EQUAL_AS400||Keypad Equal Sign| + +## Special Keys + +|Long Name|Short Name|Description| +|---------|----------|-----------| +|KC_NO||Ignore this key. (NOOP) | + +## Mousekey + +|Long Name|Short Name|Description| +|---------|----------|-----------| +|KC_MS_UP|KC_MS_U|Mouse Cursor Up| +|KC_MS_DOWN|KC_MS_D|Mouse Cursor Down| +|KC_MS_LEFT|KC_MS_L|Mouse Cursor Left| +|KC_MS_RIGHT|KC_MS_R|Mouse Cursor Right| +|KC_MS_BTN1|KC_BTN1|Mouse Button 1| +|KC_MS_BTN2|KC_BTN2|Mouse Button 2| +|KC_MS_BTN3|KC_BTN3|Mouse Button 3| +|KC_MS_BTN4|KC_BTN4|Mouse Button 4| +|KC_MS_BTN5|KC_BTN5|Mouse Button 5| +|KC_MS_WH_UP|KC_WH_U|Mouse Wheel Up| +|KC_MS_WH_DOWN|KC_WH_D|Mouse Wheel Down| +|KC_MS_WH_LEFT|KC_WH_L|Mouse Wheel Left| +|KC_MS_WH_RIGHT|KC_WH_R|Mouse Wheel Right| +|KC_MS_ACCEL0|KC_ACL0|Mouse Acceleration 0| +|KC_MS_ACCEL1|KC_ACL1|Mouse Acceleration 1| +|KC_MS_ACCEL2|KC_ACL2|Mouse Acceleration 2| diff --git a/docs/keymap.md b/docs/keymap.md index 53b17f4019..170fdaed7d 100644 --- a/docs/keymap.md +++ b/docs/keymap.md @@ -215,8 +215,7 @@ To actually handle the keypress event we define an `action_function()`. This fun This should have given you a basic overview for creating your own keymap. For more details see the following resources: -* https://github.com/qmk/qmk_firmware/wiki/Keycodes -* https://github.com/qmk/qmk_firmware/wiki/FAQ-Keymap -* https://github.com/qmk/qmk_firmware/wiki/Keymap-examples +* [Keycodes](keycodes.md) +* [Keymap FAQ](faq_keymap.md) -We are actively working to improve these docs. If you have suggestions for how they could be made better please [file an issue](https://github.com/qmk/qmk_firmware/issues/new)! \ No newline at end of file +We are actively working to improve these docs. If you have suggestions for how they could be made better please [file an issue](https://github.com/qmk/qmk_firmware/issues/new)! diff --git a/docs/leader_key.md b/docs/leader_key.md deleted file mode 100644 index bf4d5456d1..0000000000 --- a/docs/leader_key.md +++ /dev/null @@ -1,37 +0,0 @@ -# The Leader key: A new kind of modifier - -If you've ever used Vim, you know what a Leader key is. If not, you're about to discover a wonderful concept. :) Instead of hitting Alt+Shift+W for example (holding down three keys at the same time), what if you could hit a _sequence_ of keys instead? So you'd hit our special modifier (the Leader key), followed by W and then C (just a rapid succession of keys), and something would happen. - -That's what `KC_LEAD` does. Here's an example: - -1. Pick a key on your keyboard you want to use as the Leader key. Assign it the keycode `KC_LEAD`. This key would be dedicated just for this -- it's a single action key, can't be used for anything else. -2. Include the line `#define LEADER_TIMEOUT 300` somewhere in your keymap.c file, probably near the top. The 300 there is 300ms -- that's how long you have for the sequence of keys following the leader. You can tweak this value for comfort, of course. -3. Within your `matrix_scan_user` function, do something like this: - -``` -LEADER_EXTERNS(); - -void matrix_scan_user(void) { - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - SEQ_ONE_KEY(KC_F) { - register_code(KC_S); - unregister_code(KC_S); - } - SEQ_TWO_KEYS(KC_A, KC_S) { - register_code(KC_H); - unregister_code(KC_H); - } - SEQ_THREE_KEYS(KC_A, KC_S, KC_D) { - register_code(KC_LGUI); - register_code(KC_S); - unregister_code(KC_S); - unregister_code(KC_LGUI); - } - } -} -``` - -As you can see, you have three function. you can use - `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS` and `SEQ_THREE_KEYS` for longer sequences. Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously. \ No newline at end of file diff --git a/docs/macros.md b/docs/macros.md index 6b128541b8..c7a9b2e7a6 100644 --- a/docs/macros.md +++ b/docs/macros.md @@ -24,7 +24,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { }; ``` -This defines two macros which will be run when the key they are assigned to is pressed. If you'd like them to run when the release is released instead you can change the if statement: +This defines two macros which will be run when the key they are assigned to is pressed. If instead you'd like them to run when the key is released you can change the if statement: ```c if (!record->event.pressed) { diff --git a/docs/modding_your_keyboard.md b/docs/modding_your_keyboard.md deleted file mode 100644 index a58fbd52b2..0000000000 --- a/docs/modding_your_keyboard.md +++ /dev/null @@ -1,403 +0,0 @@ - -## Audio output from a speaker - -Your keyboard can make sounds! If you've got a Planck, Preonic, or basically any AVR keyboard that allows access to the C6 or B5 port (`#define C6_AUDIO` and/or `#define B5_AUDIO`), you can hook up a simple speaker and make it beep. You can use those beeps to indicate layer transitions, modifiers, special keys, or just to play some funky 8bit tunes. - -If you add `AUDIO_ENABLE = yes` to your `rules.mk`, there's a couple different sounds that will automatically be enabled without any other configuration: - -``` -STARTUP_SONG // plays when the keyboard starts up (audio.c) -GOODBYE_SONG // plays when you press the RESET key (quantum.c) -AG_NORM_SONG // plays when you press AG_NORM (quantum.c) -AG_SWAP_SONG // plays when you press AG_SWAP (quantum.c) -MUSIC_ON_SONG // plays when music mode is activated (process_music.c) -MUSIC_OFF_SONG // plays when music mode is deactivated (process_music.c) -CHROMATIC_SONG // plays when the chromatic music mode is selected (process_music.c) -GUITAR_SONG // plays when the guitar music mode is selected (process_music.c) -VIOLIN_SONG // plays when the violin music mode is selected (process_music.c) -MAJOR_SONG // plays when the major music mode is selected (process_music.c) -``` - -You can override the default songs by doing something like this in your `config.h`: - -```c -#ifdef AUDIO_ENABLE - #define STARTUP_SONG SONG(STARTUP_SOUND) -#endif -``` - -A full list of sounds can be found in [quantum/audio/song_list.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/audio/song_list.h) - feel free to add your own to this list! All available notes can be seen in [quantum/audio/musical_notes.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/audio/musical_notes.h). - -To play a custom sound at a particular time, you can define a song like this (near the top of the file): - -```c -float my_song[][2] = SONG(QWERTY_SOUND); -``` - -And then play your song like this: - -```c -PLAY_SONG(my_song); -``` - -Alternatively, you can play it in a loop like this: - -```c -PLAY_LOOP(my_song); -``` - -It's advised that you wrap all audio features in `#ifdef AUDIO_ENABLE` / `#endif` to avoid causing problems when audio isn't built into the keyboard. - -## 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. - -Keycodes available: - -* `MU_ON` - Turn music mode on -* `MU_OFF` - Turn music mode off -* `MU_TOG` - Toggle music mode -* `MU_MOD` - Cycle through the music modes: - * `CHROMATIC_MODE` - Chromatic scale, row changes the octave - * `GUITAR_MODE` - Chromatic scale, but the row changes the string (+5 st) - * `VIOLIN_MODE` - Chromatic scale, but the row changes the string (+7 st) - * `MAJOR_MODE` - Major scale - -In music mode, the following keycodes work differently, and don't pass through: - -* `LCTL` - start a recording -* `LALT` - stop recording/stop playing -* `LGUI` - play recording -* `KC_UP` - speed-up playback -* `KC_DOWN` - slow-down playback - -By default, `MUSIC_MASK` is set to `keycode < 0xFF` which means keycodes less than `0xFF` are turned into notes, and don't output anything. You can change this by defining this in your `config.h` like this: - - #define MUSIC_MASK keycode != KC_NO - -Which will capture all keycodes - be careful, this will get you stuck in music mode until you restart your keyboard! - -The pitch standard (`PITCH_STANDARD_A`) is 440.0f by default - to change this, add something like this to your `config.h`: - - #define PITCH_STANDARD_A 432.0f - -## MIDI functionalty - -This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile. - -## Bluetooth functionality - -This requires [some hardware changes](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts), but can be enabled via the Makefile. The firmware will still output characters via USB, so be aware of this when charging via a computer. It would make sense to have a switch on the Bluefruit to turn it off at will. - -## RGB Under Glow Mod - -![Planck with RGB Underglow](https://raw.githubusercontent.com/qmk/qmk_firmware/master/keyboards/planck/keymaps/yang/planck-with-rgb-underglow.jpg) - -Here is a quick demo on Youtube (with NPKC KC60) (https://www.youtube.com/watch?v=VKrpPAHlisY). - -For this mod, you need an unused pin wiring to DI of WS2812 strip. After wiring the VCC, GND, and DI, you can enable the underglow in your Makefile. - - RGBLIGHT_ENABLE = yes - -In order to use the underglow animation functions, you need to have `#define RGBLIGHT_ANIMATIONS` in your `config.h`. - -Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the `F4` pin by default: - - #define RGB_DI_PIN F4 // The pin your RGB strip is wired to - #define RGBLIGHT_ANIMATIONS // Require for fancier stuff (not compatible with audio) - #define RGBLED_NUM 14 // Number of LEDs - #define RGBLIGHT_HUE_STEP 10 - #define RGBLIGHT_SAT_STEP 17 - #define RGBLIGHT_VAL_STEP 17 - -You'll need to edit `RGB_DI_PIN` to the pin you have your `DI` on your RGB strip wired to. - -The firmware supports 5 different light effects, and the color (hue, saturation, brightness) can be customized in most effects. To control the underglow, you need to modify your keymap file to assign those functions to some keys/key combinations. For details, please check this keymap. `keyboards/planck/keymaps/yang/keymap.c` - -### WS2812 Wiring - -![WS2812 Wiring](https://raw.githubusercontent.com/qmk/qmk_firmware/master/keyboards/planck/keymaps/yang/WS2812-wiring.jpg) - -Please note the USB port can only supply a limited amount of power to the keyboard (500mA by standard, however, modern computer and most usb hubs can provide 700+mA.). According to the data of NeoPixel from Adafruit, 30 WS2812 LEDs require a 5V 1A power supply, LEDs used in this mod should not more than 20. - -## PS/2 Mouse Support - -Its possible to hook up a PS/2 mouse (for example touchpads or trackpoints) to your keyboard as a composite device. - -To hook up a Trackpoint, you need to obtain a Trackpoint module (i.e. harvest from a Thinkpad keyboard), identify the function of each pin of the module, and make the necessary circuitry between controller and Trackpoint module. For more information, please refer to [Trackpoint Hardware](https://deskthority.net/wiki/TrackPoint_Hardware) page on Deskthority Wiki. - -There are three available modes for hooking up PS/2 devices: USART (best), interrupts (better) or busywait (not recommended). - -### Busywait version - -Note: This is not recommended, you may encounter jerky movement or unsent inputs. Please use interrupt or USART version if possible. - -In rules.mk: - -``` -PS2_MOUSE_ENABLE = yes -PS2_USE_BUSYWAIT = yes -``` - -In your keyboard config.h: - -``` -#ifdef PS2_USE_BUSYWAIT -# define PS2_CLOCK_PORT PORTD -# define PS2_CLOCK_PIN PIND -# define PS2_CLOCK_DDR DDRD -# define PS2_CLOCK_BIT 1 -# define PS2_DATA_PORT PORTD -# define PS2_DATA_PIN PIND -# define PS2_DATA_DDR DDRD -# define PS2_DATA_BIT 2 -#endif -``` - -### Interrupt version - -The following example uses D2 for clock and D5 for data. You can use any INT or PCINT pin for clock, and any pin for data. - -In rules.mk: - -``` -PS2_MOUSE_ENABLE = yes -PS2_USE_INT = yes -``` - -In your keyboard config.h: - -``` -#ifdef PS2_USE_INT -#define PS2_CLOCK_PORT PORTD -#define PS2_CLOCK_PIN PIND -#define PS2_CLOCK_DDR DDRD -#define PS2_CLOCK_BIT 2 -#define PS2_DATA_PORT PORTD -#define PS2_DATA_PIN PIND -#define PS2_DATA_DDR DDRD -#define PS2_DATA_BIT 5 - -#define PS2_INT_INIT() do { \ - EICRA |= ((1</readme.md` @@ -42,7 +42,7 @@ This is where you'll describe your keyboard - please write as much as you can ab ## `/keyboards//.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) +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.md). ## `/keyboards//.h` diff --git a/docs/quantum_keycodes.md b/docs/quantum_keycodes.md index 2e17ae4b7b..a5160bf94a 100644 --- a/docs/quantum_keycodes.md +++ b/docs/quantum_keycodes.md @@ -15,8 +15,8 @@ On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are |`KC_GESC`/`GRAVE_ESC`|Acts as escape when pressed normally but when pressed with Shift or GUI will send a ```| |`KC_LSPO`|Left shift when held, open paranthesis when tapped| |`KC_RSPC`|Right shift when held, close paranthesis when tapped| -|`KC_LEAD`|The [leader key](leader_key.md)| +|`KC_LEAD`|The [leader key](feature_leader_key.md)| |`KC_LOCK`|The [lock key](key_lock.md)| -|`FUNC(n)`/`F(n)`|Call `fn_action(n)`| +|`FUNC(n)`/`F(n)`|Call `fn_action(n)` (deprecated)| |`M(n)`|to call macro n| |`MACROTAP(n)`|to macro-tap n idk FIXME| diff --git a/docs/understanding_qmk.md b/docs/understanding_qmk.md index 28927f0eff..2ac4f30365 100644 --- a/docs/understanding_qmk.md +++ b/docs/understanding_qmk.md @@ -3,7 +3,7 @@ This document attempts to explain how the QMK firmware works from a very high level. It assumes you understand basic programming concepts but does not (except where needed to demonstrate) assume familiarity with C. It assumes that you have a basic understanding of the following documents: * [QMK Overview](qmk_overview.md) -* [How Keyboards Work](basic_how_keyboards_work.md) +* [How Keyboards Work](how_keyboards_work.md) * [FAQ](faq.md) ## Startup -- cgit v1.2.3