diff options
author | Ryan <fauxpark@gmail.com> | 2022-09-23 22:46:23 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-23 22:46:23 +1000 |
commit | 36c410592dbd35da33ccc5fd6d2a5cbf4b25a708 (patch) | |
tree | 4e75c5fc5cd31d9fdc904876906c0b409ee45d90 /drivers/led/issi | |
parent | d967de0df749f3be63403e07feda416ea09351d0 (diff) |
Change `DRIVER_LED_COUNT` to `{LED,RGB}_MATRIX_LED_COUNT` (#18399)
Diffstat (limited to 'drivers/led/issi')
-rw-r--r-- | drivers/led/issi/is31fl3731-simple.c | 4 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3731-simple.h | 2 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3731.c | 4 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3731.h | 2 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3733-simple.c | 4 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3733-simple.h | 2 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3733.c | 4 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3733.h | 2 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3736.c | 4 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3736.h | 6 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3737.c | 4 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3737.h | 2 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3741.c | 4 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3741.h | 2 | ||||
-rw-r--r-- | drivers/led/issi/is31flcommon.c | 15 | ||||
-rw-r--r-- | drivers/led/issi/is31flcommon.h | 6 |
16 files changed, 36 insertions, 31 deletions
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); |