diff --git a/.vscode/settings.json b/.vscode/settings.json index 3b91e707e..ba5b56aa4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,4 +14,4 @@ "*.hpp": "cpp", "xstddef": "c" } -} \ No newline at end of file +} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 9a4d98b9c..d5d8b01de 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,10 +1,10 @@ # Code Of Conduct -QMK strives to be an inclusive and tolerant community. We welcome participation from anyone regardless of age, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, political belief, race, religion, or sexual identity and orientation. +QMK strives to be an inclusive, tolerant, and welcoming community. We encourage participation from anyone regardless of age, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, political belief, race, religion, or sexual identity and orientation. -> “A gentle word turns away wrath, but a harsh word stirs up anger.” +> “A gentle word turns away wrath, but a harsh word stirs up anger." -Our users, contributors, and collaborators are expected to treat each other with respect, to assume good intentions, and to gently correct, where possible, rather than react with escalation. Some examples of behavior we will not tolerate include, but is not limited to: +Our users, contributors, and collaborators are expected to treat each other with kindness and respect, to assume good intentions, and to gently correct, where possible, rather than react with escalation. While our goal is to be as accurate as possible, kindness and understanding are more valuable than correctness. Some examples of behavior we will not tolerate include, but is not limited to: * The use of sexualized language or imagery * Unwelcome advances, sexual or otherwise diff --git a/Makefile b/Makefile index 9ef82bbd3..0dd77d403 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ $(eval $(call NEXT_PATH_ELEMENT)) # It's really a very simple if else chain, if you squint enough, # but the makefile syntax makes it very verbose. # If we are in a subfolder of keyboards -# +# # *** No longer needed ** # # ifeq ($(CURRENT_PATH_ELEMENT),keyboards) @@ -307,11 +307,6 @@ define PARSE_KEYBOARD KEYBOARD_FOLDER_PATH_3 := $$(patsubst %/,%,$$(dir $$(KEYBOARD_FOLDER_PATH_2))) KEYBOARD_FOLDER_PATH_4 := $$(patsubst %/,%,$$(dir $$(KEYBOARD_FOLDER_PATH_3))) KEYBOARD_FOLDER_PATH_5 := $$(patsubst %/,%,$$(dir $$(KEYBOARD_FOLDER_PATH_4))) - KEYBOARD_FOLDER_1 := $$(notdir $$(KEYBOARD_FOLDER_PATH_1)) - KEYBOARD_FOLDER_2 := $$(notdir $$(KEYBOARD_FOLDER_PATH_2)) - KEYBOARD_FOLDER_3 := $$(notdir $$(KEYBOARD_FOLDER_PATH_3)) - KEYBOARD_FOLDER_4 := $$(notdir $$(KEYBOARD_FOLDER_PATH_4)) - KEYBOARD_FOLDER_5 := $$(notdir $$(KEYBOARD_FOLDER_PATH_5)) KEYMAPS := # get a list of all keymaps @@ -325,35 +320,35 @@ define PARSE_KEYBOARD $$(KEYBOARD_FOLDER_3) $$(KEYBOARD_FOLDER_4) $$(KEYBOARD_FOLDER_5), $$(KEYMAPS))) KEYBOARD_LAYOUTS := - ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_5)/rules.mk)","") + ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_5)/rules.mk)","") LAYOUTS := - $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_5)/rules.mk) + $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_5)/rules.mk) KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS)) endif - ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_4)/rules.mk)","") + ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_4)/rules.mk)","") LAYOUTS := - $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_4)/rules.mk) + $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_4)/rules.mk) KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS)) endif - ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_3)/rules.mk)","") + ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_3)/rules.mk)","") LAYOUTS := - $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_3)/rules.mk) + $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_3)/rules.mk) KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS)) endif - ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_2)/rules.mk)","") + ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_2)/rules.mk)","") LAYOUTS := - $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_2)/rules.mk) + $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_2)/rules.mk) KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS)) endif - ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_1)/rules.mk)","") + ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_1)/rules.mk)","") LAYOUTS := - $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_1)/rules.mk) + $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_1)/rules.mk) KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS)) endif LAYOUT_KEYMAPS := $$(foreach LAYOUT,$$(KEYBOARD_LAYOUTS),$$(eval LAYOUT_KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/layouts/*/$$(LAYOUT)/*/.))))) - + KEYMAPS := $$(sort $$(KEYMAPS) $$(LAYOUT_KEYMAPS)) # if the rule after removing the start of it is empty (we haven't specified a kemap or target) diff --git a/Vagrantfile b/Vagrantfile index 389b688ae..08de5f7f5 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -2,27 +2,8 @@ # vi: set ft=ruby : Vagrant.configure(2) do |config| - # You can only have one config.vm.box uncommented at a time - - # Comment this and uncomment another if you don't want to use the minimal Arch box - #config.vm.box = "dragon788/arch-ala-elasticdog" - # VMware/Virtualbox 64 bit config.vm.box = "phusion/ubuntu-14.04-amd64" - # - # VMware/Virtualbox 64 bit - #config.vm.box = "puphpet/centos65-x64" - # - # The opensuse boxes don't have dfu-util in their default repositories - # - # The virtualbox version has tools issues - # VMware/Virtualbox 64 bit - #config.vm.box = "bento/opensuse-13.2-x86_64" - # - # Virtualbox only - #config.vm.box = "bento/opensuse-13.2-i386" - # config.vm.box = "" - # config.vm.box = "" # This section allows you to customize the Virtualbox VM # settings, ie showing the GUI or upping the memory @@ -81,18 +62,16 @@ Vagrant.configure(2) do |config| config.vm.provision "shell", run: "always", path: "./util/install_dependencies.sh", args: "-update" config.vm.post_up_message = <<-EOT - Log into the VM using 'vagrant ssh' on OSX or from Git Bash (Win) - or 'vagrant ssh-config' and Putty or Bitvise SSH or another SSH tool - Change directory (cd) to the keyboard you wish to program - (Optionally) modify your layout, - then run 'make clean' - and then 'make' to compile the .eep and .hex files. - - Or you can copy and paste the example line below. - - cd /vagrant; cd keyboards; cd ergodox; make clean; make + Log into the VM using 'vagrant ssh'. QMK directory synchronized with host is + located at /vagrant + To compile the .hex files use make command inside this directory. + QMK's make format recently changed to use folder locations and colons: + make project_folder:keymap[:target] + Examples: + make planck/rev4:default:dfu + make planck:default EOT end diff --git a/build_keyboard.mk b/build_keyboard.mk index 4781f4a5d..b25712385 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -210,8 +210,8 @@ endif USER_PATH := users/$(USER_NAME) -include $(USER_PATH)/rules.mk -ifneq ("$(wildcard users/$(KEYMAP)/config.h)","") - CONFIG_H += users/$(KEYMAP)/config.h +ifneq ("$(wildcard $(USER_PATH)/config.h)","") + CONFIG_H += $(USER_PATH)/config.h endif diff --git a/common.mk b/common.mk index 5b49680ea..272d170e6 100644 --- a/common.mk +++ b/common.mk @@ -3,16 +3,16 @@ include message.mk # Directory common source files exist TOP_DIR = . TMK_DIR = tmk_core -TMK_PATH = $(TOP_DIR)/$(TMK_DIR) -LIB_PATH = $(TOP_DIR)/lib +TMK_PATH = $(TMK_DIR) +LIB_PATH = lib QUANTUM_DIR = quantum -QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR) +QUANTUM_PATH = $(QUANTUM_DIR) DRIVER_DIR = drivers -DRIVER_PATH = $(TOP_DIR)/$(DRIVER_DIR) +DRIVER_PATH = $(DRIVER_DIR) -BUILD_DIR := $(TOP_DIR)/.build +BUILD_DIR := .build COMMON_VPATH := $(TOP_DIR) COMMON_VPATH += $(TMK_PATH) @@ -21,4 +21,5 @@ COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras COMMON_VPATH += $(QUANTUM_PATH)/audio COMMON_VPATH += $(QUANTUM_PATH)/process_keycode COMMON_VPATH += $(QUANTUM_PATH)/api -COMMON_VPATH += $(DRIVER_PATH) \ No newline at end of file +COMMON_VPATH += $(QUANTUM_PATH)/split_common +COMMON_VPATH += $(DRIVER_PATH) diff --git a/common_features.mk b/common_features.mk index 7ba7d4815..b78f04d2a 100644 --- a/common_features.mk +++ b/common_features.mk @@ -117,7 +117,7 @@ endif ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) OPT_DEFS += -DRGB_MATRIX_ENABLE SRC += is31fl3731.c - SRC += TWIlib.c + SRC += i2c_master.c SRC += $(QUANTUM_DIR)/color.c SRC += $(QUANTUM_DIR)/rgb_matrix.c CIE1931_CURVE = yes @@ -197,6 +197,12 @@ ifeq ($(strip $(USB_HID_ENABLE)), yes) include $(TMK_DIR)/protocol/usb_hid.mk endif + +ifeq ($(strip $(HD44780_ENABLE)), yes) + SRC += drivers/avr/hd44780.c + OPT_DEFS += -DHD44780_ENABLE +endif + QUANTUM_SRC:= \ $(QUANTUM_DIR)/quantum.c \ $(QUANTUM_DIR)/keymap_common.c \ @@ -204,5 +210,17 @@ QUANTUM_SRC:= \ $(QUANTUM_DIR)/process_keycode/process_leader.c ifndef CUSTOM_MATRIX - QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c + ifeq ($(strip $(SPLIT_KEYBOARD)), yes) + QUANTUM_SRC += $(QUANTUM_DIR)/split_common/matrix.c + else + QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c + endif +endif + +ifeq ($(strip $(SPLIT_KEYBOARD)), yes) + OPT_DEFS += -DSPLIT_KEYBOARD + QUANTUM_SRC += $(QUANTUM_DIR)/split_common/split_flags.c \ + $(QUANTUM_DIR)/split_common/split_util.c \ + $(QUANTUM_DIR)/split_common/i2c.c \ + $(QUANTUM_DIR)/split_common/serial.c endif diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 000000000..e089843e0 --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +docs.qmk.fm \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index a4db81eb6..22ab243cd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -19,7 +19,7 @@ Otherwise, you can either download it directly ([zip](https://github.com/qmk/qmk ## How to Compile -Before you are able to compile, you'll need to [install an environment](01_Getting_Started/01_Install_Build_Tools.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: +Before you are able to compile, you'll need to [install an environment](getting_started_build_tools.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: make planck/rev4:default @@ -29,4 +29,4 @@ This would build the `rev4` revision of the `planck` with the `default` keymap. ## How to Customize -QMK has lots of [features](05_Features/index.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](07_Reference/Keymap_Overview.md), and changing the [keycodes](06_Keycodes/index.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/_sidebar.md b/docs/_sidebar.md index 00aeb8057..6c56bb2e5 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -43,8 +43,9 @@ * [Pointing Device](feature_pointing_device.md) * [PS/2 Mouse](feature_ps2_mouse.md) * [RGB Lighting](feature_rgblight.md) - * [Space Cadet Shift](feature_space_cadet.md) - * [Space Cadet Shift Enter](feature_space_shift_cadet.md) + * [RGB Matrix](feature_rgb_matrix.md) + * [Space Cadet Shift](feature_space_cadet_shift.md) + * [Space Cadet Shift Enter](feature_space_cadet_shift_enter.md) * [Stenography](feature_stenography.md) * [Swap Hands](feature_swap_hands.md) * [Tap Dance](feature_tap_dance.md) @@ -54,18 +55,22 @@ * [Userspace](feature_userspace.md) * [Keycodes](keycodes.md) - * [Backlight](feature_backlight.md#backlight-keycodes) * [Basic](keycodes_basic.md) + * [Quantum](quantum_keycodes.md) + * [Audio](feature_audio.md#audio-keycodes) + * [Backlight](feature_backlight.md#backlight-keycodes) * [Bluetooth](feature_bluetooth.md#bluetooth-keycodes) * [Bootmagic](feature_bootmagic.md#bootmagic-keycodes) * [Layer Switching](feature_advanced_keycodes.md#switching-and-toggling-layers) * [Mod+Key](feature_advanced_keycodes.md#modifier-keys) * [Mod Tap](feature_advanced_keycodes.md#mod-tap) + * [Mouse Keys](feature_mouse_keys.md#mapping-mouse-actions-to-keyboard-keys) * [One Shot Keys](feature_advanced_keycodes.md#one-shot-keys) - * [Quantum](quantum_keycodes.md) * [RGB Light](feature_rgblight.md#rgblight-keycodes) + * [RGB Matrix](feature_rgb_matrix.md#keycodes) * [Shifted Keys](feature_advanced_keycodes.md#shifted-keycodes) * [Stenography](feature_stenography.md#keycode-reference) + * [Swap Hands](feature_swap_hands.md#swap-keycodes) * [Thermal Printer](feature_thermal_printer.md#thermal-printer-keycodes) * [US ANSI Shifted Keys](keycodes_us_ansi_shifted.md) diff --git a/docs/_summary.md b/docs/_summary.md index 318c526a8..6c56bb2e5 100644 --- a/docs/_summary.md +++ b/docs/_summary.md @@ -43,7 +43,9 @@ * [Pointing Device](feature_pointing_device.md) * [PS/2 Mouse](feature_ps2_mouse.md) * [RGB Lighting](feature_rgblight.md) - * [Space Cadet](feature_space_cadet.md) + * [RGB Matrix](feature_rgb_matrix.md) + * [Space Cadet Shift](feature_space_cadet_shift.md) + * [Space Cadet Shift Enter](feature_space_cadet_shift_enter.md) * [Stenography](feature_stenography.md) * [Swap Hands](feature_swap_hands.md) * [Tap Dance](feature_tap_dance.md) @@ -53,18 +55,22 @@ * [Userspace](feature_userspace.md) * [Keycodes](keycodes.md) - * [Backlight](feature_backlight.md#backlight-keycodes) * [Basic](keycodes_basic.md) + * [Quantum](quantum_keycodes.md) + * [Audio](feature_audio.md#audio-keycodes) + * [Backlight](feature_backlight.md#backlight-keycodes) * [Bluetooth](feature_bluetooth.md#bluetooth-keycodes) * [Bootmagic](feature_bootmagic.md#bootmagic-keycodes) * [Layer Switching](feature_advanced_keycodes.md#switching-and-toggling-layers) * [Mod+Key](feature_advanced_keycodes.md#modifier-keys) * [Mod Tap](feature_advanced_keycodes.md#mod-tap) + * [Mouse Keys](feature_mouse_keys.md#mapping-mouse-actions-to-keyboard-keys) * [One Shot Keys](feature_advanced_keycodes.md#one-shot-keys) - * [Quantum](quantum_keycodes.md) * [RGB Light](feature_rgblight.md#rgblight-keycodes) + * [RGB Matrix](feature_rgb_matrix.md#keycodes) * [Shifted Keys](feature_advanced_keycodes.md#shifted-keycodes) * [Stenography](feature_stenography.md#keycode-reference) + * [Swap Hands](feature_swap_hands.md#swap-keycodes) * [Thermal Printer](feature_thermal_printer.md#thermal-printer-keycodes) * [US ANSI Shifted Keys](keycodes_us_ansi_shifted.md) diff --git a/docs/config_options.md b/docs/config_options.md index 8cdcc97e4..afc29fae9 100644 --- a/docs/config_options.md +++ b/docs/config_options.md @@ -91,6 +91,8 @@ This is a C header file that is one of the first things included, and will persi * key combination that allows the use of magic commands (useful for debugging) * `#define USB_MAX_POWER_CONSUMPTION` * sets the maximum power (in mA) over USB for the device (default: 500) +* `#define SCL_CLOCK 100000L` + * sets the SCL_CLOCK speed for split keyboards. The default is `100000L` but some boards can be set to `400000L`. ## Features That Can Be Disabled @@ -123,21 +125,27 @@ If you define these options you will enable the associated feature, which may in ## Behaviors That Can Be Configured * `#define TAPPING_TERM 200` - * how long before a tap becomes a hold + * how long before a tap becomes a hold, if set above 500, a key tapped during the tapping term will turn it into a hold too * `#define RETRO_TAPPING` * tap anyway, even after TAPPING_TERM, if there was no other key interruption between press and release + * See [Retro Tapping](feature_advanced_keycodes.md#retro-tapping) for details * `#define TAPPING_TOGGLE 2` * how many taps before triggering the toggle * `#define PERMISSIVE_HOLD` * makes tap and hold keys work better for fast typers who don't want tapping term set above 500 + * See [Permissive Hold](feature_advanced_keycodes.md#permissive-hold) for details +* `#define IGNORE_MOD_TAP_INTERRUPT` + * makes it possible to do rolling combos (zx) with keys that convert to other keys on hold + * See [Mod tap interrupt](feature_advanced_keycodes.md#mod-tap-interrupt) for details +* `#define TAPPING_FORCE_HOLD` + * makes it possible to use a dual role key as modifier shortly after having been tapped + * See [Hold after tap](feature_advanced_keycodes.md#hold-after-tap) * `#define LEADER_TIMEOUT 300` * how long before the leader key times out * `#define ONESHOT_TIMEOUT 300` * how long before oneshot times out * `#define ONESHOT_TAP_TOGGLE 2` * how many taps before oneshot toggle is triggered -* `#define IGNORE_MOD_TAP_INTERRUPT` - * makes it possible to do rolling combos (zx) with keys that convert to other keys on hold * `#define QMK_KEYS_PER_SCAN 4` * Allows sending more than one key per scan. By default, only one key event gets sent via `process_record()` per scan. This has little impact on most typing, but @@ -173,6 +181,16 @@ If you define these options you will enable the associated feature, which may in * `#define MOUSEKEY_MAX_SPEED 7` * `#define MOUSEKEY_WHEEL_DELAY 0` +## Split Keyboard Options + +Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk + +* `#define SPLIT_HAND_PIN B7` + * For using high/low pin to determine handedness, low = right hand, high = left hand. Replace 'B7' with the pin you are using. This is optional and you can still use the EEHANDS method or MASTER_LEFT / MASTER_RIGHT defines like the stock Let's Split uses. + +* `#define USE_I2C` + * For using I2C instead of Serial (defaults to serial) + # The `rules.mk` File This is a [make](https://www.gnu.org/software/make/manual/make.html) file that is included by the top-level `Makefile`. It is used to set some information about the MCU that we will be compiling for as well as enabling and disabling certain features. @@ -226,3 +244,5 @@ Use these to enable or disable building certain features. The more you have enab * Unicode * `BLUETOOTH_ENABLE` * Enable Bluetooth with the Adafruit EZ-Key HID +* `SPLIT_KEYBOARD` + * Enables split keyboard support (dual MCU like the let's split and bakingpy's boards) and includes all necessary files located at quantum/split_common diff --git a/docs/contributing.md b/docs/contributing.md index 0e8066f00..8242cc1ad 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -11,7 +11,7 @@ Third-party contributions help us grow and improve QMK. We want to make the pull ## I Don't Want to Read This Whole Thing! I Just Have a Question! -If you'd like to ask questions about QMK you can do so on the [OLKB Subreddit](https://reddit.com/r/olkb) or on [Gitter](https://gitter.im/qmk/qmk_firmware). +If you'd like to ask questions about QMK you can do so on the [OLKB Subreddit](https://reddit.com/r/olkb) or on [Discord](https://discord.gg/Uq7gcHh). Please keep these things in mind: @@ -29,7 +29,7 @@ QMK is largely written in C, with specific features and parts written in C++. It # Where Can I Go for Help? -If you need help you can [open an issue](https://github.com/qmk/qmk_firmware/issues) or [chat on gitter](http://gitter.im/QMK/qmk_firmware). +If you need help you can [open an issue](https://github.com/qmk/qmk_firmware/issues) or [chat on Discord](https://discord.gg/Uq7gcHh). # How Do I Make a Contribution? @@ -101,7 +101,7 @@ You'll find all our documentation in the `qmk_firmware/docs` directory, or if yo Most first-time QMK contributors start with their personal keymaps. We try to keep keymap standards pretty casual (keymaps, after all, reflect the personality of their creators) but we do ask that you follow these guidelines to make it easier for others to discover and learn from your keymap. -* Write a `readme.md` using [the template](https://docs.qmk.fm/documentation_templates.html#). +* Write a `readme.md` using [the template](documentation_templates.md). * All Keymap PR's are squashed, so if you care about how your commits are squashed you should do it yourself * Do not lump features in with keymap PR's. Submit the feature first and then a second PR for the keymap. * Do not include `Makefile`s in your keymap folder (they're no longer used) @@ -113,7 +113,7 @@ Keyboards are the raison d'être for QMK. Some keyboards are community maintaine We also ask that you follow these guidelines: -* Write a `readme.md` using [the template](https://docs.qmk.fm/documentation_templates.html#). +* Write a `readme.md` using [the template](documentation_templates.md). * Keep the number of commits reasonable or we will squash your PR * Do not lump core features in with new keyboards. Submit the feature first and then submit a separate PR for the keyboard. * Name `.c`/`.h` file after the immediate parent folder, eg `/keyboards///.[ch]` @@ -124,7 +124,7 @@ We also ask that you follow these guidelines: 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 [Understanding QMK](understanding_qmk.md), 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) +* [Chat on Discord](https://discord.gg/Uq7gcHh) * [Open an Issue](https://github.com/qmk/qmk_firmware/issues/new) Feature and Bug Fix PR's affect all keyboards. We are also in the process of restructuring QMK. For this reason it is especially important for significant changes to be discussed before implementation has happened. If you open a PR without talking to us first please be prepared to do some significant rework if your choices do not mesh well with our planned direction. @@ -140,7 +140,7 @@ We also ask that you follow these guidelines: * Keep the number of commits reasonable or we will squash your PR * Do not lump keyboards or keymaps in with core changes. Submit your core changes first. -* Write [Unit Tests](http://docs.qmk.fm/unit_testing.html) for your feature +* Write [Unit Tests](unit_testing.md) for your feature * Follow the style of the file you are editing. If the style is unclear or there are mixed styles you should conform to the [coding conventions](#coding-conventions) above. ## Refactoring diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md index 6d741b6cb..10c5c75a2 100644 --- a/docs/custom_quantum_functions.md +++ b/docs/custom_quantum_functions.md @@ -135,9 +135,11 @@ void led_set_user(uint8_t usb_led) { * Keyboard/Revision: `void led_set_kb(uint8_t usb_led)` * Keymap: `void led_set_user(uint8_t usb_led)` + # Matrix Initialization Code -Before a keyboard can be used the hardware must be initialized. QMK handles initialization of the keyboard matrix itself, but if you have other hardware like LED's or i²c controllers you will need to set up that hardware before it can be used. +Before a keyboard can be used the hardware must be initialized. QMK handles initialization of the keyboard matrix itself, but if you have other hardware like LED's or i²c controllers you will need to set up that hardware before it can be used. + ### Example `matrix_init_user()` Implementation @@ -165,7 +167,7 @@ Whenever possible you should customize your keyboard by using `process_record_*( ### Example `matrix_scan_*` Implementation -This example has been deliberately omitted. You should understand enough about QMK internals to write this without an example before hooking into such a performance sensitive area. If you need help please [open an issue](https://github.com/qmk/qmk_firmware/issues/new) or [chat with us on gitter](https://gitter.im/qmk/qmk_firmware). +This example has been deliberately omitted. You should understand enough about QMK internals to write this without an example before hooking into such a performance sensitive area. If you need help please [open an issue](https://github.com/qmk/qmk_firmware/issues/new) or [chat with us on Discord](https://discord.gg/Uq7gcHh). ### `matrix_scan_*` Function Documentation @@ -177,9 +179,38 @@ This function gets called at every matrix scan, which is basically as often as t You should use this function if you need custom matrix scanning code. It can also be used for custom status output (such as LED's or a display) or other functionality that you want to trigger regularly even when the user isn't typing. +# Keyboard Idling/Wake Code + +If the board supports it, it can be "idled", by stopping a number of functions. A good example of this is RGB lights or backlights. This can save on power consumption, or may be better behavior for your keyboard. + +This is controlled by two functions: `suspend_power_down_*` and `suspend_wakeup_init_*`, which are called when the system is board is idled and when it wakes up, respectively. + + +### Example suspend_power_down_user() and suspend_wakeup_init_user() Implementation + +This example, at the keyboard level, sets up B1, B2, and B3 as LED pins. + +``` +void suspend_power_down_user(void) +{ + rgb_matrix_set_suspend_state(true); +} + +void suspend_wakeup_init_user(void) +{ + rgb_matrix_set_suspend_state(false); +} + +``` + +### `keyboard_init_*` Function Documentation + +* Keyboard/Revision: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)` +* Keymap: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)` + # Layer Change Code -Thir runs code every time that the layers get changed. This can be useful for layer indication, or custom layer handling. +This runs code every time that the layers get changed. This can be useful for layer indication, or custom layer handling. ### Example `layer_state_set_*` Implementation diff --git a/docs/faq_build.md b/docs/faq_build.md index 2d1b91b60..7d17df074 100644 --- a/docs/faq_build.md +++ b/docs/faq_build.md @@ -104,3 +104,17 @@ brew install dfu-programmer brew install gcc-arm-none-eabi brew install avrdude ``` + +### avr-gcc 8.1 and LUFA + +If you updated your avr-gcc to above 7 you may see errors involving LUFA. For example: + +`lib/lufa/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h:380:5: error: 'const' attribute on function returning 'void'` + +For now, you need to rollback avr-gcc to 7 in brew. + +``` +brew uninstall --force avr-gcc +brew install avr-gcc@7 +brew link avr-gcc@7 +``` diff --git a/docs/faq_keymap.md b/docs/faq_keymap.md index 674d207aa..447b89226 100644 --- a/docs/faq_keymap.md +++ b/docs/faq_keymap.md @@ -87,14 +87,14 @@ On **Xorg** you can use `compose` key, instead. And see this for **Unicode** input. * http://en.wikipedia.org/wiki/Unicode_input +## `Fn` Key on macOS -## Apple/Mac Keyboard `Fn` -Not supported. +Unlike most Fn keys, the one on Apple keyboards actually has its own keycode... sort of. It takes the place of the sixth keycode in a basic 6KRO HID report -- so an Apple keyboard is in fact only 5KRO. -Apple/Mac keyboard sends keycode for Fn unlike most of other keyboards. -I think you can send Apple Fn key using Apple venter specific Page 0xff01 and usage 0x0003. But you have to change HID Report Descriptor for this, of course. +It is technically possible to get QMK to send this key. However, doing so requires modification of the report format to add the state of the Fn key. +Even worse, it is not recognized unless the keyboard's VID and PID match that of a real Apple keyboard. The legal issues that official QMK support for this feature may create mean it is unlikely to happen. -https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-606.1.7/IOHIDFamily/AppleHIDUsageTables.h +See [this issue](https://github.com/qmk/qmk_firmware/issues/2179) for detailed information. ## Media Control Keys in Mac OSX diff --git a/docs/feature_advanced_keycodes.md b/docs/feature_advanced_keycodes.md index aeb7ce1bf..493a99fd7 100644 --- a/docs/feature_advanced_keycodes.md +++ b/docs/feature_advanced_keycodes.md @@ -133,7 +133,7 @@ We've added shortcuts to make common modifier/tap (mod-tap) mappings more compac ?> Due to the way that keycodes are structured, any modifiers specified as part of `kc`, such as `LCTL()` or `KC_LPRN`, will only activate when held instead of tapped. -?> Additionally, if there is at least one right modifier, any other modifiers will turn into their right equivalents, so it is not possible to "mix and match" the two. +?> Additionally, if there is at least one right-handed modifier, any other modifiers in a chain of functions will turn into their right-handed equivalents, so it is not possible to "mix and match" the two. # One Shot Keys @@ -175,3 +175,37 @@ Example: (Tapping Term = 200ms) - SHFT_T(KC_A) Up With defaults, if above is typed within tapping term, this will emit `ax`. With permissive hold, if above is typed within tapping term, this will emit `X` (so, Shift+X). + +# Mod tap interrupt + +When a dual role key used for a modifier is quickly followed by another keys, it is interpreted as held even before the tapping term elapsed. This is a problem if a key is used for example inside a rolling combo because the second key will be pressed before the first key is released. + +For example, when trying to type the rolling combo "zx" and z being configured to send Ctrl when hold, z rapidly followed by x actually sends Ctrl-x. That's bad. + +You can disable this behavior by defining `IGNORE_MOD_TAP_INTERRUPT` in `config.h`. + +Note that this only concerns modifiers and not layer switching keys. + +# Hold after tap + +When the user holds a key after tap, this repeats the tapped key rather to hold a modifier key. This allows to use auto repeat for the tapped key. If you prefer to hold a modifier instead, define `TAPPING_FORCE_HOLD` in `config.h`. + +Example: + +- SHFT_T(KC_A) Down +- SHFT_T(KC_A) Up +- SHFT_T(KC_A) Down +- wait more than tapping term... +- SHFT_T(KC_A) Up + +With default settings, `a` will be sent on the first release, then `a` will be sent on the second press allowing the computer to trigger its auto repeat function. + +With `TAPPING_FORCE_HOLD`, the second press will be interpreted as a Shift, allowing to use it as a modifier shortly after having used it as a tap. + +!> `TAPPING_FORCE_HOLD` will break anything that uses tapping toggles (Such as the `TT` layer keycode, and the One Shot Tapping Toggle). + +# Retro Tapping + +When you hold a dual function key, and haven't pressed anything when you release the key, normally nothing happens. However, if you enable this, if you release the key without pressing another key, it will send the original key, even if it is outside of the tapping term. + +For instance, if you're using `LT(2, KC_SPACE)`, if you hold the key, don't hit anything else and then release it, normally, nothing happens. But with `RETRO_TAPPING` defined in your `config.h`, it will send `KC_SPACE`. diff --git a/docs/feature_audio.md b/docs/feature_audio.md index 50e389605..039c62cdf 100644 --- a/docs/feature_audio.md +++ b/docs/feature_audio.md @@ -3,6 +3,7 @@ Your keyboard can make sounds! If you've got a Planck, Preonic, or basically any AVR keyboard that allows access to certain PWM-capable pins, 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. Up to two simultaneous audio voices are supported, one driven by timer 1 and another driven by timer 3. The following pins can be defined as audio outputs in config.h: + Timer 1: `#define B5_AUDIO` `#define B6_AUDIO` @@ -58,6 +59,13 @@ 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. +The available keycodes for audio are: + +* `AU_ON` - Turn audio mode on +* `AU_OFF` - Turn audio mode off +* `AU_TOG` - Toggle audio mode + + ## 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. @@ -145,6 +153,23 @@ You can configure the default, min and max frequencies, the stepping and built i This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile. + +## Audio Keycodes + +|Key |Aliases |Description | +|----------------|---------|----------------------------------| +|`AU_ON` | |Audio mode on | +|`AU_OFF` | |Audio mode off | +|`AU_TOG` | |Toggles Audio mode | +|`CLICKY_TOGGLE` |`CK_TOGG`|Toggles Audio clicky mode | +|`CLICKY_UP` |`CK_UP` |Increases frequency of the clicks | +|`CLICKY_DOWN` |`CK_DOWN`|Decreases frequency of the clicks | +|`CLICKY_RESET` |`CK_RST` |Resets frequency to default | +|`MU_ON` | |Turns on Music Mode | +|`MU_OFF` | |Turns off Music Mode | +|`MU_TOG` | |Toggles Music Mode | +|`MU_MOD` | |Cycles through the music modes | + +Many keyboards support backlit keys by way of individual LEDs placed through or underneath the keyswitches. QMK is able to control the brightness of these LEDs by switching them on and off rapidly in a certain ratio, a technique known as *Pulse Width Modulation*, or PWM. By altering the duty cycle of the PWM signal, it creates the illusion of dimming. -## Backlight Keycodes +The MCU can only supply so much current to its GPIO pins. Instead of powering the backlight directly from the MCU, the backlight pin is connected to a transistor or MOSFET that switches the power to the LEDs. -These keycodes control the backlight. Most keyboards use this for single color in-switch lighting. +## Usage + +Most keyboards have backlighting enabled by default if they support it, but if it is not working for you, check that your `rules.mk` includes the following: + +```make +BACKLIGHT_ENABLE = yes +``` + +You should then be able to use the keycodes below to change the backlight level. + +## Keycodes |Key |Description | |---------|------------------------------------------| @@ -16,24 +26,28 @@ These keycodes control the backlight. Most keyboards use this for single color i |`BL_DEC` |Decrease the backlight level | |`BL_BRTG`|Toggle backlight breathing | -Note that for backlight breathing, you need to have `#define BACKLIGHT_BREATHING` in your config.h. +## Caveats -## Configuration Options in `config.h` +This feature is distinct from both the [RGB underglow](feature_rgblight.md) and [RGB matrix](feature_rgb_matrix.md) features as it usually allows for only a single colour per switch, though you can obviously use multiple different coloured LEDs on a keyboard. -* `BACKLIGHT_PIN B7` defines the pin that controlls the LEDs. Unless you design your own keyboard, you don't need to set this. -* `BACKLIGHT_LEVELS 3` defines the number of brightness levels (maximum 15 excluding off). -* `BACKLIGHT_BREATHING` if defined, enables backlight breathing. Note that this is only available if `BACKLIGHT_PIN` is B5, B6 or B7. -* `BREATHING_PERIOD 6` defines the length of one backlight "breath" in seconds. +Hardware PWM is only supported on certain pins of the MCU, so if the backlighting is not connected to one of them, a software implementation will be used, and backlight breathing will not be available. Currently the supported pins are `B5`, `B6`, `B7`, and `C6`. -## Notes on Implementation +## Configuration -To change the brightness when using pins B5, B6 or B7, the PWM (Pulse Width Modulation) functionality of the on-chip timer is used. -The timer is a counter that counts up to a certain TOP value (`0xFFFF` set in ICR1) before resetting to 0. -We also set an OCR1x register. -When the counter reaches the value stored in that register, the PWM pin drops to low. -The PWM pin is pulled high again when the counter resets to 0. -Therefore, OCR1x basically sets the duty cycle of the LEDs and as such the brightness where `0` is the darkest and `0xFFFF` the brightest setting. +To change the behaviour of the backlighting, `#define` these in your `config.h`: -To enable the breathing effect, we register an interrupt handler to be called whenever the counter resets (with `ISR(TIMER1_OVF_vect)`). -In this handler, which gets called roughly 244 times per second, we compute the desired brightness using a precomputed brightness curve. -To disable breathing, we can just disable the respective interrupt vector and reset the brightness to the desired level. +|Define |Default |Description | +|---------------------|-------------|-------------------------------------------------------------------------------------------------------------| +|`BACKLIGHT_PIN` |`B7` |The pin that controls the LEDs. Unless you are designing your own keyboard, you shouldn't need to change this| +|`BACKLIGHT_LEVELS` |`3` |The number of brightness levels (maximum 15 excluding off) | +|`BACKLIGHT_BREATHING`|*Not defined*|Enable backlight breathing, if hardware PWM is used | +|`BREATHING_PERIOD` |`6` |The length of one backlight "breath" in seconds | + +## Hardware PWM Implementation + +When using the supported pins for backlighting, QMK will use a hardware timer configured to output a PWM signal. This timer will count up to `ICRx` (by default `0xFFFF`) before resetting to 0. +The desired brightness is calculated and stored in the `OCRxx` register. When the counter reaches this value, the backlight pin will go low, and is pulled high again when the counter resets. +In this way `OCRxx` essentially controls the duty cycle of the LEDs, and thus the brightness, where `0x0000` is completely off and `0xFFFF` is completely on. + +The breathing effect is achieved by registering an interrupt handler for `TIMER1_OVF_vect` that is called whenever the counter resets, roughly 244 times per second. +In this handler, the value of an incrementing counter is mapped onto a precomputed brightness curve. To turn off breathing, the interrupt handler is simply disabled, and the brightness reset to the level stored in EEPROM. diff --git a/docs/feature_bootmagic.md b/docs/feature_bootmagic.md index beef6c467..d6915d355 100644 --- a/docs/feature_bootmagic.md +++ b/docs/feature_bootmagic.md @@ -1,89 +1,100 @@ -# Bootmagic and Magic Keycodes +# Bootmagic -There are 3 separate but related features that allow you to change the behavior of your keyboard without reflashing. While each of them have similar functionality you access that functionality in different ways depending on how your keyboard is configured. +There are three separate but related features that allow you to change the behavior of your keyboard without reflashing. While each of them have similar functionality, it is accessed in different ways depending on how your keyboard is configured. -Bootmagic is a system for configuring your keyboard while it initializes. To trigger a Bootmagic command you hold down the bootmagic key (`KC_SPACE` on most keyboards) and one or more command keys. +**Bootmagic** is a system for configuring your keyboard while it initializes. To trigger a Bootmagic command, hold down the Bootmagic key and one or more command keys. -Bootmagic Keycodes allow you to access the Bootmagic functionality after your keyboard has initialized. To use Bootmagic Keycodes you assign keycodes starting with `MAGIC_`, much in the same way you define any other key. +**Bootmagic Keycodes** are prefixed with `MAGIC_`, and allow you to access the Bootmagic functionality *after* your keyboard has initialized. To use the keycodes, assign them to your keymap as you would any other keycode. -Command is a feature that allows you to control different aspects of your keyboard. Command used to be called Magic. Command is typically accessed by holding Left and Right Shift at the same time, although that can be customized. While it shares some functionality with Bootmagic it also allows you to access functionality that Bootmagic does not. For more information see the [Command](feature_command.md) documentation page. +**Command**, formerly known as **Magic**, is another feature that allows you to control different aspects of your keyboard. While it shares some functionality with Bootmagic, it also allows you to do things that Bootmagic does not, such as printing version information to the console. For more information, see [Command](feature_command.md). -## Enabling Bootmagic +On some keyboards Bootmagic is disabled by default. If this is the case, it must be explicitly enabled in your `rules.mk` with: -Bootmagic is disabled by default. To use Bootmagic you need to enable it in your `rules.mk` file: +```make +BOOTMAGIC_ENABLE = yes +``` - BOOTMAGIC_ENABLE = yes +## Hotkeys -## Bootmagic Hotkeys and Keycodes +Hold down the Bootmagic key (Space by default) and the desired hotkey while plugging in your keyboard. For example, holding Space+`B` should cause it to enter the bootloader. -This table describes the default Hotkeys for Bootmagic and the Keycodes for Magic. These may be overriden at the Keyboard or Keymap level. Some functionality is not available in both methods. +|Hotkey |Description | +|------------------|---------------------------------------------| +|Escape |Ignore Bootmagic configuration in EEPROM | +|`B` |Enter the bootloader | +|`D` |Toggle debugging over serial | +|`X` |Toggle key matrix debugging | +|`K` |Toggle keyboard debugging | +|`M` |Toggle mouse debugging | +|Backspace |Clear the EEPROM | +|Caps Lock |Toggle treating Caps Lock as Left Control | +|Left Control |Toggle swapping Caps Lock and Left Control | +|Left Alt |Toggle swapping Left Alt and Left GUI | +|Right Alt |Toggle swapping Right Alt and Right GUI | +|Left GUI |Toggle the GUI keys (useful when gaming) | +|`|Toggle swapping ` and Escape| +|`\` |Toggle swapping `\` and Backspace | +|`N` |Toggle N-Key Rollover (NKRO) | +|`0` |Make layer 0 the default layer | +|`1` |Make layer 1 the default layer | +|`2` |Make layer 2 the default layer | +|`3` |Make layer 3 the default layer | +|`4` |Make layer 4 the default layer | +|`5` |Make layer 5 the default layer | +|`6` |Make layer 6 the default layer | +|`7` |Make layer 7 the default layer | -To use the Hotkey hold down `BOOTMAGIC_KEY_SALT` (`KC_SPACE` by default) and the Hotkey while plugging in your keyboard. To use the Keycode assign that keycode to a layer. For example, if you hold down Space+B while plugging in most keyboards, you will enter bootloader mode. +## Keycodes -|Hotkey |Keycode |Description | -|-----------|----------------------------------|--------------------------------------------------------| -|`ESC` | |Skip bootmagic and saved eeprom configuration | -|`B` |`RESET` |Enter bootloader instead of firmware | -|`D` |`DEBUG` |Enable debugging (writes messages to serial) | -|`X` | |Enable matrix debugging | -|`K` | |Enable keyboard debugging | -|`M` | |Enable mouse debugging | -|`BACKSPACE`| |Clear the saved settings from flash | -|`CAPSLOCK` |`MAGIC_CAPSLOCK_TO_CONTROL` |Treat `Capslock` as `Control` | -| |`MAGIC_UNCAPSLOCK_TO_CONTROL` |Stop treating CapsLock as Control | -|`LCTRL` |`MAGIC_SWAP_CONTROL_CAPSLOCK` |Swap `Control` and `Capslock` | -| |`MAGIC_UNSWAP_CONTROL_CAPSLOCK` |Unswap Left Control and Caps Lock | -| |`MAGIC_SWAP_ALT_GUI` |Swap Alt and GUI on both sides | -| |`MAGIC_UNSWAP_ALT_GUI` |Unswap Left Alt and GUI | -|`LALT` |`MAGIC_SWAP_LALT_LGUI` |Swap Left `Alt` and `GUI`, e.g. for OSX Opt and Cmd | -| |`MAGIC_UNSWAP_LALT_LGUI` |Unswap Left Alt and GUI | -|`RALT` |`MAGIC_SWAP_RALT_RGUI` |Swap Right `Alt` and `GUI` | -| |`MAGIC_UNSWAP_RALT_RGUI` |Unswap Right Alt and GUI | -|`LGUI` |`MAGIC_NO_GUI` |Disable GUI key - e.g. disable Windows key during gaming| -| |`MAGIC_UNNO_GUI` |Enable the GUI key | -|`GRAVE` |`MAGIC_SWAP_GRAVE_ESC` |Swap `\`~` and `ESC` | -| |`MAGIC_UNSWAP_GRAVE_ESC` |Unswap `\`~` and Escape | -|`BACKSLASH`|`MAGIC_SWAP_BACKSLASH_BACKSPACE` |Swap Blackslash and Backspace | -| |`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`|Unswap Backslash and Backspace | -|`N` |`MAGIC_HOST_NKRO` |Force N-Key Rollover (NKRO) on | -| |`MAGIC_UNHOST_NKRO` |Force NKRO off | -| |`MAGIC_TOGGLE_NKRO` |Toggle NKRO on or off | -|`0` |`DF(0)` |Make Layer 0 the default layer at bootup | -|`1` |`DF(1)` |Make Layer 1 the default layer at bootup | -|`2` |`DF(2)` |Make Layer 2 the default layer at bootup | -|`3` |`DF(3)` |Make Layer 3 the default layer at bootup | -|`4` |`DF(4)` |Make Layer 4 the default layer at bootup | -|`5` |`DF(5)` |Make Layer 5 the default layer at bootup | -|`6` |`DF(6)` |Make Layer 6 the default layer at bootup | -|`7` |`DF(7)` |Make Layer 7 the default layer at bootup | +|Keycode |Aliases |Description | +|----------------------------------|---------|------------------------------------------| +|`MAGIC_CAPSLOCK_TO_CONTROL` | |Treat Caps Lock as Left Control | +|`MAGIC_UNCAPSLOCK_TO_CONTROL` | |Stop treating Caps Lock as Left Control | +|`MAGIC_HOST_NKRO` | |Force N-Key Rollover (NKRO) on | +|`MAGIC_UNHOST_NKRO` | |Force NKRO off | +|`MAGIC_TOGGLE_NKRO` | |Turn NKRO on or off | +|`MAGIC_NO_GUI` | |Disable the GUI keys (useful when gaming) | +|`MAGIC_UNNO_GUI` | |Enable the GUI keys | +|`MAGIC_SWAP_ALT_GUI` |`AG_SWAP`|Swap Alt and GUI on both sides (for macOS)| +|`MAGIC_UNSWAP_ALT_GUI` |`AG_NORM`|Unswap Left Alt and Left GUI | +|`MAGIC_SWAP_BACKSLASH_BACKSPACE` | |Swap `\` and Backspace | +|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`| |Unswap `\` and Backspace | +|`MAGIC_SWAP_CONTROL_CAPSLOCK` | |Swap Left Control and Caps Lock | +|`MAGIC_UNSWAP_CONTROL_CAPSLOCK` | |Unswap Left Control and Caps Lock | +|`MAGIC_SWAP_GRAVE_ESC` | |Swap ` and Escape | +|`MAGIC_UNSWAP_GRAVE_ESC` | |Unswap ` and Escape | +|`MAGIC_SWAP_LALT_LGUI` | |Swap Left Alt and Left GUI | +|`MAGIC_UNSWAP_LALT_LGUI` | |Unswap Left Alt and Left GUI | +|`MAGIC_SWAP_RALT_RGUI` | |Swap Right Alt and Right GUI | +|`MAGIC_UNSWAP_RALT_RGUI` | |Unswap Right Alt and Right GUI | -## Bootmagic Configuration +## Configuration -When setting up your keyboard and/or keymap there are a number of `#define`s that control the behavior of Bootmagic. To use these put them in your `config.h`, either at the keyboard or keymap level. +If you would like to change the hotkey assignments for Bootmagic, `#define` these in your `config.h` at either the keyboard or keymap level. -|Define |Default|Description | -|-------|-------|------------| -|`BOOTMAGIC_KEY_SALT`|`KC_SPACE`|The key to hold down to trigger Bootmagic during initialization.| -|`BOOTMAGIC_KEY_SKIP`|`KC_ESC`|The Hotkey to ignore saved eeprom configuration.| -|`BOOTMAGIC_KEY_EEPROM_CLEAR`|`KC_BSPACE`|The hotkey to clear the saved eeprom configuration.| -|`BOOTMAGIC_KEY_BOOTLOADER`|`KC_B`|The hotkey to enter the bootloader.| -|`BOOTMAGIC_KEY_DEBUG_ENABLE`|`KC_D`|The hotkey to enable debug mode.| -|`BOOTMAGIC_KEY_DEBUG_MATRIX`|`KC_X`|The hotkey to enable matrix debugging mode.| -|`BOOTMAGIC_KEY_DEBUG_KEYBOARD`|`KC_K`|The hotkey to enable keyboard debugging mode.| -|`BOOTMAGIC_KEY_DEBUG_MOUSE`|`KC_M`|The hotkey to enable mouse debugging mode.| -|`BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK`|`KC_LCTRL`|| -|`BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL`|`KC_CAPSLOCK`|| -|`BOOTMAGIC_KEY_SWAP_LALT_LGUI`|`KC_LALT`|| -|`BOOTMAGIC_KEY_SWAP_RALT_RGUI`|`KC_RALT`|| -|`BOOTMAGIC_KEY_NO_GUI`|`KC_LGUI`|| -|`BOOTMAGIC_KEY_SWAP_GRAVE_ESC`|`KC_GRAVE`|| -|`BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE`|`KC_BSLASH`|| -|`BOOTMAGIC_HOST_NKRO`|`KC_N`|| -|`BOOTMAGIC_KEY_DEFAULT_LAYER_0`|`KC_0`|Hotkey to set Layer 0 as the default layer| -|`BOOTMAGIC_KEY_DEFAULT_LAYER_1`|`KC_1`|Hotkey to set Layer 1 as the default layer| -|`BOOTMAGIC_KEY_DEFAULT_LAYER_2`|`KC_2`|Hotkey to set Layer 2 as the default layer| -|`BOOTMAGIC_KEY_DEFAULT_LAYER_3`|`KC_3`|Hotkey to set Layer 3 as the default layer| -|`BOOTMAGIC_KEY_DEFAULT_LAYER_4`|`KC_4`|Hotkey to set Layer 4 as the default layer| -|`BOOTMAGIC_KEY_DEFAULT_LAYER_5`|`KC_5`|Hotkey to set Layer 5 as the default layer| -|`BOOTMAGIC_KEY_DEFAULT_LAYER_6`|`KC_6`|Hotkey to set Layer 6 as the default layer| -|`BOOTMAGIC_KEY_DEFAULT_LAYER_7`|`KC_7`|Hotkey to set Layer 7 as the default layer| +|Define |Default |Description | +|----------------------------------------|-------------|---------------------------------------------------| +|`BOOTMAGIC_KEY_SALT` |`KC_SPACE` |The Bootmagic key | +|`BOOTMAGIC_KEY_SKIP` |`KC_ESC` |Ignore Bootmagic configuration in EEPROM | +|`BOOTMAGIC_KEY_EEPROM_CLEAR` |`KC_BSPACE` |Clear the EEPROM configuration | +|`BOOTMAGIC_KEY_BOOTLOADER` |`KC_B` |Enter the bootloader | +|`BOOTMAGIC_KEY_DEBUG_ENABLE` |`KC_D` |Toggle debugging over serial | +|`BOOTMAGIC_KEY_DEBUG_MATRIX` |`KC_X` |Toggle matrix debugging | +|`BOOTMAGIC_KEY_DEBUG_KEYBOARD` |`KC_K` |Toggle keyboard debugging | +|`BOOTMAGIC_KEY_DEBUG_MOUSE` |`KC_M` |Toggle mouse debugging | +|`BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK` |`KC_LCTRL` |Swap Left Control and Caps Lock | +|`BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL` |`KC_CAPSLOCK`|Toggle treating Caps Lock as Left Control | +|`BOOTMAGIC_KEY_SWAP_LALT_LGUI` |`KC_LALT` |Toggle swapping Left Alt and Left GUI (for macOS) | +|`BOOTMAGIC_KEY_SWAP_RALT_RGUI` |`KC_RALT` |Toggle swapping Right Alt and Right GUI (for macOS)| +|`BOOTMAGIC_KEY_NO_GUI` |`KC_LGUI` |Toggle the GUI keys (useful when gaming) | +|`BOOTMAGIC_KEY_SWAP_GRAVE_ESC` |`KC_GRAVE` |Toggle swapping ` and Escape | +|`BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE`|`KC_BSLASH` |Toggle swapping `\` and Backspace | +|`BOOTMAGIC_HOST_NKRO` |`KC_N` |Toggle N-Key Rollover (NKRO) | +|`BOOTMAGIC_KEY_DEFAULT_LAYER_0` |`KC_0` |Make layer 0 the default layer | +|`BOOTMAGIC_KEY_DEFAULT_LAYER_1` |`KC_1` |Make layer 1 the default layer | +|`BOOTMAGIC_KEY_DEFAULT_LAYER_2` |`KC_2` |Make layer 2 the default layer | +|`BOOTMAGIC_KEY_DEFAULT_LAYER_3` |`KC_3` |Make layer 3 the default layer | +|`BOOTMAGIC_KEY_DEFAULT_LAYER_4` |`KC_4` |Make layer 4 the default layer | +|`BOOTMAGIC_KEY_DEFAULT_LAYER_5` |`KC_5` |Make layer 5 the default layer | +|`BOOTMAGIC_KEY_DEFAULT_LAYER_6` |`KC_6` |Make layer 6 the default layer | +|`BOOTMAGIC_KEY_DEFAULT_LAYER_7` |`KC_7` |Make layer 7 the default layer | diff --git a/docs/feature_command.md b/docs/feature_command.md index ad987aaf6..ca2ecce0d 100644 --- a/docs/feature_command.md +++ b/docs/feature_command.md @@ -1,52 +1,50 @@ -# Command (Formerly known as Magic) +# Command -Command is a way to change your keyboard's behavior without having to flash or unplug it to use [Bootmagic](feature_bootmagic.md). There is a lot of overlap between this functionality and the [Bootmagic Keycodes](feature_bootmagic.md). Whenever possible we encourage you to use that functionality instead of Command. +Command, formerly known as Magic, is a way to change your keyboard's behavior without having to flash or unplug it to use [Bootmagic](feature_bootmagic.md). There is a lot of overlap between this functionality and the [Bootmagic Keycodes](feature_bootmagic.md#keycodes). Wherever possible we encourage you to use that feature instead of Command. -## Enabling Command +On some keyboards Command is disabled by default. If this is the case, it must be explicitly enabled in your `rules.mk`: -By default Command is disabled. You can enable it in your `rules.mk` file: - - COMMAND_ENABLE = yes +```make +COMMAND_ENABLE = yes +``` ## Usage -To use Command you hold down the key combination defined by `IS_COMMAND`. By default that combination is both shift keys. While holding the key combination press the key corresponding to the command you want. - -For example, to write the current QMK version to the QMK Toolbox console, you can press `Left Shift`+`Right Shift`+`V`. +To use Command, hold down the key combination defined by the `IS_COMMAND()` macro. By default this is Left Shift+Right Shift. Then, press the key corresponding to the command you want. For example, to output the current QMK version to the QMK Toolbox console, press Left Shift+Right Shift+`V`. ## Configuration -The following values can be defined in `config.h` to control the behavior of Command. +If you would like to change the key assignments for Command, `#define` these in your `config.h` at either the keyboard or keymap level. All keycode assignments here must omit the `KC_` prefix. -|Define |Default | Description | -|-------|--------|-------------| -|`IS_COMMAND()` |`(keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))`|Key combination to activate Command| -|`MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS` |`true` |Do layer switching with Function row| -|`MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS` |`true` |Do layer switching with number keys.| -|`MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM`|`false` |Do layer switching with custom keys (`MAGIC_KEY_LAYER0..9` below.)| -|`MAGIC_KEY_HELP1` |`H` |Show help.| -|`MAGIC_KEY_HELP2` |`SLASH` |Show help.| -|`MAGIC_KEY_DEBUG` |`D` |Turn on debug mode.| -|`MAGIC_KEY_DEBUG_MATRIX` |`X` |Turn on matrix debugging.| -|`MAGIC_KEY_DEBUG_KBD` |`K` |Turn on keyboard debugging.| -|`MAGIC_KEY_DEBUG_MOUSE` |`M` |Turn on mouse debugging.| -|`MAGIC_KEY_VERSION` |`V` |Write the QMK version to the console| -|`MAGIC_KEY_STATUS` |`S` |Show the current keyboard status| -|`MAGIC_KEY_CONSOLE` |`C` |Enable the Command Console| -|`MAGIC_KEY_LAYER0_ALT1` |`ESC` |Alternate access to layer 0| -|`MAGIC_KEY_LAYER0_ALT2` |`GRAVE` |Alternate access to layer 0| -|`MAGIC_KEY_LAYER0` |`0` |Change default layer to 0| -|`MAGIC_KEY_LAYER1` |`1` |Change default layer to 1| -|`MAGIC_KEY_LAYER2` |`2` |Change default layer to 2| -|`MAGIC_KEY_LAYER3` |`3` |Change default layer to 3| -|`MAGIC_KEY_LAYER4` |`4` |Change default layer to 4| -|`MAGIC_KEY_LAYER5` |`5` |Change default layer to 5| -|`MAGIC_KEY_LAYER6` |`6` |Change default layer to 6| -|`MAGIC_KEY_LAYER7` |`7` |Change default layer to 7| -|`MAGIC_KEY_LAYER8` |`8` |Change default layer to 8| -|`MAGIC_KEY_LAYER9` |`9` |Change default layer to 9| -|`MAGIC_KEY_BOOTLOADER` |`PAUSE` |Exit keyboard and enter bootloader| -|`MAGIC_KEY_LOCK` |`CAPS` |Lock the keyboard so nothing can be typed| -|`MAGIC_KEY_EEPROM` |`E` |Erase EEPROM settings| -|`MAGIC_KEY_NKRO` |`N` |Toggle NKRO on/off| -|`MAGIC_KEY_SLEEP_LED` |`Z` |Toggle LED when computer is sleeping on/off| +|Define |Default |Description | +|------------------------------------|--------------------------------------------------------------------------------------|------------------------------------------------| +|`IS_COMMAND()` |(keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))|The key combination to activate Command | +|`MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS` |`true` |Set default layer with the Function row | +|`MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS` |`true` |Set default layer with the number keys | +|`MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM`|`false` |Set default layer with `MAGIC_KEY_LAYER0..9` | +|`MAGIC_KEY_DEBUG` |`D` |Toggle debugging over serial | +|`MAGIC_KEY_DEBUG_MATRIX` |`X` |Toggle key matrix debugging | +|`MAGIC_KEY_DEBUG_KBD` |`K` |Toggle keyboard debugging | +|`MAGIC_KEY_DEBUG_MOUSE` |`M` |Toggle mouse debugging | +|`MAGIC_KEY_CONSOLE` |`C` |Enable the Command console | +|`MAGIC_KEY_VERSION` |`V` |Print the running QMK version to the console | +|`MAGIC_KEY_STATUS` |`S` |Print the current keyboard status to the console| +|`MAGIC_KEY_HELP1` |`H` |Print Command help to the console | +|`MAGIC_KEY_HELP2` |`SLASH` |Print Command help to the console (alternate) | +|`MAGIC_KEY_LAYER0` |`0` |Make layer 0 the default layer | +|`MAGIC_KEY_LAYER1` |`1` |Make layer 1 the default layer | +|`MAGIC_KEY_LAYER2` |`2` |Make layer 2 the default layer | +|`MAGIC_KEY_LAYER3` |`3` |Make layer 3 the default layer | +|`MAGIC_KEY_LAYER4` |`4` |Make layer 4 the default layer | +|`MAGIC_KEY_LAYER5` |`5` |Make layer 5 the default layer | +|`MAGIC_KEY_LAYER6` |`6` |Make layer 6 the default layer | +|`MAGIC_KEY_LAYER7` |`7` |Make layer 7 the default layer | +|`MAGIC_KEY_LAYER8` |`8` |Make layer 8 the default layer | +|`MAGIC_KEY_LAYER9` |`9` |Make layer 9 the default layer | +|`MAGIC_KEY_LAYER0_ALT1` |`ESC` |Make layer 0 the default layer (alternate) | +|`MAGIC_KEY_LAYER0_ALT2` |`GRAVE` |Make layer 0 the default layer (alternate) | +|`MAGIC_KEY_BOOTLOADER` |`PAUSE` |Enter the bootloader | +|`MAGIC_KEY_LOCK` |`CAPS` |Lock the keyboard so nothing can be typed | +|`MAGIC_KEY_EEPROM` |`E` |Clear the EEPROM | +|`MAGIC_KEY_NKRO` |`N` |Toggle N-Key Rollover (NKRO) | +|`MAGIC_KEY_SLEEP_LED` |`Z` |Toggle LED when computer is sleeping | diff --git a/docs/feature_dynamic_macros.md b/docs/feature_dynamic_macros.md index 9803557e9..0d11a2864 100644 --- a/docs/feature_dynamic_macros.md +++ b/docs/feature_dynamic_macros.md @@ -4,10 +4,10 @@ QMK supports temporary macros created on the fly. We call these Dynamic Macros. You can store one or two macros and they may have a combined total of 128 keypresses. You can increase this size at the cost of RAM. -To enable them, first add a new element to the `planck_keycodes` enum — `DYNAMIC_MACRO_RANGE`: +To enable them, first add a new element to the end of your `keycodes` enum — `DYNAMIC_MACRO_RANGE`: ```c -enum planck_keycodes { +enum keycodes { QWERTY = SAFE_RANGE, COLEMAK, DVORAK, @@ -20,7 +20,7 @@ enum planck_keycodes { }; ``` -It must be the last element because `dynamic_macros.h` will add some more keycodes after it. +Your `keycodes` enum may have a slightly different name. You must add `DYNAMIC_MACRO_RANGE` as the last element because `dynamic_macros.h` will add some more keycodes after it. Below it, include the `dynamic_macro.h` header: diff --git a/docs/feature_grave_esc.md b/docs/feature_grave_esc.md index a8e45f3a9..c6fa16022 100644 --- a/docs/feature_grave_esc.md +++ b/docs/feature_grave_esc.md @@ -1,17 +1,24 @@ # Grave Escape -Grave Escape is a feature that allows you to share the grave key (` and `~`) on the same key as Escape. When `KC_GESC` is used it will act as `KC_ESC`, unless Shift or GUI is pressed, in which case it will act as `KC_GRAVE`. +If you're using a 60% keyboard, or any other layout with no F-row, you will have noticed that there is no dedicated Escape key. Grave Escape is a feature that allows you to share the grave key (` and `~`) with Escape. +## Usage + +Replace the `KC_GRAVE` key in your keymap (usually to the left of the `1` key) with `KC_GESC`. When pressed it will behave like `KC_ESC`, but with Shift or GUI held it will send `KC_GRAVE`. + +## Keycodes |Key |Aliases |Description | |---------|-----------|------------------------------------------------------------------| |`KC_GESC`|`GRAVE_ESC`|Escape when pressed, ` when Shift or GUI are held| -There are several possible key combinations this will break, among them Ctrl+Shift+Esc on Windows and Cmd+Opt+Esc on macOS. You can use these options in your `config.h` to work around this: +## Configuration -| Option | Description | -|--------|-------------| -| `GRAVE_ESC_ALT_OVERRIDE` | Always send Escape if Alt is pressed. | -| `GRAVE_ESC_CTRL_OVERRIDE` | Always send Escape if Ctrl is pressed. | -| `GRAVE_ESC_GUI_OVERRIDE` | Always send Escape if GUI is pressed. | -| `GRAVE_ESC_SHIFT_OVERRIDE` | Always send Escape if SHIFT is pressed. | +There are several possible key combinations this will break, among them Control+Shift+Escape on Windows and Command+Option+Escape on macOS. To work around this, you can `#define` these options in your `config.h`: + +|Define |Description | +|--------------------------|-----------------------------------------| +|`GRAVE_ESC_ALT_OVERRIDE` |Always send Escape if Alt is pressed | +|`GRAVE_ESC_CTRL_OVERRIDE` |Always send Escape if Control is pressed | +|`GRAVE_ESC_GUI_OVERRIDE` |Always send Escape if GUI is pressed | +|`GRAVE_ESC_SHIFT_OVERRIDE`|Always send Escape if Shift is pressed | diff --git a/docs/feature_hd44780.md b/docs/feature_hd44780.md new file mode 100644 index 000000000..e9d9e8b7b --- /dev/null +++ b/docs/feature_hd44780.md @@ -0,0 +1,56 @@ +# HD44780 LCD Displays + +This is an integration of Peter Fleury's LCD library. This page will explain the basics. [For in depth documentation visit his page.](http://homepage.hispeed.ch/peterfleury/doxygen/avr-gcc-libraries/group__pfleury__lcd.html) + +You can enable support for HD44780 Displays by setting the `HD44780_ENABLE` flag in your keyboards `rules.mk` to yes. This will use about 400 KB of extra space. + +## Configuration + +You will need to configure the pins used by your display and its number of lines and collumn in your keyboards `config.h`. + +Uncomment the section labled HD44780 and change the parameters as needed. +```` +/* + * HD44780 LCD Display Configuration + */ + +#define LCD_LINES 2 //< number of visible lines of the display +#define LCD_DISP_LENGTH 16 //< visibles characters per line of the display +#define LCD_IO_MODE 1 //< 0: memory mapped mode, 1: IO port mode +#if LCD_IO_MODE +#define LCD_PORT PORTB //< port for the LCD lines +#define LCD_DATA0_PORT LCD_PORT //< port for 4bit data bit 0 +#define LCD_DATA1_PORT LCD_PORT //< port for 4bit data bit 1 +#define LCD_DATA2_PORT LCD_PORT //< port for 4bit data bit 2 +#define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3 +#define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0 +#define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1 +#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2 +#define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3 +#define LCD_RS_PORT LCD_PORT //< port for RS line +#define LCD_RS_PIN 3 //< pin for RS line +#define LCD_RW_PORT LCD_PORT //< port for RW line +#define LCD_RW_PIN 2 //< pin for RW line +#define LCD_E_PORT LCD_PORT //< port for Enable line +#define LCD_E_PIN 1 //< pin for Enable line +#endif +```` + +Should you need to configure other properties you can copy them from `quantum/hd44780.h` and set them in your `config.h` + +## Usage + +To initialize your display call lcd_init() with one of these parameters: +```` +LCD_DISP_OFF : display off +LCD_DISP_ON : display on, cursor off +LCD_DISP_ON_CURSOR : display on, cursor on +LCD_DISP_ON_CURSOR_BLINK : display on, cursor on flashing +```` +This is best done in your keyboards `matrix_init_kb` or your keymaps `matrix_init_user`. +It is advised to clear the display before use. +To do so call `lcd_clrsrc()`. + +To now print something to your Display you first call `lcd_gotoxy(column, line)`. To go to the start of the first line you would call `lcd_gotoxy(0, 0)` and then print a string with `lcd_puts("example string")`. + +There are more posible methods to control the display. [For in depth documentation please visit the linked page.](http://homepage.hispeed.ch/peterfleury/doxygen/avr-gcc-libraries/group__pfleury__lcd.html) diff --git a/docs/feature_key_lock.md b/docs/feature_key_lock.md index 225e7136f..718d9c5bd 100644 --- a/docs/feature_key_lock.md +++ b/docs/feature_key_lock.md @@ -1,11 +1,22 @@ -## Key Lock: Holding Down Keys for You +# Key Lock -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. +Sometimes you may find yourself needing to hold down a specific key for a long period of time. Key Lock holds down the next key you press for you. Press it again, and it will be released. -Here's how to use it: +Let's say you need to type in ALL CAPS for a few sentences. Hit `KC_LOCK`, and then Shift. Now, Shift will be considered held until you tap it again. You can think of Key Lock as Caps Lock, but supercharged. -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! +## Usage -Important: switching layers does not cancel the key lock. Additionally, key lock is only able to hold standard action keys and One Shot modifier keys (for example, if you have your shift defined as `OSM(KC_LSFT)`; see [One Shot Keys](quantum_keycodes.md#one-shot-keys)). This does not include any of the QMK special functions (except One Shot modifiers), or shifted versions of keys such as KC_LPRN. If it's in the [Basic Keycodes](keycodes_basic.md) list, it can be held. If it's not, then it can't be. +First, enable Key Lock by setting `KEY_LOCK_ENABLE = yes` in your `rules.mk`. Then pick a key in your keymap and assign it the keycode `KC_LOCK`. + +## Keycodes + +|Keycode |Description | +|---------|--------------------------------------------------------------| +|`KC_LOCK`|Hold down the next key pressed, until the key is pressed again| + +## Caveats + +Key Lock is only able to hold standard action keys and [One Shot modifier](quantum_keycodes.md#one-shot-keys) keys (for example, if you have your Shift defined as `OSM(KC_LSFT)`). +This does not include any of the QMK special functions (except One Shot modifiers), or shifted versions of keys such as `KC_LPRN`. If it's in the [Basic Keycodes](keycodes_basic.md) list, it can be held. + +Switching layers will not cancel the Key Lock. diff --git a/docs/feature_leader_key.md b/docs/feature_leader_key.md index fb74bf7c8..46633b287 100644 --- a/docs/feature_leader_key.md +++ b/docs/feature_leader_key.md @@ -17,14 +17,16 @@ void matrix_scan_user(void) { leader_end(); SEQ_ONE_KEY(KC_F) { - register_code(KC_S); - unregister_code(KC_S); + // Anything you can do in a macro. + SEND_STRING("QMK is awesome."); + } + SEQ_TWO_KEYS(KC_D, KC_D) { + SEND_STRING(SS_LCTRL("a")SS_LCTRL("c")); + } + SEQ_THREE_KEYS(KC_D, KC_D, KC_S) { + SEND_STRING("https://start.duckduckgo.com"SS_TAP(X_ENTER)); } 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); @@ -34,4 +36,6 @@ 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_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. +As you can see, you have a few function. You can use `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS`, `SEQ_THREE_KEYS` up to `SEQ_FIVE_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. diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 5d2db3b97..ed33c7ea4 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -80,7 +80,7 @@ All RGB keycodes are currently shared with the RGBLIGHT system: These are the effects that are currently available: enum rgb_matrix_effects { - RGB_MATRIX_SOLID_COLOR = 1, + RGB_MATRIX_SOLID_COLOR = 1, RGB_MATRIX_ALPHAS_MODS, RGB_MATRIX_DUAL_BEACON, RGB_MATRIX_GRADIENT_UP_DOWN, @@ -93,7 +93,7 @@ These are the effects that are currently available: RGB_MATRIX_RAINBOW_MOVING_CHEVRON, RGB_MATRIX_JELLYBEAN_RAINDROPS, #ifdef RGB_MATRIX_KEYPRESSES - RGB_MATRIX_SOLID_REACTIVE, + RGB_MATRIX_SOLID_REACTIVE, RGB_MATRIX_SPLASH, RGB_MATRIX_MULTISPLASH, RGB_MATRIX_SOLID_SPLASH, @@ -107,7 +107,7 @@ These are the effects that are currently available: Custom layer effects can be done by defining this in your `.c`: void rgb_matrix_indicators_kb(void) { - // rgb_matrix_set_color(index, red, green, blue); + rgb_matrix_set_color(index, red, green, blue); } A similar function works in the keymap as `rgb_matrix_indicators_user`. @@ -119,6 +119,7 @@ A similar function works in the keymap as `rgb_matrix_indicators_user`. #define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects #define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended #define RGB_MATRIX_SKIP_FRAMES 1 // number of frames to skip when displaying animations (0 is full effect) if not defined defaults to 1 + #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 ## EEPROM storage diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md index 0f1e649ef..d48941a04 100644 --- a/docs/feature_rgblight.md +++ b/docs/feature_rgblight.md @@ -1,106 +1,46 @@ # RGB Lighting -If you've installed addressable RGB lights on your keyboard you can control them with QMK. Currently we support the following addressable LEDs on Atmel AVR processors: +QMK has the ability to control RGB LEDs attached to your keyboard. This is commonly called *underglow*, due to the LEDs often being mounted on the bottom of the keyboard, producing a nice diffused effect when combined with a translucent case. -* WS2811 and variants (WS2812, WS2812B, WS2812C, etc) -* SK6812RGBW +![Planck with RGB Underglow](https://raw.githubusercontent.com/qmk/qmk_firmware/3774a7fcdab5544fc787f4c200be05fcd417e31f/keyboards/planck/keymaps/yang/planck-with-rgb-underglow.jpg) -Some keyboards come with RGB LEDs pre-installed. Others have to have LEDs installed after the fact. See below for information on modifying your keyboard. +Some keyboards come with RGB LEDs preinstalled. Others must have them installed after the fact. See the [Hardware Modification](#hardware-modification) section for information on adding RGB lighting to your keyboard. -## Selecting Colors +Currently QMK supports the following addressable LEDs on AVR microcontrollers (however, the white LED in RGBW variants is not supported): -QMK uses Hue, Saturation, and Value to set color rather than using RGB. You can use the color wheel below to see how this works. Changing the Hue will cycle around the circle. Saturation will affect the intensity of the color, which you can see as you move from the inner part to the outer part of the wheel. Value sets the overall brightness. + * WS2811, WS2812, WS2812B, WS2812C, etc. + * SK6812, SK6812MINI, SK6805 -HSV Color Wheel +These LEDs are called "addressable" because instead of using a wire per color, each LED contains a small microchip that understands a special protocol sent over a single wire. The chip passes on the remaining data to the next LED, allowing them to be chained together. In this way, you can easily control the color of the individual LEDs. -If you would like to learn more about HSV you can start with the [Wikipedia article](https://en.wikipedia.org/wiki/HSL_and_HSV). +## Usage -## Configuration +On keyboards with onboard RGB LEDs, it is usually enabled by default. If it is not working for you, check that your `rules.mk` includes the following: -Before RGB Lighting can be used you have to enable it in `rules.mk`: - - RGBLIGHT_ENABLE = yes - -You can configure the behavior of the RGB lighting by defining values inside `config.h`. - -### Required Configuration - -At minimum you have to define the pin your LED strip is connected to and the number of LEDs connected. - -```c -#define RGB_DI_PIN D7 // The pin the LED strip is connected to -#define RGBLED_NUM 14 // Number of LEDs in your strip +```make +RGBLIGHT_ENABLE = yes ``` -### Optional Configuration +At minimum you must define the data pin your LED strip is connected to, and the number of LEDs in the strip, in your `config.h`. If your keyboard has onboard RGB LEDs, and you are simply creating a keymap, you usually won't need to modify these. -You can change the behavior of the RGB Lighting by setting these configuration values. Use `#define