From f4a426a0b1817dcf865cb5303184cd693074e9b3 Mon Sep 17 00:00:00 2001 From: Erez Zukerman Date: Tue, 24 May 2016 22:37:25 -0400 Subject: [Erez & Jack] Documents new Leader key functionality --- README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 10 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 4e53569a8e..3925cf8d9a 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,42 @@ 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. +### 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: + +``` +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_.EYS` 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. + ### Temporarily setting the default layer `DF(layer)` - sets default layer to *layer*. The default layer is the one at the "bottom" of the layer stack - the ultimate fallback layer. This currently does not persist over power loss. When you plug the keyboard back in, layer 0 will always be the default. It is theoretically possible to work around that, but that's not what `DF` does. @@ -258,7 +294,7 @@ if (timer_elapsed(key_timer) < 100) { } ``` -It's best to declare the `static uint16_t key_timer;` outside of the macro block (top of file, etc). +It's best to declare the `static uint16_t key_timer;` outside of the macro block (top of file, etc). #### Example 1: Single-key copy/paste (hold to copy, tap to paste) @@ -276,7 +312,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case 0: { if (record->event.pressed) { key_timer = timer_read(); // if the key is being pressed, we start the timer. - } + } else { // this means the key was just released, so we can figure out how long it was pressed for (tap or "held down"). if (timer_elapsed(key_timer) > 150) { // 150 being 150ms, the threshhold we pick for counting something as a tap. return MACRO( D(LCTL), T(C), U(LCTL), END ); @@ -312,7 +348,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) key_timer = timer_read(); // if the key is being pressed, we start the timer. register_code(KC_LSFT); // we're now holding down Shift. } else { // this means the key was just released, so we can figure out how long it was pressed for (tap or "held down"). - if (timer_elapsed(key_timer) < 150) { // 150 being 150ms, the threshhold we pick for counting something as a tap. + if (timer_elapsed(key_timer) < 150) { // 150 being 150ms, the threshhold we pick for counting something as a tap. register_code(KC_9); // sending 9 while Shift is held down gives us an opening paren unregister_code(KC_9); // now let's let go of that key } @@ -323,13 +359,13 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case 1: { if (record->event.pressed) { key_timer = timer_read(); // Now we're doing the same thing, only for the right shift/close paren key - register_code(KC_RSFT); - } else { - if (timer_elapsed(key_timer) < 150) { - register_code(KC_0); - unregister_code(KC_0); + register_code(KC_RSFT); + } else { + if (timer_elapsed(key_timer) < 150) { + register_code(KC_0); + unregister_code(KC_0); } - unregister_code(KC_RSFT); + unregister_code(KC_RSFT); } break; } @@ -510,4 +546,4 @@ what things are (and likely aren't) too risky. - EEPROM has around a 100000 write cycle. You shouldn't rewrite the firmware repeatedly and continually; that'll burn the EEPROM eventually. - + -- cgit v1.2.3 From 1237025963484d70bbe5185a790bec6544653ccc Mon Sep 17 00:00:00 2001 From: Erez Zukerman Date: Tue, 24 May 2016 23:27:59 -0400 Subject: [Erez & Jack] Packages Space Cadet shifts into keycodes --- README.md | 62 +++++++++++++++----------------------------------------------- 1 file changed, 15 insertions(+), 47 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 3925cf8d9a..021c2499f4 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,20 @@ 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. +### Space Cadet Shift: The future, built in + +Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds. + +To use it, use `KC_LSPO` (Left Shift, Parens Open) for your left Shift on your keymap, and `KC_RSPC` (Right Shift, Parens Close) for your right Shift. + +The only other thing you're going to want to do is create a `makefile.mk` in your keymap directory and set the following: + +``` +COMMAND_ENABLE = no # Commands for debug and configuration +``` + +This is just to keep the keyboard from going into command mode when you hold both Shift keys at the same time. + ### 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. @@ -296,7 +310,7 @@ if (timer_elapsed(key_timer) < 100) { It's best to declare the `static uint16_t key_timer;` outside of the macro block (top of file, etc). -#### Example 1: Single-key copy/paste (hold to copy, tap to paste) +#### Example: Single-key copy/paste (hold to copy, tap to paste) With QMK, it's easy to make one key do two things, as long as one of those things is being a modifier. :) So if you want a key to act as Ctrl when held and send the letter R when tapped, that's easy: `CTL_T(KC_R)`. But what do you do when you want that key to send Ctrl-V (paste) when tapped, and Ctrl-C (copy) when held? @@ -330,52 +344,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) And then, to assign this macro to a key on your keyboard layout, you just use `M(0)` on the key you want to press for copy/paste. -#### Example 2: Space Cadet Shift (making it easy to send opening and closing parentheses) - -In the [Modern Space Cadet Keyboard](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/#shift-parentheses), one of cooler features is the Shift Parentheses. To quote Steve Losh: - - > When held while pressing other keys, act like Shift. - > When pressed and released on their own, type an opening or closing parenthesis (left and right shift respectively). - -``` -static uint16_t key_timer; - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - switch(id) { - case 0: { - if (record->event.pressed) { - key_timer = timer_read(); // if the key is being pressed, we start the timer. - register_code(KC_LSFT); // we're now holding down Shift. - } else { // this means the key was just released, so we can figure out how long it was pressed for (tap or "held down"). - if (timer_elapsed(key_timer) < 150) { // 150 being 150ms, the threshhold we pick for counting something as a tap. - register_code(KC_9); // sending 9 while Shift is held down gives us an opening paren - unregister_code(KC_9); // now let's let go of that key - } - unregister_code(KC_LSFT); // let's release the Shift key now. - } - break; - } - case 1: { - if (record->event.pressed) { - key_timer = timer_read(); // Now we're doing the same thing, only for the right shift/close paren key - register_code(KC_RSFT); - } else { - if (timer_elapsed(key_timer) < 150) { - register_code(KC_0); - unregister_code(KC_0); - } - unregister_code(KC_RSFT); - } - break; - } - } - return MACRO_NONE; -}; -``` - -And then, to assign this macro to a key on your keyboard layout, you just use `M(0)` on the key you want to press for left shift/opening parens, and `M(1)` for right shift/closing parens. - ## Additional keycode aliases for software-implemented layouts (Colemak, Dvorak, etc) Everything is assuming you're in Qwerty (in software) by default, but there is built-in support for using a Colemak or Dvorak layout by including this at the top of your keymap: -- cgit v1.2.3 From 9d6debd9b23ffb045f63bc77dd44cafe2c7ce851 Mon Sep 17 00:00:00 2001 From: Nathan Sharfi Date: Wed, 25 May 2016 17:25:04 -0700 Subject: Add double quote for everyone; update Zweihander --- README.md | 1 + 1 file changed, 1 insertion(+) (limited to 'README.md') diff --git a/README.md b/README.md index 021c2499f4..646fa6f2b1 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ The following shortcuts automatically add `LSFT()` to keycodes to get commonly u KC_RPRN ) KC_UNDS _ KC_PLUS + + KC_DQUO " KC_LCBR { KC_RCBR } KC_LABK < -- cgit v1.2.3 From 8497a45134bcd7cdfda59cfaef6d54a0c43608c3 Mon Sep 17 00:00:00 2001 From: Erez Zukerman Date: Sat, 28 May 2016 20:48:20 -0400 Subject: Adds a roadmap to the intro section of the docs --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 646fa6f2b1..2513935d23 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,17 @@ This documentation is edited and maintained by Erez Zukerman of ErgoDox EZ. If y The OLKB product firmwares are maintained by Jack, the Ergodox EZ by Erez, and the Clueboard by [Zach White](https://github.com/skullydazed). -## Important background info: TMK documentation +## Documentation roadmap -The documentation below explains QMK customizations and elaborates on some of the more useful features of TMK. To understand the base firmware, and especially what *layers* are and how they work, please see [TMK_README.md](/TMK_README.md). +This is not a tiny project. While this is the main Readme, there are many other files you might want to consult. Here are some points of interest: + +* The Readme for your own keyboard: This is found under `keyboards//'. So for the ErgoDox EZ, it's [here](/tree/master/keyboard/ergodox_ez/); for the Atomic, it's [here](/tree/master/keyboard/atomic/) and so on. +* The [build guide](BUILD_GUIDE.md), also mentioned in the next section. This is how you put your development environment together so you can compile the firmware. +* The list of possible keycodes you can use in your keymap is actually spread out in a few different places: + * [tmk_core/common/keycode.h](/blob/master/tmk_core/common/keycode.h) - the base TMK keycodes. This is the actual source file. + * [tmk_core/doc/keycode.txt](/blob/master/tmk_core/doc/keycode.txt) - an explanation of those same keycodes. + * [quantum/keymap_common.h](/blob/master/quantum/keymap_common.h) - this is where the QMK-specific aliases are all set up. Things like the Hyper and Meh key, the Leader key, and all of the other QMK innovations. These are also explained and documented below, but `keymap_common.h` is where they're actually defined. +* The [TMK documentation](/tree/master/tmk_core/doc). QMK is based on TMK, and this explains how it works internally. ## Getting started -- cgit v1.2.3 From d7ed882d2a32dd0cf1df66c204f5e52395726a41 Mon Sep 17 00:00:00 2001 From: Erez Zukerman Date: Sat, 28 May 2016 20:50:24 -0400 Subject: Corrects links --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 2513935d23..9c8f926e25 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,13 @@ The OLKB product firmwares are maintained by Jack, the Ergodox EZ by Erez, and t This is not a tiny project. While this is the main Readme, there are many other files you might want to consult. Here are some points of interest: -* The Readme for your own keyboard: This is found under `keyboards//'. So for the ErgoDox EZ, it's [here](/tree/master/keyboard/ergodox_ez/); for the Atomic, it's [here](/tree/master/keyboard/atomic/) and so on. +* The Readme for your own keyboard: This is found under `keyboards//'. So for the ErgoDox EZ, it's [here](keyboard/ergodox_ez/); for the Atomic, it's [here](keyboard/atomic/) and so on. * The [build guide](BUILD_GUIDE.md), also mentioned in the next section. This is how you put your development environment together so you can compile the firmware. * The list of possible keycodes you can use in your keymap is actually spread out in a few different places: - * [tmk_core/common/keycode.h](/blob/master/tmk_core/common/keycode.h) - the base TMK keycodes. This is the actual source file. - * [tmk_core/doc/keycode.txt](/blob/master/tmk_core/doc/keycode.txt) - an explanation of those same keycodes. - * [quantum/keymap_common.h](/blob/master/quantum/keymap_common.h) - this is where the QMK-specific aliases are all set up. Things like the Hyper and Meh key, the Leader key, and all of the other QMK innovations. These are also explained and documented below, but `keymap_common.h` is where they're actually defined. -* The [TMK documentation](/tree/master/tmk_core/doc). QMK is based on TMK, and this explains how it works internally. + * [tmk_core/common/keycode.h](tmk_core/common/keycode.h) - the base TMK keycodes. This is the actual source file. + * [tmk_core/doc/keycode.txt](tmk_core/doc/keycode.txt) - an explanation of those same keycodes. + * [quantum/keymap_common.h](quantum/keymap_common.h) - this is where the QMK-specific aliases are all set up. Things like the Hyper and Meh key, the Leader key, and all of the other QMK innovations. These are also explained and documented below, but `keymap_common.h` is where they're actually defined. +* The [TMK documentation](tmk_core/doc). QMK is based on TMK, and this explains how it works internally. ## Getting started -- cgit v1.2.3 From 536ad6813a452328d8b3437c55c1984f84eecc79 Mon Sep 17 00:00:00 2001 From: Erez Zukerman Date: Sat, 28 May 2016 20:51:25 -0400 Subject: Corrects a backtick --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 9c8f926e25..2c82575285 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The OLKB product firmwares are maintained by Jack, the Ergodox EZ by Erez, and t This is not a tiny project. While this is the main Readme, there are many other files you might want to consult. Here are some points of interest: -* The Readme for your own keyboard: This is found under `keyboards//'. So for the ErgoDox EZ, it's [here](keyboard/ergodox_ez/); for the Atomic, it's [here](keyboard/atomic/) and so on. +* The Readme for your own keyboard: This is found under `keyboards//`. So for the ErgoDox EZ, it's [here](keyboard/ergodox_ez/); for the Atomic, it's [here](keyboard/atomic/) and so on. * The [build guide](BUILD_GUIDE.md), also mentioned in the next section. This is how you put your development environment together so you can compile the firmware. * The list of possible keycodes you can use in your keymap is actually spread out in a few different places: * [tmk_core/common/keycode.h](tmk_core/common/keycode.h) - the base TMK keycodes. This is the actual source file. -- cgit v1.2.3 From cc3972e7d6338febb306b384b939f5494ff8cdf9 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Thu, 2 Jun 2016 14:23:01 -0400 Subject: adds travis badge --- README.md | 1 + 1 file changed, 1 insertion(+) (limited to 'README.md') diff --git a/README.md b/README.md index 2c82575285..c848d477d6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![Build Status](https://travis-ci.org/jackhumbert/qmk_firmware.svg?branch=master)](https://travis-ci.org/jackhumbert/qmk_firmware) # Quantum Mechanical Keyboard Firmware This is a keyboard firmware based on the [tmk_keyboard firmware](http://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.co), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/). -- cgit v1.2.3 From b36e532b5e0eef219f33075e6e60b68d104484ee Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sat, 4 Jun 2016 00:10:47 -0400 Subject: cleans up folder structure * consolidates docs * deletes converter/ * updates .md references (most) --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index c848d477d6..a6bd3c495e 100644 --- a/README.md +++ b/README.md @@ -14,18 +14,18 @@ The OLKB product firmwares are maintained by Jack, the Ergodox EZ by Erez, and t This is not a tiny project. While this is the main Readme, there are many other files you might want to consult. Here are some points of interest: * The Readme for your own keyboard: This is found under `keyboards//`. So for the ErgoDox EZ, it's [here](keyboard/ergodox_ez/); for the Atomic, it's [here](keyboard/atomic/) and so on. -* The [build guide](BUILD_GUIDE.md), also mentioned in the next section. This is how you put your development environment together so you can compile the firmware. +* The [build guide](doc/BUILD_GUIDE.md), also mentioned in the next section. This is how you put your development environment together so you can compile the firmware. * The list of possible keycodes you can use in your keymap is actually spread out in a few different places: * [tmk_core/common/keycode.h](tmk_core/common/keycode.h) - the base TMK keycodes. This is the actual source file. - * [tmk_core/doc/keycode.txt](tmk_core/doc/keycode.txt) - an explanation of those same keycodes. + * [doc/keycode.txt](doc/keycode.txt) - an explanation of those same keycodes. * [quantum/keymap_common.h](quantum/keymap_common.h) - this is where the QMK-specific aliases are all set up. Things like the Hyper and Meh key, the Leader key, and all of the other QMK innovations. These are also explained and documented below, but `keymap_common.h` is where they're actually defined. -* The [TMK documentation](tmk_core/doc). QMK is based on TMK, and this explains how it works internally. +* The [TMK documentation](doc/TMK_README.md). QMK is based on TMK, and this explains how it works internally. ## Getting started -* [BUILD_GUIDE.md](BUILD_GUIDE.md) contains instructions to set up a build environment, build the firmware, and deploy it to a keyboard. Once your build environment has been set up, all `make` commands to actually build the firmware must be run from a folder in `keyboard/`. +* [BUILD_GUIDE.md](doc/BUILD_GUIDE.md) contains instructions to set up a build environment, build the firmware, and deploy it to a keyboard. Once your build environment has been set up, all `make` commands to actually build the firmware must be run from a folder in `keyboard/`. * If you're looking to customize a keyboard that currently runs QMK or TMK, find your keyboard's directory under `keyboard/` and run the make commands from there. -* If you're looking to apply this firmware to an entirely new hardware project (a new kind of keyboard), you can create your own Quantum-based project by using `./new_project.sh `, which will create `/keyboard/` with all the necessary components for a Quantum project. +* If you're looking to apply this firmware to an entirely new hardware project (a new kind of keyboard), you can create your own Quantum-based project by using `util/new_project.sh `, which will create `/keyboard/` with all the necessary components for a Quantum project. ### Makefile Options @@ -205,7 +205,7 @@ rounded up (5 bits per key). For example on Planck (48 keys) it uses ### Remember: These are just aliases -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](https://github.com/jackhumbert/qmk_firmware/blob/master/tmk_core/doc/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 tmk ACTION_* functions, please see the [TMK documentation](https://github.com/jackhumbert/qmk_firmware/blob/master/doc/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. -- cgit v1.2.3 From ea63714950c4fef930142c1b81626522dceb152c Mon Sep 17 00:00:00 2001 From: TuxForLife Date: Mon, 6 Jun 2016 07:42:41 -0700 Subject: Tiny typo (#386) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index a6bd3c495e..0990dd8341 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ void matrix_scan_user(void) { } ``` -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_.EYS` 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. +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. ### Temporarily setting the default layer -- cgit v1.2.3