9c865839819bf9ec3ed573354a53bcbe905080f7

Author
Ryan <fauxpark@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

Backward compatibility for new RGB keycode handling (#24490)

Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>

Diff

This diff is truncated to protect this page.

  1diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk
  2index 2eb7056b6f6e3637e6ee28b50f92a4c2952a61fe..f5b01de015d04de6f26bdaf9b17d0ee04a22f6c7 100644
  3--- a/builddefs/common_features.mk
  4+++ b/builddefs/common_features.mk
  5@@ -456,6 +456,10 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
  6     COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations
  7     COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations/runners
  8     POST_CONFIG_H += $(QUANTUM_DIR)/rgb_matrix/post_config.h
  9+
 10+    # TODO: Remove this
 11+    SRC += $(QUANTUM_DIR)/process_keycode/process_underglow.c
 12+
 13     SRC += $(QUANTUM_DIR)/process_keycode/process_rgb_matrix.c
 14     SRC += $(QUANTUM_DIR)/color.c
 15     SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix.c
 16diff --git a/docs/features/rgblight.md b/docs/features/rgblight.md
 17index 2afc2eb7d098af31a89ef582bd7071e384b004c3..4322fe796e7a0d3ead30604b68748d59d639a7f5 100644
 18--- a/docs/features/rgblight.md
 19+++ b/docs/features/rgblight.md
 20@@ -59,6 +59,10 @@ Changing the **Value** sets the overall brightness.<br>
 21 
 22 ## Keycodes
 23 
 24+::: warning
 25diff --git a/keyboards/inett_studio/sqx/hotswap/config.h b/keyboards/inett_studio/sqx/hotswap/config.h
 26index 4172a72379f8f8646638f70f62379662d74785b2..22d2e739cbbb38075b9e27e70cd0622d431854c7 100644
 27--- a/keyboards/inett_studio/sqx/hotswap/config.h
 28+++ b/keyboards/inett_studio/sqx/hotswap/config.h
 29@@ -20,3 +20,5 @@
 30 
 31 #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
 32 #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC
 33+
 34+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
 35diff --git a/keyboards/inett_studio/sqx/universal/config.h b/keyboards/inett_studio/sqx/universal/config.h
 36index 4172a72379f8f8646638f70f62379662d74785b2..22d2e739cbbb38075b9e27e70cd0622d431854c7 100644
 37--- a/keyboards/inett_studio/sqx/universal/config.h
 38+++ b/keyboards/inett_studio/sqx/universal/config.h
 39@@ -20,3 +20,5 @@
 40 
 41 #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
 42 #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC
 43+
 44+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
 45diff --git a/keyboards/kprepublic/bm60hsrgb_ec/rev2/config.h b/keyboards/kprepublic/bm60hsrgb_ec/rev2/config.h
 46index b58434efece85731f8d7718db57ff36b9661429e..ddb8a2525ff529fe3d908d02446fdde03dce77fd 100644
 47--- a/keyboards/kprepublic/bm60hsrgb_ec/rev2/config.h
 48+++ b/keyboards/kprepublic/bm60hsrgb_ec/rev2/config.h
 49@@ -16,3 +16,5 @@
 50 #pragma once
 51 
 52 #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
 53+
 54+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
 55diff --git a/keyboards/kprepublic/bm68hsrgb/rev2/config.h b/keyboards/kprepublic/bm68hsrgb/rev2/config.h
 56index f35697b992e534c829d02b651a181fe6978e520c..026cbdcdca0ac642184e7e7b44d33bb91fded32f 100644
 57--- a/keyboards/kprepublic/bm68hsrgb/rev2/config.h
 58+++ b/keyboards/kprepublic/bm68hsrgb/rev2/config.h
 59@@ -17,3 +17,5 @@
 60 #pragma once
 61 
 62 #define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
 63+
 64+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
 65diff --git a/keyboards/mechlovin/adelais/rgb_led/rev2/config.h b/keyboards/mechlovin/adelais/rgb_led/rev2/config.h
 66index 82b582bfe1201347c2ccbda1a094905121b77773..fea263d7fbe9fb4e8f20a895cdd0397767e5088c 100644
 67--- a/keyboards/mechlovin/adelais/rgb_led/rev2/config.h
 68+++ b/keyboards/mechlovin/adelais/rgb_led/rev2/config.h
 69@@ -2,3 +2,5 @@
 70 
 71 #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
 72 #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
 73+
 74+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
 75diff --git a/keyboards/mechlovin/hannah60rgb/rev2/config.h b/keyboards/mechlovin/hannah60rgb/rev2/config.h
 76index 82b582bfe1201347c2ccbda1a094905121b77773..fea263d7fbe9fb4e8f20a895cdd0397767e5088c 100644
 77--- a/keyboards/mechlovin/hannah60rgb/rev2/config.h
 78+++ b/keyboards/mechlovin/hannah60rgb/rev2/config.h
 79@@ -2,3 +2,5 @@
 80 
 81 #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
 82 #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
 83+
 84+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
 85diff --git a/keyboards/owlab/voice65/hotswap/config.h b/keyboards/owlab/voice65/hotswap/config.h
 86index be6b66e58a8f107f19cbe5878fa04bd864a0e199..97bde08548ec16fc6de2a926a19f92b46ba99569 100644
 87--- a/keyboards/owlab/voice65/hotswap/config.h
 88+++ b/keyboards/owlab/voice65/hotswap/config.h
 89@@ -18,3 +18,5 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 90 #pragma once
 91 
 92 #define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
 93+
 94+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
 95diff --git a/keyboards/owlab/voice65/soldered/config.h b/keyboards/owlab/voice65/soldered/config.h
 96index be6b66e58a8f107f19cbe5878fa04bd864a0e199..97bde08548ec16fc6de2a926a19f92b46ba99569 100644
 97--- a/keyboards/owlab/voice65/soldered/config.h
 98+++ b/keyboards/owlab/voice65/soldered/config.h
 99@@ -18,3 +18,5 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
100 #pragma once
101 
102 #define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
103+
104+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
105diff --git a/keyboards/qwertykeys/qk100/ansi/config.h b/keyboards/qwertykeys/qk100/ansi/config.h
106index b78d15782bac292f2a7ae7c0a26e46de81995ed7..ceba1c798dd159992bef273019837b451aa8172e 100644
107--- a/keyboards/qwertykeys/qk100/ansi/config.h
108+++ b/keyboards/qwertykeys/qk100/ansi/config.h
109@@ -30,3 +30,5 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
110 #define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
111 
112 #define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
113+
114+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
115diff --git a/keyboards/work_louder/loop/config.h b/keyboards/work_louder/loop/config.h
116index b883b0ff578020a863a52d4e4ff3b8d8077b869e..5b031c6fc105eac975d56072a53082828465bca1 100644
117--- a/keyboards/work_louder/loop/config.h
118+++ b/keyboards/work_louder/loop/config.h
119@@ -18,3 +18,5 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
120 #pragma once
121 
122 #define RGBLIGHT_DI_PIN E6
123+
124+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
125diff --git a/keyboards/work_louder/micro/config.h b/keyboards/work_louder/micro/config.h
126index b9f2d8d87dc517f05982087918584a663f5454cd..6748a5f595110896fadc2d7643ed08155024b0e0 100644
127--- a/keyboards/work_louder/micro/config.h
128+++ b/keyboards/work_louder/micro/config.h
129@@ -9,3 +9,5 @@
130 #define WORK_LOUDER_LED_PIN_1 B6
131 #define WORK_LOUDER_LED_PIN_2 B7
132 #define WORK_LOUDER_LED_PIN_3 B5
133+
134+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
135diff --git a/keyboards/work_louder/nano/config.h b/keyboards/work_louder/nano/config.h
136index 2372f371b998cdedb8c0024a4d05d65a9f6fbcae..492931c559cbee1bc5d4d093d9269e57518b26ca 100644
137--- a/keyboards/work_louder/nano/config.h
138+++ b/keyboards/work_louder/nano/config.h
139@@ -18,3 +18,5 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
140 #pragma once
141 
142 #define RGBLIGHT_DI_PIN        C7
143+
144+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
145diff --git a/keyboards/work_louder/numpad/config.h b/keyboards/work_louder/numpad/config.h
146index cfc27d3612409c98a4de8c0064bc68878d46c0e4..809c498dbbbff747414666d23b2fb05c435d4613 100644
147--- a/keyboards/work_louder/numpad/config.h
148+++ b/keyboards/work_louder/numpad/config.h
149@@ -5,3 +5,5 @@
150 
151 #define RGBLIGHT_DI_PIN D2
152 #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9
153+
154+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
155diff --git a/keyboards/work_louder/work_board/config.h b/keyboards/work_louder/work_board/config.h
156index 6688711bbbce03ef014244ca238171461a548203..efd4c529cd895aafd798cb34cc2c2cfcec89cc5a 100644
157--- a/keyboards/work_louder/work_board/config.h
158+++ b/keyboards/work_louder/work_board/config.h
159@@ -20,3 +20,5 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
160 #define RGBLIGHT_DI_PIN        D2
161 
162 #define RGBLIGHT_DEFAULT_MODE         RGBLIGHT_MODE_STATIC_GRADIENT + 9
163+
164+#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
165diff --git a/quantum/process_keycode/process_underglow.c b/quantum/process_keycode/process_underglow.c
166index 779672ac0768a01bdd3fbaebef806769397b328d..6104cd02c6ced5846c62db4e929f8276048772cb 100644
167--- a/quantum/process_keycode/process_underglow.c
168+++ b/quantum/process_keycode/process_underglow.c
169@@ -2,87 +2,200 @@
170 // SPDX-License-Identifier: GPL-2.0-or-later
171 
172 #include "process_underglow.h"
173-#include "rgblight.h"
174+#if defined(RGBLIGHT_ENABLE)
175+#    include "rgblight.h"
176+#endif
177 #include "action_util.h"
178 #include "keycodes.h"
179 #include "modifiers.h"
180 
181+// TODO: Remove this
182+#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
183+#    include "rgb_matrix.h"
184+#endif
185+
186 bool process_underglow(uint16_t keycode, keyrecord_t *record) {
187     if (record->event.pressed) {
188         uint8_t shifted = get_mods() & MOD_MASK_SHIFT;
189         switch (keycode) {
190             case QK_UNDERGLOW_TOGGLE:
191+#if defined(RGBLIGHT_ENABLE)
192                 rgblight_toggle();
193+#endif
194+
195+#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
196+                rgb_matrix_toggle();
197+#endif
198                 return false;
199             case QK_UNDERGLOW_MODE_NEXT:
200+#if defined(RGBLIGHT_ENABLE)
201                 if (shifted) {
202                     rgblight_step_reverse();
203                 } else {
204                     rgblight_step();
205                 }
206+#endif
207+
208+#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
209+                if (shifted) {
210+                    rgb_matrix_step_reverse();
211+                } else {
212+                    rgb_matrix_step();
213+                }
214+#endif
215                 return false;
216             case QK_UNDERGLOW_MODE_PREVIOUS:
217+#if defined(RGBLIGHT_ENABLE)
218                 if (shifted) {
219                     rgblight_step();
220                 } else {
221                     rgblight_step_reverse();
222                 }
223+#endif
224+
225+#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
226+                if (shifted) {
227+                    rgb_matrix_step();
228+                } else {
229+                    rgb_matrix_step_reverse();
230+                }
231+#endif
232                 return false;
233             case QK_UNDERGLOW_HUE_UP:
234+#if defined(RGBLIGHT_ENABLE)
235                 if (shifted) {
236                     rgblight_decrease_hue();
237                 } else {
238                     rgblight_increase_hue();
239                 }
240+#endif
241+
242+#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
243+                if (shifted) {
244+                    rgb_matrix_decrease_hue();
245+                } else {
246+                    rgb_matrix_increase_hue();
247+                }
248+#endif
249                 return false;
250             case QK_UNDERGLOW_HUE_DOWN:
251+#if defined(RGBLIGHT_ENABLE)
252                 if (shifted) {
253                     rgblight_increase_hue();
254                 } else {
255                     rgblight_decrease_hue();
256                 }
257+#endif
258+
259+#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
260+                if (shifted) {
261+                    rgb_matrix_increase_hue();
262+                } else {
263+                    rgb_matrix_decrease_hue();
264+                }
265+#endif
266                 return false;
267             case QK_UNDERGLOW_SATURATION_UP:
268+#if defined(RGBLIGHT_ENABLE)
269diff --git a/quantum/quantum.c b/quantum/quantum.c
270index 8bfe04e17987411b201645124ab2b15c2dc2ae6e..874df1593a2b95bf2f7ca51fbaa0e92a90d24018 100644
271--- a/quantum/quantum.c
272+++ b/quantum/quantum.c
273@@ -60,7 +60,7 @@
274 #    include "process_rgb_matrix.h"
275 #endif
276 
277-#if defined(RGBLIGHT_ENABLE)
278+#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
279 #    include "process_underglow.h"
280 #endif
281 
282@@ -382,7 +382,7 @@ bool process_record_quantum(keyrecord_t *record) {
283 #ifdef GRAVE_ESC_ENABLE
284             process_grave_esc(keycode, record) &&
285 #endif
286-#if defined(RGBLIGHT_ENABLE)
287+#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
288             process_underglow(keycode, record) &&
289 #endif
290 #if defined(RGB_MATRIX_ENABLE)