1
0
Fork 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
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 72
#define IS31FL3731_LED_COUNT 72
// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
#define LOCKING_SUPPORT_ENABLE

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 72
#define IS31FL3731_LED_COUNT 72
// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
#define LOCKING_SUPPORT_ENABLE

View file

@ -23,7 +23,7 @@
// IS31FL3731 driver
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
#define IS31FL3731_DRIVER_COUNT 1
#define RGB_MATRIX_LED_COUNT 12
#define IS31FL3731_LED_COUNT 12
// Enable WT RGB backlight
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -24,7 +24,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 72
#define IS31FL3731_LED_COUNT 72
// Enable WT RGB backlight
#define RGB_BACKLIGHT_ENABLED 1

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 72
#define IS31FL3731_LED_COUNT 72
// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
#define LOCKING_SUPPORT_ENABLE

View file

@ -24,7 +24,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 72
#define IS31FL3731_LED_COUNT 72
// Enable WT RGB backlight
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -24,7 +24,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 72
#define IS31FL3731_LED_COUNT 72
// Enable WT RGB backlight
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -20,7 +20,7 @@
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
#define RGB_MATRIX_LED_COUNT 6
#define IS31FL3218_LED_COUNT 6
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -42,7 +42,7 @@
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
#define IS31FL3731_I2C_ADDRESS_3 IS31FL3731_I2C_ADDRESS_SCL
#define IS31FL3731_DRIVER_COUNT 3
#define RGB_MATRIX_LED_COUNT 108
#define IS31FL3731_LED_COUNT 108
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -26,7 +26,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 72
#define IS31FL3731_LED_COUNT 72
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -26,7 +26,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 72
#define IS31FL3731_LED_COUNT 72
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -26,7 +26,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 72
#define IS31FL3731_LED_COUNT 72
#define RGB_BACKLIGHT_ENABLED 1

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -64,4 +64,4 @@
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_DRIVER_COUNT 1
#define LED_MATRIX_LED_COUNT 96
#define IS31FL3736_LED_COUNT 96

View file

