1
0

Relocate LED driver init code (#22365)

This commit is contained in:
Ryan
2023-11-01 11:53:45 +11:00
committed by GitHub
parent eac8e67888
commit b52aca0af8
100 changed files with 795 additions and 798 deletions

View File

@@ -74,7 +74,7 @@
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120
#define ISSI_LED_TOTAL DRIVER_1_LED_TOTAL
#define IS31FL3733_LED_COUNT DRIVER_1_LED_TOTAL
// Underglow LEDs are WS2812, but someone might want to use RGBLIGHT for them;
// don't use those LEDs in RGB Matrix in that case.
@@ -84,7 +84,7 @@
# define WS2812_LED_TOTAL 6
#endif
#define RGB_MATRIX_LED_COUNT (ISSI_LED_TOTAL + WS2812_LED_TOTAL)
#define RGB_MATRIX_LED_COUNT (IS31FL3733_LED_COUNT + WS2812_LED_TOTAL)
#ifdef RGB_MATRIX_ENABLE
# define RGB_MATRIX_KEYPRESSES

View File

@@ -22,7 +22,7 @@
# include "is31fl3733.h"
# include "ws2812.h"
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
{ 0, B_1, A_1, C_1 },
{ 0, B_2, A_2, C_2 },
{ 0, B_3, A_3, C_3 },
@@ -153,8 +153,8 @@ rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL];
static void rgb_matrix_driver_init(void) {
i2c_init();
is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, 0);
for (uint8_t index = 0; index < ISSI_LED_TOTAL; index++) {
is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE);
for (uint8_t index = 0; index < IS31FL3733_LED_COUNT; index++) {
bool enabled = true;
is31fl3733_set_led_control_register(index, enabled, enabled, enabled);
}
@@ -169,13 +169,13 @@ static void rgb_matrix_driver_flush(void) {
}
static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
if (index < ISSI_LED_TOTAL) {
if (index < IS31FL3733_LED_COUNT) {
is31fl3733_set_color(index, red, green, blue);
} else {
# if WS2812_LED_TOTAL > 0
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].r = red;
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].g = green;
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].b = blue;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].r = red;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].g = green;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].b = blue;
# endif
}
}

View File

@@ -82,7 +82,7 @@
// IS31FL3733+WS2812 driver setup used by this board the LED controller drivers
// are compiled unconditionally).
#define ISSI_LED_TOTAL DRIVER_1_LED_TOTAL
#define IS31FL3733_LED_COUNT DRIVER_1_LED_TOTAL
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 180
@@ -94,7 +94,7 @@
# define WS2812_LED_TOTAL 6
#endif
#define RGB_MATRIX_LED_COUNT (ISSI_LED_TOTAL + WS2812_LED_TOTAL)
#define RGB_MATRIX_LED_COUNT (IS31FL3733_LED_COUNT + WS2812_LED_TOTAL)
#ifdef RGB_MATRIX_ENABLE
# define RGB_MATRIX_KEYPRESSES

View File

@@ -24,7 +24,7 @@
# include "ws2812.h"
const PROGMEM is31fl3733_led_t g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
const PROGMEM is31fl3733_led_t g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
{ 0, B_1, A_1, C_1 },
{ 0, B_2, A_2, C_2 },
{ 0, B_3, A_3, C_3 },
@@ -153,8 +153,8 @@ rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL];
static void rgb_matrix_driver_init(void) {
i2c_init();
is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, 0);
for (uint8_t index = 0; index < ISSI_LED_TOTAL; index++) {
is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE);
for (uint8_t index = 0; index < IS31FL3733_LED_COUNT; index++) {
bool enabled = true;
is31fl3733_set_led_control_register(index, enabled, enabled, enabled);
}
@@ -169,13 +169,13 @@ static void rgb_matrix_driver_flush(void) {
}
static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
if (index < ISSI_LED_TOTAL) {
if (index < IS31FL3733_LED_COUNT) {
is31fl3733_set_color(index, red, green, blue);
} else {
# if WS2812_LED_TOTAL > 0
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].r = red;
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].g = green;
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].b = blue;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].r = red;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].g = green;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].b = blue;
# endif
}
}

View File

@@ -81,7 +81,7 @@
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
#define DRIVER_1_LED_TOTAL 61
#define ISSI_LED_TOTAL DRIVER_1_LED_TOTAL
#define IS31FL3733_LED_COUNT DRIVER_1_LED_TOTAL
// Underglow LEDs are WS2812, but someone might want to use RGBLIGHT for them;
// don't use those LEDs in RGB Matrix in that case.
@@ -91,7 +91,7 @@
# define WS2812_LED_TOTAL 6
#endif
#define RGB_MATRIX_LED_COUNT (ISSI_LED_TOTAL + WS2812_LED_TOTAL)
#define RGB_MATRIX_LED_COUNT (IS31FL3733_LED_COUNT + WS2812_LED_TOTAL)
#ifdef RGB_MATRIX_ENABLE
# define RGB_MATRIX_KEYPRESSES

View File

@@ -21,7 +21,7 @@
# include "is31fl3733.h"
# include "ws2812.h"
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
{ 0, B_1, A_1, C_1 },
{ 0, B_2, A_2, C_2 },
{ 0, B_3, A_3, C_3 },
@@ -149,8 +149,8 @@ rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL];
static void rgb_matrix_driver_init(void) {
i2c_init();
is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, 0);
for (uint8_t index = 0; index < ISSI_LED_TOTAL; index++) {
is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE);
for (uint8_t index = 0; index < IS31FL3733_LED_COUNT; index++) {
bool enabled = true;
is31fl3733_set_led_control_register(index, enabled, enabled, enabled);
}
@@ -165,13 +165,13 @@ static void rgb_matrix_driver_flush(void) {
}
static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
if (index < ISSI_LED_TOTAL) {
if (index < IS31FL3733_LED_COUNT) {
is31fl3733_set_color(index, red, green, blue);
} else {
# if WS2812_LED_TOTAL > 0
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].r = red;
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].g = green;
rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].b = blue;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].r = red;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].g = green;
rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].b = blue;
# endif
}
}