From 52d3ef0fe4bd860420893e364be36c155f4ba300 Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 11 Apr 2024 14:14:02 +1000 Subject: [PATCH] Add new set of keycodes for LED Matrix (#23432) --- data/constants/keycodes/keycodes_0.0.4.hjson | 0 .../keycodes/keycodes_0.0.4_lighting.hjson | 67 +++++++++++++++++++ docs/feature_led_matrix.md | 21 +++--- docs/keycodes.md | 16 +++++ quantum/keycodes.h | 20 ++++++ tests/test_common/keycode_table.cpp | 9 +++ 6 files changed, 123 insertions(+), 10 deletions(-) create mode 100644 data/constants/keycodes/keycodes_0.0.4.hjson create mode 100644 data/constants/keycodes/keycodes_0.0.4_lighting.hjson diff --git a/data/constants/keycodes/keycodes_0.0.4.hjson b/data/constants/keycodes/keycodes_0.0.4.hjson new file mode 100644 index 0000000000..e69de29bb2 diff --git a/data/constants/keycodes/keycodes_0.0.4_lighting.hjson b/data/constants/keycodes/keycodes_0.0.4_lighting.hjson new file mode 100644 index 0000000000..d7b27230f3 --- /dev/null +++ b/data/constants/keycodes/keycodes_0.0.4_lighting.hjson @@ -0,0 +1,67 @@ +{ + "keycodes": { + "0x7810": { + "group": "led_matrix", + "key": "QK_LED_MATRIX_ON", + "aliases": [ + "LM_ON" + ] + }, + "0x7811": { + "group": "led_matrix", + "key": "QK_LED_MATRIX_OFF", + "aliases": [ + "LM_OFF" + ] + }, + "0x7812": { + "group": "led_matrix", + "key": "QK_LED_MATRIX_TOGGLE", + "aliases": [ + "LM_TOGG" + ] + }, + "0x7813": { + "group": "led_matrix", + "key": "QK_LED_MATRIX_MODE_NEXT", + "aliases": [ + "LM_NEXT" + ] + }, + "0x7814": { + "group": "led_matrix", + "key": "QK_LED_MATRIX_MODE_PREVIOUS", + "aliases": [ + "LM_PREV" + ] + }, + "0x7815": { + "group": "led_matrix", + "key": "QK_LED_MATRIX_BRIGHTNESS_UP", + "aliases": [ + "LM_BRIU" + ] + }, + "0x7816": { + "group": "led_matrix", + "key": "QK_LED_MATRIX_BRIGHTNESS_DOWN", + "aliases": [ + "LM_BRID" + ] + }, + "0x7817": { + "group": "led_matrix", + "key": "QK_LED_MATRIX_SPEED_UP", + "aliases": [ + "LM_SPDU" + ] + }, + "0x7818": { + "group": "led_matrix", + "key": "QK_LED_MATRIX_SPEED_DOWN", + "aliases": [ + "LM_SPDD" + ] + } + } +} diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md index 3a3a9dbf84..83357ab14e 100644 --- a/docs/feature_led_matrix.md +++ b/docs/feature_led_matrix.md @@ -217,16 +217,17 @@ As mentioned earlier, the center of the keyboard by default is expected to be `{ ## Keycodes :id=keycodes -All LED matrix keycodes are currently shared with the [Backlight feature](feature_backlight.md). - -| Key | Aliases | Description | -|-------------------------|-----------|-------------------------------| -| `QK_BACKLIGHT_TOGGLE` | `BL_TOGG` | Toggle LED Matrix on or off | -| `QK_BACKLIGHT_STEP` | `BL_STEP` | Cycle through modes | -| `QK_BACKLIGHT_ON` | `BL_ON` | Turn on LED Matrix | -| `QK_BACKLIGHT_OFF` | `BL_OFF` | Turn off LED Matrix | -| `QK_BACKLIGHT_UP` | `BL_UP` | Increase the brightness level | -| `QK_BACKLIGHT_DOWN` | `BL_DOWN` | Decrease the brightness level | +|Key |Aliases |Description | +|-------------------------------|---------|-----------------------------------| +|`QK_LED_MATRIX_ON` |`LM_ON` |Turn on LED Matrix | +|`QK_LED_MATRIX_OFF` |`LM_OFF` |Turn off LED Matrix | +|`QK_LED_MATRIX_TOGGLE` |`LM_TOGG`|Toggle LED Matrix on or off | +|`QK_LED_MATRIX_MODE_NEXT` |`LM_NEXT`|Cycle through animations | +|`QK_LED_MATRIX_MODE_PREVIOUS` |`LM_PREV`|Cycle through animations in reverse| +|`QK_LED_MATRIX_BRIGHTNESS_UP` |`LM_BRIU`|Increase the brightness level | +|`QK_LED_MATRIX_BRIGHTNESS_DOWN`|`LM_BRID`|Decrease the brightness level | +|`QK_LED_MATRIX_SPEED_UP` |`LM_SPDU`|Increase the animation speed | +|`QK_LED_MATRIX_SPEED_DOWN` |`LM_SPDD`|Decrease the animation speed | ## LED Matrix Effects :id=led-matrix-effects diff --git a/docs/keycodes.md b/docs/keycodes.md index 65762234a4..9d722216a9 100644 --- a/docs/keycodes.md +++ b/docs/keycodes.md @@ -398,6 +398,22 @@ See also: [Leader Key](feature_leader_key.md) |---------|------------------------| |`QK_LEAD`|Begins a leader sequence| +## LED Matrix :id=led-matrix + +See also: [LED Matrix](feature_led_matrix.md) + +|Key |Aliases |Description | +|-------------------------------|---------|-----------------------------------| +|`QK_LED_MATRIX_ON` |`LM_ON` |Turn on LED Matrix | +|`QK_LED_MATRIX_OFF` |`LM_OFF` |Turn off LED Matrix | +|`QK_LED_MATRIX_TOGGLE` |`LM_TOGG`|Toggle LED Matrix on or off | +|`QK_LED_MATRIX_MODE_NEXT` |`LM_NEXT`|Cycle through animations | +|`QK_LED_MATRIX_MODE_PREVIOUS` |`LM_PREV`|Cycle through animations in reverse| +|`QK_LED_MATRIX_BRIGHTNESS_UP` |`LM_BRIU`|Increase the brightness level | +|`QK_LED_MATRIX_BRIGHTNESS_DOWN`|`LM_BRID`|Decrease the brightness level | +|`QK_LED_MATRIX_SPEED_UP` |`LM_SPDU`|Increase the animation speed | +|`QK_LED_MATRIX_SPEED_DOWN` |`LM_SPDD`|Decrease the animation speed | + ## Magic Keycodes :id=magic-keycodes See also: [Magic Keycodes](keycodes_magic.md) diff --git a/quantum/keycodes.h b/quantum/keycodes.h index 69d62b5731..da1012cf12 100644 --- a/quantum/keycodes.h +++ b/quantum/keycodes.h @@ -627,6 +627,15 @@ enum qk_keycode_defines { QK_BACKLIGHT_UP = 0x7804, QK_BACKLIGHT_STEP = 0x7805, QK_BACKLIGHT_TOGGLE_BREATHING = 0x7806, + QK_LED_MATRIX_ON = 0x7810, + QK_LED_MATRIX_OFF = 0x7811, + QK_LED_MATRIX_TOGGLE = 0x7812, + QK_LED_MATRIX_MODE_NEXT = 0x7813, + QK_LED_MATRIX_MODE_PREVIOUS = 0x7814, + QK_LED_MATRIX_BRIGHTNESS_UP = 0x7815, + QK_LED_MATRIX_BRIGHTNESS_DOWN = 0x7816, + QK_LED_MATRIX_SPEED_UP = 0x7817, + QK_LED_MATRIX_SPEED_DOWN = 0x7818, RGB_TOG = 0x7820, RGB_MODE_FORWARD = 0x7821, RGB_MODE_REVERSE = 0x7822, @@ -1281,6 +1290,15 @@ enum qk_keycode_defines { BL_UP = QK_BACKLIGHT_UP, BL_STEP = QK_BACKLIGHT_STEP, BL_BRTG = QK_BACKLIGHT_TOGGLE_BREATHING, + LM_ON = QK_LED_MATRIX_ON, + LM_OFF = QK_LED_MATRIX_OFF, + LM_TOGG = QK_LED_MATRIX_TOGGLE, + LM_NEXT = QK_LED_MATRIX_MODE_NEXT, + LM_PREV = QK_LED_MATRIX_MODE_PREVIOUS, + LM_BRIU = QK_LED_MATRIX_BRIGHTNESS_UP, + LM_BRID = QK_LED_MATRIX_BRIGHTNESS_DOWN, + LM_SPDU = QK_LED_MATRIX_SPEED_UP, + LM_SPDD = QK_LED_MATRIX_SPEED_DOWN, RGB_MOD = RGB_MODE_FORWARD, RGB_RMOD = RGB_MODE_REVERSE, RGB_M_P = RGB_MODE_PLAIN, @@ -1416,6 +1434,7 @@ enum qk_keycode_defines { #define IS_STENO_KEYCODE(code) ((code) >= QK_STENO_BOLT && (code) <= QK_STENO_COMB_MAX) #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_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_QUANTUM_KEYCODE(code) ((code) >= QK_BOOTLOADER && (code) <= QK_ALT_REPEAT_KEY) #define IS_KB_KEYCODE(code) ((code) >= QK_KB_0 && (code) <= QK_KB_31) @@ -1438,6 +1457,7 @@ enum qk_keycode_defines { #define STENO_KEYCODE_RANGE QK_STENO_BOLT ... QK_STENO_COMB_MAX #define MACRO_KEYCODE_RANGE QK_MACRO_0 ... QK_MACRO_31 #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 RGB_KEYCODE_RANGE RGB_TOG ... RGB_MODE_TWINKLE #define QUANTUM_KEYCODE_RANGE QK_BOOTLOADER ... QK_ALT_REPEAT_KEY #define KB_KEYCODE_RANGE QK_KB_0 ... QK_KB_31 diff --git a/tests/test_common/keycode_table.cpp b/tests/test_common/keycode_table.cpp index 29f7c710a0..06064e77f9 100644 --- a/tests/test_common/keycode_table.cpp +++ b/tests/test_common/keycode_table.cpp @@ -569,6 +569,15 @@ std::map KEYCODE_ID_TABLE = { {QK_BACKLIGHT_UP, "QK_BACKLIGHT_UP"}, {QK_BACKLIGHT_STEP, "QK_BACKLIGHT_STEP"}, {QK_BACKLIGHT_TOGGLE_BREATHING, "QK_BACKLIGHT_TOGGLE_BREATHING"}, + {QK_LED_MATRIX_ON, "QK_LED_MATRIX_ON"}, + {QK_LED_MATRIX_OFF, "QK_LED_MATRIX_OFF"}, + {QK_LED_MATRIX_TOGGLE, "QK_LED_MATRIX_TOGGLE"}, + {QK_LED_MATRIX_MODE_NEXT, "QK_LED_MATRIX_MODE_NEXT"}, + {QK_LED_MATRIX_MODE_PREVIOUS, "QK_LED_MATRIX_MODE_PREVIOUS"}, + {QK_LED_MATRIX_BRIGHTNESS_UP, "QK_LED_MATRIX_BRIGHTNESS_UP"}, + {QK_LED_MATRIX_BRIGHTNESS_DOWN, "QK_LED_MATRIX_BRIGHTNESS_DOWN"}, + {QK_LED_MATRIX_SPEED_UP, "QK_LED_MATRIX_SPEED_UP"}, + {QK_LED_MATRIX_SPEED_DOWN, "QK_LED_MATRIX_SPEED_DOWN"}, {RGB_TOG, "RGB_TOG"}, {RGB_MODE_FORWARD, "RGB_MODE_FORWARD"}, {RGB_MODE_REVERSE, "RGB_MODE_REVERSE"},