From b45a037c7edcd9c1cfadceb69ed51e7d42aa58c1 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 22 Jan 2022 14:34:15 +1100 Subject: Rename some Quantum keycodes (#15968) * Rename some Quantum keycodes * Tweak EEPROM clear and debug keycode short aliases --- quantum/process_keycode/process_grave_esc.c | 4 ++-- quantum/quantum.c | 6 +++--- quantum/quantum_keycodes.h | 16 ++++++++++------ quantum/quantum_keycodes_legacy.h | 13 +++++++++++++ quantum/via_ensure_keycode.h | 6 +++--- 5 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 quantum/quantum_keycodes_legacy.h (limited to 'quantum') diff --git a/quantum/process_keycode/process_grave_esc.c b/quantum/process_keycode/process_grave_esc.c index 41c50f5cb8..ddf027391d 100644 --- a/quantum/process_keycode/process_grave_esc.c +++ b/quantum/process_keycode/process_grave_esc.c @@ -15,13 +15,13 @@ */ #include "process_grave_esc.h" -/* true if the last press of GRAVE_ESC was shifted (i.e. GUI or SHIFT were pressed), false otherwise. +/* true if the last press of QK_GRAVE_ESCAPE was shifted (i.e. GUI or SHIFT were pressed), false otherwise. * Used to ensure that the correct keycode is released if the key is released. */ static bool grave_esc_was_shifted = false; bool process_grave_esc(uint16_t keycode, keyrecord_t *record) { - if (keycode == GRAVE_ESC) { + if (keycode == QK_GRAVE_ESCAPE) { const uint8_t mods = get_mods(); uint8_t shifted = mods & MOD_MASK_SG; diff --git a/quantum/quantum.c b/quantum/quantum.c index ac99bcbd45..f12b1a9526 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -302,12 +302,12 @@ bool process_record_quantum(keyrecord_t *record) { if (record->event.pressed) { switch (keycode) { #ifndef NO_RESET - case RESET: + case QK_BOOTLOADER: reset_keyboard(); return false; #endif #ifndef NO_DEBUG - case DEBUG: + case QK_DEBUG_TOGGLE: debug_enable ^= 1; if (debug_enable) { print("DEBUG: enabled.\n"); @@ -316,7 +316,7 @@ bool process_record_quantum(keyrecord_t *record) { } #endif return false; - case EEPROM_RESET: + case QK_CLEAR_EEPROM: eeconfig_init(); return false; #ifdef VELOCIKEY_ENABLE diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 3950a3bcae..15ea0276a7 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -80,8 +80,8 @@ enum quantum_keycodes { QK_UNICODEMAP_PAIR_MAX = 0xFFFF, // Loose keycodes - to be used directly - RESET = 0x5C00, - DEBUG, // 5C01 + QK_BOOTLOADER = 0x5C00, + QK_DEBUG_TOGGLE, // 5C01 // Magic MAGIC_SWAP_CONTROL_CAPSLOCK, // 5C02 @@ -106,7 +106,7 @@ enum quantum_keycodes { MAGIC_TOGGLE_ALT_GUI, // 5C15 // Grave Escape - GRAVE_ESC, // 5C16 + QK_GRAVE_ESCAPE, // 5C16 // Auto Shift KC_ASUP, // 5C17 @@ -379,7 +379,7 @@ enum quantum_keycodes { OUT_USB, // 5CDE // Clear EEPROM - EEPROM_RESET, // 5CDF + QK_CLEAR_EEPROM, // 5CDF // Unicode UNICODE_MODE_FORWARD, // 5CE0 @@ -716,9 +716,11 @@ enum quantum_keycodes { #define MACROTAP(kc) (QK_MACRO | (FUNC_TAP << 8) | (kc)) #define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE) -#define KC_GESC GRAVE_ESC +#define QK_GESC QK_GRAVE_ESCAPE -#define EEP_RST EEPROM_RESET +#define QK_BOOT QK_BOOTLOADER +#define DB_TOGG QK_DEBUG_TOGGLE +#define EE_CLR QK_CLEAR_EEPROM // Audio Clicky aliases #define CK_TOGG CLICKY_TOGGLE @@ -964,3 +966,5 @@ enum quantum_keycodes { #define PB_32 PROGRAMMABLE_BUTTON_32 #define PROGRAMMABLE_BUTTON_MIN PROGRAMMABLE_BUTTON_1 #define PROGRAMMABLE_BUTTON_MAX PROGRAMMABLE_BUTTON_32 + +#include "quantum_keycodes_legacy.h" diff --git a/quantum/quantum_keycodes_legacy.h b/quantum/quantum_keycodes_legacy.h new file mode 100644 index 0000000000..ed9455ee74 --- /dev/null +++ b/quantum/quantum_keycodes_legacy.h @@ -0,0 +1,13 @@ +#pragma once + +// clang-format off + +// Deprecated Quantum keycodes + +#define RESET QK_BOOTLOADER +#define DEBUG QK_DEBUG_TOGGLE +#define GRAVE_ESC QK_GRAVE_ESCAPE +#define EEPROM_RESET QK_CLEAR_EEPROM + +#define KC_GESC QK_GRAVE_ESCAPE +#define EEP_RST QK_CLEAR_EEPROM diff --git a/quantum/via_ensure_keycode.h b/quantum/via_ensure_keycode.h index 1aba0cdd2a..75f816b560 100644 --- a/quantum/via_ensure_keycode.h +++ b/quantum/via_ensure_keycode.h @@ -244,12 +244,12 @@ _Static_assert(KC_LT == 0x0236, ""); _Static_assert(KC_GT == 0x0237, ""); _Static_assert(KC_QUES == 0x0238, ""); -_Static_assert(RESET == 0x5C00, ""); -_Static_assert(DEBUG == 0x5C01, ""); +_Static_assert(QK_BOOTLOADER == 0x5C00, ""); +_Static_assert(QK_DEBUG_TOGGLE == 0x5C01, ""); _Static_assert(MAGIC_TOGGLE_NKRO == 0x5C14, ""); -_Static_assert(KC_GESC == 0x5C16, ""); +_Static_assert(QK_GRAVE_ESCAPE == 0x5C16, ""); _Static_assert(AU_ON == 0x5C1D, ""); _Static_assert(AU_OFF == 0x5C1E, ""); -- cgit v1.2.3