Normalise RGBLight (underglow) keycodes (#23656)

This commit is contained in:
Ryan 2024-05-07 18:36:50 +10:00 committed by GitHub
parent 18735599b4
commit 224ff1d262
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 141 additions and 37 deletions

View File

@ -64,6 +64,86 @@
] ]
}, },
"0x7820": {
"group": "underglow",
"key": "QK_UNDERGLOW_TOGGLE",
"aliases": [
"UG_TOGG"
]
},
"0x7821": {
"group": "underglow",
"key": "QK_UNDERGLOW_MODE_NEXT",
"aliases": [
"!reset!",
"UG_NEXT"
]
},
"0x7822": {
"group": "underglow",
"key": "QK_UNDERGLOW_MODE_PREVIOUS",
"aliases": [
"!reset!",
"UG_PREV"
]
},
"0x7823": {
"group": "underglow",
"key": "QK_UNDERGLOW_HUE_UP",
"aliases": [
"UG_HUEU"
]
},
"0x7824": {
"group": "underglow",
"key": "QK_UNDERGLOW_HUE_DOWN",
"aliases": [
"UG_HUED"
]
},
"0x7825": {
"group": "underglow",
"key": "QK_UNDERGLOW_SATURATION_UP",
"aliases": [
"UG_SATU"
]
},
"0x7826": {
"group": "underglow",
"key": "QK_UNDERGLOW_SATURATION_DOWN",
"aliases": [
"UG_SATD"
]
},
"0x7827": {
"group": "underglow",
"key": "QK_UNDERGLOW_VALUE_UP",
"aliases": [
"UG_VALU"
]
},
"0x7828": {
"group": "underglow",
"key": "QK_UNDERGLOW_VALUE_DOWN",
"aliases": [
"UG_VALD"
]
},
"0x7829": {
"group": "underglow",
"key": "QK_UNDERGLOW_SPEED_UP",
"aliases": [
"UG_SPDU"
]
},
"0x782A": {
"group": "underglow",
"key": "QK_UNDERGLOW_SPEED_DOWN",
"aliases": [
"UG_SPDD"
]
},
"0x7840": { "0x7840": {
"group": "rgb_matrix", "group": "rgb_matrix",
"key": "QK_RGB_MATRIX_ON", "key": "QK_RGB_MATRIX_ON",

View File

@ -636,17 +636,17 @@ enum qk_keycode_defines {
QK_LED_MATRIX_BRIGHTNESS_DOWN = 0x7816, QK_LED_MATRIX_BRIGHTNESS_DOWN = 0x7816,
QK_LED_MATRIX_SPEED_UP = 0x7817, QK_LED_MATRIX_SPEED_UP = 0x7817,
QK_LED_MATRIX_SPEED_DOWN = 0x7818, QK_LED_MATRIX_SPEED_DOWN = 0x7818,
RGB_TOG = 0x7820, QK_UNDERGLOW_TOGGLE = 0x7820,
RGB_MODE_FORWARD = 0x7821, QK_UNDERGLOW_MODE_NEXT = 0x7821,
RGB_MODE_REVERSE = 0x7822, QK_UNDERGLOW_MODE_PREVIOUS = 0x7822,
RGB_HUI = 0x7823, QK_UNDERGLOW_HUE_UP = 0x7823,
RGB_HUD = 0x7824, QK_UNDERGLOW_HUE_DOWN = 0x7824,
RGB_SAI = 0x7825, QK_UNDERGLOW_SATURATION_UP = 0x7825,
RGB_SAD = 0x7826, QK_UNDERGLOW_SATURATION_DOWN = 0x7826,
RGB_VAI = 0x7827, QK_UNDERGLOW_VALUE_UP = 0x7827,
RGB_VAD = 0x7828, QK_UNDERGLOW_VALUE_DOWN = 0x7828,
RGB_SPI = 0x7829, QK_UNDERGLOW_SPEED_UP = 0x7829,
RGB_SPD = 0x782A, QK_UNDERGLOW_SPEED_DOWN = 0x782A,
RGB_MODE_PLAIN = 0x782B, RGB_MODE_PLAIN = 0x782B,
RGB_MODE_BREATHE = 0x782C, RGB_MODE_BREATHE = 0x782C,
RGB_MODE_RAINBOW = 0x782D, RGB_MODE_RAINBOW = 0x782D,
@ -1312,8 +1312,17 @@ enum qk_keycode_defines {
LM_BRID = QK_LED_MATRIX_BRIGHTNESS_DOWN, LM_BRID = QK_LED_MATRIX_BRIGHTNESS_DOWN,
LM_SPDU = QK_LED_MATRIX_SPEED_UP, LM_SPDU = QK_LED_MATRIX_SPEED_UP,
LM_SPDD = QK_LED_MATRIX_SPEED_DOWN, LM_SPDD = QK_LED_MATRIX_SPEED_DOWN,
RGB_MOD = RGB_MODE_FORWARD, UG_TOGG = QK_UNDERGLOW_TOGGLE,
RGB_RMOD = RGB_MODE_REVERSE, UG_NEXT = QK_UNDERGLOW_MODE_NEXT,
UG_PREV = QK_UNDERGLOW_MODE_PREVIOUS,
UG_HUEU = QK_UNDERGLOW_HUE_UP,
UG_HUED = QK_UNDERGLOW_HUE_DOWN,
UG_SATU = QK_UNDERGLOW_SATURATION_UP,
UG_SATD = QK_UNDERGLOW_SATURATION_DOWN,
UG_VALU = QK_UNDERGLOW_VALUE_UP,
UG_VALD = QK_UNDERGLOW_VALUE_DOWN,
UG_SPDU = QK_UNDERGLOW_SPEED_UP,
UG_SPDD = QK_UNDERGLOW_SPEED_DOWN,
RGB_M_P = RGB_MODE_PLAIN, RGB_M_P = RGB_MODE_PLAIN,
RGB_M_B = RGB_MODE_BREATHE, RGB_M_B = RGB_MODE_BREATHE,
RGB_M_R = RGB_MODE_RAINBOW, RGB_M_R = RGB_MODE_RAINBOW,
@ -1461,7 +1470,8 @@ enum qk_keycode_defines {
#define IS_MACRO_KEYCODE(code) ((code) >= QK_MACRO_0 && (code) <= QK_MACRO_31) #define IS_MACRO_KEYCODE(code) ((code) >= QK_MACRO_0 && (code) <= QK_MACRO_31)
#define IS_BACKLIGHT_KEYCODE(code) ((code) >= QK_BACKLIGHT_ON && (code) <= QK_BACKLIGHT_TOGGLE_BREATHING) #define IS_BACKLIGHT_KEYCODE(code) ((code) >= QK_BACKLIGHT_ON && (code) <= QK_BACKLIGHT_TOGGLE_BREATHING)
#define IS_LED_MATRIX_KEYCODE(code) ((code) >= QK_LED_MATRIX_ON && (code) <= QK_LED_MATRIX_SPEED_DOWN) #define IS_LED_MATRIX_KEYCODE(code) ((code) >= QK_LED_MATRIX_ON && (code) <= QK_LED_MATRIX_SPEED_DOWN)
#define IS_RGB_KEYCODE(code) ((code) >= RGB_TOG && (code) <= RGB_MODE_TWINKLE) #define IS_UNDERGLOW_KEYCODE(code) ((code) >= QK_UNDERGLOW_TOGGLE && (code) <= QK_UNDERGLOW_SPEED_DOWN)
#define IS_RGB_KEYCODE(code) ((code) >= RGB_MODE_PLAIN && (code) <= RGB_MODE_TWINKLE)
#define IS_RGB_MATRIX_KEYCODE(code) ((code) >= QK_RGB_MATRIX_ON && (code) <= QK_RGB_MATRIX_SPEED_DOWN) #define IS_RGB_MATRIX_KEYCODE(code) ((code) >= QK_RGB_MATRIX_ON && (code) <= QK_RGB_MATRIX_SPEED_DOWN)
#define IS_QUANTUM_KEYCODE(code) ((code) >= QK_BOOTLOADER && (code) <= QK_ALT_REPEAT_KEY) #define IS_QUANTUM_KEYCODE(code) ((code) >= QK_BOOTLOADER && (code) <= QK_ALT_REPEAT_KEY)
#define IS_KB_KEYCODE(code) ((code) >= QK_KB_0 && (code) <= QK_KB_31) #define IS_KB_KEYCODE(code) ((code) >= QK_KB_0 && (code) <= QK_KB_31)
@ -1485,7 +1495,8 @@ enum qk_keycode_defines {
#define MACRO_KEYCODE_RANGE QK_MACRO_0 ... QK_MACRO_31 #define MACRO_KEYCODE_RANGE QK_MACRO_0 ... QK_MACRO_31
#define BACKLIGHT_KEYCODE_RANGE QK_BACKLIGHT_ON ... QK_BACKLIGHT_TOGGLE_BREATHING #define BACKLIGHT_KEYCODE_RANGE QK_BACKLIGHT_ON ... QK_BACKLIGHT_TOGGLE_BREATHING
#define LED_MATRIX_KEYCODE_RANGE QK_LED_MATRIX_ON ... QK_LED_MATRIX_SPEED_DOWN #define LED_MATRIX_KEYCODE_RANGE QK_LED_MATRIX_ON ... QK_LED_MATRIX_SPEED_DOWN
#define RGB_KEYCODE_RANGE RGB_TOG ... RGB_MODE_TWINKLE #define UNDERGLOW_KEYCODE_RANGE QK_UNDERGLOW_TOGGLE ... QK_UNDERGLOW_SPEED_DOWN
#define RGB_KEYCODE_RANGE RGB_MODE_PLAIN ... RGB_MODE_TWINKLE
#define RGB_MATRIX_KEYCODE_RANGE QK_RGB_MATRIX_ON ... QK_RGB_MATRIX_SPEED_DOWN #define RGB_MATRIX_KEYCODE_RANGE QK_RGB_MATRIX_ON ... QK_RGB_MATRIX_SPEED_DOWN
#define QUANTUM_KEYCODE_RANGE QK_BOOTLOADER ... QK_ALT_REPEAT_KEY #define QUANTUM_KEYCODE_RANGE QK_BOOTLOADER ... QK_ALT_REPEAT_KEY
#define KB_KEYCODE_RANGE QK_KB_0 ... QK_KB_31 #define KB_KEYCODE_RANGE QK_KB_0 ... QK_KB_31

View File

@ -69,7 +69,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
uint8_t shifted = get_mods() & MOD_MASK_SHIFT; uint8_t shifted = get_mods() & MOD_MASK_SHIFT;
#endif #endif
switch (keycode) { switch (keycode) {
case RGB_TOG: case QK_UNDERGLOW_TOGGLE:
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
rgblight_toggle(); rgblight_toggle();
#endif #endif
@ -77,7 +77,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
rgb_matrix_toggle(); rgb_matrix_toggle();
#endif #endif
return false; return false;
case RGB_MODE_FORWARD: case QK_UNDERGLOW_MODE_NEXT:
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
handleKeycodeRGB(shifted, rgblight_step, rgblight_step_reverse); handleKeycodeRGB(shifted, rgblight_step, rgblight_step_reverse);
#endif #endif
@ -85,7 +85,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
handleKeycodeRGB(shifted, rgb_matrix_step, rgb_matrix_step_reverse); handleKeycodeRGB(shifted, rgb_matrix_step, rgb_matrix_step_reverse);
#endif #endif
return false; return false;
case RGB_MODE_REVERSE: case QK_UNDERGLOW_MODE_PREVIOUS:
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
handleKeycodeRGB(shifted, rgblight_step_reverse, rgblight_step); handleKeycodeRGB(shifted, rgblight_step_reverse, rgblight_step);
#endif #endif
@ -93,7 +93,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
handleKeycodeRGB(shifted, rgb_matrix_step_reverse, rgb_matrix_step); handleKeycodeRGB(shifted, rgb_matrix_step_reverse, rgb_matrix_step);
#endif #endif
return false; return false;
case RGB_HUI: case QK_UNDERGLOW_HUE_UP:
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
handleKeycodeRGB(shifted, rgblight_increase_hue, rgblight_decrease_hue); handleKeycodeRGB(shifted, rgblight_increase_hue, rgblight_decrease_hue);
#endif #endif
@ -101,7 +101,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
handleKeycodeRGB(shifted, rgb_matrix_increase_hue, rgb_matrix_decrease_hue); handleKeycodeRGB(shifted, rgb_matrix_increase_hue, rgb_matrix_decrease_hue);
#endif #endif
return false; return false;
case RGB_HUD: case QK_UNDERGLOW_HUE_DOWN:
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
handleKeycodeRGB(shifted, rgblight_decrease_hue, rgblight_increase_hue); handleKeycodeRGB(shifted, rgblight_decrease_hue, rgblight_increase_hue);
#endif #endif
@ -109,7 +109,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
handleKeycodeRGB(shifted, rgb_matrix_decrease_hue, rgb_matrix_increase_hue); handleKeycodeRGB(shifted, rgb_matrix_decrease_hue, rgb_matrix_increase_hue);
#endif #endif
return false; return false;
case RGB_SAI: case QK_UNDERGLOW_SATURATION_UP:
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
handleKeycodeRGB(shifted, rgblight_increase_sat, rgblight_decrease_sat); handleKeycodeRGB(shifted, rgblight_increase_sat, rgblight_decrease_sat);
#endif #endif
@ -117,7 +117,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
handleKeycodeRGB(shifted, rgb_matrix_increase_sat, rgb_matrix_decrease_sat); handleKeycodeRGB(shifted, rgb_matrix_increase_sat, rgb_matrix_decrease_sat);
#endif #endif
return false; return false;
case RGB_SAD: case QK_UNDERGLOW_SATURATION_DOWN:
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
handleKeycodeRGB(shifted, rgblight_decrease_sat, rgblight_increase_sat); handleKeycodeRGB(shifted, rgblight_decrease_sat, rgblight_increase_sat);
#endif #endif
@ -125,7 +125,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
handleKeycodeRGB(shifted, rgb_matrix_decrease_sat, rgb_matrix_increase_sat); handleKeycodeRGB(shifted, rgb_matrix_decrease_sat, rgb_matrix_increase_sat);
#endif #endif
return false; return false;
case RGB_VAI: case QK_UNDERGLOW_VALUE_UP:
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
handleKeycodeRGB(shifted, rgblight_increase_val, rgblight_decrease_val); handleKeycodeRGB(shifted, rgblight_increase_val, rgblight_decrease_val);
#endif #endif
@ -133,7 +133,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
handleKeycodeRGB(shifted, rgb_matrix_increase_val, rgb_matrix_decrease_val); handleKeycodeRGB(shifted, rgb_matrix_increase_val, rgb_matrix_decrease_val);
#endif #endif
return false; return false;
case RGB_VAD: case QK_UNDERGLOW_VALUE_DOWN:
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
handleKeycodeRGB(shifted, rgblight_decrease_val, rgblight_increase_val); handleKeycodeRGB(shifted, rgblight_decrease_val, rgblight_increase_val);
#endif #endif
@ -141,7 +141,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
handleKeycodeRGB(shifted, rgb_matrix_decrease_val, rgb_matrix_increase_val); handleKeycodeRGB(shifted, rgb_matrix_decrease_val, rgb_matrix_increase_val);
#endif #endif
return false; return false;
case RGB_SPI: case QK_UNDERGLOW_SPEED_UP:
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
handleKeycodeRGB(shifted, rgblight_increase_speed, rgblight_decrease_speed); handleKeycodeRGB(shifted, rgblight_increase_speed, rgblight_decrease_speed);
#endif #endif
@ -149,7 +149,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
handleKeycodeRGB(shifted, rgb_matrix_increase_speed, rgb_matrix_decrease_speed); handleKeycodeRGB(shifted, rgb_matrix_increase_speed, rgb_matrix_decrease_speed);
#endif #endif
return false; return false;
case RGB_SPD: case QK_UNDERGLOW_SPEED_DOWN:
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
handleKeycodeRGB(shifted, rgblight_decrease_speed, rgblight_increase_speed); handleKeycodeRGB(shifted, rgblight_decrease_speed, rgblight_increase_speed);
#endif #endif

View File

@ -3,3 +3,16 @@
// clang-format off // clang-format off
// Deprecated Quantum keycodes // Deprecated Quantum keycodes
#define RGB_TOG QK_UNDERGLOW_TOGGLE
#define RGB_MOD QK_UNDERGLOW_MODE_NEXT
#define RGB_MODE_FORWARD QK_UNDERGLOW_MODE_NEXT
#define RGB_RMOD QK_UNDERGLOW_MODE_PREVIOUS
#define RGB_MODE_REVERSE QK_UNDERGLOW_MODE_PREVIOUS
#define RGB_HUI QK_UNDERGLOW_HUE_UP
#define RGB_HUD QK_UNDERGLOW_HUE_DOWN
#define RGB_SAI QK_UNDERGLOW_SATURATION_UP
#define RGB_SAD QK_UNDERGLOW_SATURATION_DOWN
#define RGB_VAI QK_UNDERGLOW_VALUE_UP
#define RGB_VAD QK_UNDERGLOW_VALUE_DOWN
#define RGB_SPI QK_UNDERGLOW_SPEED_UP
#define RGB_SPD QK_UNDERGLOW_SPEED_DOWN

View File

@ -578,17 +578,17 @@ std::map<uint16_t, std::string> KEYCODE_ID_TABLE = {
{QK_LED_MATRIX_BRIGHTNESS_DOWN, "QK_LED_MATRIX_BRIGHTNESS_DOWN"}, {QK_LED_MATRIX_BRIGHTNESS_DOWN, "QK_LED_MATRIX_BRIGHTNESS_DOWN"},
{QK_LED_MATRIX_SPEED_UP, "QK_LED_MATRIX_SPEED_UP"}, {QK_LED_MATRIX_SPEED_UP, "QK_LED_MATRIX_SPEED_UP"},
{QK_LED_MATRIX_SPEED_DOWN, "QK_LED_MATRIX_SPEED_DOWN"}, {QK_LED_MATRIX_SPEED_DOWN, "QK_LED_MATRIX_SPEED_DOWN"},
{RGB_TOG, "RGB_TOG"}, {QK_UNDERGLOW_TOGGLE, "QK_UNDERGLOW_TOGGLE"},
{RGB_MODE_FORWARD, "RGB_MODE_FORWARD"}, {QK_UNDERGLOW_MODE_NEXT, "QK_UNDERGLOW_MODE_NEXT"},
{RGB_MODE_REVERSE, "RGB_MODE_REVERSE"}, {QK_UNDERGLOW_MODE_PREVIOUS, "QK_UNDERGLOW_MODE_PREVIOUS"},
{RGB_HUI, "RGB_HUI"}, {QK_UNDERGLOW_HUE_UP, "QK_UNDERGLOW_HUE_UP"},
{RGB_HUD, "RGB_HUD"}, {QK_UNDERGLOW_HUE_DOWN, "QK_UNDERGLOW_HUE_DOWN"},
{RGB_SAI, "RGB_SAI"}, {QK_UNDERGLOW_SATURATION_UP, "QK_UNDERGLOW_SATURATION_UP"},
{RGB_SAD, "RGB_SAD"}, {QK_UNDERGLOW_SATURATION_DOWN, "QK_UNDERGLOW_SATURATION_DOWN"},
{RGB_VAI, "RGB_VAI"}, {QK_UNDERGLOW_VALUE_UP, "QK_UNDERGLOW_VALUE_UP"},
{RGB_VAD, "RGB_VAD"}, {QK_UNDERGLOW_VALUE_DOWN, "QK_UNDERGLOW_VALUE_DOWN"},
{RGB_SPI, "RGB_SPI"}, {QK_UNDERGLOW_SPEED_UP, "QK_UNDERGLOW_SPEED_UP"},
{RGB_SPD, "RGB_SPD"}, {QK_UNDERGLOW_SPEED_DOWN, "QK_UNDERGLOW_SPEED_DOWN"},
{RGB_MODE_PLAIN, "RGB_MODE_PLAIN"}, {RGB_MODE_PLAIN, "RGB_MODE_PLAIN"},
{RGB_MODE_BREATHE, "RGB_MODE_BREATHE"}, {RGB_MODE_BREATHE, "RGB_MODE_BREATHE"},
{RGB_MODE_RAINBOW, "RGB_MODE_RAINBOW"}, {RGB_MODE_RAINBOW, "RGB_MODE_RAINBOW"},