You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

857 lines
20 KiB

Velocikey: Match RGB animation speed to typing speed (#3754) * Draft commit of typing speed RGB control * More information in the readme * Support all RGB animation modes (Fixes #1) * Added support for all RGB light modes to use typing speed Except christmas lights because that is seizure-inducing at high speeds! * Introduced a value range specific to each RGB mode Because some modes are a little too much when running at full speed! * Update readme.md * Update readme.md * Re-arrange typing_speed definitions (Fixes #5) (#6) * Re-arrange variable definitions to avoid including quantum.h from rgblight.c * Fix a compilation error when trying to run make test:all * Tweaks to the typing speed decay rate * Renamed to momentum; moved implementation into dedicated files * Groundwork for toggling momentum on/off (currently always on) * Add EEPROM toggle for momentum-matching * Moved momentum out of RGBLIGHT_ENABLE toggles so it's more generic * Move momentum decay task out of rgblight_task() * Fix missing momentum.h in lufa.c * Experimental LED support (untested) * Draft commit of typing speed RGB control * More information in the readme * Support all RGB animation modes (Fixes #1) * Added support for all RGB light modes to use typing speed Except christmas lights because that is seizure-inducing at high speeds! * Introduced a value range specific to each RGB mode Because some modes are a little too much when running at full speed! * Update readme.md * Update readme.md * Re-arrange typing_speed definitions (Fixes #5) (#6) * Re-arrange variable definitions to avoid including quantum.h from rgblight.c * Fix a compilation error when trying to run make test:all * Tweaks to the typing speed decay rate * Renamed to momentum; moved implementation into dedicated files * Groundwork for toggling momentum on/off (currently always on) * Add EEPROM toggle for momentum-matching * Moved momentum out of RGBLIGHT_ENABLE toggles so it's more generic * Move momentum decay task out of rgblight_task() * Fix missing momentum.h in lufa.c * Added documentation * Renamed feature to velocikey * Reverted readme to original state * Correct the readme title * Updated feature name in the docs * Update EECONFIG name * Add compile-time toggles for velocikey * Update feature documentation * Revert "Merge branch 'led-support' into master" This reverts commit e123ff5febf61639b9a9020748e1c2e2313460ff, reversing changes made to df111a55b9d4929182e16108b1c0ead15b16df97. * Move velocikey EECONFIG definition to depend on VELOCIKEY_ENABLE * Rename decay_task function to decelerate * Apply suggestions from code review Co-Authored-By: chrislewisdev <chris@chrislewisdev.com> * Re-order eeconfig definitions * Apply coding conventions * Apply #ifdef check in lufa.c * Refactored interval time checks into one functionc * Small rename * Fix unused function error for layouts not using all rgb effects * Only update EEPROM if Velocikey is enabled * Incorporate code review feedback * Small adjustment to top-end decay rate * Add Velocikey documentation to table of contents * Bring tetris:default keymap size down by disabling audio
5 years ago
Hid joystick interface (#4226) * add support for hid gamepad interface add documentation for HID joystick Add joystick_task to read analog axes values even when no key is pressed or release. update doc Update docs/feature_joystick.md Manage pin setup and read to maintain matrix scan after analog read * Incorporates patches and changes to HID reporting There are some patches provided by @a-chol incorporated on this commit, and also some changes I made to the HID Report structure. The most interesting is the one dealing with number of buttons: Linux doesn't seem to care, but Windows requires the HID structure to be byte aligned (that's in the spec). So if one declares 8/16/32... buttons they should not have any issues, but this is what happens when you have 9 buttons: ``` bits |0|1|2|3|4|5|6|7| |*|*|*|*|*|*|*|*| axis 0 (report size 8) |*|*|*|*|*|*|*|*| ... |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| axis 6 |*|*|*|*|*|*|*|*| first 8 buttons (report size 1) |*| | | | | | | | last of 9 buttons, not aligned ``` So for that I added a conditonal that will add a number of reports with size 1 to make sure it aligns to the next multiple of 8. Those reports send dummy inputs that don't do anything aside from aligning the data. Tested on Linux, Windows 10 and Street Fighter (where the joystick is recognized as direct-input) * Add save and restore of each pin used in reading joystick (AVR). Allow output pin to be JS_VIRTUAL_AXIS if the axis is connected to Vcc instead of an output pin from the MCU. Fix joystick report id Fix broken v-usb hid joystick interface. Make it more resilient to unusual settings (none multiple of eight button count, 0 buttons or 0 axes) Correct adc reading for multiple axes. Piecewise range conversion for uncentered raw value range. Input, output and ground pin configuration per axis. Documentation fixes * Fix port addressing for joystick analog read * The other required set of changes As per the PR, the changes still holding it up. Add onekey for testing. Fix ARM builds. Fix device descriptor when either axes or buttons is zero. Add compile-time check for at least one axis or button. Move definition to try to fix conflict. PR review comments. qmk cformat * avoid float functions to compute range mapping for axis adc reading * Remove V-USB support for now. Updated docs accordingly. * Update tmk_core/protocol/lufa/lufa.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Add support for joystick adc reading for stm32 MCUs. Fix joystick hid report sending for chibios * Fix HID joystick report sending for ChibiOS. Add one analog axis to the onekey:joystick keymap. Fix pin state save and restore during joystick analog read for STM32 MCUs. * Update tmk_core/protocol/chibios/usb_main.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/lufa/lufa.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Add missing mcuconf.h and halconf.h to onekey:joystick keymap. Add suggested fixes from PR. * Switch saveState and restoreState signature to use pin_t type. onekey:joystick : add a second axis, virtual and programmatically animated. * Update docs/feature_joystick.md Co-Authored-By: Ryan <fauxpark@gmail.com> * Update docs/feature_joystick.md Co-Authored-By: Ryan <fauxpark@gmail.com> * Add PR corrections * Remove halconf.h and mcuconf.h from onekey keymaps * Change ADC_PIN to A0 Co-authored-by: achol <allecooll@hotmail.com> Co-authored-by: José Júnior <jose.junior@gmail.com> Co-authored-by: a-chol <achol@notamail.com> Co-authored-by: Nick Brassel <nick@tzarc.org> Co-authored-by: Ryan <fauxpark@gmail.com>
3 years ago
Overhaul Unicode Common functionality (#4325) * Standardize the Unicode EEPROM code * Remove unicode init from process_record_* functions * Add unicode init to where it belongs: matrix_init_quantum * Move Unicode proccessing to unicode common * Add audio feedback to input mode keys to drive konstantin up a wall * Tap_code cleanup * Update keycodes * Update unicode documentation * Update unicode keycodes for consistency/easier merge * Add Audio Feedback section * Remove Functions from feature page And link to the file instead. Link to specific lines later on. * Fix spacing Co-Authored-By: drashna <drashna@live.com> * Because I missed it! Co-Authored-By: drashna <drashna@live.com> * Fix spacing Co-Authored-By: drashna <drashna@live.com> * SPAAAAAAAAAACing Co-Authored-By: drashna <drashna@live.com> * Add BSD for future compatibility * Thought I fixed that! Co-Authored-By: drashna <drashna@live.com> * non-breaking Co-Authored-By: drashna <drashna@live.com> * Considered that Co-Authored-By: drashna <drashna@live.com> * Yuuup Co-Authored-By: drashna <drashna@live.com> * consistency Co-Authored-By: drashna <drashna@live.com> * white spaces .... copied from elsewhere Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * Update keycode defines * Fix Linux Song * Update all of the songs * Cleanup * Move and update check to ensure only one unicode method is enabled * Update quantum/quantum_keycodes.h * Update documentation * Wordsmithing and cleanup * Format unicode_common (#13) * case alignment * process_record_unicode_common → process_unicode_common * Move song arrays into function where they're used, align preprocessor directives * Swap the order of UC_WIN and UC_BSD * Update Unicode docs * Reorder Unicode mode stuff to match the order of input mode constants * Fix capitalization in doc subtitle * Readd BSD and OSX_RALT songs * Reword BSD note in docs * Readd BSD keycode description * Reword explanation of input on different platforms * Steal vomindoraan's input mode documentation Co-Authored-By: vomindoraan (vomindoraan@gmail.com) * Willingly give Drashna the rest of my Unicode doc improvements * Wordsmithing Co-Authored-By: drashna <drashna@live.com> * remove merge artifacts * Unicode common cleanup (#17) * Standardize the Unicode EEPROM code * Remove unicode init from process_record_* functions * Add unicode init to where it belongs: matrix_init_quantum * Move Unicode proccessing to unicode common * Add audio feedback to input mode keys to drive konstantin up a wall * Tap_code cleanup * Update keycodes * Update unicode documentation * Update unicode keycodes for consistency/easier merge * Add Audio Feedback section * Remove Functions from feature page And link to the file instead. Link to specific lines later on. * Fix white spaces Co-Authored-By: drashna <drashna@live.com> * Fix spacing Co-Authored-By: drashna <drashna@live.com> * Because I missed it! Co-Authored-By: drashna <drashna@live.com> * Fix spacing Co-Authored-By: drashna <drashna@live.com> * SPAAAAAAAAAACing Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * Add BSD for future compatibility * Thought I fixed that! Co-Authored-By: drashna <drashna@live.com> * non-breaking Co-Authored-By: drashna <drashna@live.com> * Considered that Co-Authored-By: drashna <drashna@live.com> * Yuuup Co-Authored-By: drashna <drashna@live.com> * consistency Co-Authored-By: drashna <drashna@live.com> * white spaces .... copied from elsewhere Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * Update keycode defines * Fix Linux Song * Update all of the songs * Cleanup * Move and update check to ensure only one unicode method is enabled * Update quantum/quantum_keycodes.h * Update documentation * Wordsmithing and cleanup * Format unicode_common (#13) * case alignment * process_record_unicode_common → process_unicode_common * Move song arrays into function where they're used, align preprocessor directives * Swap the order of UC_WIN and UC_BSD * Update Unicode docs * Reorder Unicode mode stuff to match the order of input mode constants * Fix capitalization in doc subtitle * Readd BSD and OSX_RALT songs * Reword BSD note in docs * Readd BSD keycode description * Reword explanation of input on different platforms * Steal vomindoraan's input mode documentation Co-Authored-By: vomindoraan (vomindoraan@gmail.com) * Willingly give Drashna the rest of my Unicode doc improvements * Wordsmithing Co-Authored-By: drashna <drashna@live.com> * Rearrange process_unicode_common functions * Make Unicode input mode constants (UC_*) an enum * Simplify unicode_input_start/finish code * Make the key used for WinCompose configurable * Remove UC_OSX_RALT in favor of setting the key with UNICODE_OSX_KEY * Update Unicode input mode doc * Add descriptions and rearrange definitions in process_unicode_common.h * Add registry command to Unicode docs + misc updates * Reword an explanation in Unicode docs * Add TODO comment * Remove trailing whitespace * Improve Cycling documentation * Add Unicode Input method Cycling support (#19) * Standardize the Unicode EEPROM code * Remove unicode init from process_record_* functions * Add unicode init to where it belongs: matrix_init_quantum * Move Unicode proccessing to unicode common * Add audio feedback to input mode keys to drive konstantin up a wall * Tap_code cleanup * Update keycodes * Update unicode documentation * Update unicode keycodes for consistency/easier merge * Add Audio Feedback section * Remove Functions from feature page And link to the file instead. Link to specific lines later on. * Fix white spaces Co-Authored-By: drashna <drashna@live.com> * Fix spacing Co-Authored-By: drashna <drashna@live.com> * Because I missed it! Co-Authored-By: drashna <drashna@live.com> * Fix spacing Co-Authored-By: drashna <drashna@live.com> * SPAAAAAAAAAACing Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * Add BSD for future compatibility * Thought I fixed that! Co-Authored-By: drashna <drashna@live.com> * non-breaking Co-Authored-By: drashna <drashna@live.com> * Considered that Co-Authored-By: drashna <drashna@live.com> * Yuuup Co-Authored-By: drashna <drashna@live.com> * consistency Co-Authored-By: drashna <drashna@live.com> * white spaces .... copied from elsewhere Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * Update keycode defines * Fix Linux Song * Update all of the songs * Cleanup * Move and update check to ensure only one unicode method is enabled * Update quantum/quantum_keycodes.h * Update documentation * Wordsmithing and cleanup * Format unicode_common (#13) * case alignment * process_record_unicode_common → process_unicode_common * Move song arrays into function where they're used, align preprocessor directives * Swap the order of UC_WIN and UC_BSD * Update Unicode docs * Reorder Unicode mode stuff to match the order of input mode constants * Fix capitalization in doc subtitle * Readd BSD and OSX_RALT songs * Reword BSD note in docs * Readd BSD keycode description * Reword explanation of input on different platforms * Steal vomindoraan's input mode documentation Co-Authored-By: vomindoraan (vomindoraan@gmail.com) * Willingly give Drashna the rest of my Unicode doc improvements * Wordsmithing Co-Authored-By: drashna <drashna@live.com> * Rearrange process_unicode_common functions * Make Unicode input mode constants (UC_*) an enum * Simplify unicode_input_start/finish code * Make the key used for WinCompose configurable * Remove UC_OSX_RALT in favor of setting the key with UNICODE_OSX_KEY * Update Unicode input mode doc * Add descriptions and rearrange definitions in process_unicode_common.h * Add registry command to Unicode docs + misc updates * Reword an explanation in Unicode docs * Add TODO comment * Add cycle_unicode_input_mode and UNICODE_SELECTED_MODES macro * Add an option for making cycle changes persistent * Add debug prints to functions that change input_mode * Use cycle_unicode_input_mode in whitefox/konstantin * Add persist_unicode_input_mode function * Add offset to cycle to allow stepping in reverse * Add keycodes: UNICODE_MODE_FORWARD, UNICODE_MODE_REVERSE Aliases: UC_MOD, UC_RMOD (respectively) * REVERT ME: Undo changes to whitefox/konstantin to avoid conflicts * Fix wrong constant name * Revert "REVERT ME: Undo changes to whitefox/konstantin to avoid conflicts" This reverts commit 42676bf251fc8e3823f5e614dad6e510ba47a2f3. * Change dprintf text * Give selected modes priority over EEPROM when !UNICODE_CYCLE_PERSIST * Remove trailing whitespace * Cleanup of RALT code and unicode compilation stuff * Remove else for unicode handling
5 years ago
Overhaul Unicode Common functionality (#4325) * Standardize the Unicode EEPROM code * Remove unicode init from process_record_* functions * Add unicode init to where it belongs: matrix_init_quantum * Move Unicode proccessing to unicode common * Add audio feedback to input mode keys to drive konstantin up a wall * Tap_code cleanup * Update keycodes * Update unicode documentation * Update unicode keycodes for consistency/easier merge * Add Audio Feedback section * Remove Functions from feature page And link to the file instead. Link to specific lines later on. * Fix spacing Co-Authored-By: drashna <drashna@live.com> * Because I missed it! Co-Authored-By: drashna <drashna@live.com> * Fix spacing Co-Authored-By: drashna <drashna@live.com> * SPAAAAAAAAAACing Co-Authored-By: drashna <drashna@live.com> * Add BSD for future compatibility * Thought I fixed that! Co-Authored-By: drashna <drashna@live.com> * non-breaking Co-Authored-By: drashna <drashna@live.com> * Considered that Co-Authored-By: drashna <drashna@live.com> * Yuuup Co-Authored-By: drashna <drashna@live.com> * consistency Co-Authored-By: drashna <drashna@live.com> * white spaces .... copied from elsewhere Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * Update keycode defines * Fix Linux Song * Update all of the songs * Cleanup * Move and update check to ensure only one unicode method is enabled * Update quantum/quantum_keycodes.h * Update documentation * Wordsmithing and cleanup * Format unicode_common (#13) * case alignment * process_record_unicode_common → process_unicode_common * Move song arrays into function where they're used, align preprocessor directives * Swap the order of UC_WIN and UC_BSD * Update Unicode docs * Reorder Unicode mode stuff to match the order of input mode constants * Fix capitalization in doc subtitle * Readd BSD and OSX_RALT songs * Reword BSD note in docs * Readd BSD keycode description * Reword explanation of input on different platforms * Steal vomindoraan's input mode documentation Co-Authored-By: vomindoraan (vomindoraan@gmail.com) * Willingly give Drashna the rest of my Unicode doc improvements * Wordsmithing Co-Authored-By: drashna <drashna@live.com> * remove merge artifacts * Unicode common cleanup (#17) * Standardize the Unicode EEPROM code * Remove unicode init from process_record_* functions * Add unicode init to where it belongs: matrix_init_quantum * Move Unicode proccessing to unicode common * Add audio feedback to input mode keys to drive konstantin up a wall * Tap_code cleanup * Update keycodes * Update unicode documentation * Update unicode keycodes for consistency/easier merge * Add Audio Feedback section * Remove Functions from feature page And link to the file instead. Link to specific lines later on. * Fix white spaces Co-Authored-By: drashna <drashna@live.com> * Fix spacing Co-Authored-By: drashna <drashna@live.com> * Because I missed it! Co-Authored-By: drashna <drashna@live.com> * Fix spacing Co-Authored-By: drashna <drashna@live.com> * SPAAAAAAAAAACing Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * Add BSD for future compatibility * Thought I fixed that! Co-Authored-By: drashna <drashna@live.com> * non-breaking Co-Authored-By: drashna <drashna@live.com> * Considered that Co-Authored-By: drashna <drashna@live.com> * Yuuup Co-Authored-By: drashna <drashna@live.com> * consistency Co-Authored-By: drashna <drashna@live.com> * white spaces .... copied from elsewhere Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * Update keycode defines * Fix Linux Song * Update all of the songs * Cleanup * Move and update check to ensure only one unicode method is enabled * Update quantum/quantum_keycodes.h * Update documentation * Wordsmithing and cleanup * Format unicode_common (#13) * case alignment * process_record_unicode_common → process_unicode_common * Move song arrays into function where they're used, align preprocessor directives * Swap the order of UC_WIN and UC_BSD * Update Unicode docs * Reorder Unicode mode stuff to match the order of input mode constants * Fix capitalization in doc subtitle * Readd BSD and OSX_RALT songs * Reword BSD note in docs * Readd BSD keycode description * Reword explanation of input on different platforms * Steal vomindoraan's input mode documentation Co-Authored-By: vomindoraan (vomindoraan@gmail.com) * Willingly give Drashna the rest of my Unicode doc improvements * Wordsmithing Co-Authored-By: drashna <drashna@live.com> * Rearrange process_unicode_common functions * Make Unicode input mode constants (UC_*) an enum * Simplify unicode_input_start/finish code * Make the key used for WinCompose configurable * Remove UC_OSX_RALT in favor of setting the key with UNICODE_OSX_KEY * Update Unicode input mode doc * Add descriptions and rearrange definitions in process_unicode_common.h * Add registry command to Unicode docs + misc updates * Reword an explanation in Unicode docs * Add TODO comment * Remove trailing whitespace * Improve Cycling documentation * Add Unicode Input method Cycling support (#19) * Standardize the Unicode EEPROM code * Remove unicode init from process_record_* functions * Add unicode init to where it belongs: matrix_init_quantum * Move Unicode proccessing to unicode common * Add audio feedback to input mode keys to drive konstantin up a wall * Tap_code cleanup * Update keycodes * Update unicode documentation * Update unicode keycodes for consistency/easier merge * Add Audio Feedback section * Remove Functions from feature page And link to the file instead. Link to specific lines later on. * Fix white spaces Co-Authored-By: drashna <drashna@live.com> * Fix spacing Co-Authored-By: drashna <drashna@live.com> * Because I missed it! Co-Authored-By: drashna <drashna@live.com> * Fix spacing Co-Authored-By: drashna <drashna@live.com> * SPAAAAAAAAAACing Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * Add BSD for future compatibility * Thought I fixed that! Co-Authored-By: drashna <drashna@live.com> * non-breaking Co-Authored-By: drashna <drashna@live.com> * Considered that Co-Authored-By: drashna <drashna@live.com> * Yuuup Co-Authored-By: drashna <drashna@live.com> * consistency Co-Authored-By: drashna <drashna@live.com> * white spaces .... copied from elsewhere Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * white spaces Co-Authored-By: drashna <drashna@live.com> * Update keycode defines * Fix Linux Song * Update all of the songs * Cleanup * Move and update check to ensure only one unicode method is enabled * Update quantum/quantum_keycodes.h * Update documentation * Wordsmithing and cleanup * Format unicode_common (#13) * case alignment * process_record_unicode_common → process_unicode_common * Move song arrays into function where they're used, align preprocessor directives * Swap the order of UC_WIN and UC_BSD * Update Unicode docs * Reorder Unicode mode stuff to match the order of input mode constants * Fix capitalization in doc subtitle * Readd BSD and OSX_RALT songs * Reword BSD note in docs * Readd BSD keycode description * Reword explanation of input on different platforms * Steal vomindoraan's input mode documentation Co-Authored-By: vomindoraan (vomindoraan@gmail.com) * Willingly give Drashna the rest of my Unicode doc improvements * Wordsmithing Co-Authored-By: drashna <drashna@live.com> * Rearrange process_unicode_common functions * Make Unicode input mode constants (UC_*) an enum * Simplify unicode_input_start/finish code * Make the key used for WinCompose configurable * Remove UC_OSX_RALT in favor of setting the key with UNICODE_OSX_KEY * Update Unicode input mode doc * Add descriptions and rearrange definitions in process_unicode_common.h * Add registry command to Unicode docs + misc updates * Reword an explanation in Unicode docs * Add TODO comment * Add cycle_unicode_input_mode and UNICODE_SELECTED_MODES macro * Add an option for making cycle changes persistent * Add debug prints to functions that change input_mode * Use cycle_unicode_input_mode in whitefox/konstantin * Add persist_unicode_input_mode function * Add offset to cycle to allow stepping in reverse * Add keycodes: UNICODE_MODE_FORWARD, UNICODE_MODE_REVERSE Aliases: UC_MOD, UC_RMOD (respectively) * REVERT ME: Undo changes to whitefox/konstantin to avoid conflicts * Fix wrong constant name * Revert "REVERT ME: Undo changes to whitefox/konstantin to avoid conflicts" This reverts commit 42676bf251fc8e3823f5e614dad6e510ba47a2f3. * Change dprintf text * Give selected modes priority over EEPROM when !UNICODE_CYCLE_PERSIST * Remove trailing whitespace * Cleanup of RALT code and unicode compilation stuff * Remove else for unicode handling
5 years ago
  1. /* Copyright 2016-2017 Jack Humbert
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef QUANTUM_KEYCODES_H
  17. #define QUANTUM_KEYCODES_H
  18. #ifndef MIDI_ENABLE_STRICT
  19. # define MIDI_ENABLE_STRICT 0
  20. #endif
  21. #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED))
  22. # ifndef MIDI_TONE_KEYCODE_OCTAVES
  23. # define MIDI_TONE_KEYCODE_OCTAVES 3
  24. # endif
  25. #endif
  26. // Fillers to make layering more clear
  27. #define _______ KC_TRNS
  28. #define XXXXXXX KC_NO
  29. enum quantum_keycodes {
  30. // Ranges used in shortcuts - not to be used directly
  31. QK_BASIC = 0x0000,
  32. QK_BASIC_MAX = 0x00FF,
  33. QK_MODS = 0x0100,
  34. QK_LCTL = 0x0100,
  35. QK_LSFT = 0x0200,
  36. QK_LALT = 0x0400,
  37. QK_LGUI = 0x0800,
  38. QK_RMODS_MIN = 0x1000,
  39. QK_RCTL = 0x1100,
  40. QK_RSFT = 0x1200,
  41. QK_RALT = 0x1400,
  42. QK_RGUI = 0x1800,
  43. QK_MODS_MAX = 0x1FFF,
  44. QK_FUNCTION = 0x2000,
  45. QK_FUNCTION_MAX = 0x2FFF,
  46. QK_MACRO = 0x3000,
  47. QK_MACRO_MAX = 0x3FFF,
  48. QK_LAYER_TAP = 0x4000,
  49. QK_LAYER_TAP_MAX = 0x4FFF,
  50. QK_TO = 0x5000,
  51. QK_TO_MAX = 0x50FF,
  52. QK_MOMENTARY = 0x5100,
  53. QK_MOMENTARY_MAX = 0x51FF,
  54. QK_DEF_LAYER = 0x5200,
  55. QK_DEF_LAYER_MAX = 0x52FF,
  56. QK_TOGGLE_LAYER = 0x5300,
  57. QK_TOGGLE_LAYER_MAX = 0x53FF,
  58. QK_ONE_SHOT_LAYER = 0x5400,
  59. QK_ONE_SHOT_LAYER_MAX = 0x54FF,
  60. QK_ONE_SHOT_MOD = 0x5500,
  61. QK_ONE_SHOT_MOD_MAX = 0x55FF,
  62. QK_TAP_DANCE = 0x5700,
  63. QK_TAP_DANCE_MAX = 0x57FF,
  64. QK_LAYER_TAP_TOGGLE = 0x5800,
  65. QK_LAYER_TAP_TOGGLE_MAX = 0x58FF,
  66. QK_LAYER_MOD = 0x5900,
  67. QK_LAYER_MOD_MAX = 0x59FF,
  68. #ifdef STENO_ENABLE
  69. QK_STENO = 0x5A00,
  70. QK_STENO_BOLT = 0x5A30,
  71. QK_STENO_GEMINI = 0x5A31,
  72. QK_STENO_MAX = 0x5A3F,
  73. #endif
  74. #ifdef SWAP_HANDS_ENABLE
  75. QK_SWAP_HANDS = 0x5B00,
  76. QK_SWAP_HANDS_MAX = 0x5BFF,
  77. #endif
  78. QK_MOD_TAP = 0x6000,
  79. QK_MOD_TAP_MAX = 0x7FFF,
  80. #ifdef UNICODE_ENABLE
  81. QK_UNICODE = 0x8000,
  82. QK_UNICODE_MAX = 0xFFFF,
  83. #endif
  84. #ifdef UNICODEMAP_ENABLE
  85. QK_UNICODEMAP = 0x8000,
  86. QK_UNICODEMAP_MAX = 0xBFFF,
  87. QK_UNICODEMAP_PAIR = 0xC000,
  88. QK_UNICODEMAP_PAIR_MAX = 0xFFFF,
  89. #endif
  90. // Loose keycodes - to be used directly
  91. RESET = 0x5C00,
  92. DEBUG,
  93. MAGIC_SWAP_CONTROL_CAPSLOCK,
  94. MAGIC_CAPSLOCK_TO_CONTROL,
  95. MAGIC_SWAP_LALT_LGUI,
  96. MAGIC_SWAP_RALT_RGUI,
  97. MAGIC_NO_GUI,
  98. MAGIC_SWAP_GRAVE_ESC,
  99. MAGIC_SWAP_BACKSLASH_BACKSPACE,
  100. MAGIC_HOST_NKRO,
  101. MAGIC_SWAP_ALT_GUI,
  102. MAGIC_UNSWAP_CONTROL_CAPSLOCK,
  103. MAGIC_UNCAPSLOCK_TO_CONTROL,
  104. MAGIC_UNSWAP_LALT_LGUI,
  105. MAGIC_UNSWAP_RALT_RGUI,
  106. MAGIC_UNNO_GUI,
  107. MAGIC_UNSWAP_GRAVE_ESC,
  108. MAGIC_UNSWAP_BACKSLASH_BACKSPACE,
  109. MAGIC_UNHOST_NKRO,
  110. MAGIC_UNSWAP_ALT_GUI,
  111. MAGIC_TOGGLE_NKRO,
  112. MAGIC_TOGGLE_ALT_GUI,
  113. GRAVE_ESC,
  114. // Leader key
  115. #ifdef LEADER_ENABLE
  116. KC_LEAD,
  117. #endif
  118. // Auto Shift setup
  119. #ifndef AUTO_SHIFT_NO_SETUP
  120. KC_ASUP,
  121. KC_ASDN,
  122. KC_ASRP,
  123. #endif
  124. KC_ASTG,
  125. KC_ASON,
  126. KC_ASOFF,
  127. // Audio on/off/toggle
  128. AU_ON,
  129. AU_OFF,
  130. AU_TOG,
  131. // Faux clicky as part of main audio feature
  132. CLICKY_TOGGLE,
  133. CLICKY_ENABLE,
  134. CLICKY_DISABLE,
  135. CLICKY_UP,
  136. CLICKY_DOWN,
  137. CLICKY_RESET,
  138. #ifdef FAUXCLICKY_ENABLE
  139. // Faux clicky
  140. FC_ON,
  141. FC_OFF,
  142. FC_TOG,
  143. #endif
  144. // Music mode on/off/toggle
  145. MU_ON,
  146. MU_OFF,
  147. MU_TOG,
  148. // Music mode cycle
  149. MU_MOD,
  150. // Music voice iterate
  151. MUV_IN,
  152. MUV_DE,
  153. // Midi
  154. #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
  155. MI_ON,
  156. MI_OFF,
  157. MI_TOG,
  158. #endif
  159. #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED))
  160. MIDI_TONE_MIN,
  161. # if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 0
  162. MI_C = MIDI_TONE_MIN,
  163. MI_Cs,
  164. MI_Db = MI_Cs,
  165. MI_D,
  166. MI_Ds,
  167. MI_Eb = MI_Ds,
  168. MI_E,
  169. MI_F,
  170. MI_Fs,
  171. MI_Gb = MI_Fs,
  172. MI_G,
  173. MI_Gs,
  174. MI_Ab = MI_Gs,
  175. MI_A,
  176. MI_As,
  177. MI_Bb = MI_As,
  178. MI_B,
  179. # endif
  180. # if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 1
  181. MI_C_1,
  182. MI_Cs_1,
  183. MI_Db_1 = MI_Cs_1,
  184. MI_D_1,
  185. MI_Ds_1,
  186. MI_Eb_1 = MI_Ds_1,
  187. MI_E_1,
  188. MI_F_1,
  189. MI_Fs_1,
  190. MI_Gb_1 = MI_Fs_1,
  191. MI_G_1,
  192. MI_Gs_1,
  193. MI_Ab_1 = MI_Gs_1,
  194. MI_A_1,
  195. MI_As_1,
  196. MI_Bb_1 = MI_As_1,
  197. MI_B_1,
  198. # endif
  199. # if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 2
  200. MI_C_2,
  201. MI_Cs_2,
  202. MI_Db_2 = MI_Cs_2,
  203. MI_D_2,
  204. MI_Ds_2,
  205. MI_Eb_2 = MI_Ds_2,
  206. MI_E_2,
  207. MI_F_2,
  208. MI_Fs_2,
  209. MI_Gb_2 = MI_Fs_2,
  210. MI_G_2,
  211. MI_Gs_2,
  212. MI_Ab_2 = MI_Gs_2,
  213. MI_A_2,
  214. MI_As_2,
  215. MI_Bb_2 = MI_As_2,
  216. MI_B_2,
  217. # endif
  218. # if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 3
  219. MI_C_3,
  220. MI_Cs_3,
  221. MI_Db_3 = MI_Cs_3,
  222. MI_D_3,
  223. MI_Ds_3,
  224. MI_Eb_3 = MI_Ds_3,
  225. MI_E_3,
  226. MI_F_3,
  227. MI_Fs_3,
  228. MI_Gb_3 = MI_Fs_3,
  229. MI_G_3,
  230. MI_Gs_3,
  231. MI_Ab_3 = MI_Gs_3,
  232. MI_A_3,
  233. MI_As_3,
  234. MI_Bb_3 = MI_As_3,
  235. MI_B_3,
  236. # endif
  237. # if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 4
  238. MI_C_4,
  239. MI_Cs_4,
  240. MI_Db_4 = MI_Cs_4,
  241. MI_D_4,
  242. MI_Ds_4,
  243. MI_Eb_4 = MI_Ds_4,
  244. MI_E_4,
  245. MI_F_4,
  246. MI_Fs_4,
  247. MI_Gb_4 = MI_Fs_4,
  248. MI_G_4,
  249. MI_Gs_4,
  250. MI_Ab_4 = MI_Gs_4,
  251. MI_A_4,
  252. MI_As_4,
  253. MI_Bb_4 = MI_As_4,
  254. MI_B_4,
  255. # endif
  256. # if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5
  257. MI_C_5,
  258. MI_Cs_5,
  259. MI_Db_5 = MI_Cs_5,
  260. MI_D_5,
  261. MI_Ds_5,
  262. MI_Eb_5 = MI_Ds_5,
  263. MI_E_5,
  264. MI_F_5,
  265. MI_Fs_5,
  266. MI_Gb_5 = MI_Fs_5,
  267. MI_G_5,
  268. MI_Gs_5,
  269. MI_Ab_5 = MI_Gs_5,
  270. MI_A_5,
  271. MI_As_5,
  272. MI_Bb_5 = MI_As_5,
  273. MI_B_5,
  274. # endif
  275. # if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5
  276. MIDI_TONE_MAX = MI_B_5,
  277. # elif MIDI_TONE_KEYCODE_OCTAVES > 4
  278. MIDI_TONE_MAX = MI_B_4,
  279. # elif MIDI_TONE_KEYCODE_OCTAVES > 3
  280. MIDI_TONE_MAX = MI_B_3,
  281. # elif MIDI_TONE_KEYCODE_OCTAVES > 2
  282. MIDI_TONE_MAX = MI_B_2,
  283. # elif MIDI_TONE_KEYCODE_OCTAVES > 1
  284. MIDI_TONE_MAX = MI_B_1,
  285. # elif MIDI_TONE_KEYCODE_OCTAVES > 0
  286. MIDI_TONE_MAX = MI_B,
  287. # endif
  288. MIDI_OCTAVE_MIN,
  289. MI_OCT_N2 = MIDI_OCTAVE_MIN,
  290. MI_OCT_N1,
  291. MI_OCT_0,
  292. MI_OCT_1,
  293. MI_OCT_2,
  294. MI_OCT_3,
  295. MI_OCT_4,
  296. MI_OCT_5,
  297. MI_OCT_6,
  298. MI_OCT_7,
  299. MIDI_OCTAVE_MAX = MI_OCT_7,
  300. MI_OCTD, // octave down
  301. MI_OCTU, // octave up
  302. MIDI_TRANSPOSE_MIN,
  303. MI_TRNS_N6 = MIDI_TRANSPOSE_MIN,
  304. MI_TRNS_N5,
  305. MI_TRNS_N4,
  306. MI_TRNS_N3,
  307. MI_TRNS_N2,
  308. MI_TRNS_N1,
  309. MI_TRNS_0,
  310. MI_TRNS_1,
  311. MI_TRNS_2,
  312. MI_TRNS_3,
  313. MI_TRNS_4,
  314. MI_TRNS_5,
  315. MI_TRNS_6,
  316. MIDI_TRANSPOSE_MAX = MI_TRNS_6,
  317. MI_TRNSD, // transpose down
  318. MI_TRNSU, // transpose up
  319. MIDI_VELOCITY_MIN,
  320. MI_VEL_1 = MIDI_VELOCITY_MIN,
  321. MI_VEL_2,
  322. MI_VEL_3,
  323. MI_VEL_4,
  324. MI_VEL_5,
  325. MI_VEL_6,
  326. MI_VEL_7,
  327. MI_VEL_8,
  328. MI_VEL_9,
  329. MI_VEL_10,
  330. MIDI_VELOCITY_MAX = MI_VEL_10,
  331. MI_VELD, // velocity down
  332. MI_VELU, // velocity up
  333. MIDI_CHANNEL_MIN,
  334. MI_CH1 = MIDI_CHANNEL_MIN,
  335. MI_CH2,
  336. MI_CH3,
  337. MI_CH4,
  338. MI_CH5,
  339. MI_CH6,
  340. MI_CH7,
  341. MI_CH8,
  342. MI_CH9,
  343. MI_CH10,
  344. MI_CH11,
  345. MI_CH12,
  346. MI_CH13,
  347. MI_CH14,
  348. MI_CH15,
  349. MI_CH16,
  350. MIDI_CHANNEL_MAX = MI_CH16,
  351. MI_CHD, // previous channel
  352. MI_CHU, // next channel
  353. MI_ALLOFF, // all notes off
  354. MI_SUS, // sustain
  355. MI_PORT, // portamento
  356. MI_SOST, // sostenuto
  357. MI_SOFT, // soft pedal
  358. MI_LEG, // legato
  359. MI_MOD, // modulation
  360. MI_MODSD, // decrease modulation speed
  361. MI_MODSU, // increase modulation speed
  362. MI_BENDD, // Bend down
  363. MI_BENDU, // Bend up
  364. #endif // MIDI_ADVANCED
  365. // Backlight functionality
  366. BL_ON,
  367. BL_OFF,
  368. BL_DEC,
  369. BL_INC,
  370. BL_TOGG,
  371. BL_STEP,
  372. BL_BRTG,
  373. // RGB functionality
  374. RGB_TOG,
  375. RGB_MODE_FORWARD,
  376. RGB_MODE_REVERSE,
  377. RGB_HUI,
  378. RGB_HUD,
  379. RGB_SAI,
  380. RGB_SAD,
  381. RGB_VAI,
  382. RGB_VAD,
  383. RGB_SPI,
  384. RGB_SPD,
  385. RGB_MODE_PLAIN,
  386. RGB_MODE_BREATHE,
  387. RGB_MODE_RAINBOW,
  388. RGB_MODE_SWIRL,
  389. RGB_MODE_SNAKE,
  390. RGB_MODE_KNIGHT,
  391. RGB_MODE_XMAS,
  392. RGB_MODE_GRADIENT,
  393. RGB_MODE_RGBTEST,
  394. // Momentum matching toggle
  395. VLK_TOG,
  396. // Left shift, open paren
  397. KC_LSPO,
  398. // Right shift, close paren
  399. KC_RSPC,
  400. // Shift, Enter
  401. KC_SFTENT,
  402. // Printing
  403. PRINT_ON,
  404. PRINT_OFF,
  405. // output selection
  406. OUT_AUTO,
  407. OUT_USB,
  408. #ifdef BLUETOOTH_ENABLE
  409. OUT_BT,
  410. #endif
  411. #ifdef KEY_LOCK_ENABLE
  412. KC_LOCK,
  413. #endif
  414. #ifdef TERMINAL_ENABLE
  415. TERM_ON,
  416. TERM_OFF,
  417. #endif
  418. EEPROM_RESET,
  419. UNICODE_MODE_FORWARD,
  420. UNICODE_MODE_REVERSE,
  421. UNICODE_MODE_MAC,
  422. UNICODE_MODE_LNX,
  423. UNICODE_MODE_WIN,
  424. UNICODE_MODE_BSD,
  425. UNICODE_MODE_WINC,
  426. HPT_ON,
  427. HPT_OFF,
  428. HPT_TOG,
  429. HPT_RST,
  430. HPT_FBK,
  431. HPT_BUZ,
  432. HPT_MODI,
  433. HPT_MODD,
  434. HPT_CONT,
  435. HPT_CONI,
  436. HPT_COND,
  437. HPT_DWLI,
  438. HPT_DWLD,
  439. // Left control, open paren
  440. KC_LCPO,
  441. // Right control, close paren
  442. KC_RCPC,
  443. // Left control, open paren
  444. KC_LAPO,
  445. // Right control, close paren
  446. KC_RAPC,
  447. CMB_ON,
  448. CMB_OFF,
  449. CMB_TOG,
  450. MAGIC_SWAP_LCTL_LGUI,
  451. MAGIC_SWAP_RCTL_RGUI,
  452. MAGIC_UNSWAP_LCTL_LGUI,
  453. MAGIC_UNSWAP_RCTL_RGUI,
  454. MAGIC_SWAP_CTL_GUI,
  455. MAGIC_UNSWAP_CTL_GUI,
  456. MAGIC_TOGGLE_CTL_GUI,
  457. MAGIC_EE_HANDS_LEFT,
  458. MAGIC_EE_HANDS_RIGHT,
  459. // Dynamic Macros
  460. DYN_REC_START1,
  461. DYN_REC_START2,
  462. DYN_REC_STOP,
  463. DYN_MACRO_PLAY1,
  464. DYN_MACRO_PLAY2,
  465. JS_BUTTON0,
  466. JS_BUTTON_MIN = JS_BUTTON0,
  467. JS_BUTTON1,
  468. JS_BUTTON2,
  469. JS_BUTTON3,
  470. JS_BUTTON4,
  471. JS_BUTTON5,
  472. JS_BUTTON6,
  473. JS_BUTTON7,
  474. JS_BUTTON8,
  475. JS_BUTTON9,
  476. JS_BUTTON10,
  477. JS_BUTTON11,
  478. JS_BUTTON12,
  479. JS_BUTTON13,
  480. JS_BUTTON14,
  481. JS_BUTTON15,
  482. JS_BUTTON16,
  483. JS_BUTTON17,
  484. JS_BUTTON18,
  485. JS_BUTTON19,
  486. JS_BUTTON20,
  487. JS_BUTTON21,
  488. JS_BUTTON22,
  489. JS_BUTTON23,
  490. JS_BUTTON24,
  491. JS_BUTTON25,
  492. JS_BUTTON26,
  493. JS_BUTTON27,
  494. JS_BUTTON28,
  495. JS_BUTTON29,
  496. JS_BUTTON30,
  497. JS_BUTTON31,
  498. JS_BUTTON_MAX = JS_BUTTON31,
  499. // always leave at the end
  500. SAFE_RANGE
  501. };
  502. // Ability to use mods in layouts
  503. #define LCTL(kc) (QK_LCTL | (kc))
  504. #define LSFT(kc) (QK_LSFT | (kc))
  505. #define LALT(kc) (QK_LALT | (kc))
  506. #define LGUI(kc) (QK_LGUI | (kc))
  507. #define LOPT(kc) LALT(kc)
  508. #define LCMD(kc) LGUI(kc)
  509. #define LWIN(kc) LGUI(kc)
  510. #define RCTL(kc) (QK_RCTL | (kc))
  511. #define RSFT(kc) (QK_RSFT | (kc))
  512. #define RALT(kc) (QK_RALT | (kc))
  513. #define RGUI(kc) (QK_RGUI | (kc))
  514. #define ALGR(kc) RALT(kc)
  515. #define ROPT(kc) RALT(kc)
  516. #define RCMD(kc) RGUI(kc)
  517. #define RWIN(kc) RGUI(kc)
  518. #define HYPR(kc) (QK_LCTL | QK_LSFT | QK_LALT | QK_LGUI | (kc))
  519. #define MEH(kc) (QK_LCTL | QK_LSFT | QK_LALT | (kc))
  520. #define LCAG(kc) (QK_LCTL | QK_LALT | QK_LGUI | (kc))
  521. #define SGUI(kc) (QK_LGUI | QK_LSFT | (kc))
  522. #define SCMD(kc) SGUI(kc)
  523. #define SWIN(kc) SGUI(kc)
  524. #define LCA(kc) (QK_LCTL | QK_LALT | (kc))
  525. #define LSA(kc) (QK_LSFT | QK_LALT | (kc))
  526. #define RSA(kc) (QK_RSFT | QK_RALT | (kc))
  527. #define RCS(kc) (QK_RCTL | QK_RSFT | (kc))
  528. #define SAGR(kc) RSA(kc)
  529. #define MOD_HYPR 0xF
  530. #define MOD_MEH 0x7
  531. // Aliases for shifted symbols
  532. // Each key has a 4-letter code, and some have longer aliases too.
  533. // While the long aliases are descriptive, the 4-letter codes
  534. // make for nicer grid layouts (everything lines up), and are
  535. // the preferred style for Quantum.
  536. #define KC_TILD LSFT(KC_GRV) // ~
  537. #define KC_TILDE KC_TILD
  538. #define KC_EXLM LSFT(KC_1) // !
  539. #define KC_EXCLAIM KC_EXLM
  540. #define KC_AT LSFT(KC_2) // @
  541. #define KC_HASH LSFT(KC_3) // #
  542. #define KC_DLR LSFT(KC_4) // $
  543. #define KC_DOLLAR KC_DLR
  544. #define KC_PERC LSFT(KC_5) // %
  545. #define KC_PERCENT KC_PERC
  546. #define KC_CIRC LSFT(KC_6) // ^
  547. #define KC_CIRCUMFLEX KC_CIRC
  548. #define KC_AMPR LSFT(KC_7) // &
  549. #define KC_AMPERSAND KC_AMPR
  550. #define KC_ASTR LSFT(KC_8) // *
  551. #define KC_ASTERISK KC_ASTR
  552. #define KC_LPRN LSFT(KC_9) // (
  553. #define KC_LEFT_PAREN KC_LPRN
  554. #define KC_RPRN LSFT(KC_0) // )
  555. #define KC_RIGHT_PAREN KC_RPRN
  556. #define KC_UNDS LSFT(KC_MINS) // _
  557. #define KC_UNDERSCORE KC_UNDS
  558. #define KC_PLUS LSFT(KC_EQL) // +
  559. #define KC_LCBR LSFT(KC_LBRC) // {
  560. #define KC_LEFT_CURLY_BRACE KC_LCBR
  561. #define KC_RCBR LSFT(KC_RBRC) // }
  562. #define KC_RIGHT_CURLY_BRACE KC_RCBR
  563. #define KC_LABK LSFT(KC_COMM) // <
  564. #define KC_LEFT_ANGLE_BRACKET KC_LABK
  565. #define KC_RABK LSFT(KC_DOT) // >
  566. #define KC_RIGHT_ANGLE_BRACKET KC_RABK
  567. #define KC_COLN LSFT(KC_SCLN) // :
  568. #define KC_COLON KC_COLN
  569. #define KC_PIPE LSFT(KC_BSLS) // |
  570. #define KC_LT LSFT(KC_COMM) // <
  571. #define KC_GT LSFT(KC_DOT) // >
  572. #define KC_QUES LSFT(KC_SLSH) // ?
  573. #define KC_QUESTION KC_QUES
  574. #define KC_DQT LSFT(KC_QUOT) // "
  575. #define KC_DOUBLE_QUOTE KC_DQT
  576. #define KC_DQUO KC_DQT
  577. #define KC_DELT KC_DELETE // Del key (four letter code)
  578. // Alias for function layers than expand past FN31
  579. #define FUNC(kc) (QK_FUNCTION | (kc))
  580. // Aliases
  581. #define C(kc) LCTL(kc)
  582. #define S(kc) LSFT(kc)
  583. #define A(kc) LALT(kc)
  584. #define G(kc) LGUI(kc)
  585. #define F(kc) FUNC(kc)
  586. #define M(kc) (QK_MACRO | (kc))
  587. #define MACROTAP(kc) (QK_MACRO | (FUNC_TAP << 8) | (kc))
  588. #define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE)
  589. #define KC_GESC GRAVE_ESC
  590. #define EEP_RST EEPROM_RESET
  591. #define CK_TOGG CLICKY_TOGGLE
  592. #define CK_RST CLICKY_RESET
  593. #define CK_UP CLICKY_UP
  594. #define CK_DOWN CLICKY_DOWN
  595. #define CK_ON CLICKY_ENABLE
  596. #define CK_OFF CLICKY_DISABLE
  597. #define RGB_MOD RGB_MODE_FORWARD
  598. #define RGB_RMOD RGB_MODE_REVERSE
  599. #define RGB_M_P RGB_MODE_PLAIN
  600. #define RGB_M_B RGB_MODE_BREATHE
  601. #define RGB_M_R RGB_MODE_RAINBOW
  602. #define RGB_M_SW RGB_MODE_SWIRL
  603. #define RGB_M_SN RGB_MODE_SNAKE
  604. #define RGB_M_K RGB_MODE_KNIGHT
  605. #define RGB_M_X RGB_MODE_XMAS
  606. #define RGB_M_G RGB_MODE_GRADIENT
  607. #define RGB_M_T RGB_MODE_RGBTEST
  608. // L-ayer, T-ap - 256 keycode max, 16 layer max
  609. #define LT(layer, kc) (QK_LAYER_TAP | (((layer)&0xF) << 8) | ((kc)&0xFF))
  610. #define CL_SWAP MAGIC_SWAP_CONTROL_CAPSLOCK
  611. #define CL_NORM MAGIC_UNSWAP_CONTROL_CAPSLOCK
  612. #define CL_CTRL MAGIC_CAPSLOCK_TO_CONTROL
  613. #define CL_CAPS MAGIC_UNCAPSLOCK_TO_CONTROL
  614. #define LCG_SWP MAGIC_SWAP_LCTL_LGUI
  615. #define LCG_NRM MAGIC_UNSWAP_LCTL_LGUI
  616. #define RCG_SWP MAGIC_SWAP_RCTL_RGUI
  617. #define RCG_NRM MAGIC_UNSWAP_RCTL_RGUI
  618. #define CG_SWAP MAGIC_SWAP_CTL_GUI
  619. #define CG_NORM MAGIC_UNSWAP_CTL_GUI
  620. #define CG_TOGG MAGIC_TOGGLE_CTL_GUI
  621. #define LAG_SWP MAGIC_SWAP_LALT_LGUI
  622. #define LAG_NRM MAGIC_UNSWAP_LALT_LGUI
  623. #define RAG_SWP MAGIC_SWAP_RALT_RGUI
  624. #define RAG_NRM MAGIC_UNSWAP_RALT_RGUI
  625. #define AG_SWAP MAGIC_SWAP_ALT_GUI
  626. #define AG_NORM MAGIC_UNSWAP_ALT_GUI
  627. #define AG_TOGG MAGIC_TOGGLE_ALT_GUI
  628. #define GUI_OFF MAGIC_NO_GUI
  629. #define GUI_ON MAGIC_UNNO_GUI
  630. #define GE_SWAP MAGIC_SWAP_GRAVE_ESC
  631. #define GE_NORM MAGIC_UNSWAP_GRAVE_ESC
  632. #define BS_SWAP MAGIC_SWAP_BACKSLASH_BACKSPACE
  633. #define BS_NORM MAGIC_UNSWAP_BACKSLASH_BACKSPACE
  634. #define NK_ON MAGIC_HOST_NKRO
  635. #define NK_OFF MAGIC_UNHOST_NKRO
  636. #define NK_TOGG MAGIC_TOGGLE_NKRO
  637. #define EH_LEFT MAGIC_EE_HANDS_LEFT
  638. #define EH_RGHT MAGIC_EE_HANDS_RIGHT
  639. // GOTO layer - 16 layers max
  640. // when:
  641. // ON_PRESS = 1
  642. // ON_RELEASE = 2
  643. // Unless you have a good reason not to do so, prefer ON_PRESS (1) as your default.
  644. // In fact, we changed it to assume ON_PRESS for sanity/simplicity. If needed, you can add your own
  645. // keycode modeled after the old version, kept below for this.
  646. /* #define TO(layer, when) (QK_TO | (when << 0x4) | (layer & 0xFF)) */
  647. #define TO(layer) (QK_TO | (ON_PRESS << 0x4) | ((layer)&0xFF))
  648. // Momentary switch layer - 256 layer max
  649. #define MO(layer) (QK_MOMENTARY | ((layer)&0xFF))
  650. // Set default layer - 256 layer max
  651. #define DF(layer) (QK_DEF_LAYER | ((layer)&0xFF))
  652. // Toggle to layer - 256 layer max
  653. #define TG(layer) (QK_TOGGLE_LAYER | ((layer)&0xFF))
  654. // One-shot layer - 256 layer max
  655. #define OSL(layer) (QK_ONE_SHOT_LAYER | ((layer)&0xFF))
  656. // L-ayer M-od: Momentary switch layer with modifiers active - 16 layer max, left mods only
  657. #define LM(layer, mod) (QK_LAYER_MOD | (((layer)&0xF) << 4) | ((mod)&0xF))
  658. // One-shot mod
  659. #define OSM(mod) (QK_ONE_SHOT_MOD | ((mod)&0xFF))
  660. // Layer tap-toggle
  661. #define TT(layer) (QK_LAYER_TAP_TOGGLE | ((layer)&0xFF))
  662. // M-od, T-ap - 256 keycode max
  663. #define MT(mod, kc) (QK_MOD_TAP | (((mod)&0x1F) << 8) | ((kc)&0xFF))
  664. #define LCTL_T(kc) MT(MOD_LCTL, kc)
  665. #define RCTL_T(kc) MT(MOD_RCTL, kc)
  666. #define CTL_T(kc) LCTL_T(kc)
  667. #define LSFT_T(kc) MT(MOD_LSFT, kc)
  668. #define RSFT_T(kc) MT(MOD_RSFT, kc)
  669. #define SFT_T(kc) LSFT_T(kc)
  670. #define LALT_T(kc) MT(MOD_LALT, kc)
  671. #define RALT_T(kc) MT(MOD_RALT, kc)
  672. #define LOPT_T(kc) LALT_T(kc)
  673. #define ROPT_T(kc) RALT_T(kc)
  674. #define ALGR_T(kc) RALT_T(kc)
  675. #define ALT_T(kc) LALT_T(kc)
  676. #define OPT_T(kc) LOPT_T(kc)
  677. #define LGUI_T(kc) MT(MOD_LGUI, kc)
  678. #define RGUI_T(kc) MT(MOD_RGUI, kc)
  679. #define LCMD_T(kc) LGUI_T(kc)
  680. #define LWIN_T(kc) LGUI_T(kc)
  681. #define RCMD_T(kc) RGUI_T(kc)
  682. #define RWIN_T(kc) RGUI_T(kc)
  683. #define GUI_T(kc) LGUI_T(kc)
  684. #define CMD_T(kc) LCMD_T(kc)
  685. #define WIN_T(kc) LWIN_T(kc)
  686. #define C_S_T(kc) MT(MOD_LCTL | MOD_LSFT, kc) // Left Control + Shift e.g. for gnome-terminal
  687. #define MEH_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT, kc) // Meh is a less hyper version of the Hyper key -- doesn't include GUI, so just Left Control + Shift + Alt
  688. #define LCAG_T(kc) MT(MOD_LCTL | MOD_LALT | MOD_LGUI, kc) // Left Control + Alt + GUI
  689. #define RCAG_T(kc) MT(MOD_RCTL | MOD_RALT | MOD_RGUI, kc) // Right Control + Alt + GUI
  690. #define HYPR_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI, kc) // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/
  691. #define SGUI_T(kc) MT(MOD_LGUI | MOD_LSFT, kc) // Left Shift + GUI
  692. #define SCMD_T(kc) SGUI_T(kc)
  693. #define SWIN_T(kc) SGUI_T(kc)
  694. #define LCA_T(kc) MT(MOD_LCTL | MOD_LALT, kc) // Left Control + Alt
  695. #define LSA_T(kc) MT(MOD_LSFT | MOD_LALT, kc) // Left Shift + Alt
  696. #define RSA_T(kc) MT(MOD_RSFT | MOD_RALT, kc) // Right Shift + Alt
  697. #define RCS_T(kc) MT(MOD_RCTL | MOD_RSFT, kc) // Right Control + Shift
  698. #define SAGR_T(kc) RSA_T(kc)
  699. #define ALL_T(kc) HYPR_T(kc)
  700. // Dedicated keycode versions for Hyper and Meh, if you want to use them as standalone keys rather than mod-tap
  701. #define KC_HYPR HYPR(KC_NO)
  702. #define KC_MEH MEH(KC_NO)
  703. #ifdef UNICODE_ENABLE
  704. // Allows Unicode input up to 0x7FFF
  705. # define UC(c) (QK_UNICODE | (c))
  706. #endif
  707. #ifdef UNICODEMAP_ENABLE
  708. // Allows Unicode input up to 0x10FFFF, requires unicode_map
  709. # define X(i) (QK_UNICODEMAP | (i))
  710. # define XP(i, j) (QK_UNICODEMAP_PAIR | ((i)&0x7F) | (((j)&0x7F) << 7)) // 127 max i and j
  711. #endif
  712. #define UC_MOD UNICODE_MODE_FORWARD
  713. #define UC_RMOD UNICODE_MODE_REVERSE
  714. #define UC_M_MA UNICODE_MODE_MAC
  715. #define UNICODE_MODE_OSX UNICODE_MODE_MAC // Deprecated alias
  716. #define UC_M_OS UNICODE_MODE_MAC // Deprecated alias
  717. #define UC_M_LN UNICODE_MODE_LNX
  718. #define UC_M_WI UNICODE_MODE_WIN
  719. #define UC_M_BS UNICODE_MODE_BSD
  720. #define UC_M_WC UNICODE_MODE_WINC
  721. #ifdef SWAP_HANDS_ENABLE
  722. # define SH_T(kc) (QK_SWAP_HANDS | (kc))
  723. # define SH_TG (QK_SWAP_HANDS | OP_SH_TOGGLE)
  724. # define SH_TT (QK_SWAP_HANDS | OP_SH_TAP_TOGGLE)
  725. # define SH_OS (QK_SWAP_HANDS | OP_SH_ONESHOT)
  726. # define SH_MON (QK_SWAP_HANDS | OP_SH_ON_OFF)
  727. # define SH_MOFF (QK_SWAP_HANDS | OP_SH_OFF_ON)
  728. # define SH_ON (QK_SWAP_HANDS | OP_SH_ON)
  729. # define SH_OFF (QK_SWAP_HANDS | OP_SH_OFF)
  730. #endif
  731. // Dynamic Macros aliases
  732. #define DM_REC1 DYN_REC_START1
  733. #define DM_REC2 DYN_REC_START2
  734. #define DM_RSTP DYN_REC_STOP
  735. #define DM_PLY1 DYN_MACRO_PLAY1
  736. #define DM_PLY2 DYN_MACRO_PLAY2
  737. #endif // QUANTUM_KEYCODES_H