summaryrefslogtreecommitdiffstats
path: root/drivers/led/issi/is31flcommon.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/led/issi/is31flcommon.c')
-rw-r--r--drivers/led/issi/is31flcommon.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/led/issi/is31flcommon.c b/drivers/led/issi/is31flcommon.c
index 106890a8bf..4b78947ada 100644
--- a/drivers/led/issi/is31flcommon.c
+++ b/drivers/led/issi/is31flcommon.c
@@ -133,19 +133,28 @@ void IS31FL_common_update_pwm_register(uint8_t addr, uint8_t index) {
#ifdef ISSI_MANUAL_SCALING
void IS31FL_set_manual_scaling_buffer(void) {
+ is31_led led;
+ is31_led scale;
for (int i = 0; i < ISSI_MANUAL_SCALING; i++) {
- is31_led scale = g_is31_scaling[i];
+ memcpy_P(&scale, (&g_is31_scaling[i]), sizeof(scale));
+
# ifdef RGB_MATRIX_ENABLE
if (scale.driver >= 0 && scale.driver < RGB_MATRIX_LED_COUNT) {
- is31_led led = g_is31_leds[scale.driver];
+ memcpy_P(&led, (&g_is31_leds[scale.driver]), sizeof(led));
+ if (g_scaling_buffer[led.driver][led.r] = scale.r && g_scaling_buffer[led.driver][led.g] = scale.g && g_scaling_buffer[led.driver][led.b] = scale.b) {
+ return;
+ }
g_scaling_buffer[led.driver][led.r] = scale.r;
g_scaling_buffer[led.driver][led.g] = scale.g;
g_scaling_buffer[led.driver][led.b] = scale.b;
# elif defined(LED_MATRIX_ENABLE)
if (scale.driver >= 0 && scale.driver < LED_MATRIX_LED_COUNT) {
- is31_led led = g_is31_leds[scale.driver];
+ memcpy_P(&led, (&g_is31_leds[scale.driver]), sizeof(led));
+ if (g_scaling_buffer[led.driver][led.v] == scale.v) {
+ return;
+ }
g_scaling_buffer[led.driver][led.v] = scale.v;
# endif
g_scaling_buffer_update_required[led.driver] = true;
@@ -169,7 +178,8 @@ void IS31FL_common_update_scaling_register(uint8_t addr, uint8_t index) {
// Colour is set by adjusting PWM register
void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
- is31_led led = g_is31_leds[index];
+ is31_led led;
+ memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
g_pwm_buffer[led.driver][led.r] = red;
g_pwm_buffer[led.driver][led.g] = green;
@@ -186,7 +196,8 @@ void IS31FL_RGB_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
// Setup Scaling register that decides the peak current of each LED
void IS31FL_RGB_set_scaling_buffer(uint8_t index, bool red, bool green, bool blue) {
- is31_led led = g_is31_leds[index];
+ is31_led led;
+ memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
if (red) {
g_scaling_buffer[led.driver][led.r] = ISSI_SCAL_RED;
} else {
@@ -208,7 +219,8 @@ void IS31FL_RGB_set_scaling_buffer(uint8_t index, bool red, bool green, bool blu
#elif defined(LED_MATRIX_ENABLE)
// LED Matrix Specific scripts
void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value) {
- is31_led led = g_is31_leds[index];
+ is31_led led;
+ memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
if (value) {
g_scaling_buffer[led.driver][led.v] = ISSI_SCAL_LED;
} else {
@@ -219,7 +231,9 @@ void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value) {
void IS31FL_simple_set_brightness(int index, uint8_t value) {
if (index >= 0 && index < LED_MATRIX_LED_COUNT) {
- is31_led led = g_is31_leds[index];
+ is31_led led;
+ memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
+
g_pwm_buffer[led.driver][led.v] = value;
g_pwm_buffer_update_required[led.driver] = true;
}