aboutsummaryrefslogtreecommitdiff
path: root/quantum/quantum.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r--quantum/quantum.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index ad957a1b1..d3905decf 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -36,14 +36,42 @@ static void do_code16 (uint16_t code, void (*f) (uint8_t)) {
36 f(KC_RGUI); 36 f(KC_RGUI);
37} 37}
38 38
39static inline void qk_register_weak_mods(uint8_t kc) {
40 add_weak_mods(MOD_BIT(kc));
41 send_keyboard_report();
42}
43
44static inline void qk_unregister_weak_mods(uint8_t kc) {
45 del_weak_mods(MOD_BIT(kc));
46 send_keyboard_report();
47}
48
49static inline void qk_register_mods(uint8_t kc) {
50 add_weak_mods(MOD_BIT(kc));
51 send_keyboard_report();
52}
53
54static inline void qk_unregister_mods(uint8_t kc) {
55 del_weak_mods(MOD_BIT(kc));
56 send_keyboard_report();
57}
58
39void register_code16 (uint16_t code) { 59void register_code16 (uint16_t code) {
40 do_code16 (code, register_code); 60 if (IS_MOD(code) || code == KC_NO) {
61 do_code16 (code, qk_register_mods);
62 } else {
63 do_code16 (code, qk_register_weak_mods);
64 }
41 register_code (code); 65 register_code (code);
42} 66}
43 67
44void unregister_code16 (uint16_t code) { 68void unregister_code16 (uint16_t code) {
45 unregister_code (code); 69 unregister_code (code);
46 do_code16 (code, unregister_code); 70 if (IS_MOD(code) || code == KC_NO) {
71 do_code16 (code, qk_unregister_mods);
72 } else {
73 do_code16 (code, qk_unregister_weak_mods);
74 }
47} 75}
48 76
49__attribute__ ((weak)) 77__attribute__ ((weak))
@@ -133,6 +161,9 @@ bool process_record_quantum(keyrecord_t *record) {
133 #ifndef DISABLE_CHORDING 161 #ifndef DISABLE_CHORDING
134 process_chording(keycode, record) && 162 process_chording(keycode, record) &&
135 #endif 163 #endif
164 #ifdef COMBO_ENABLE
165 process_combo(keycode, record) &&
166 #endif
136 #ifdef UNICODE_ENABLE 167 #ifdef UNICODE_ENABLE
137 process_unicode(keycode, record) && 168 process_unicode(keycode, record) &&
138 #endif 169 #endif
@@ -541,6 +572,11 @@ void matrix_scan_quantum() {
541 #ifdef TAP_DANCE_ENABLE 572 #ifdef TAP_DANCE_ENABLE
542 matrix_scan_tap_dance(); 573 matrix_scan_tap_dance();
543 #endif 574 #endif
575
576 #ifdef COMBO_ENABLE
577 matrix_scan_combo();
578 #endif
579
544 matrix_scan_kb(); 580 matrix_scan_kb();
545} 581}
546 582