aboutsummaryrefslogtreecommitdiff
path: root/quantum/quantum.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2019-11-04 22:59:13 -0800
committerJames Young <18669334+noroadsleft@users.noreply.github.com>2019-11-04 22:59:13 -0800
commit542cb0a8ce3f324c6bd46751d733daf86384a8f6 (patch)
tree08128a4e00a42fa0e78199d86f757a8d562952a9 /quantum/quantum.c
parent0e664f92c4d61d685259607d7257c53f60da5fc0 (diff)
downloadqmk_firmware-542cb0a8ce3f324c6bd46751d733daf86384a8f6.tar.gz
qmk_firmware-542cb0a8ce3f324c6bd46751d733daf86384a8f6.zip
[Core] Convert Dynamic Macro to a Core Feature (#5948)
* Convert Dynamic Macro to a Core Feature This imports the code from Dynamic Macro into the core code, and handles it, as such. This deprecates the old method but does not remove it, for legacy support. This way, no existing user files need to be touched. Additionally, this reorganizes the documentation to better reflect the changes. Also, it adds user hooks to the feature so users can customize the existing functionality. Based heavily on and closes #2976 * Apply suggestions from code review Co-Authored-By: fauxpark <fauxpark@gmail.com> Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Cleanup based on feedback * Add short-form keycodes and document them - add short-form keycodes to quantum/quantum_keycodes.h - document the new aliases in docs/feature_dynamic_macros.md * Add Dynamic Macros section and keycodes to docs/keycodes.md * Make anti-nesting optional * Add documentation for DYNAMIC_MACRO_NO_NESTING option * Fix Merge artifacts * Fix formatting typo in docs Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com> * Remove DYNAMIC_MACRO_RANGE as it's not needed * Fix includes and layer var type
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r--quantum/quantum.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 571dda4c5..1f17c6ff7 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -26,7 +26,7 @@
26 26
27#ifdef BACKLIGHT_ENABLE 27#ifdef BACKLIGHT_ENABLE
28# include "backlight.h" 28# include "backlight.h"
29 extern backlight_config_t backlight_config; 29extern backlight_config_t backlight_config;
30#endif 30#endif
31 31
32#ifdef FAUXCLICKY_ENABLE 32#ifdef FAUXCLICKY_ENABLE
@@ -89,7 +89,7 @@ static void do_code16(uint16_t code, void (*f)(uint8_t)) {
89 89
90 uint8_t mods_to_send = 0; 90 uint8_t mods_to_send = 0;
91 91
92 if (code & QK_RMODS_MIN) { // Right mod flag is set 92 if (code & QK_RMODS_MIN) { // Right mod flag is set
93 if (code & QK_LCTL) mods_to_send |= MOD_BIT(KC_RCTL); 93 if (code & QK_LCTL) mods_to_send |= MOD_BIT(KC_RCTL);
94 if (code & QK_LSFT) mods_to_send |= MOD_BIT(KC_RSFT); 94 if (code & QK_LSFT) mods_to_send |= MOD_BIT(KC_RSFT);
95 if (code & QK_LALT) mods_to_send |= MOD_BIT(KC_RALT); 95 if (code & QK_LALT) mods_to_send |= MOD_BIT(KC_RALT);
@@ -222,6 +222,10 @@ bool process_record_quantum(keyrecord_t *record) {
222 // Must run first to be able to mask key_up events. 222 // Must run first to be able to mask key_up events.
223 process_key_lock(&keycode, record) && 223 process_key_lock(&keycode, record) &&
224#endif 224#endif
225#if defined(DYNAMIC_MACRO_ENABLE) && !defined(DYNAMIC_MACRO_USER_CALL)
226 // Must run asap to ensure all keypresses are recorded.
227 process_dynamic_macro(keycode, record) &&
228#endif
225#if defined(AUDIO_ENABLE) && defined(AUDIO_CLICKY) 229#if defined(AUDIO_ENABLE) && defined(AUDIO_CLICKY)
226 process_clicky(keycode, record) && 230 process_clicky(keycode, record) &&
227#endif // AUDIO_CLICKY 231#endif // AUDIO_CLICKY
@@ -563,7 +567,7 @@ bool process_record_quantum(keyrecord_t *record) {
563 keymap_config.swap_backslash_backspace = true; 567 keymap_config.swap_backslash_backspace = true;
564 break; 568 break;
565 case MAGIC_HOST_NKRO: 569 case MAGIC_HOST_NKRO:
566 clear_keyboard(); // clear first buffer to prevent stuck keys 570 clear_keyboard(); // clear first buffer to prevent stuck keys
567 keymap_config.nkro = true; 571 keymap_config.nkro = true;
568 break; 572 break;
569 case MAGIC_SWAP_ALT_GUI: 573 case MAGIC_SWAP_ALT_GUI:
@@ -606,7 +610,7 @@ bool process_record_quantum(keyrecord_t *record) {
606 keymap_config.swap_backslash_backspace = false; 610 keymap_config.swap_backslash_backspace = false;
607 break; 611 break;
608 case MAGIC_UNHOST_NKRO: 612 case MAGIC_UNHOST_NKRO:
609 clear_keyboard(); // clear first buffer to prevent stuck keys 613 clear_keyboard(); // clear first buffer to prevent stuck keys
610 keymap_config.nkro = false; 614 keymap_config.nkro = false;
611 break; 615 break;
612 case MAGIC_UNSWAP_ALT_GUI: 616 case MAGIC_UNSWAP_ALT_GUI:
@@ -644,7 +648,7 @@ bool process_record_quantum(keyrecord_t *record) {
644#endif 648#endif
645 break; 649 break;
646 case MAGIC_TOGGLE_NKRO: 650 case MAGIC_TOGGLE_NKRO:
647 clear_keyboard(); // clear first buffer to prevent stuck keys 651 clear_keyboard(); // clear first buffer to prevent stuck keys
648 keymap_config.nkro = !keymap_config.nkro; 652 keymap_config.nkro = !keymap_config.nkro;
649 break; 653 break;
650 case MAGIC_EE_HANDS_LEFT: 654 case MAGIC_EE_HANDS_LEFT: