summaryrefslogtreecommitdiff
path: root/quantum/process_keycode/process_quantum.c
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/process_quantum.c
parent53c6fa5de75da248fe3d5549f9e79660682bc64c (diff)
Relocate remaining `process_record_quantum` keycodes (#25328)
Diffstat (limited to 'quantum/process_keycode/process_quantum.c')
-rw-r--r--quantum/process_keycode/process_quantum.c76
1 files changed, 76 insertions, 0 deletions
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}