From 36c410592dbd35da33ccc5fd6d2a5cbf4b25a708 Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 23 Sep 2022 22:46:23 +1000 Subject: Change `DRIVER_LED_COUNT` to `{LED,RGB}_MATRIX_LED_COUNT` (#18399) --- drivers/led/aw20216.c | 2 +- drivers/led/aw20216.h | 2 +- drivers/led/ckled2001-simple.c | 4 ++-- drivers/led/ckled2001-simple.h | 2 +- drivers/led/ckled2001.c | 4 ++-- drivers/led/ckled2001.h | 2 +- drivers/led/issi/is31fl3731-simple.c | 4 ++-- drivers/led/issi/is31fl3731-simple.h | 2 +- drivers/led/issi/is31fl3731.c | 4 ++-- drivers/led/issi/is31fl3731.h | 2 +- drivers/led/issi/is31fl3733-simple.c | 4 ++-- drivers/led/issi/is31fl3733-simple.h | 2 +- drivers/led/issi/is31fl3733.c | 4 ++-- drivers/led/issi/is31fl3733.h | 2 +- drivers/led/issi/is31fl3736.c | 4 ++-- drivers/led/issi/is31fl3736.h | 6 +++--- drivers/led/issi/is31fl3737.c | 4 ++-- drivers/led/issi/is31fl3737.h | 2 +- drivers/led/issi/is31fl3741.c | 4 ++-- drivers/led/issi/is31fl3741.h | 2 +- drivers/led/issi/is31flcommon.c | 15 +++++++++------ drivers/led/issi/is31flcommon.h | 6 ++++-- 22 files changed, 44 insertions(+), 39 deletions(-) (limited to 'drivers/led') diff --git a/drivers/led/aw20216.c b/drivers/led/aw20216.c index 55083936ef..cbb0b60774 100644 --- a/drivers/led/aw20216.c +++ b/drivers/led/aw20216.c @@ -133,7 +133,7 @@ void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { } void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { AW20216_set_color(i, red, green, blue); } } diff --git a/drivers/led/aw20216.h b/drivers/led/aw20216.h index 0a17050fed..c6e71b4b4e 100644 --- a/drivers/led/aw20216.h +++ b/drivers/led/aw20216.h @@ -28,7 +28,7 @@ typedef struct aw_led { uint8_t b; } aw_led; -extern const aw_led PROGMEM g_aw_leds[DRIVER_LED_TOTAL]; +extern const aw_led PROGMEM g_aw_leds[RGB_MATRIX_LED_COUNT]; void AW20216_init(pin_t cs_pin, pin_t en_pin); void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); diff --git a/drivers/led/ckled2001-simple.c b/drivers/led/ckled2001-simple.c index da4bf20b99..6c4ffd398e 100644 --- a/drivers/led/ckled2001-simple.c +++ b/drivers/led/ckled2001-simple.c @@ -148,7 +148,7 @@ void CKLED2001_init(uint8_t addr) { void CKLED2001_set_value(int index, uint8_t value) { ckled2001_led led; - if (index >= 0 && index < DRIVER_LED_TOTAL) { + if (index >= 0 && index < LED_MATRIX_LED_COUNT) { memcpy_P(&led, (&g_ckled2001_leds[index]), sizeof(led)); g_pwm_buffer[led.driver][led.v] = value; @@ -157,7 +157,7 @@ void CKLED2001_set_value(int index, uint8_t value) { } void CKLED2001_set_value_all(uint8_t value) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { CKLED2001_set_value(i, value); } } diff --git a/drivers/led/ckled2001-simple.h b/drivers/led/ckled2001-simple.h index 731da2e1cd..a56cad3461 100644 --- a/drivers/led/ckled2001-simple.h +++ b/drivers/led/ckled2001-simple.h @@ -25,7 +25,7 @@ typedef struct ckled2001_led { uint8_t v; } __attribute__((packed)) ckled2001_led; -extern const ckled2001_led PROGMEM g_ckled2001_leds[DRIVER_LED_TOTAL]; +extern const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT]; void CKLED2001_init(uint8_t addr); bool CKLED2001_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/led/ckled2001.c b/drivers/led/ckled2001.c index b7e7db06cc..1651628175 100644 --- a/drivers/led/ckled2001.c +++ b/drivers/led/ckled2001.c @@ -148,7 +148,7 @@ void CKLED2001_init(uint8_t addr) { void CKLED2001_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { ckled2001_led led; - if (index >= 0 && index < DRIVER_LED_TOTAL) { + if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { memcpy_P(&led, (&g_ckled2001_leds[index]), sizeof(led)); g_pwm_buffer[led.driver][led.r] = red; @@ -159,7 +159,7 @@ void CKLED2001_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { } void CKLED2001_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { CKLED2001_set_color(i, red, green, blue); } } diff --git a/drivers/led/ckled2001.h b/drivers/led/ckled2001.h index 7d5ad34f95..aa70a0623f 100644 --- a/drivers/led/ckled2001.h +++ b/drivers/led/ckled2001.h @@ -27,7 +27,7 @@ typedef struct ckled2001_led { uint8_t b; } __attribute__((packed)) ckled2001_led; -extern const ckled2001_led PROGMEM g_ckled2001_leds[DRIVER_LED_TOTAL]; +extern const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT]; void CKLED2001_init(uint8_t addr); bool CKLED2001_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/led/issi/is31fl3731-simple.c b/drivers/led/issi/is31fl3731-simple.c index 3abe9ea337..84060f9426 100644 --- a/drivers/led/issi/is31fl3731-simple.c +++ b/drivers/led/issi/is31fl3731-simple.c @@ -194,7 +194,7 @@ void IS31FL3731_init(uint8_t addr) { void IS31FL3731_set_value(int index, uint8_t value) { is31_led led; - if (index >= 0 && index < DRIVER_LED_TOTAL) { + if (index >= 0 && index < LED_MATRIX_LED_COUNT) { memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); // Subtract 0x24 to get the second index of g_pwm_buffer @@ -204,7 +204,7 @@ void IS31FL3731_set_value(int index, uint8_t value) { } void IS31FL3731_set_value_all(uint8_t value) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { IS31FL3731_set_value(i, value); } } diff --git a/drivers/led/issi/is31fl3731-simple.h b/drivers/led/issi/is31fl3731-simple.h index ded94b0470..1ddadd5209 100644 --- a/drivers/led/issi/is31fl3731-simple.h +++ b/drivers/led/issi/is31fl3731-simple.h @@ -27,7 +27,7 @@ typedef struct is31_led { uint8_t v; } __attribute__((packed)) is31_led; -extern const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL]; +extern const is31_led PROGMEM g_is31_leds[LED_MATRIX_LED_COUNT]; void IS31FL3731_init(uint8_t addr); void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/led/issi/is31fl3731.c b/drivers/led/issi/is31fl3731.c index 9c6c29f081..fed5354145 100644 --- a/drivers/led/issi/is31fl3731.c +++ b/drivers/led/issi/is31fl3731.c @@ -182,7 +182,7 @@ void IS31FL3731_init(uint8_t addr) { void IS31FL3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { is31_led led; - if (index >= 0 && index < DRIVER_LED_TOTAL) { + if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); // Subtract 0x24 to get the second index of g_pwm_buffer @@ -194,7 +194,7 @@ void IS31FL3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { } void IS31FL3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { IS31FL3731_set_color(i, red, green, blue); } } diff --git a/drivers/led/issi/is31fl3731.h b/drivers/led/issi/is31fl3731.h index 6647119eba..6791289c9e 100644 --- a/drivers/led/issi/is31fl3731.h +++ b/drivers/led/issi/is31fl3731.h @@ -28,7 +28,7 @@ typedef struct is31_led { uint8_t b; } __attribute__((packed)) is31_led; -extern const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL]; +extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT]; void IS31FL3731_init(uint8_t addr); void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/led/issi/is31fl3733-simple.c b/drivers/led/issi/is31fl3733-simple.c index 2f41a7b1a9..1e0994d780 100644 --- a/drivers/led/issi/is31fl3733-simple.c +++ b/drivers/led/issi/is31fl3733-simple.c @@ -195,7 +195,7 @@ void IS31FL3733_init(uint8_t addr, uint8_t sync) { } void IS31FL3733_set_value(int index, uint8_t value) { - if (index >= 0 && index < DRIVER_LED_TOTAL) { + if (index >= 0 && index < LED_MATRIX_LED_COUNT) { is31_led led = g_is31_leds[index]; g_pwm_buffer[led.driver][led.v] = value; @@ -204,7 +204,7 @@ void IS31FL3733_set_value(int index, uint8_t value) { } void IS31FL3733_set_value_all(uint8_t value) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { IS31FL3733_set_value(i, value); } } diff --git a/drivers/led/issi/is31fl3733-simple.h b/drivers/led/issi/is31fl3733-simple.h index f5253e3101..f0ea3adca0 100644 --- a/drivers/led/issi/is31fl3733-simple.h +++ b/drivers/led/issi/is31fl3733-simple.h @@ -29,7 +29,7 @@ typedef struct is31_led { uint8_t v; } __attribute__((packed)) is31_led; -extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; +extern const is31_led __flash g_is31_leds[LED_MATRIX_LED_COUNT]; void IS31FL3733_init(uint8_t addr, uint8_t sync); bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/led/issi/is31fl3733.c b/drivers/led/issi/is31fl3733.c index add998f256..379eaa0ae3 100644 --- a/drivers/led/issi/is31fl3733.c +++ b/drivers/led/issi/is31fl3733.c @@ -186,7 +186,7 @@ void IS31FL3733_init(uint8_t addr, uint8_t sync) { void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { is31_led led; - if (index >= 0 && index < DRIVER_LED_TOTAL) { + if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); g_pwm_buffer[led.driver][led.r] = red; @@ -197,7 +197,7 @@ void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { } void IS31FL3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { IS31FL3733_set_color(i, red, green, blue); } } diff --git a/drivers/led/issi/is31fl3733.h b/drivers/led/issi/is31fl3733.h index 7653dd17c0..29441846ac 100644 --- a/drivers/led/issi/is31fl3733.h +++ b/drivers/led/issi/is31fl3733.h @@ -30,7 +30,7 @@ typedef struct is31_led { uint8_t b; } __attribute__((packed)) is31_led; -extern const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL]; +extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT]; void IS31FL3733_init(uint8_t addr, uint8_t sync); bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/led/issi/is31fl3736.c b/drivers/led/issi/is31fl3736.c index e9943614d2..82e7ee3d18 100644 --- a/drivers/led/issi/is31fl3736.c +++ b/drivers/led/issi/is31fl3736.c @@ -168,7 +168,7 @@ void IS31FL3736_init(uint8_t addr) { void IS31FL3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { is31_led led; - if (index >= 0 && index < DRIVER_LED_TOTAL) { + if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); g_pwm_buffer[led.driver][led.r] = red; @@ -179,7 +179,7 @@ void IS31FL3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { } void IS31FL3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { IS31FL3736_set_color(i, red, green, blue); } } diff --git a/drivers/led/issi/is31fl3736.h b/drivers/led/issi/is31fl3736.h index f126034615..ccb19afbcc 100644 --- a/drivers/led/issi/is31fl3736.h +++ b/drivers/led/issi/is31fl3736.h @@ -28,8 +28,8 @@ # define DRIVER_COUNT 2 #endif -#ifndef DRIVER_LED_TOTAL -# define DRIVER_LED_TOTAL 96 +#ifndef RGB_MATRIX_LED_COUNT +# define RGB_MATRIX_LED_COUNT 96 #endif typedef struct is31_led { @@ -39,7 +39,7 @@ typedef struct is31_led { uint8_t b; } __attribute__((packed)) is31_led; -extern const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL]; +extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT]; void IS31FL3736_init(uint8_t addr); void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/led/issi/is31fl3737.c b/drivers/led/issi/is31fl3737.c index 932530ac0a..45a20018c5 100644 --- a/drivers/led/issi/is31fl3737.c +++ b/drivers/led/issi/is31fl3737.c @@ -175,7 +175,7 @@ void IS31FL3737_init(uint8_t addr) { void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { is31_led led; - if (index >= 0 && index < DRIVER_LED_TOTAL) { + if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); g_pwm_buffer[led.driver][led.r] = red; @@ -186,7 +186,7 @@ void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { } void IS31FL3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { IS31FL3737_set_color(i, red, green, blue); } } diff --git a/drivers/led/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h index ddb70a9df5..fb0c33420c 100644 --- a/drivers/led/issi/is31fl3737.h +++ b/drivers/led/issi/is31fl3737.h @@ -30,7 +30,7 @@ typedef struct is31_led { uint8_t b; } __attribute__((packed)) is31_led; -extern const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL]; +extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT]; void IS31FL3737_init(uint8_t addr); void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/led/issi/is31fl3741.c b/drivers/led/issi/is31fl3741.c index ba6b6761a3..c2cdd4c46f 100644 --- a/drivers/led/issi/is31fl3741.c +++ b/drivers/led/issi/is31fl3741.c @@ -179,7 +179,7 @@ void IS31FL3741_init(uint8_t addr) { void IS31FL3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { is31_led led; - if (index >= 0 && index < DRIVER_LED_TOTAL) { + if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); g_pwm_buffer[led.driver][led.r] = red; @@ -190,7 +190,7 @@ void IS31FL3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { } void IS31FL3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { IS31FL3741_set_color(i, red, green, blue); } } diff --git a/drivers/led/issi/is31fl3741.h b/drivers/led/issi/is31fl3741.h index 3bdb23bd2d..b0089ea5ba 100644 --- a/drivers/led/issi/is31fl3741.h +++ b/drivers/led/issi/is31fl3741.h @@ -30,7 +30,7 @@ typedef struct is31_led { uint32_t b : 10; } __attribute__((packed)) is31_led; -extern const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL]; +extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT]; void IS31FL3741_init(uint8_t addr); void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/led/issi/is31flcommon.c b/drivers/led/issi/is31flcommon.c index 9f4b2123ff..106890a8bf 100644 --- a/drivers/led/issi/is31flcommon.c +++ b/drivers/led/issi/is31flcommon.c @@ -135,14 +135,17 @@ void IS31FL_common_update_pwm_register(uint8_t addr, uint8_t index) { void IS31FL_set_manual_scaling_buffer(void) { for (int i = 0; i < ISSI_MANUAL_SCALING; i++) { is31_led scale = g_is31_scaling[i]; - if (scale.driver >= 0 && scale.driver < DRIVER_LED_TOTAL) { +# ifdef RGB_MATRIX_ENABLE + if (scale.driver >= 0 && scale.driver < RGB_MATRIX_LED_COUNT) { is31_led led = g_is31_leds[scale.driver]; -# ifdef RGB_MATRIX_ENABLE 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]; + g_scaling_buffer[led.driver][led.v] = scale.v; # endif g_scaling_buffer_update_required[led.driver] = true; @@ -165,7 +168,7 @@ void IS31FL_common_update_scaling_register(uint8_t addr, uint8_t index) { #ifdef RGB_MATRIX_ENABLE // 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 < DRIVER_LED_TOTAL) { + if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { is31_led led = g_is31_leds[index]; g_pwm_buffer[led.driver][led.r] = red; @@ -176,7 +179,7 @@ void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { } void IS31FL_RGB_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { IS31FL_RGB_set_color(i, red, green, blue); } } @@ -215,7 +218,7 @@ 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 < DRIVER_LED_TOTAL) { + if (index >= 0 && index < LED_MATRIX_LED_COUNT) { is31_led led = g_is31_leds[index]; g_pwm_buffer[led.driver][led.v] = value; g_pwm_buffer_update_required[led.driver] = true; @@ -223,7 +226,7 @@ void IS31FL_simple_set_brightness(int index, uint8_t value) { } void IS31FL_simple_set_brigntness_all(uint8_t value) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { IS31FL_simple_set_brightness(i, value); } } diff --git a/drivers/led/issi/is31flcommon.h b/drivers/led/issi/is31flcommon.h index 77e9665e32..18432ffc31 100644 --- a/drivers/led/issi/is31flcommon.h +++ b/drivers/led/issi/is31flcommon.h @@ -43,11 +43,15 @@ typedef struct is31_led { uint8_t b; } __attribute__((packed)) is31_led; +extern const is31_led __flash g_is31_leds[RGB_MATRIX_LED_COUNT]; + #elif defined(LED_MATRIX_ENABLE) typedef struct is31_led { uint8_t driver; uint8_t v; } __attribute__((packed)) is31_led; + +extern const is31_led __flash g_is31_leds[LED_MATRIX_LED_COUNT]; #endif #ifdef ISSI_MANUAL_SCALING @@ -55,8 +59,6 @@ extern const is31_led __flash g_is31_scaling[]; void IS31FL_set_manual_scaling_buffer(void); #endif -extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; - void IS31FL_write_single_register(uint8_t addr, uint8_t reg, uint8_t data); bool IS31FL_write_multi_registers(uint8_t addr, uint8_t *source_buffer, uint8_t buffer_size, uint8_t transfer_size, uint8_t start_reg_addr); void IS31FL_unlock_register(uint8_t addr, uint8_t page); -- cgit v1.2.3