X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Home.md;h=41a934001471d5a95147a1c20e077e7a7b6e6afa;hb=cad54d531371c8a3955409a28f8b19ba2c8e317f;hp=6567e347cb8e18088489707a875b9c11d703c9dc;hpb=b7533e0abf1739196816519704c50528560b384c;p=qmk_firmware.git diff --git a/Home.md b/Home.md index 6567e347c..41a934001 100644 --- a/Home.md +++ b/Home.md @@ -1,157 +1,8 @@ -# Quantum Mechanical Keyboard Firmware - -[![Build Status](https://travis-ci.org/jackhumbert/qmk_firmware.svg?branch=master)](https://travis-ci.org/jackhumbert/qmk_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.com), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/). - -## Official website - -For an easy-to-read version of this document and the repository, check out [http://qmk.fm](http://qmk.fm). Nicely formatted keyboard and keymap listings are also available there, along with the ability to download .hex files instead of having to setup a build environment and compile them. - -## Included Keyboards - -* [Planck](/keyboards/planck/) -* [Preonic](/keyboards/preonic/) -* [Atomic](/keyboards/atomic/) -* [ErgoDox EZ](/keyboards/ergodox/) -* [Clueboard](/keyboards/clueboard/) -* [Cluepad](/keyboards/cluepad/) - -The project also includes community support for [lots of other keyboards](/keyboards/). - -## Maintainers - -QMK is developed and maintained by Jack Humbert of OLKB with contributions from the community, and of course, [Hasu](https://github.com/tmk). This repo used to be a fork of [TMK](https://github.com/tmk/tmk_keyboard), and we are incredibly grateful for his founding contributions to the firmware. We've had to break the fork due to purely technical reasons - it simply became too different over time, and we've had to start refactoring some of the basic bits and pieces. We are huge fans of TMK and Hasu :) - -This documentation is edited and maintained by Erez Zukerman of ErgoDox EZ. If you spot any typos or inaccuracies, please [open an issue](https://github.com/jackhumbert/qmk_firmware/issues/new). - -The OLKB product firmwares are maintained by [Jack Humbert](https://github.com/jackhumbert), the Ergodox EZ by [Erez Zukerman](https://github.com/ezuk), and the Clueboard by [Zach White](https://github.com/skullydazed). - -## Documentation roadmap - -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](keyboards/ergodox/ez/); for the Planck, it's [here](keyboards/planck/) and so on. -* The list of possible keycodes you can use in your keymap is actually spread out in a few different places: - * [doc/keycode.txt](doc/keycode.txt) - an explanation of those same keycodes. - * [quantum/keymap.h](quantum/keymap.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.h` is where they're actually defined. -* The [TMK documentation](doc/TMK_README.md). QMK is based on TMK, and this explains how it works internally. - # 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/jackhumbert/qmk_firmware/pulls) with your changes! - -## Build Environment Setup - -### Windows 10 - -It's still recommended to use the method for Vista and later below. The reason for this is that the Windows 10 Subsystem for Linux lacks [USB support](https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13355724-unable-to-access-usb-devices-from-bash), so it's not possible to flash the firmware to the keyboard. Please add your vote to the link! - -That said, it's still possible to use it for compilation. And recommended, if you need to compile much, since it's much faster than at least Cygwin (which is also supported, but currently lacking documentation). I haven't tried the method below, so I'm unable to tell. - -Here are the steps - -1. Install the Windows 10 subsystem for Linux, following [these instructions](http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/). -2. If you have previously cloned the repository using the normal Git bash, you will need to clean up the line endings. If you have cloned it after 20th of August 2016, you are likely fine. To clean up the line endings do the following - 1. Make sure that you have no changes you haven't committed by running `git status`, if you do commit them first - 2. From within the Git bash run `git rm --cached -r .` - 3. Followed by `git reset --hard` -3. Start the "Bash On Ubuntu On Windows" from the start menu -4. With the bash open, navigate to your Git checkout. The harddisk can be accessed from `/mnt` for example `/mnt/c` for the `c:\` drive. -5. Run `sudo util/install_dependencies.sh`. -6. After a while the installation will finish, and you are good to go - -**Note** From time to time, the dependencies might change, so just run `install_dependencies.sh` again if things are not working. - -**Warning:** 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) -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). -4. Install [MinGW](https://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download). During installation, uncheck the option to install a graphical user interface. **DO NOT change the default installation folder.** The scripts depend on the default location. -5. Clone this repository. [This link will download it as a zip file, which you'll need to extract.](https://github.com/jackhumbert/qmk_firmware/archive/master.zip) Open the extracted folder in Windows Explorer. -6. Open the `\util` folder. -7. Double-click on the `1-setup-path-win` batch script to run it. You'll need to accept a User Account Control prompt. Press the spacebar to dismiss the success message in the command prompt that pops up. -8. Right-click on the `2-setup-environment-win` batch script, select "Run as administrator", and accept the User Account Control prompt. This part may take a couple of minutes, and you'll need to approve a driver installation, but once it finishes, your environment is complete! - -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 -If you're using [homebrew,](http://brew.sh/) you can use the following commands: - - brew tap osx-cross/avr - brew install avr-libc - brew install dfu-programmer - -This is the recommended method. If you don't have homebrew, [install it!](http://brew.sh/) It's very much worth it for anyone who works in the command line. - -You can also try these instructions: - -1. Install Xcode from the App Store. -2. Install the Command Line Tools from `Xcode->Preferences->Downloads`. -3. Install [DFU-Programmer][dfu-prog]. - -If you are going to flash Infinity based keyboards you will also need dfu-util - - brew install dfu-util - -### 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. - -You can also install things manually, but this documentation might not be always up to date with all requirements. - -The current requirements are the following, but not all might be needed depending on what you do. Also note that some systems might not have all the dependencies available as packages, or they might be named differently. - -``` -build-essential -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 -git -``` - -Install the dependencies with your favorite package manager. - -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 - -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: +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! -```bash -# You'll run this every time you want to build a keymap -# modify the keymap and keyboard assigment to compile what you want -# defaults are ergodox/default - -docker run -e keymap=gwen -e keyboard=ergodox --rm -v $('pwd'):/qmk:rw edasque/qmk_firmware - -``` - -This will compile the targetted keyboard/keymap and leave it in your QMK directory for you to flash. - -### 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 file](doc/VAGRANT_GUIDE.md). - -## Verify Your Installation -1. If you haven't already, obtain this repository ([https://github.com/jackhumbert/qmk_firmware](https://github.com/jackhumbert/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`. -4. Once you're in the correct keyboard-specific folder, run the `make` command. This should output a lot of information about the build process. More information about the `make` command can be found below. +## [Build Environment Setup](wiki/Build-Environment-Setup) # Customizing your keymap @@ -238,6 +89,7 @@ You can also add extra options at the end of the make command line, after the ta * `make COLOR=false` - turns off color output * `make SILENT=true` - turns off output besides errors/warnings * `make VERBOSE=true` - outputs all of the gcc stuff (not interesting, unless you need to debug) +* `make EXTRAFLAGS=-E` - Preprocess the code without doing any compiling (useful if you are trying to debug #define commands) The make command itself also has some additional options, type `make --help` for more information. The most useful is probably `-jx`, which specifies that you want to compile using more than one CPU, the `x` represents the number of CPUs that you want to use. Setting that can greatly reduce the compile times, especially if you are compiling many keyboards/keymaps. I usually set it to one less than the number of CPUs that I have, so that I have some left for doing other things while it's compiling. Note that not all operating systems and make versions supports that option. @@ -264,12 +116,14 @@ For keyboards and subprojects, the make files are split in two parts `Makefile` ### Makefile options -Set the variables to `no` to disable them, and `yes` to enable them. +Set these variables to `no` to disable them, and `yes` to enable them. `BOOTMAGIC_ENABLE` This allows you to hold a key and the salt key (space by default) and have access to a various EEPROM settings that persist over power loss. It's advised you keep this disabled, as the settings are often changed by accident, and produce confusing results that makes it difficult to debug. It's one of the more common problems encountered in help sessions. +Consumes about 1000 bytes. + `MOUSEKEY_ENABLE` This gives you control over cursor movements and clicks via keycodes/custom functions. @@ -294,6 +148,8 @@ To see the text, open `hid_listen` and enjoy looking at your printed messages. **NOTE:** Do not include *uprint* messages in anything other than your keymap code. It must not be used within the QMK system framework. Otherwise, you will bloat other people's .hex files. +Consumes about 400 bytes. + `COMMAND_ENABLE` This enables magic commands, typically fired with the default magic key combo `LSHIFT+RSHIFT+KEY`. Magic commands include turning on debugging messages (`MAGIC+D`) or temporarily toggling NKRO (`MAGIC+N`). @@ -320,13 +176,39 @@ This enables MIDI sending and receiving with your keyboard. To enter MIDI send m This allows you to send unicode symbols via `UC()` in your keymap. Only codes up to 0x7FFF are currently supported. +`UNICODEMAP_ENABLE` + +This allows sending unicode symbols using `X()` in your keymap. Codes +up to 0xFFFFFFFF are supported, including emojis. You will need to maintain +a separate mapping table in your keymap file. + +Known limitations: +- Under Mac OS, only codes up to 0xFFFF are supported. +- Under Linux ibus, only codes up to 0xFFFFF are supported (but anything important is still under this limit for now). + +Characters out of range supported by the OS will be ignored. + `BLUETOOTH_ENABLE` This allows you to interface with a Bluefruit EZ-key to send keycodes wirelessly. It uses the D2 and D3 pins. `AUDIO_ENABLE` -This allows you output audio on the C6 pin (needs abstracting). See the [audio section](#driving-a-speaker---audio-support) for more information. +This allows you output audio on the C6 pin (needs abstracting). See the [audio section](#audio-output-from-a-speaker) for more information. + +`FAUXCLICKY_ENABLE` + +Uses buzzer to emulate clicky switches. A cheap imitation of the Cherry blue switches. By default, uses the C6 pin, same as AUDIO_ENABLE. + +`VARIABLE_TRACE` + +Use this to debug changes to variable values, see the [tracing variables](#tracing-variables) section for more information. + +`API_SYSEX_ENABLE` + +This enables using the Quantum SYSEX API to send strings (somewhere?) + +This consumes about 5390 bytes. ### Customizing Makefile options on a per-keymap basis @@ -356,13 +238,13 @@ You can then override any settings, rather than having to copy and paste the who # Going beyond the keycodes -Aside from the [basic keycodes](doc/keycode.txt), your keymap can include shortcuts to common operations. +Aside from the [basic keycodes](https://github.com/qmk/qmk_firmware/blob/master/doc/keycode.txt), your keymap can include shortcuts to common operations. ## Quick aliases to common actions 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](https://github.com/jackhumbert/qmk_firmware/blob/master/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/qmk/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. @@ -378,6 +260,7 @@ Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` - `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). + ### Fun with modifier keys * `LSFT(kc)` - applies left Shift to *kc* (keycode) - `S(kc)` is an alias @@ -396,10 +279,11 @@ 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. -The following shortcuts automatically add `LSFT()` to keycodes to get commonly used symbols. Their long names are also available and documented in `/quantum/keymap_common.h`. +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 ~ KC_EXLM ! + KC_QUES ? KC_AT @ KC_HASH # KC_DLR $ @@ -509,7 +393,7 @@ As you can see, you have three function. you can use - `SEQ_ONE_KEY` for single- ## 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/jackhumbert/qmk_firmware/pull/451). Here's how algernon describes the feature: +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. @@ -527,7 +411,7 @@ This array specifies what actions shall be taken when a tap-dance key is in acti * `ACTION_TAP_DANCE_DOUBLE(kc1, kc2)`: Sends the `kc1` keycode when tapped once, `kc2` otherwise. When the key is held, the appropriate keycode is registered: `kc1` when pressed and held, `kc2` when tapped once, then pressed and held. * `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action. -* `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function on when the dance action finishes (like the previous option), and the last function when the tap dance action resets. +* `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function on when the dance action finishes (like the previous option), and the last function when the tap dance action resets. The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise. @@ -824,7 +708,7 @@ And then, to assign this macro to a key on your keyboard layout, you just use `M ## Dynamic macros: record and replay macros in runtime -In addition to the static macros described above, you may enable the dynamic macros which you may record while writing. They are forgotten as soon as the keyboard is unplugged. Only two such macros may be stored at the same time, with the total length of 128 keypresses. +In addition to the static macros described above, you may enable the dynamic macros which you may record while writing. They are forgotten as soon as the keyboard is unplugged. Only two such macros may be stored at the same time, with the total length of 64 keypresses (by default). To enable them, first add a new element to the `planck_keycodes` enum -- `DYNAMIC_MACRO_RANGE`: @@ -865,7 +749,7 @@ Add the following code to the very beginning of your `process_record_user()` fun To start recording the macro, press either `DYN_REC_START1` or `DYN_REC_START2`. To finish the recording, press the `_DYN` layer button. The handler awaits specifically for the `MO(_DYN)` keycode as the "stop signal" so please don't use any fancy ways to access this layer, use the regular `MO()` modifier. To replay the macro, press either `DYN_MACRO_PLAY1` or `DYN_MACRO_PLAY2`. -If the LED-s start blinking during the recording with each keypress, it means there is no more space for the macro in the macro buffer. To fit the macro in, either make the other macro shorter (they share the same buffer) or increase the buffer size by setting the `DYNAMIC_MACRO_SIZE` preprocessor macro (default value: 256; please read the comments for it in the header). +If the LED-s start blinking during the recording with each keypress, it means there is no more space for the macro in the macro buffer. To fit the macro in, either make the other macro shorter (they share the same buffer) or increase the buffer size by setting the `DYNAMIC_MACRO_SIZE` preprocessor macro (default value: 128; please read the comments for it in the header). For the details about the internals of the dynamic macros, please read the comments in the `dynamic_macro.h` header. @@ -873,7 +757,7 @@ For the details about the internals of the dynamic macros, please read the comme 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: @@ -890,7 +774,33 @@ In `quantum/keymap_extras/`, you'll see various language files - these work the ## Unicode support -You can currently send 4 hex digits with your OS-specific modifier key (RALT for OSX with the "Unicode Hex Input" layout) - this is currently limited to supporting one OS at a time, and requires a recompile for switching. 8 digit hex codes are being worked on. The keycode function is `UC(n)`, where *n* is a 4 digit hexidecimal. Enable from the Makefile. +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 @@ -1013,7 +923,7 @@ This gets called whenever there is a state change on your host LEDs (eg caps loc #define USB_LED_KANA 4 ``` -and can be tested against the `usb_led` with a conditional like `if (usb_led & (1<