X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=Home.md;h=3197933a873611a165468516f9d1ec208aa26114;hb=684a02ae3f2ecc6ee312b410039b799c62686f07;hp=2f31d6e991761383b40901ebc5dd1b46064b8a07;hpb=6e88c5014bd9e10bf8aeb15e4f00a4e691fbea84;p=qmk_firmware.git diff --git a/Home.md b/Home.md index 2f31d6e99..3197933a8 100644 --- a/Home.md +++ b/Home.md @@ -1,158 +1,130 @@ # Quantum Mechanical Keyboard Firmware -You have found the QMK Firmware documentation site. This is a keyboard firmware based on the [tmk_keyboard firmware](http://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.com), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/). It has also been ported to ARM chips using ChibiOS. You can use it to power your own hand-wired or custom keyboard PCB. +You have found the QMK Firmware documentation site. This is a keyboard firmware based on the [tmk\_keyboard firmware](http://github.com/tmk/tmk_keyboard) \([view differences](/Differences-from-TMK.md)\) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.com), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/). It has also been ported to ARM chips using ChibiOS. You can use it to power your own hand-wired or custom keyboard PCB. # Getting started -Before you are able to compile, you'll need to install an environment for AVR development. You'll find the instructions for any OS below. If you find another/better way to set things up from scratch, please consider [making a pull request](https://github.com/qmk/qmk_firmware/pulls) with your changes! +Before you are able to compile, you'll need to install an environment for AVR or ARM development. You'll find the instructions for any OS below. If you find another/better way to set things up from scratch, please consider [making a pull request](https://github.com/qmk/qmk_firmware/pulls) with your changes! -* [Build Environment Setup](Build-Environment-Setup) -* [QMK Overview](QMK-Overview) +* [Build Environment Setup](/Build-Environment-Setup.md) +* [QMK Overview](/QMK-Overview.md) -# Going beyond the keycodes +# Configuring QMK Firmware -Aside from the [basic keycodes](https://github.com/qmk/qmk_firmware/wiki/Keycodes), your keymap can include shortcuts to common operations. +The QMK Firmware can be configured via the `keymaps` array data. For simply generating a [basic keycode](/Keycodes.md), you add it as an element of your `keymaps` array data. For more complicated actions, there are more advanced keycodes that are organized carefully to represent common operations, some of which can be found on the [Key Functions](/Key-Functions.md) page. -## Quick aliases to common actions - -Your keymap can include shortcuts to common operations (called "function actions" in tmk). To learn more about them check out the [Key Functions](Key-Functions) page. +For more details of the `keymaps` array, see [Keymap Overview](/Keymap.md) page. ## Space Cadet Shift: The future, built in -Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds. Head on over to the [Space Cadet Shift](Space-Cadet-Shift) page to read about it. +Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds. Head on over to the [Space Cadet Shift](/Space-Cadet-Shift.md) page to read about it. ## The Leader key: A new kind of modifier -Most modifiers have to be held or toggled. But what if you had a key that indicated the start of a sequence? You could press that key and then rapidly press 1-3 more keys to trigger a macro, or enter a special layer, or anything else you might want to do. To learn more about it check out the [Leader Key](Leader-Key) page. +Most modifiers have to be held or toggled. But what if you had a key that indicated the start of a sequence? You could press that key and then rapidly press 1-3 more keys to trigger a macro, or enter a special layer, or anything else you might want to do. To learn more about it check out the [Leader Key](/Leader-Key.md) page. ## Tap Dance: A single key can do 3, 5, or 100 different things -Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a colon. Hit it three times, and your keyboard's LEDs do a wild dance. That's just one example of what Tap Dance can do. Read more about it on the [Tap Dance](Tap-Dance) page. +Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a colon. Hit it three times, and your keyboard's LEDs do a wild dance. That's just one example of what Tap Dance can do. Read more about it on the [Tap Dance](/Tap-Dance.md) page. ## Temporarily setting the default layer -`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. +`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. ## Macro shortcuts: Send a whole string when pressing just one key -How would you like a single keypress to send a whole word, sentence, paragraph, or even document? Head on over to the [Macros](Macros) page to read up on all aspects of Simple and Dynamic Macros. +How would you like a single keypress to send a whole word, sentence, paragraph, or even document? Head on over to the [Macros](/Macros.md) page to read up on all aspects of Simple and Dynamic Macros. -## Additional keycode aliases for software-implemented layouts (Colemak, Dvorak, etc) +## 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: +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 +``` +#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: - * `CM_*` for all of the Colemak-equivalent characters - * `DV_*` for all of the Dvorak-equivalent characters +* `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. 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`. -## Additional language support - -In `quantum/keymap_extras/`, you'll see various language files - these work the same way as the alternative layout ones do. Most are defined by their two letter country/language code followed by an underscore and a 4-letter abbreviation of its name. `FR_UGRV` which will result in a `ù` when using a software-implemented AZERTY layout. It's currently difficult to send such characters in just the firmware (but it's being worked on - see Unicode support). - -## Unicode support - -There are three Unicode keymap definition method available in QMK: - -### UNICODE_ENABLE - -Supports Unicode input up to 0xFFFF. The keycode function is `UC(n)` in -keymap file, where *n* is a 4 digit hexadecimal. - -### UNICODEMAP_ENABLE - -Supports Unicode up to 0xFFFFFFFF. You need to maintain a separate mapping -table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file. -The keycode function is `X(n)` where *n* is the array index of the mapping -table. - -### UCIS_ENABLE - -TBD - -Unicode input in QMK works by inputing a sequence of characters to the OS, -sort of like macro. Unfortunately, each OS has different ideas on how Unicode is inputted. - -This is the current list of Unicode input method in QMK: - -* UC_OSX: MacOS Unicode Hex Input support. Works only up to 0xFFFF. Disabled by default. To enable: go to System Preferences -> Keyboard -> Input Sources, and enable Unicode Hex. -* UC_LNX: Unicode input method under Linux. Works up to 0xFFFFF. Should work almost anywhere on ibus enabled distros. Without ibus, this works under GTK apps, but rarely anywhere else. -* UC_WIN: (not recommended) Windows built-in Unicode input. To enable: create registry key under `HKEY_CURRENT_USER\Control Panel\Input Method\EnableHexNumpad` of type `REG_SZ` called `EnableHexNumpad`, set its value to 1, and reboot. This method is not recommended because of reliability and compatibility issue, use WinCompose method below instead. -* UC_WINC: Windows Unicode input using WinCompose. Requires [WinCompose](https://github.com/samhocevar/wincompose). Works reliably under many (all?) variations of Windows. - ## Backlight Breathing In order to enable backlight breathing, the following line must be added to your config.h file. - #define BACKLIGHT_BREATHING +``` +#define BACKLIGHT_BREATHING +``` The following function calls are used to control the breathing effect. -* ```breathing_enable()``` - Enable the free-running breathing effect. -* ```breathing_disable()``` - Disable the free-running breathing effect immediately. -* ```breathing_self_disable()``` - Disable the free-running breathing effect after the current effect ends. -* ```breathing_toggle()``` - Toggle the free-running breathing effect. -* ```breathing_defaults()``` - Reset the speed and brightness settings of the breathing effect. +* `breathing_enable()` - Enable the free-running breathing effect. +* `breathing_disable()` - Disable the free-running breathing effect immediately. +* `breathing_self_disable()` - Disable the free-running breathing effect after the current effect ends. +* `breathing_toggle()` - Toggle the free-running breathing effect. +* `breathing_defaults()` - Reset the speed and brightness settings of the breathing effect. The following function calls are used to control the maximum brightness of the breathing effect. -* ```breathing_intensity_set(value)``` - Set the brightness of the breathing effect when it is at its max value. -* ```breathing_intensity_default()``` - Reset the brightness of the breathing effect to the default value based on the current backlight intensity. +* `breathing_intensity_set(value)` - Set the brightness of the breathing effect when it is at its max value. +* `breathing_intensity_default()` - Reset the brightness of the breathing effect to the default value based on the current backlight intensity. The following function calls are used to control the cycling speed of the breathing effect. -* ```breathing_speed_set(value)``` - Set the speed of the breathing effect - how fast it cycles. -* ```breathing_speed_inc(value)``` - Increase the speed of the breathing effect by a fixed value. -* ```breathing_speed_dec(value)``` - Decrease the speed of the breathing effect by a fixed value. -* ```breathing_speed_default()``` - Reset the speed of the breathing effect to the default value. +* `breathing_speed_set(value)` - Set the speed of the breathing effect - how fast it cycles. +* `breathing_speed_inc(value)` - Increase the speed of the breathing effect by a fixed value. +* `breathing_speed_dec(value)` - Decrease the speed of the breathing effect by a fixed value. +* `breathing_speed_default()` - Reset the speed of the breathing effect to the default value. The following example shows how to enable the backlight breathing effect when the FUNCTION layer macro button is pressed: - case MACRO_FUNCTION: - if (record->event.pressed) - { - breathing_speed_set(3); - breathing_enable(); - layer_on(LAYER_FUNCTION); - } - else - { - breathing_speed_set(1); - breathing_self_disable(); - layer_off(LAYER_FUNCTION); - } - break; +``` +case MACRO_FUNCTION: + if (record->event.pressed) + { + breathing_speed_set(3); + breathing_enable(); + layer_on(LAYER_FUNCTION); + } + else + { + breathing_speed_set(1); + breathing_self_disable(); + layer_off(LAYER_FUNCTION); + } + break; +``` The following example shows how to pulse the backlight on-off-on when the RAISED layer macro button is pressed: - case MACRO_RAISED: - if (record->event.pressed) - { - layer_on(LAYER_RAISED); - breathing_speed_set(2); - breathing_pulse(); - update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST); - } - else - { - layer_off(LAYER_RAISED); - update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST); - } - break; +``` +case MACRO_RAISED: + if (record->event.pressed) + { + layer_on(LAYER_RAISED); + breathing_speed_set(2); + breathing_pulse(); + update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST); + } + else + { + layer_off(LAYER_RAISED); + update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST); + } + break; +``` ## Other firmware shortcut keycodes -* `RESET` - puts the MCU in DFU mode for flashing new firmware (with `make dfu`) -* `DEBUG` - the firmware into debug mode - you'll need hid_listen to see things +* `RESET` - puts the MCU in DFU mode for flashing new firmware \(with `make dfu`\) +* `DEBUG` - the firmware into debug mode - you'll need hid\_listen to see things * `BL_ON` - turns the backlight on * `BL_OFF` - turns the backlight off -* `BL_` - sets the backlight to level *n* +* `BL_` - sets the backlight to level _n_ * `BL_INC` - increments the backlight level by one * `BL_DEC` - decrements the backlight level by one * `BL_TOGG` - toggles the backlight @@ -197,7 +169,7 @@ The conditional `if (record->event.pressed)` can tell if the key is being presse ## `void led_set_*(uint8_t usb_led)` -This gets called whenever there is a state change on your host LEDs (eg caps lock, scroll lock, etc). The LEDs are defined as: +This gets called whenever there is a state change on your host LEDs \(eg caps lock, scroll lock, etc\). The LEDs are defined as: ``` #define USB_LED_NUM_LOCK 0 @@ -209,464 +181,3 @@ This gets called whenever there is a state change on your host LEDs (eg caps loc and can be tested against the `usb_led` with a conditional like `if (usb_led & (1<` script to help get you started - you can simply pass your keyboard's name into the script, and all of the necessary files will be created. The components of each are described below. - -## `/keyboards//config.h` - -The `USB Device descriptor parameter` block contains parameters are used to uniquely identify your keyboard, but they don't really matter to the machine. - -Your `MATRIX_ROWS` and `MATRIX_COLS` are the numbers of rows and cols in your keyboard matrix - this may be different than the number of actual rows and columns on your keyboard. There are some tricks you can pull to increase the number of keys in a given matrix, but most keyboards are pretty straight-forward. - -The `MATRIX_ROW_PINS` and `MATRIX_COL_PINS` are the pins your MCU uses on each row/column. Your schematic (if you have one) will have this information on it, and the values will vary depending on your setup. This is one of the most important things to double-check in getting your keyboard setup correctly. - -For the `DIODE_DIRECTION`, most hand-wiring guides will instruct you to wire the diodes in the `COL2ROW` position, but it's possible that they are in the other - people coming from EasyAVR often use `ROW2COL`. Nothing will function if this is incorrect. - -`BACKLIGHT_PIN` is the pin that your PWM-controlled backlight (if one exists) is hooked-up to. Currently only B5, B6, and B7 are supported. - -`BACKLIGHT_BREATHING` is a fancier backlight feature that adds breathing/pulsing/fading effects to the backlight. It uses the same timer as the normal backlight. These breathing effects must be called by code in your keymap. - -`BACKLIGHT_LEVELS` is how many levels exist for your backlight - max is 15, and they are computed automatically from this number. - -## `/keyboards//Makefile` - -The values at the top likely won't need to be changed, since most boards use the `atmega32u4` chip. The `BOOTLOADER_SIZE` will need to be adjusted based on your MCU type. It's defaulted to the Teensy, since that's the most common controller. Below is quoted from the `Makefile`. - -``` -# Boot Section Size in *bytes* -# Teensy halfKay 512 -# Teensy++ halfKay 1024 -# Atmel DFU loader 4096 -# LUFA bootloader 4096 -# USBaspLoader 2048 -OPT_DEFS += -DBOOTLOADER_SIZE=512 -``` - -At the bottom of the file, you'll find lots of features to turn on and off - all of these options should be set with `?=` to allow for the keymap overrides. `?=` only assigns if the variable was previously undefined. For the full documenation of these features, see the [Makefile options](#makefile-options). - -## `/keyboards//readme.md` - -This is where you'll describe your keyboard - please write as much as you can about it! Talking about default functionality/features is useful here. Feel free to link to external pages/sites if necessary. Images can be included here as well. This file will be rendered into a webpage at qmk.fm/keyboards//. - -## `/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) - -## `/keyboards//.h` - -Here is where you can (optionally) define your `KEYMAP` function to remap your matrix into a more readable format. With ortholinear boards, this isn't always necessary, but it can help to accomodate the dead spots on your matrix, where there are keys that take up more than one space (2u, staggering, 6.25u, etc). The example shows the difference between the physical keys, and the matrix design: - -``` -#define KEYMAP( \ - k00, k01, k02, \ - k10, k11 \ -) \ -{ \ - { k00, k01, k02 }, \ - { k10, KC_NO, k11 }, \ -} -``` - -Each of the `kxx` variables needs to be unique, and usually follows the format `k`. You can place `KC_NO` where your dead keys are in your matrix. -