Rename some Quantum keycodes (#15968)

* Rename some Quantum keycodes

* Tweak EEPROM clear and debug keycode short aliases
This commit is contained in:
Ryan 2022-01-22 14:34:15 +11:00 committed by GitHub
parent c7f477bc59
commit b45a037c7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 49 additions and 32 deletions

View File

@ -4,17 +4,17 @@ If you're using a 60% keyboard, or any other layout with no F-row, you will have
## Usage ## Usage
Replace the `KC_GRV` key in your keymap (usually to the left of the `1` key) with `KC_GESC`. Most of the time this key will output `KC_ESC` when pressed. However, when Shift or GUI are held down it will output `KC_GRV` instead. Replace the `KC_GRV` key in your keymap (usually to the left of the `1` key) with `QK_GESC`. Most of the time this key will output `KC_ESC` when pressed. However, when Shift or GUI are held down it will output `KC_GRV` instead.
## What Your OS Sees ## What Your OS Sees
If Mary presses GESC on her keyboard, the OS will see an KC_ESC character. Now if Mary holds Shift down and presses GESC it will output `~`, or a shifted backtick. Now if she holds GUI/CMD/WIN, it will output a simple <code>&#96;</code> character. If Mary presses `QK_GESC` on her keyboard, the OS will see an KC_ESC character. Now if Mary holds Shift down and presses `QK_GESC` it will output `~`, or a shifted backtick. Now if she holds GUI/CMD/WIN, it will output a simple <code>&#96;</code> character.
## Keycodes ## Keycodes
|Key |Aliases |Description | |Key |Aliases |Description |
|---------|-----------|------------------------------------------------------------------| |-----------------|---------|------------------------------------------------------------------|
|`KC_GESC`|`GRAVE_ESC`|Escape when pressed, <code>&#96;</code> when Shift or GUI are held| |`QK_GRAVE_ESCAPE`|`QK_GESC`|Escape when pressed, <code>&#96;</code> when Shift or GUI are held|
### Caveats ### Caveats

View File

@ -220,10 +220,10 @@ See also: [Basic Keycodes](keycodes_basic.md)
See also: [Quantum Keycodes](quantum_keycodes.md#qmk-keycodes) See also: [Quantum Keycodes](quantum_keycodes.md#qmk-keycodes)
|Key |Aliases |Description | |Key |Aliases |Description |
|--------------|---------|-------------------------------------------------------| |-----------------|---------|-------------------------------------------------------|
|`RESET` | |Put the keyboard into bootloader mode for flashing | |`QK_BOOTLOADER` |`QK_BOOT`|Put the keyboard into bootloader mode for flashing |
|`DEBUG` | |Toggle debug mode | |`QK_DEBUG_TOGGLE`|`DB_TOGG`|Toggle debug mode |
|`EEPROM_RESET`|`EEP_RST`|Reinitializes the keyboard's EEPROM (persistent memory)| |`QK_CLEAR_EEPROM`|`EE_CLR` |Reinitializes the keyboard's EEPROM (persistent memory)|
## Audio Keys :id=audio-keys ## Audio Keys :id=audio-keys
@ -284,8 +284,8 @@ See also: [Dynamic Macros](feature_dynamic_macros.md)
See also: [Grave Escape](feature_grave_esc.md) See also: [Grave Escape](feature_grave_esc.md)
|Key |Aliases |Description | |Key |Aliases |Description |
|-----------|---------|------------------------------------------------------------------| |-----------------|---------|------------------------------------------------------------------|
|`GRAVE_ESC`|`KC_GESC`|Escape when pressed, <code>&#96;</code> when Shift or GUI are held| |`QK_GRAVE_ESCAPE`|`QK_GESC`|Escape when pressed, <code>&#96;</code> when Shift or GUI are held|
## Key Lock :id=key-lock ## Key Lock :id=key-lock

View File

@ -9,7 +9,7 @@ On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are
## QMK Keycodes :id=qmk-keycodes ## QMK Keycodes :id=qmk-keycodes
|Key |Aliases |Description | |Key |Aliases |Description |
|--------------|---------|-------------------------------------------------------| |-----------------|---------|-------------------------------------------------------|
|`RESET` | |Put the keyboard into bootloader mode for flashing | |`QK_BOOTLOADER` |`QK_BOOT`|Put the keyboard into bootloader mode for flashing |
|`DEBUG` | |Toggle debug mode | |`QK_DEBUG_TOGGLE`|`DB_TOGG`|Toggle debug mode |
|`EEPROM_RESET`|`EEP_RST`|Reinitializes the keyboard's EEPROM (persistent memory)| |`QK_CLEAR_EEPROM`|`EE_CLR` |Reinitializes the keyboard's EEPROM (persistent memory)|

View File

@ -15,13 +15,13 @@
*/ */
#include "process_grave_esc.h" #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. * Used to ensure that the correct keycode is released if the key is released.
*/ */
static bool grave_esc_was_shifted = false; static bool grave_esc_was_shifted = false;
bool process_grave_esc(uint16_t keycode, keyrecord_t *record) { 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(); const uint8_t mods = get_mods();
uint8_t shifted = mods & MOD_MASK_SG; uint8_t shifted = mods & MOD_MASK_SG;

View File

@ -302,12 +302,12 @@ bool process_record_quantum(keyrecord_t *record) {
if (record->event.pressed) { if (record->event.pressed) {
switch (keycode) { switch (keycode) {
#ifndef NO_RESET #ifndef NO_RESET
case RESET: case QK_BOOTLOADER:
reset_keyboard(); reset_keyboard();
return false; return false;
#endif #endif
#ifndef NO_DEBUG #ifndef NO_DEBUG
case DEBUG: case QK_DEBUG_TOGGLE:
debug_enable ^= 1; debug_enable ^= 1;
if (debug_enable) { if (debug_enable) {
print("DEBUG: enabled.\n"); print("DEBUG: enabled.\n");
@ -316,7 +316,7 @@ bool process_record_quantum(keyrecord_t *record) {
} }
#endif #endif
return false; return false;
case EEPROM_RESET: case QK_CLEAR_EEPROM:
eeconfig_init(); eeconfig_init();
return false; return false;
#ifdef VELOCIKEY_ENABLE #ifdef VELOCIKEY_ENABLE

View File

@ -80,8 +80,8 @@ enum quantum_keycodes {
QK_UNICODEMAP_PAIR_MAX = 0xFFFF, QK_UNICODEMAP_PAIR_MAX = 0xFFFF,
// Loose keycodes - to be used directly // Loose keycodes - to be used directly
RESET = 0x5C00, QK_BOOTLOADER = 0x5C00,
DEBUG, // 5C01 QK_DEBUG_TOGGLE, // 5C01
// Magic // Magic
MAGIC_SWAP_CONTROL_CAPSLOCK, // 5C02 MAGIC_SWAP_CONTROL_CAPSLOCK, // 5C02
@ -106,7 +106,7 @@ enum quantum_keycodes {
MAGIC_TOGGLE_ALT_GUI, // 5C15 MAGIC_TOGGLE_ALT_GUI, // 5C15
// Grave Escape // Grave Escape
GRAVE_ESC, // 5C16 QK_GRAVE_ESCAPE, // 5C16
// Auto Shift // Auto Shift
KC_ASUP, // 5C17 KC_ASUP, // 5C17
@ -379,7 +379,7 @@ enum quantum_keycodes {
OUT_USB, // 5CDE OUT_USB, // 5CDE
// Clear EEPROM // Clear EEPROM
EEPROM_RESET, // 5CDF QK_CLEAR_EEPROM, // 5CDF
// Unicode // Unicode
UNICODE_MODE_FORWARD, // 5CE0 UNICODE_MODE_FORWARD, // 5CE0
@ -716,9 +716,11 @@ enum quantum_keycodes {
#define MACROTAP(kc) (QK_MACRO | (FUNC_TAP << 8) | (kc)) #define MACROTAP(kc) (QK_MACRO | (FUNC_TAP << 8) | (kc))
#define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE) #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 // Audio Clicky aliases
#define CK_TOGG CLICKY_TOGGLE #define CK_TOGG CLICKY_TOGGLE
@ -964,3 +966,5 @@ enum quantum_keycodes {
#define PB_32 PROGRAMMABLE_BUTTON_32 #define PB_32 PROGRAMMABLE_BUTTON_32
#define PROGRAMMABLE_BUTTON_MIN PROGRAMMABLE_BUTTON_1 #define PROGRAMMABLE_BUTTON_MIN PROGRAMMABLE_BUTTON_1
#define PROGRAMMABLE_BUTTON_MAX PROGRAMMABLE_BUTTON_32 #define PROGRAMMABLE_BUTTON_MAX PROGRAMMABLE_BUTTON_32
#include "quantum_keycodes_legacy.h"

View File

@ -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

View File

@ -244,12 +244,12 @@ _Static_assert(KC_LT == 0x0236, "");
_Static_assert(KC_GT == 0x0237, ""); _Static_assert(KC_GT == 0x0237, "");
_Static_assert(KC_QUES == 0x0238, ""); _Static_assert(KC_QUES == 0x0238, "");
_Static_assert(RESET == 0x5C00, ""); _Static_assert(QK_BOOTLOADER == 0x5C00, "");
_Static_assert(DEBUG == 0x5C01, ""); _Static_assert(QK_DEBUG_TOGGLE == 0x5C01, "");
_Static_assert(MAGIC_TOGGLE_NKRO == 0x5C14, ""); _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_ON == 0x5C1D, "");
_Static_assert(AU_OFF == 0x5C1E, ""); _Static_assert(AU_OFF == 0x5C1E, "");