From 8ee4d7a30d509654ab289bb5b575a3c3199ccd28 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sun, 7 Apr 2024 11:47:09 +1000 Subject: [PATCH 1/3] Add new set of keycodes for LED Matrix --- data/constants/keycodes/keycodes_0.0.4.hjson | 0 .../keycodes/keycodes_0.0.4_lighting.hjson | 67 +++++++++++++++++++ quantum/keycodes.h | 20 ++++++ 3 files changed, 87 insertions(+) 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 000000000000..e69de29bb2d1 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 000000000000..d7b27230f30c --- /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/quantum/keycodes.h b/quantum/keycodes.h index 69d62b573111..da1012cf12b0 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 From 64a54165881aeef6c654dc7f10b47dc331781c7e Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sun, 7 Apr 2024 11:47:57 +1000 Subject: [PATCH 2/3] Docs --- docs/feature_led_matrix.md | 21 +++++++++++---------- docs/keycodes.md | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md index 3a3a9dbf844c..83357ab14e8c 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 65762234a448..9d722216a934 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) From 296c801e802adcd70244e21447edf2229683f531 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sun, 7 Apr 2024 11:59:33 +1000 Subject: [PATCH 3/3] Missed keycode table for tests --- tests/test_common/keycode_table.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_common/keycode_table.cpp b/tests/test_common/keycode_table.cpp index 29f7c710a035..06064e77f912 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"},