X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=README.md;h=6a6bbed40b0097ba50b0168d8a554de56da5e719;hb=acd64aa841f92ee638ca630fc66c3ff91c09ae72;hp=33005227df2b5fd54b3c47d7ead25ad2e43eb0df;hpb=ebd209d285ffdad5d56098c8d4edb6f2f364c907;p=qmk_firmware.git diff --git a/README.md b/README.md index 33005227d..6a6bbed40 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ The documentation below explains QMK customizations and elaborates on some of th ## Getting started -* **If you're looking to customize a keyboard that currently runs QMK or TMK** , find your keyboard's directory under `/keyboard/` and read the README file. This will get you all set up. -* Read the [QUICK_START.md](QUICK_START.md) if you want to hit the ground running with minimal fuss or you aren't a technical person and you just want to build the firmware with the least amount of hassle possible. +* [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/`. +* 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. You have access to a bunch of goodies! Check out the Makefile to enable/disable some of the features. Uncomment the `#` to enable them. Setting them to `no` does nothing and will only confuse future you. @@ -47,6 +47,7 @@ Your keymap can include shortcuts to common operations (called "function actions * `RGUI(kc)` - applies right GUI (command/win) to *kc* * `HYPR(kc)` - applies Hyper (all modifiers) to *kc* * `MEH(kc)` - applies Meh (all modifiers except Win/Cmd) to *kc* +* `LCAG(kc)` - applies CtrlAltGui to *kc* You can also chain these, like this: @@ -72,7 +73,7 @@ The following shortcuts automatically add `LSFT()` to keycodes to get commonly u KC_PIPE | KC_COLN : -`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. +`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()` (right-hand modifiers are not available): @@ -85,14 +86,15 @@ These can also be combined like `MOD_LCTL | MOD_LSFT` e.g. `MT(MOD_LCTL | MOD_LS We've added shortcuts to make common modifier/tap (mod-tap) mappings more compact: - * `CTL_T(kc)` - is LCTL when held and *kc* when tapped - * `SFT_T(kc)` - is LSFT when held and *kc* when tapped - * `ALT_T(kc)` - is LALT when held and *kc* when tapped - * `GUI_T(kc)` - is LGUI when held and *kc* when tapped + * `CTL_T(kc)` - is LCTL when held and *kc* when tapped + * `SFT_T(kc)` - is LSFT when held and *kc* when tapped + * `ALT_T(kc)` - is LALT when held and *kc* when tapped + * `GUI_T(kc)` - is LGUI when held and *kc* when tapped * `ALL_T(kc)` - is Hyper (all mods) when held and *kc* when tapped. To read more about what you can do with a Hyper key, see [this blog post by Brett Terpstra](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/) + * `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. -### Temporarily setting the default layer +### 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. @@ -113,7 +115,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // case 0: // this would trigger when you hit a key mapped as M(0) if (record->event.pressed) { return MACRO( I(255), T(H), T(E), T(L), T(L), W(255), T(O), END ); // this sends the string 'hello' when the macro executes - } + } break; } return MACRO_NONE; @@ -130,20 +132,80 @@ A macro can include the following commands: So above you can see the stroke interval changed to 255ms between each keystroke, then a bunch of keys being typed, waits a while, then the macro ends. -Note: Using macros to have your keyboard send passwords for you is a bad idea. +Note: Using macros to have your keyboard send passwords for you is possible, but a bad idea. -### Additional keycode aliases for software-implemented layouts (Colemak, Dvorak, etc) +### Advanced macro functions + +To get more control over the keys/actions your keyboard takes, the following functions are available to you in the `action_get_macro` function block: + +* `record->event.pressed` + +This is a boolean value that can be tested to see if the switch is being pressed or released. An example of this is + +```c +if (record->event.pressed) { + // on keydown +} else { + // on keyup +} +``` + +* `register_code();` + +This sends the `` keydown event to the computer. Some examples would be `KC_ESC`, `KC_C`, `KC_4`, and even modifiers such as `KC_LSFT` and `KC_LGUI`. + +* `unregister_code();` + +Parallel to `register_code` function, this sends the `` keyup event to the computer. If you don't use this, the key will be held down until it's sent. + +* `layer_on();` + +This will turn on the layer `` - the higher layer number will always take priority. Make sure you have `KC_TRNS` for the key you're pressing on the layer you're switching to, or you'll get stick there unless you have another plan. + +* `layer_off();` + +This will turn off the layer ``. + +* `clear_keyboard();` + +This will clear all mods and keys currently pressed. + +* `clear_mods();` + +This will clear all mods currently pressed. + +* `clear_keyboard_but_mods();` + +This will clear all keys besides the mods currently pressed. + +#### Timer functionality + +It's possible to start timers and read values for time-specific events - here's an example: + +```c +static uint16_t key_timer; +key_timer = timer_read(); +if (timer_elapsed(key_timer) < 100) { + // do something if less than 100ms have passed +} else { + // do something if 100ms or more have passed +} +``` + +It's best to declare the `static uint16_t key_timer;` outside of the macro block (top of file, etc). + +## 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: - #include "keymap_.h" + #include + +If you use Dvorak, use `keymap_dvorak.h` instead of `keymap_colemak.h` for this line. After including this line, you will get access to: -Where is "colemak" or "dvorak". After including this line, you will get access to: - * `CM_*` for all of the Colemak-equivalent characters * `DV_*` for all of the Dvorak-equivalent characters - -These implementations assume you're using Colemak or Dvorak on your OS, not on your keyboard - this is referred to as a software-implemented layout. If your computer is in Qwerty and your keymap is in Colemak or Dvorak, this is referred to as a firmware-implemented layout, and you won't need these features. + +These implementations assume you're using Colemak or Dvorak on your OS, not on your keyboard - this is referred to as a software-implemented layout. If your computer is in Qwerty and your keymap is in Colemak or Dvorak, this is referred to as a firmware-implemented layout, and you won't need these features. To give an example, if you're using software-implemented Colemak, and want to get an `F`, you would use `CM_F` - `KC_F` under these same circumstances would result in `T`. @@ -176,3 +238,75 @@ This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happeni ## 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. + +## International Characters on Windows + +[AutoHotkey](https://autohotkey.com) allows Windows users to create custom hotkeys amont others. + +The method does not require Unicode support in the keyboard itself but depends instead of AutoHotkey running in the background. + +First you need to select a modifier combination that is not in use by any of your programs. +CtrlAltWin is not used very widely and should therefore be perfect for this. +There is a macro defined for a mod-tab combo `LCAG_T`. +Add this mod-tab combo to a key on your keyboard, e.g.: `LCAG_T(KC_TAB)`. +This makes the key behave like a tab key if pressed and released immediately but changes it to the modifier if used with another key. + +In the default script of AutoHotkey you can define custom hotkeys. + + <^