summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/rgb_matrix.c16
-rw-r--r--quantum/rgb_matrix.h4
-rw-r--r--quantum/rgb_matrix_animations/alpha_mods_anim.h4
-rw-r--r--quantum/rgb_matrix_animations/cycle_all_anim.h2
-rw-r--r--quantum/rgb_matrix_animations/cycle_left_right_anim.h5
-rw-r--r--quantum/rgb_matrix_animations/cycle_up_down_anim.h5
-rw-r--r--quantum/rgb_matrix_animations/dual_beacon_anim.h5
-rw-r--r--quantum/rgb_matrix_animations/gradient_up_down_anim.h5
-rw-r--r--quantum/rgb_matrix_animations/jellybean_raindrops_anim.h4
-rw-r--r--quantum/rgb_matrix_animations/rainbow_beacon_anim.h5
-rw-r--r--quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h5
-rw-r--r--quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h5
-rw-r--r--quantum/rgb_matrix_animations/raindrops_anim.h3
-rw-r--r--quantum/rgb_matrix_animations/solid_color_anim.h1
-rw-r--r--quantum/rgb_matrix_animations/solid_reactive_anim.h1
-rw-r--r--quantum/rgb_matrix_animations/solid_reactive_cross.h7
-rw-r--r--quantum/rgb_matrix_animations/solid_reactive_nexus.h7
-rw-r--r--quantum/rgb_matrix_animations/solid_reactive_simple_anim.h1
-rw-r--r--quantum/rgb_matrix_animations/solid_reactive_wide.h7
-rw-r--r--quantum/rgb_matrix_animations/solid_splash_anim.h7
-rw-r--r--quantum/rgb_matrix_animations/splash_anim.h7
-rw-r--r--quantum/rgb_matrix_types.h18
22 files changed, 53 insertions, 71 deletions
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c
index 5528a08347..edbcee9cd1 100644
--- a/quantum/rgb_matrix.c
+++ b/quantum/rgb_matrix.c
@@ -105,6 +105,7 @@
bool g_suspend_state = false;
+extern led_config_t g_led_config;
rgb_config_t rgb_matrix_config;
rgb_counters_t g_rgb_counters;
@@ -150,14 +151,11 @@ uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t
}
uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) {
- // TODO: This is kinda expensive, fix this soonish
uint8_t led_count = rgb_matrix_map_row_column_to_led_kb(row, column, led_i);
- for (uint8_t i = 0; i < DRIVER_LED_TOTAL && led_count < LED_HITS_TO_REMEMBER; i++) {
- matrix_co_t matrix_co = g_rgb_leds[i].matrix_co;
- if (row == matrix_co.row && column == matrix_co.col) {
- led_i[led_count] = i;
- led_count++;
- }
+ uint8_t led_index = g_led_config.matrix_co[row][column];
+ if (led_index != NO_LED) {
+ led_i[led_count] = led_index;
+ led_count++;
}
return led_count;
}
@@ -201,8 +199,8 @@ bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
for(uint8_t i = 0; i < led_count; i++) {
uint8_t index = last_hit_buffer.count;
- last_hit_buffer.x[index] = g_rgb_leds[led[i]].point.x;
- last_hit_buffer.y[index] = g_rgb_leds[led[i]].point.y;
+ last_hit_buffer.x[index] = g_led_config.point[led[i]].x;
+ last_hit_buffer.y[index] = g_led_config.point[led[i]].y;
last_hit_buffer.index[index] = led[i];
last_hit_buffer.tick[index] = 0;
last_hit_buffer.count++;
diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h
index 33665ffff2..365a92bbf6 100644
--- a/quantum/rgb_matrix.h
+++ b/quantum/rgb_matrix.h
@@ -54,9 +54,7 @@
uint8_t max = DRIVER_LED_TOTAL;
#endif
-#define RGB_MATRIX_TEST_LED_FLAGS() if (!HAS_ANY_FLAGS(g_rgb_leds[i].flags, params->flags)) continue
-
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+#define RGB_MATRIX_TEST_LED_FLAGS() if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) continue
typedef struct
{
diff --git a/quantum/rgb_matrix_animations/alpha_mods_anim.h b/quantum/rgb_matrix_animations/alpha_mods_anim.h
index 4bd01c4fc8..d7f6f4655b 100644
--- a/quantum/rgb_matrix_animations/alpha_mods_anim.h
+++ b/quantum/rgb_matrix_animations/alpha_mods_anim.h
@@ -1,7 +1,7 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
// alphas = color1, mods = color2
@@ -15,7 +15,7 @@ bool rgb_matrix_alphas_mods(effect_params_t* params) {
for (uint8_t i = led_min; i < led_max; i++) {
RGB_MATRIX_TEST_LED_FLAGS();
- if (HAS_FLAGS(g_rgb_leds[i].flags, LED_FLAG_MODIFIER)) {
+ if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {
rgb_matrix_set_color(i, rgb2.r, rgb2.g, rgb2.b);
} else {
rgb_matrix_set_color(i, rgb1.r, rgb1.g, rgb1.b);
diff --git a/quantum/rgb_matrix_animations/cycle_all_anim.h b/quantum/rgb_matrix_animations/cycle_all_anim.h
index 513dff1281..e93798f900 100644
--- a/quantum/rgb_matrix_animations/cycle_all_anim.h
+++ b/quantum/rgb_matrix_animations/cycle_all_anim.h
@@ -2,7 +2,7 @@
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
extern rgb_counters_t g_rgb_counters;
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_cycle_all(effect_params_t* params) {
diff --git a/quantum/rgb_matrix_animations/cycle_left_right_anim.h b/quantum/rgb_matrix_animations/cycle_left_right_anim.h
index 428adea223..4b09d5826b 100644
--- a/quantum/rgb_matrix_animations/cycle_left_right_anim.h
+++ b/quantum/rgb_matrix_animations/cycle_left_right_anim.h
@@ -2,7 +2,7 @@
#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
extern rgb_counters_t g_rgb_counters;
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_cycle_left_right(effect_params_t* params) {
@@ -12,8 +12,7 @@ bool rgb_matrix_cycle_left_right(effect_params_t* params) {
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
for (uint8_t i = led_min; i < led_max; i++) {
RGB_MATRIX_TEST_LED_FLAGS();
- point_t point = g_rgb_leds[i].point;
- hsv.h = point.x - time;
+ hsv.h = g_led_config.point[i].x - time;
RGB rgb = hsv_to_rgb(hsv);
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
}
diff --git a/quantum/rgb_matrix_animations/cycle_up_down_anim.h b/quantum/rgb_matrix_animations/cycle_up_down_anim.h
index ea63095d2e..403214bb73 100644
--- a/quantum/rgb_matrix_animations/cycle_up_down_anim.h
+++ b/quantum/rgb_matrix_animations/cycle_up_down_anim.h
@@ -2,7 +2,7 @@
#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
extern rgb_counters_t g_rgb_counters;
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_cycle_up_down(effect_params_t* params) {
@@ -12,8 +12,7 @@ bool rgb_matrix_cycle_up_down(effect_params_t* params) {
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
for (uint8_t i = led_min; i < led_max; i++) {
RGB_MATRIX_TEST_LED_FLAGS();
- point_t point = g_rgb_leds[i].point;
- hsv.h = point.y - time;
+ hsv.h = g_led_config.point[i].y - time;
RGB rgb = hsv_to_rgb(hsv);
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
}
diff --git a/quantum/rgb_matrix_animations/dual_beacon_anim.h b/quantum/rgb_matrix_animations/dual_beacon_anim.h
index 00f6e50880..dcb594029e 100644
--- a/quantum/rgb_matrix_animations/dual_beacon_anim.h
+++ b/quantum/rgb_matrix_animations/dual_beacon_anim.h
@@ -2,7 +2,7 @@
#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
extern rgb_counters_t g_rgb_counters;
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_dual_beacon(effect_params_t* params) {
@@ -14,8 +14,7 @@ bool rgb_matrix_dual_beacon(effect_params_t* params) {
int8_t sin_value = sin8(time) - 128;
for (uint8_t i = led_min; i < led_max; i++) {
RGB_MATRIX_TEST_LED_FLAGS();
- point_t point = g_rgb_leds[i].point;
- hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue;
+ hsv.h = ((g_led_config.point[i].y - 32) * cos_value + (g_led_config.point[i].x - 112) * sin_value) / 128 + rgb_matrix_config.hue;
RGB rgb = hsv_to_rgb(hsv);
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
}
diff --git a/quantum/rgb_matrix_animations/gradient_up_down_anim.h b/quantum/rgb_matrix_animations/gradient_up_down_anim.h
index 05117540ae..7a6ed14219 100644
--- a/quantum/rgb_matrix_animations/gradient_up_down_anim.h
+++ b/quantum/rgb_matrix_animations/gradient_up_down_anim.h
@@ -1,7 +1,7 @@
#pragma once
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_gradient_up_down(effect_params_t* params) {
@@ -11,10 +11,9 @@ bool rgb_matrix_gradient_up_down(effect_params_t* params) {
uint8_t scale = scale8(64, rgb_matrix_config.speed);
for (uint8_t i = led_min; i < led_max; i++) {
RGB_MATRIX_TEST_LED_FLAGS();
- point_t point = g_rgb_leds[i].point;
// The y range will be 0..64, map this to 0..4
// Relies on hue being 8-bit and wrapping
- hsv.h = rgb_matrix_config.hue + scale * (point.y >> 4);
+ hsv.h = rgb_matrix_config.hue + scale * (g_led_config.point[i].y >> 4);
RGB rgb = hsv_to_rgb(hsv);
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
}
diff --git a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h
index dffa532643..5ea971435e 100644
--- a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h
+++ b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h
@@ -2,11 +2,11 @@
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
extern rgb_counters_t g_rgb_counters;
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
- if (!HAS_ANY_FLAGS(g_rgb_leds[i].flags, params->flags)) return;
+ if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.val };
RGB rgb = hsv_to_rgb(hsv);
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
diff --git a/quantum/rgb_matrix_animations/rainbow_beacon_anim.h b/quantum/rgb_matrix_animations/rainbow_beacon_anim.h
index 89f6965c33..d462880731 100644
--- a/quantum/rgb_matrix_animations/rainbow_beacon_anim.h
+++ b/quantum/rgb_matrix_animations/rainbow_beacon_anim.h
@@ -2,7 +2,7 @@
#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
extern rgb_counters_t g_rgb_counters;
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_rainbow_beacon(effect_params_t* params) {
@@ -14,8 +14,7 @@ bool rgb_matrix_rainbow_beacon(effect_params_t* params) {
int16_t sin_value = 2 * (sin8(time) - 128);
for (uint8_t i = led_min; i < led_max; i++) {
RGB_MATRIX_TEST_LED_FLAGS();
- point_t point = g_rgb_leds[i].point;
- hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue;
+ hsv.h = ((g_led_config.point[i].y - 32) * cos_value + (g_led_config.point[i].x - 112) * sin_value) / 128 + rgb_matrix_config.hue;
RGB rgb = hsv_to_rgb(hsv);
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
}
diff --git a/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h b/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h
index 0d57aef57b..3b7d9689f8 100644
--- a/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h
+++ b/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h
@@ -2,7 +2,7 @@
#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
extern rgb_counters_t g_rgb_counters;
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) {
@@ -12,8 +12,7 @@ bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) {
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
for (uint8_t i = led_min; i < led_max; i++) {
RGB_MATRIX_TEST_LED_FLAGS();
- point_t point = g_rgb_leds[i].point;
- hsv.h = abs8(point.y - 32) + (point.x - time) + rgb_matrix_config.hue;
+ hsv.h = abs8(g_led_config.point[i].y - 32) + (g_led_config.point[i].x - time) + rgb_matrix_config.hue;
RGB rgb = hsv_to_rgb(hsv);
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
}
diff --git a/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h b/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h
index 03652758c6..e92f351765 100644
--- a/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h
+++ b/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h
@@ -2,7 +2,7 @@
#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
extern rgb_counters_t g_rgb_counters;
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) {
@@ -14,8 +14,7 @@ bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) {
int16_t sin_value = 3 * (sin8(time) - 128);
for (uint8_t i = led_min; i < led_max; i++) {
RGB_MATRIX_TEST_LED_FLAGS();
- point_t point = g_rgb_leds[i].point;
- hsv.h = ((point.y - 32) * cos_value + (56 - abs8(point.x - 112)) * sin_value) / 128 + rgb_matrix_config.hue;
+ hsv.h = ((g_led_config.point[i].y - 32) * cos_value + (56 - abs8(g_led_config.point[i].x - 112)) * sin_value) / 128 + rgb_matrix_config.hue;
RGB rgb = hsv_to_rgb(hsv);
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
}
diff --git a/quantum/rgb_matrix_animations/raindrops_anim.h b/quantum/rgb_matrix_animations/raindrops_anim.h
index 0e3a878642..4ce1d65e57 100644
--- a/quantum/rgb_matrix_animations/raindrops_anim.h
+++ b/quantum/rgb_matrix_animations/raindrops_anim.h
@@ -3,10 +3,11 @@
#include "rgb_matrix_types.h"
extern rgb_counters_t g_rgb_counters;
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
static void raindrops_set_color(int i, effect_params_t* params) {
- if (!HAS_ANY_FLAGS(g_rgb_leds[i].flags, params->flags)) return;
+ if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
HSV hsv = { 0 , rgb_matrix_config.sat, rgb_matrix_config.val };
// Take the shortest path between hues
diff --git a/quantum/rgb_matrix_animations/solid_color_anim.h b/quantum/rgb_matrix_animations/solid_color_anim.h
index 033c1f9333..ba2cea15e3 100644
--- a/quantum/rgb_matrix_animations/solid_color_anim.h
+++ b/quantum/rgb_matrix_animations/solid_color_anim.h
@@ -1,5 +1,6 @@
#pragma once
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
bool rgb_matrix_solid_color(effect_params_t* params) {
diff --git a/quantum/rgb_matrix_animations/solid_reactive_anim.h b/quantum/rgb_matrix_animations/solid_reactive_anim.h
index 82483653ae..c3dba8a5af 100644
--- a/quantum/rgb_matrix_animations/solid_reactive_anim.h
+++ b/quantum/rgb_matrix_animations/solid_reactive_anim.h
@@ -2,6 +2,7 @@
#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED)
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
extern last_hit_t g_last_hit_tracker;
diff --git a/quantum/rgb_matrix_animations/solid_reactive_cross.h b/quantum/rgb_matrix_animations/solid_reactive_cross.h
index 1dec1886d1..8858f71e60 100644
--- a/quantum/rgb_matrix_animations/solid_reactive_cross.h
+++ b/quantum/rgb_matrix_animations/solid_reactive_cross.h
@@ -2,7 +2,7 @@
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
extern last_hit_t g_last_hit_tracker;
@@ -13,11 +13,10 @@ static bool rgb_matrix_solid_reactive_multicross_range(uint8_t start, effect_par
uint8_t count = g_last_hit_tracker.count;
for (uint8_t i = led_min; i < led_max; i++) {
hsv.v = 0;
- point_t point = g_rgb_leds[i].point;
for (uint8_t j = start; j < count; j++) {
RGB_MATRIX_TEST_LED_FLAGS();
- int16_t dx = point.x - g_last_hit_tracker.x[j];
- int16_t dy = point.y - g_last_hit_tracker.y[j];
+ int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j];
+ int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j];
uint8_t dist = sqrt16(dx * dx + dy * dy);
int16_t dist2 = 16;
uint8_t dist3;
diff --git a/quantum/rgb_matrix_animations/solid_reactive_nexus.h b/quantum/rgb_matrix_animations/solid_reactive_nexus.h
index 8952a1e2bf..c0e3c24507 100644
--- a/quantum/rgb_matrix_animations/solid_reactive_nexus.h
+++ b/quantum/rgb_matrix_animations/solid_reactive_nexus.h
@@ -2,7 +2,7 @@
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
extern last_hit_t g_last_hit_tracker;
@@ -13,11 +13,10 @@ static bool rgb_matrix_solid_reactive_multinexus_range(uint8_t start, effect_par
uint8_t count = g_last_hit_tracker.count;
for (uint8_t i = led_min; i < led_max; i++) {
hsv.v = 0;
- point_t point = g_rgb_leds[i].point;
for (uint8_t j = start; j < count; j++) {
RGB_MATRIX_TEST_LED_FLAGS();
- int16_t dx = point.x - g_last_hit_tracker.x[j];
- int16_t dy = point.y - g_last_hit_tracker.y[j];
+ int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j];
+ int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j];
uint8_t dist = sqrt16(dx * dx + dy * dy);
int16_t dist2 = 8;
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist;
diff --git a/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h b/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h
index 9fc4d527a8..abc7e36a89 100644
--- a/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h
+++ b/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h
@@ -2,6 +2,7 @@
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
extern last_hit_t g_last_hit_tracker;
diff --git a/quantum/rgb_matrix_animations/solid_reactive_wide.h b/quantum/rgb_matrix_animations/solid_reactive_wide.h
index d86cb12844..3d1d38e806 100644
--- a/quantum/rgb_matrix_animations/solid_reactive_wide.h
+++ b/quantum/rgb_matrix_animations/solid_reactive_wide.h
@@ -2,7 +2,7 @@
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
extern last_hit_t g_last_hit_tracker;
@@ -13,11 +13,10 @@ static bool rgb_matrix_solid_reactive_multiwide_range(uint8_t start, effect_para
uint8_t count = g_last_hit_tracker.count;
for (uint8_t i = led_min; i < led_max; i++) {
hsv.v = 0;
- point_t point = g_rgb_leds[i].point;
for (uint8_t j = start; j < count; j++) {
RGB_MATRIX_TEST_LED_FLAGS();
- int16_t dx = point.x - g_last_hit_tracker.x[j];
- int16_t dy = point.y - g_last_hit_tracker.y[j];
+ int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j];
+ int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j];
uint8_t dist = sqrt16(dx * dx + dy * dy);
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) + dist * 5;
if (effect > 255)
diff --git a/quantum/rgb_matrix_animations/solid_splash_anim.h b/quantum/rgb_matrix_animations/solid_splash_anim.h
index 14312f33da..4e5565d0d3 100644
--- a/quantum/rgb_matrix_animations/solid_splash_anim.h
+++ b/quantum/rgb_matrix_animations/solid_splash_anim.h
@@ -2,7 +2,7 @@
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
#if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH)
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
extern last_hit_t g_last_hit_tracker;
@@ -14,10 +14,9 @@ static bool rgb_matrix_solid_multisplash_range(uint8_t start, effect_params_t* p
for (uint8_t i = led_min; i < led_max; i++) {
RGB_MATRIX_TEST_LED_FLAGS();
hsv.v = 0;
- point_t point = g_rgb_leds[i].point;
for (uint8_t j = start; j < count; j++) {
- int16_t dx = point.x - g_last_hit_tracker.x[j];
- int16_t dy = point.y - g_last_hit_tracker.y[j];
+ int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j];
+ int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j];
uint8_t dist = sqrt16(dx * dx + dy * dy);
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist;
if (effect > 255)
diff --git a/quantum/rgb_matrix_animations/splash_anim.h b/quantum/rgb_matrix_animations/splash_anim.h
index 3c96d451e1..fbe7761117 100644
--- a/quantum/rgb_matrix_animations/splash_anim.h
+++ b/quantum/rgb_matrix_animations/splash_anim.h
@@ -2,7 +2,7 @@
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
#if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
-extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
+extern led_config_t g_led_config;
extern rgb_config_t rgb_matrix_config;
extern last_hit_t g_last_hit_tracker;
@@ -15,10 +15,9 @@ static bool rgb_matrix_multisplash_range(uint8_t start, effect_params_t* params)
RGB_MATRIX_TEST_LED_FLAGS();
hsv.h = rgb_matrix_config.hue;
hsv.v = 0;
- point_t point = g_rgb_leds[i].point;
for (uint8_t j = start; j < count; j++) {
- int16_t dx = point.x - g_last_hit_tracker.x[j];
- int16_t dy = point.y - g_last_hit_tracker.y[j];
+ int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j];
+ int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j];
uint8_t dist = sqrt16(dx * dx + dy * dy);
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist;
if (effect > 255)
diff --git a/quantum/rgb_matrix_types.h b/quantum/rgb_matrix_types.h
index 7a3bc6714f..f890edd94f 100644
--- a/quantum/rgb_matrix_types.h
+++ b/quantum/rgb_matrix_types.h
@@ -59,14 +59,6 @@ typedef struct PACKED {
uint8_t y;
} point_t;
-typedef union {
- uint8_t raw;
- struct {
- uint8_t row:4; // 16 max
- uint8_t col:4; // 16 max
- };
-} matrix_co_t;
-
#define HAS_FLAGS(bits, flags) ((bits & flags) == flags)
#define HAS_ANY_FLAGS(bits, flags) ((bits & flags) != 0x00)
@@ -76,11 +68,13 @@ typedef union {
#define LED_FLAG_UNDERGLOW 0x02
#define LED_FLAG_KEYLIGHT 0x04
+#define NO_LED 255
+
typedef struct PACKED {
- matrix_co_t matrix_co;
- point_t point;
- uint8_t flags;
-} rgb_led;
+ uint8_t matrix_co[MATRIX_ROWS][MATRIX_COLS];
+ point_t point[DRIVER_LED_TOTAL];
+ uint8_t flags[DRIVER_LED_TOTAL];
+} led_config_t;
typedef union {
uint32_t raw;