@ -50,7 +50,7 @@ backlight_config g_config = {
.color_1 = MONO_BACKLIGHT_COLOR_1,
};
const is31fl3736_led_t PROGMEM g_is31fl3736_leds[LED_MATRIX_LED_COUNT] = {
const is31fl3736_led_t PROGMEM g_is31fl3736_leds[IS31FL3736_LED_COUNT] = {
{0, A_1},
{0, A_2},
{0, A_3},
@ -170,14 +170,7 @@ uint32_t g_any_key_hit = 0;
void backlight_init_drivers(void)
{
// Initialize I2C
i2c_init();
is31fl3736_init( IS31FL3736_I2C_ADDRESS_1 );
for ( uint8_t index = 0; index < 96; index++ ) {
is31fl3736_set_led_control_register( index, true );
}
is31fl3736_update_led_control_registers( IS31FL3736_I2C_ADDRESS_1, 0 );
is31fl3736_init_drivers();
}
void backlight_set_key_hit(uint8_t row, uint8_t column)

View file

@ -157,7 +157,7 @@ uint32_t g_any_key_hit = 0;
#if defined(RGB_BACKLIGHT_HS60)
#define ISSI_ADDR_1 IS31FL3733_I2C_ADDRESS_GND_GND
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -234,7 +234,7 @@ const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_1 IS31FL3733_I2C_ADDRESS_GND_GND
#define ISSI_ADDR_2 IS31FL3733_I2C_ADDRESS_GND_SDA
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -375,7 +375,7 @@ const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = {
#elif defined(RGB_BACKLIGHT_NEBULA12)
#define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND
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
@ -406,7 +406,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA
#define ISSI_ADDR_3 IS31FL3731_I2C_ADDRESS_SCL
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
@ -531,7 +531,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND
#define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA
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
@ -610,7 +610,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND
#define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_VCC
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
@ -694,7 +694,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_1 IS31FL3741_I2C_ADDRESS_GND
#define ISSI_ADDR_2
const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@ -817,7 +817,7 @@ const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = {
};
#elif defined(RGB_BACKLIGHT_M6_B)
const is31fl3218_led_t PROGMEM g_is31fl3218_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT] = {
{OUT1, OUT2, OUT3},
{OUT4, OUT5, OUT6},
{OUT7, OUT8, OUT9},
@ -829,7 +829,7 @@ const is31fl3218_led_t PROGMEM g_is31fl3218_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND
#define ISSI_ADDR_2
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
{0, C1_9, C3_10, C4_10}, // LB1
{0, C1_10, C2_10, C4_11}, // LB2
{0, C1_11, C2_11, C3_11}, // LB3
@ -847,7 +847,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {
#define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND
#define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA
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
@ -1817,12 +1817,12 @@ void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
is31fl3733_set_color( index, red, green, blue );
}
#elif defined(RGB_BACKLIGHT_DAWN60)
if( index < RGB_MATRIX_LED_COUNT ) {
if( index < IS31FL3731_LED_COUNT ) {
is31fl3731_set_color( index, red, green, blue );
} else {
g_ws2812_leds[index - RGB_MATRIX_LED_COUNT].r = red;
g_ws2812_leds[index - RGB_MATRIX_LED_COUNT].g = green;
g_ws2812_leds[index - RGB_MATRIX_LED_COUNT].b = blue;
g_ws2812_leds[index - IS31FL3731_LED_COUNT].r = red;
g_ws2812_leds[index - IS31FL3731_LED_COUNT].g = green;
g_ws2812_leds[index - IS31FL3731_LED_COUNT].b = blue;
ws2812_setleds(g_ws2812_leds, WS2812_LED_TOTAL);
}
#else
@ -2111,9 +2111,9 @@ void backlight_effect_alphas_mods(void)
for (int i = 0; i < WS2812_LED_TOTAL; i++) {
if ((RGB_UNDERGLOW_ALPHA_TOP_START <= i && i <= RGB_UNDERGLOW_ALPHA_TOP_END) ||
(RGB_UNDERGLOW_ALPHA_BOT_START <= i && i <= RGB_UNDERGLOW_ALPHA_BOT_END)) {
backlight_set_color(i + RGB_MATRIX_LED_COUNT, rgb1.r, rgb1.g, rgb1.b);
backlight_set_color(i + IS31FL3731_LED_COUNT, rgb1.r, rgb1.g, rgb1.b);
} else {
backlight_set_color(i + RGB_MATRIX_LED_COUNT, rgb2.r, rgb2.g, rgb2.b);
backlight_set_color(i + IS31FL3731_LED_COUNT, rgb2.r, rgb2.g, rgb2.b);
}
}
#endif
@ -2902,7 +2902,7 @@ void backlight_init_drivers(void)
#if defined(RGB_BACKLIGHT_M6_B)
is31fl3218_init();
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3218_LED_COUNT; index++ )
{
bool enabled = true;
@ -2913,9 +2913,9 @@ void backlight_init_drivers(void)
// This actually updates the LED drivers
is31fl3218_update_led_control_registers();
#elif defined(RGB_BACKLIGHT_HS60)
is31fl3733_init( ISSI_ADDR_1, 0 );
is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE );
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ )
{
#if defined(HS60_ANSI)
bool enabled = !( ( index == 48-1 ) || //LA48
@ -2934,10 +2934,10 @@ void backlight_init_drivers(void)
// This actually updates the LED drivers
is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 );
#elif defined(RGB_BACKLIGHT_NK65)
is31fl3733_init( ISSI_ADDR_1, 0 );
is31fl3733_init( ISSI_ADDR_2, 0 );
is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE );
is31fl3733_init( ISSI_ADDR_2, IS31FL3733_SYNC_NONE );
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ )
{
bool enabled = !( ( index == 61-1 ) || //LA61
( index > 6+64-1 ) ); //LB7-LB64
@ -2949,10 +2949,10 @@ void backlight_init_drivers(void)
is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 );
is31fl3733_update_led_control_registers( ISSI_ADDR_2, 1 );
#elif defined(RGB_BACKLIGHT_NK87)
is31fl3733_init( ISSI_ADDR_1, 0 );
is31fl3733_init( ISSI_ADDR_2, 0 );
is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE );
is31fl3733_init( ISSI_ADDR_2, IS31FL3733_SYNC_NONE );
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ )
{
bool enabled = !( ( index == 61-1 ) || //LA61
( (index >= 2+64-1) && (index <= 4+64-1) ) ||
@ -2979,10 +2979,10 @@ void backlight_init_drivers(void)
is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 );
is31fl3733_update_led_control_registers( ISSI_ADDR_2, 1 );
#elif defined(RGB_BACKLIGHT_NEBULA68)
is31fl3733_init( ISSI_ADDR_1, 0 );
is31fl3733_init( ISSI_ADDR_2, 0 );
is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE );
is31fl3733_init( ISSI_ADDR_2, IS31FL3733_SYNC_NONE );
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ )
{
bool enabled = !( ( index == 61-1 ) || //LA61
( index > 5+64-1 ) ); //LB6-LB64
@ -2995,17 +2995,17 @@ void backlight_init_drivers(void)
#elif defined(RGB_BACKLIGHT_PORTICO75)
is31fl3741_init( ISSI_ADDR_1 );
bool enabled = true;
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3741_LED_COUNT; index++ )
{
is31fl3741_set_led_control_register( index, enabled, enabled, enabled );
}
// This actually updates the LED drivers
is31fl3741_update_led_control_registers( ISSI_ADDR_1, 0 );
#elif defined(RGB_BACKLIGHT_KW_MEGA)
is31fl3733_init( ISSI_ADDR_1, 0 );
is31fl3733_init( ISSI_ADDR_2, 0 );
is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE );
is31fl3733_init( ISSI_ADDR_2, IS31FL3733_SYNC_NONE );
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ )
{
bool enabled = !( ( index == 61-1 ) || //LA61
( index > 6+64-1 ) ); //LB7-LB64
@ -3032,7 +3032,7 @@ void backlight_init_drivers(void)
bool disable_spacebar_stab_leds = false;
#endif
for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ )
for ( int index = 0; index < BACKLIGHT_LED_COUNT; index++ )
{
// OR the possible "disabled" cases together, then NOT the result to get the enabled state
// LC6 LD13 not present on Zeal65

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 72
#define IS31FL3731_LED_COUNT 72
// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
#define LOCKING_SUPPORT_ENABLE

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 72
#define IS31FL3731_LED_COUNT 72
// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
#define LOCKING_SUPPORT_ENABLE