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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
100 changed files with 795 additions and 798 deletions

View file

@ -19,7 +19,7 @@
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 64
#define IS31FL3731_LED_COUNT 64
// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
#define LOCKING_SUPPORT_ENABLE

View file

@ -30,8 +30,8 @@
#define IS31FL3731_DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 32
#define DRIVER_2_LED_TOTAL 32
#define ISSI_DRIVER_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL + WS2812_LED_TOTAL)
#define IS31FL3731_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
#define RGB_MATRIX_LED_COUNT (IS31FL3731_LED_COUNT + WS2812_LED_TOTAL)
#define RGB_MATRIX_DEFAULT_VAL 80
#define RGB_MATRIX_KEYPRESSES

View file

@ -25,7 +25,7 @@
#ifdef RGB_MATRIX_ENABLE
rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL];
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -99,28 +99,6 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
{1, C9_14, C8_14, C7_14}, //D14
{1, C9_15, C8_15, C6_14}, //D15
{1, C9_16, C7_15, C6_15}, //D16
//fake underglows 1- 20
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0},
{2, 0, 0, 0}
};
__attribute__ ((weak))
@ -169,7 +147,7 @@ static void init(void) {
i2c_init();
is31fl3731_init(IS31FL3731_I2C_ADDRESS_1);
is31fl3731_init(IS31FL3731_I2C_ADDRESS_2);
for (int index = 0; index < ISSI_DRIVER_TOTAL; index++) {
for (int index = 0; index < IS31FL3731_LED_COUNT; index++) {
bool enabled = true;
is31fl3731_set_led_control_register(index, enabled, enabled, enabled);
}
@ -187,12 +165,12 @@ static void flush(void) {
}
static void set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
if (index < ISSI_DRIVER_TOTAL) {
if (index < IS31FL3731_LED_COUNT) {
is31fl3731_set_color(index, red, green, blue);
} else {
rgb_matrix_ws2812_array[index - ISSI_DRIVER_TOTAL].r = red;
rgb_matrix_ws2812_array[index - ISSI_DRIVER_TOTAL].g = green;
rgb_matrix_ws2812_array[index - ISSI_DRIVER_TOTAL].b = blue;
rgb_matrix_ws2812_array[index - IS31FL3731_LED_COUNT].r = red;
rgb_matrix_ws2812_array[index - IS31FL3731_LED_COUNT].g = green;
rgb_matrix_ws2812_array[index - IS31FL3731_LED_COUNT].b = blue;
}
}