summaryrefslogtreecommitdiff
path: root/quantum/process_keycode
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2025-06-03 23:44:46 +0100
committerGitHub <noreply@github.com>2025-06-03 23:44:46 +0100
commitf096e5a3f3af404e6f752185260f183d3ecd503e (patch)
treeb3f628aebf2968434473eba8a1000eca410171f5 /quantum/process_keycode
parent53c6fa5de75da248fe3d5549f9e79660682bc64c (diff)
Relocate remaining `process_record_quantum` keycodes (#25328)
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_oneshot.c25
-rw-r--r--quantum/process_keycode/process_oneshot.h10
-rw-r--r--quantum/process_keycode/process_quantum.c76
-rw-r--r--quantum/process_keycode/process_quantum.h10
-rw-r--r--quantum/process_keycode/process_underglow.c5
5 files changed, 126 insertions, 0 deletions
diff --git a/quantum/process_keycode/process_oneshot.c b/quantum/process_keycode/process_oneshot.c
new file mode 100644
index 0000000000..6c43da1011
--- /dev/null
+++ b/quantum/process_keycode/process_oneshot.c
@@ -0,0 +1,25 @@
1// Copyright 2025 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "process_oneshot.h"
5#include "action_util.h"
6
7bool process_oneshot(uint16_t keycode, keyrecord_t *record) {
8#ifndef NO_ACTION_ONESHOT
9 if (record->event.pressed) {
10 switch (keycode) {
11 case QK_ONE_SHOT_TOGGLE:
12 oneshot_toggle();
13 return false;
14 case QK_ONE_SHOT_ON:
15 oneshot_enable();
16 return false;
17 case QK_ONE_SHOT_OFF:
18 oneshot_disable();
19 return false;
20 }
21 }
22#endif
23
24 return true;
25}
diff --git a/quantum/process_keycode/process_oneshot.h b/quantum/process_keycode/process_oneshot.h
new file mode 100644
index 0000000000..11445b9b38
--- /dev/null
+++ b/quantum/process_keycode/process_oneshot.h
@@ -0,0 +1,10 @@
1// Copyright 2025 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include <stdint.h>
7#include <stdbool.h>
8#include "action.h"
9
10bool process_oneshot(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_quantum.c b/quantum/process_keycode/process_quantum.c
new file mode 100644
index 0000000000..703e00755b
--- /dev/null
+++ b/quantum/process_keycode/process_quantum.c
@@ -0,0 +1,76 @@
1// Copyright 2025 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "process_quantum.h"
5#include "quantum.h"
6
7#ifdef ENABLE_COMPILE_KEYCODE
8/** \brief Compiles the firmware, and adds the flash command based on keyboard bootloader
9 */
10static void send_make_command(void) {
11# ifdef NO_ACTION_ONESHOT
12 const uint8_t temp_mod = mod_config(get_mods());
13# else
14 const uint8_t temp_mod = mod_config(get_mods() | get_oneshot_mods());
15 clear_oneshot_mods();
16# endif
17 clear_mods();
18
19 SEND_STRING_DELAY("qmk", TAP_CODE_DELAY);
20 if (temp_mod & MOD_MASK_SHIFT) { // if shift is held, flash rather than compile
21 SEND_STRING_DELAY(" flash ", TAP_CODE_DELAY);
22 } else {
23 SEND_STRING_DELAY(" compile ", TAP_CODE_DELAY);
24 }
25# if defined(CONVERTER_ENABLED)
26 SEND_STRING_DELAY("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP " -e CONVERT_TO=" CONVERTER_TARGET SS_TAP(X_ENTER), TAP_CODE_DELAY);
27# else
28 SEND_STRING_DELAY("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP SS_TAP(X_ENTER), TAP_CODE_DELAY);
29# endif
30 if (temp_mod & MOD_MASK_SHIFT && temp_mod & MOD_MASK_CTRL) {
31 reset_keyboard();
32 }
33}
34#endif
35
36bool process_quantum(uint16_t keycode, keyrecord_t *record) {
37 if (record->event.pressed) {
38 switch (keycode) {
39#ifndef NO_RESET
40 case QK_BOOTLOADER:
41 reset_keyboard();
42 return false;
43 case QK_REBOOT:
44 soft_reset_keyboard();
45 return false;
46#endif
47#ifndef NO_DEBUG
48 case QK_DEBUG_TOGGLE:
49 debug_enable ^= 1;
50 if (debug_enable) {
51 print("DEBUG: enabled.\n");
52 } else {
53 print("DEBUG: disabled.\n");
54 }
55 return false;
56#endif
57 case QK_CLEAR_EEPROM:
58#ifdef NO_RESET
59 eeconfig_init();
60#else
61 eeconfig_disable();
62 soft_reset_keyboard();
63#endif
64 return false;
65#ifdef ENABLE_COMPILE_KEYCODE
66 case QK_MAKE:
67 send_make_command();
68 return false;
69#endif
70 default:
71 break;
72 }
73 }
74
75 return true;
76}
diff --git a/quantum/process_keycode/process_quantum.h b/quantum/process_keycode/process_quantum.h
new file mode 100644
index 0000000000..5c2462be01
--- /dev/null
+++ b/quantum/process_keycode/process_quantum.h
@@ -0,0 +1,10 @@
1// Copyright 2025 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include <stdint.h>
7#include <stdbool.h>
8#include "action.h"
9
10bool process_quantum(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_underglow.c b/quantum/process_keycode/process_underglow.c
index b8d8989ef3..78006ee099 100644
--- a/quantum/process_keycode/process_underglow.c
+++ b/quantum/process_keycode/process_underglow.c
@@ -200,6 +200,11 @@ bool process_underglow(uint16_t keycode, keyrecord_t *record) {
200 } 200 }
201#endif 201#endif
202 return false; 202 return false;
203#ifdef VELOCIKEY_ENABLE
204 case QK_VELOCIKEY_TOGGLE:
205 velocikey_toggle();
206 return false;
207#endif
203 } 208 }
204 } 209 }
205 210