Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename some Quantum keycodes #15968

Merged
merged 2 commits into from
Jan 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/feature_grave_esc.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ If you're using a 60% keyboard, or any other layout with no F-row, you will have

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

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

|Key |Aliases |Description |
|---------|-----------|------------------------------------------------------------------|
|`KC_GESC`|`GRAVE_ESC`|Escape when pressed, <code>&#96;</code> when Shift or GUI are held|
|Key |Aliases |Description |
|-----------------|---------|------------------------------------------------------------------|
|`QK_GRAVE_ESCAPE`|`QK_GESC`|Escape when pressed, <code>&#96;</code> when Shift or GUI are held|

### Caveats

Expand Down
16 changes: 8 additions & 8 deletions docs/keycodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,11 @@ See also: [Basic Keycodes](keycodes_basic.md)

See also: [Quantum Keycodes](quantum_keycodes.md#qmk-keycodes)

|Key |Aliases |Description |
|--------------|---------|-------------------------------------------------------|
|`RESET` | |Put the keyboard into bootloader mode for flashing |
|`DEBUG` | |Toggle debug mode |
|`EEPROM_RESET`|`EEP_RST`|Reinitializes the keyboard's EEPROM (persistent memory)|
|Key |Aliases |Description |
|-----------------|---------|-------------------------------------------------------|
|`QK_BOOTLOADER` |`QK_BOOT`|Put the keyboard into bootloader mode for flashing |
|`QK_DEBUG_TOGGLE`|`DB_TOGG`|Toggle debug mode |
|`QK_CLEAR_EEPROM`|`EE_CLR` |Reinitializes the keyboard's EEPROM (persistent memory)|

## Audio Keys :id=audio-keys

Expand Down Expand Up @@ -283,9 +283,9 @@ See also: [Dynamic Macros](feature_dynamic_macros.md)

See also: [Grave Escape](feature_grave_esc.md)

|Key |Aliases |Description |
|-----------|---------|------------------------------------------------------------------|
|`GRAVE_ESC`|`KC_GESC`|Escape when pressed, <code>&#96;</code> when Shift or GUI are held|
|Key |Aliases |Description |
|-----------------|---------|------------------------------------------------------------------|
|`QK_GRAVE_ESCAPE`|`QK_GESC`|Escape when pressed, <code>&#96;</code> when Shift or GUI are held|

## Key Lock :id=key-lock

Expand Down
10 changes: 5 additions & 5 deletions docs/quantum_keycodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are

## QMK Keycodes :id=qmk-keycodes

|Key |Aliases |Description |
|--------------|---------|-------------------------------------------------------|
|`RESET` | |Put the keyboard into bootloader mode for flashing |
|`DEBUG` | |Toggle debug mode |
|`EEPROM_RESET`|`EEP_RST`|Reinitializes the keyboard's EEPROM (persistent memory)|
|Key |Aliases |Description |
|-----------------|---------|-------------------------------------------------------|
|`QK_BOOTLOADER` |`QK_BOOT`|Put the keyboard into bootloader mode for flashing |
|`QK_DEBUG_TOGGLE`|`DB_TOGG`|Toggle debug mode |
|`QK_CLEAR_EEPROM`|`EE_CLR` |Reinitializes the keyboard's EEPROM (persistent memory)|
4 changes: 2 additions & 2 deletions quantum/process_keycode/process_grave_esc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions quantum/quantum.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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
Expand Down
16 changes: 10 additions & 6 deletions quantum/quantum_keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -379,7 +379,7 @@ enum quantum_keycodes {
OUT_USB, // 5CDE

// Clear EEPROM
EEPROM_RESET, // 5CDF
QK_CLEAR_EEPROM, // 5CDF

// Unicode
UNICODE_MODE_FORWARD, // 5CE0
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
13 changes: 13 additions & 0 deletions quantum/quantum_keycodes_legacy.h
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions quantum/via_ensure_keycode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, "");
Expand Down