aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common_features.mk10
-rw-r--r--quantum/process_keycode/process_key_override.c2
-rw-r--r--quantum/process_keycode/process_key_override.h14
-rw-r--r--quantum/process_keycode/process_key_override_private.h24
-rw-r--r--quantum/quantum.c6
5 files changed, 17 insertions, 39 deletions
diff --git a/common_features.mk b/common_features.mk
index 91e9154f4..d8dce8a63 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -334,11 +334,6 @@ ifeq ($(strip $(PRINTING_ENABLE)), yes)
334 SRC += $(TMK_DIR)/protocol/serial_uart.c 334 SRC += $(TMK_DIR)/protocol/serial_uart.c
335endif 335endif
336 336
337ifeq ($(strip $(KEY_OVERRIDE_ENABLE)), yes)
338 OPT_DEFS += -DKEY_OVERRIDE_ENABLE
339 SRC += $(QUANTUM_DIR)/process_keycode/process_key_override.c
340endif
341
342ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes) 337ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
343 SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c) 338 SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c)
344 SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c) 339 SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
@@ -663,6 +658,11 @@ ifeq ($(strip $(COMBO_ENABLE)), yes)
663 OPT_DEFS += -DCOMBO_ENABLE 658 OPT_DEFS += -DCOMBO_ENABLE
664endif 659endif
665 660
661ifeq ($(strip $(KEY_OVERRIDE_ENABLE)), yes)
662 SRC += $(QUANTUM_DIR)/process_keycode/process_key_override.c
663 OPT_DEFS += -DKEY_OVERRIDE_ENABLE
664endif
665
666ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) 666ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
667 SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c 667 SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
668 OPT_DEFS += -DTAP_DANCE_ENABLE 668 OPT_DEFS += -DTAP_DANCE_ENABLE
diff --git a/quantum/process_keycode/process_key_override.c b/quantum/process_keycode/process_key_override.c
index fe43eacc4..8b45a9404 100644
--- a/quantum/process_keycode/process_key_override.c
+++ b/quantum/process_keycode/process_key_override.c
@@ -380,7 +380,7 @@ static bool try_activating_override(const uint16_t keycode, const uint8_t layer,
380 return true; 380 return true;
381} 381}
382 382
383void matrix_scan_key_override(void) { 383void key_override_task(void) {
384 if (deferred_register == 0) { 384 if (deferred_register == 0) {
385 return; 385 return;
386 } 386 }
diff --git a/quantum/process_keycode/process_key_override.h b/quantum/process_keycode/process_key_override.h
index 9ba59e4e9..fd76f297a 100644
--- a/quantum/process_keycode/process_key_override.h
+++ b/quantum/process_keycode/process_key_override.h
@@ -92,16 +92,22 @@ typedef struct {
92extern const key_override_t **key_overrides; 92extern const key_override_t **key_overrides;
93 93
94/** Turns key overrides on */ 94/** Turns key overrides on */
95extern void key_override_on(void); 95void key_override_on(void);
96 96
97/** Turns key overrides off */ 97/** Turns key overrides off */
98extern void key_override_off(void); 98void key_override_off(void);
99 99
100/** Toggles key overrides on */ 100/** Toggles key overrides on */
101extern void key_override_toggle(void); 101void key_override_toggle(void);
102 102
103/** Returns whether key overrides are enabled */ 103/** Returns whether key overrides are enabled */
104extern bool key_override_is_enabled(void); 104bool key_override_is_enabled(void);
105
106/** Handling of key overrides and its implemented keycodes */
107bool process_key_override(const uint16_t keycode, const keyrecord_t *const record);
108
109/** Perform any deferred keys */
110void key_override_task(void);
105 111
106/** 112/**
107 * Preferrably use these macros to create key overrides. They fix many of the options to a standard setting that should satisfy most basic use-cases. Only directly create a key_override_t struct when you really need to. 113 * Preferrably use these macros to create key overrides. They fix many of the options to a standard setting that should satisfy most basic use-cases. Only directly create a key_override_t struct when you really need to.
diff --git a/quantum/process_keycode/process_key_override_private.h b/quantum/process_keycode/process_key_override_private.h
deleted file mode 100644
index 1d0e134a1..000000000
--- a/quantum/process_keycode/process_key_override_private.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright 2021 Jonas Gessner
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include <stdint.h>
21#include "action.h"
22
23bool process_key_override(const uint16_t keycode, const keyrecord_t *const record);
24void matrix_scan_key_override(void);
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 87b219428..f35939216 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -55,10 +55,6 @@ float default_layer_songs[][16][2] = DEFAULT_LAYER_SONGS;
55# include "process_auto_shift.h" 55# include "process_auto_shift.h"
56#endif 56#endif
57 57
58#ifdef KEY_OVERRIDE_ENABLE
59# include "process_key_override_private.h"
60#endif
61
62uint8_t extract_mod_bits(uint16_t code) { 58uint8_t extract_mod_bits(uint16_t code) {
63 switch (code) { 59 switch (code) {
64 case QK_MODS ... QK_MODS_MAX: 60 case QK_MODS ... QK_MODS_MAX:
@@ -415,7 +411,7 @@ void matrix_scan_quantum() {
415#endif 411#endif
416 412
417#ifdef KEY_OVERRIDE_ENABLE 413#ifdef KEY_OVERRIDE_ENABLE
418 matrix_scan_key_override(); 414 key_override_task();
419#endif 415#endif
420 416
421#ifdef SEQUENCER_ENABLE 417#ifdef SEQUENCER_ENABLE