mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-10-30 21:02:32 +01:00 
			
		
		
		
	Relocate LED driver init code (#22365)
This commit is contained in:
		
							parent
							
								
									eac8e67888
								
							
						
					
					
						commit
						b52aca0af8
					
				| @ -126,6 +126,15 @@ static inline void aw20216s_auto_lowpower(pin_t cs_pin) { | |||||||
|     aw20216s_write_register(cs_pin, AW20216S_PAGE_FUNCTION, AW20216S_REG_MIXFUNCTION, AW20216S_MIXCR_DEFAULT | AW20216S_LPEN); |     aw20216s_write_register(cs_pin, AW20216S_PAGE_FUNCTION, AW20216S_REG_MIXFUNCTION, AW20216S_MIXCR_DEFAULT | AW20216S_LPEN); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void aw20216s_init_drivers(void) { | ||||||
|  |     spi_init(); | ||||||
|  | 
 | ||||||
|  |     aw20216s_init(AW20216S_CS_PIN_1, AW20216S_EN_PIN_1); | ||||||
|  | #if defined(AW20216S_CS_PIN_2) | ||||||
|  |     aw20216s_init(AW20216S_CS_PIN_2, AW20216S_EN_PIN_2); | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void aw20216s_init(pin_t cs_pin, pin_t en_pin) { | void aw20216s_init(pin_t cs_pin, pin_t en_pin) { | ||||||
|     setPinOutput(en_pin); |     setPinOutput(en_pin); | ||||||
|     writePinHigh(en_pin); |     writePinHigh(en_pin); | ||||||
| @ -155,7 +164,7 @@ void aw20216s_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void aw20216s_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | void aw20216s_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { |     for (uint8_t i = 0; i < AW20216S_LED_COUNT; i++) { | ||||||
|         aw20216s_set_color(i, red, green, blue); |         aw20216s_set_color(i, red, green, blue); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -65,8 +65,9 @@ typedef struct aw20216s_led_t { | |||||||
|     uint8_t b; |     uint8_t b; | ||||||
| } aw20216s_led_t; | } aw20216s_led_t; | ||||||
| 
 | 
 | ||||||
| extern const aw20216s_led_t PROGMEM g_aw20216s_leds[RGB_MATRIX_LED_COUNT]; | extern const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void aw20216s_init_drivers(void); | ||||||
| void aw20216s_init(pin_t cs_pin, pin_t en_pin); | void aw20216s_init(pin_t cs_pin, pin_t en_pin); | ||||||
| void aw20216s_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); | void aw20216s_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); | ||||||
| void aw20216s_set_color_all(uint8_t red, uint8_t green, uint8_t blue); | void aw20216s_set_color_all(uint8_t red, uint8_t green, uint8_t blue); | ||||||
|  | |||||||
| @ -68,6 +68,8 @@ void is31fl3218_write_pwm_buffer(uint8_t *pwm_buffer) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void is31fl3218_init(void) { | void is31fl3218_init(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|     // In case we ever want to reinitialize (?)
 |     // In case we ever want to reinitialize (?)
 | ||||||
|     is31fl3218_write_register(IS31FL3218_REG_RESET, 0x00); |     is31fl3218_write_register(IS31FL3218_REG_RESET, 0x00); | ||||||
| 
 | 
 | ||||||
| @ -86,11 +88,17 @@ void is31fl3218_init(void) { | |||||||
| 
 | 
 | ||||||
|     // Load PWM registers and LED Control register data
 |     // Load PWM registers and LED Control register data
 | ||||||
|     is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01); |     is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01); | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < IS31FL3218_LED_COUNT; i++) { | ||||||
|  |         is31fl3218_set_led_control_register(i, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     is31fl3218_update_led_control_registers(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void is31fl3218_set_value(int index, uint8_t value) { | void is31fl3218_set_value(int index, uint8_t value) { | ||||||
|     is31fl3218_led_t led; |     is31fl3218_led_t led; | ||||||
|     if (index >= 0 && index < LED_MATRIX_LED_COUNT) { |     if (index >= 0 && index < IS31FL3218_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_is31fl3218_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_is31fl3218_leds[index]), sizeof(led)); | ||||||
|     } |     } | ||||||
|     if (g_pwm_buffer[led.v - IS31FL3218_REG_PWM] == value) { |     if (g_pwm_buffer[led.v - IS31FL3218_REG_PWM] == value) { | ||||||
| @ -101,7 +109,7 @@ void is31fl3218_set_value(int index, uint8_t value) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void is31fl3218_set_value_all(uint8_t value) { | void is31fl3218_set_value_all(uint8_t value) { | ||||||
|     for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < IS31FL3218_LED_COUNT; i++) { | ||||||
|         is31fl3218_set_value(i, value); |         is31fl3218_set_value(i, value); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ typedef struct is31fl3218_led_t { | |||||||
|     uint8_t v; |     uint8_t v; | ||||||
| } __attribute__((packed)) is31fl3218_led_t; | } __attribute__((packed)) is31fl3218_led_t; | ||||||
| 
 | 
 | ||||||
| extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[LED_MATRIX_LED_COUNT]; | extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
| void is31fl3218_init(void); | void is31fl3218_init(void); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -68,6 +68,8 @@ void is31fl3218_write_pwm_buffer(uint8_t *pwm_buffer) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void is31fl3218_init(void) { | void is31fl3218_init(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|     // In case we ever want to reinitialize (?)
 |     // In case we ever want to reinitialize (?)
 | ||||||
|     is31fl3218_write_register(IS31FL3218_REG_RESET, 0x00); |     is31fl3218_write_register(IS31FL3218_REG_RESET, 0x00); | ||||||
| 
 | 
 | ||||||
| @ -86,11 +88,17 @@ void is31fl3218_init(void) { | |||||||
| 
 | 
 | ||||||
|     // Load PWM registers and LED Control register data
 |     // Load PWM registers and LED Control register data
 | ||||||
|     is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01); |     is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01); | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < IS31FL3218_LED_COUNT; i++) { | ||||||
|  |         is31fl3218_set_led_control_register(i, true, true, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     is31fl3218_update_led_control_registers(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void is31fl3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | void is31fl3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     is31fl3218_led_t led; |     is31fl3218_led_t led; | ||||||
|     if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { |     if (index >= 0 && index < IS31FL3218_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_is31fl3218_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_is31fl3218_leds[index]), sizeof(led)); | ||||||
|     } |     } | ||||||
|     if (g_pwm_buffer[led.r - IS31FL3218_REG_PWM] == red && g_pwm_buffer[led.g - IS31FL3218_REG_PWM] == green && g_pwm_buffer[led.b - IS31FL3218_REG_PWM] == blue) { |     if (g_pwm_buffer[led.r - IS31FL3218_REG_PWM] == red && g_pwm_buffer[led.g - IS31FL3218_REG_PWM] == green && g_pwm_buffer[led.b - IS31FL3218_REG_PWM] == blue) { | ||||||
| @ -103,7 +111,7 @@ void is31fl3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void is31fl3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | void is31fl3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < IS31FL3218_LED_COUNT; i++) { | ||||||
|         is31fl3218_set_color(i, red, green, blue); |         is31fl3218_set_color(i, red, green, blue); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -32,7 +32,7 @@ typedef struct is31fl3218_led_t { | |||||||
|     uint8_t b; |     uint8_t b; | ||||||
| } __attribute__((packed)) is31fl3218_led_t; | } __attribute__((packed)) is31fl3218_led_t; | ||||||
| 
 | 
 | ||||||
| extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[RGB_MATRIX_LED_COUNT]; | extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
| void is31fl3218_init(void); | void is31fl3218_init(void); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -104,6 +104,36 @@ void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void is31fl3731_init_drivers(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|  |     is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | ||||||
|  | #if defined(IS31FL3731_I2C_ADDRESS_2) | ||||||
|  |     is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); | ||||||
|  | #    if defined(IS31FL3731_I2C_ADDRESS_3) | ||||||
|  |     is31fl3731_init(IS31FL3731_I2C_ADDRESS_3); | ||||||
|  | #        if defined(IS31FL3731_I2C_ADDRESS_4) | ||||||
|  |     is31fl3731_init(IS31FL3731_I2C_ADDRESS_4); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < IS31FL3731_LED_COUNT; i++) { | ||||||
|  |         is31fl3731_set_led_control_register(i, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); | ||||||
|  | #if defined(IS31FL3731_I2C_ADDRESS_2) | ||||||
|  |     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1); | ||||||
|  | #    if defined(IS31FL3731_I2C_ADDRESS_3) | ||||||
|  |     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_3, 2); | ||||||
|  | #        if defined(IS31FL3731_I2C_ADDRESS_4) | ||||||
|  |     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_4, 3); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void is31fl3731_init(uint8_t addr) { | void is31fl3731_init(uint8_t addr) { | ||||||
|     // In order to avoid the LEDs being driven with garbage data
 |     // In order to avoid the LEDs being driven with garbage data
 | ||||||
|     // in the LED driver's PWM registers, first enable software shutdown,
 |     // in the LED driver's PWM registers, first enable software shutdown,
 | ||||||
| @ -161,7 +191,7 @@ void is31fl3731_init(uint8_t addr) { | |||||||
| 
 | 
 | ||||||
| void is31fl3731_set_value(int index, uint8_t value) { | void is31fl3731_set_value(int index, uint8_t value) { | ||||||
|     is31fl3731_led_t led; |     is31fl3731_led_t led; | ||||||
|     if (index >= 0 && index < LED_MATRIX_LED_COUNT) { |     if (index >= 0 && index < IS31FL3731_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_is31fl3731_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_is31fl3731_leds[index]), sizeof(led)); | ||||||
| 
 | 
 | ||||||
|         // Subtract 0x24 to get the second index of g_pwm_buffer
 |         // Subtract 0x24 to get the second index of g_pwm_buffer
 | ||||||
| @ -175,7 +205,7 @@ void is31fl3731_set_value(int index, uint8_t value) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void is31fl3731_set_value_all(uint8_t value) { | void is31fl3731_set_value_all(uint8_t value) { | ||||||
|     for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < IS31FL3731_LED_COUNT; i++) { | ||||||
|         is31fl3731_set_value(i, value); |         is31fl3731_set_value(i, value); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -66,8 +66,9 @@ typedef struct is31fl3731_led_t { | |||||||
|     uint8_t v; |     uint8_t v; | ||||||
| } __attribute__((packed)) is31fl3731_led_t; | } __attribute__((packed)) is31fl3731_led_t; | ||||||
| 
 | 
 | ||||||
| extern const is31fl3731_led_t PROGMEM g_is31fl3731_leds[LED_MATRIX_LED_COUNT]; | extern const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void is31fl3731_init_drivers(void); | ||||||
| void is31fl3731_init(uint8_t addr); | void is31fl3731_init(uint8_t addr); | ||||||
| void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); | void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); | ||||||
| void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | ||||||
|  | |||||||
| @ -101,6 +101,36 @@ void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void is31fl3731_init_drivers(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|  |     is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | ||||||
|  | #if defined(IS31FL3731_I2C_ADDRESS_2) | ||||||
|  |     is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); | ||||||
|  | #    if defined(IS31FL3731_I2C_ADDRESS_3) | ||||||
|  |     is31fl3731_init(IS31FL3731_I2C_ADDRESS_3); | ||||||
|  | #        if defined(IS31FL3731_I2C_ADDRESS_4) | ||||||
|  |     is31fl3731_init(IS31FL3731_I2C_ADDRESS_4); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < IS31FL3731_LED_COUNT; i++) { | ||||||
|  |         is31fl3731_set_led_control_register(i, true, true, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); | ||||||
|  | #if defined(IS31FL3731_I2C_ADDRESS_2) | ||||||
|  |     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1); | ||||||
|  | #    if defined(IS31FL3731_I2C_ADDRESS_3) | ||||||
|  |     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_3, 2); | ||||||
|  | #        if defined(IS31FL3731_I2C_ADDRESS_4) | ||||||
|  |     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_4, 3); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void is31fl3731_init(uint8_t addr) { | void is31fl3731_init(uint8_t addr) { | ||||||
|     // In order to avoid the LEDs being driven with garbage data
 |     // In order to avoid the LEDs being driven with garbage data
 | ||||||
|     // in the LED driver's PWM registers, first enable software shutdown,
 |     // in the LED driver's PWM registers, first enable software shutdown,
 | ||||||
| @ -158,7 +188,7 @@ void is31fl3731_init(uint8_t addr) { | |||||||
| 
 | 
 | ||||||
| void is31fl3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | void is31fl3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     is31fl3731_led_t led; |     is31fl3731_led_t led; | ||||||
|     if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { |     if (index >= 0 && index < IS31FL3731_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_is31fl3731_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_is31fl3731_leds[index]), sizeof(led)); | ||||||
| 
 | 
 | ||||||
|         // Subtract 0x24 to get the second index of g_pwm_buffer
 |         // Subtract 0x24 to get the second index of g_pwm_buffer
 | ||||||
| @ -173,7 +203,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) { | void is31fl3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < IS31FL3731_LED_COUNT; i++) { | ||||||
|         is31fl3731_set_color(i, red, green, blue); |         is31fl3731_set_color(i, red, green, blue); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -67,8 +67,9 @@ typedef struct is31fl3731_led_t { | |||||||
|     uint8_t b; |     uint8_t b; | ||||||
| } __attribute__((packed)) is31fl3731_led_t; | } __attribute__((packed)) is31fl3731_led_t; | ||||||
| 
 | 
 | ||||||
| extern const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT]; | extern const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void is31fl3731_init_drivers(void); | ||||||
| void is31fl3731_init(uint8_t addr); | void is31fl3731_init(uint8_t addr); | ||||||
| void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); | void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); | ||||||
| void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | ||||||
|  | |||||||
| @ -63,6 +63,19 @@ | |||||||
| #    define IS31FL3733_GLOBALCURRENT 0xFF | #    define IS31FL3733_GLOBALCURRENT 0xFF | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #ifndef IS31FL3733_SYNC_1 | ||||||
|  | #    define IS31FL3733_SYNC_1 IS31FL3733_SYNC_NONE | ||||||
|  | #endif | ||||||
|  | #ifndef IS31FL3733_SYNC_2 | ||||||
|  | #    define IS31FL3733_SYNC_2 IS31FL3733_SYNC_NONE | ||||||
|  | #endif | ||||||
|  | #ifndef IS31FL3733_SYNC_3 | ||||||
|  | #    define IS31FL3733_SYNC_3 IS31FL3733_SYNC_NONE | ||||||
|  | #endif | ||||||
|  | #ifndef IS31FL3733_SYNC_4 | ||||||
|  | #    define IS31FL3733_SYNC_4 IS31FL3733_SYNC_NONE | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| // Transfer buffer for TWITransmitData()
 | // Transfer buffer for TWITransmitData()
 | ||||||
| uint8_t g_twi_transfer_buffer[20]; | uint8_t g_twi_transfer_buffer[20]; | ||||||
| 
 | 
 | ||||||
| @ -126,6 +139,36 @@ bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void is31fl3733_init_drivers(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|  |     is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1); | ||||||
|  | #if defined(IS31FL3733_I2C_ADDRESS_2) | ||||||
|  |     is31fl3733_init(IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_2); | ||||||
|  | #    if defined(IS31FL3733_I2C_ADDRESS_3) | ||||||
|  |     is31fl3733_init(IS31FL3733_I2C_ADDRESS_3, IS31FL3733_SYNC_3); | ||||||
|  | #        if defined(IS31FL3733_I2C_ADDRESS_4) | ||||||
|  |     is31fl3733_init(IS31FL3733_I2C_ADDRESS_4, IS31FL3733_SYNC_4); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < IS31FL3733_LED_COUNT; i++) { | ||||||
|  |         is31fl3733_set_led_control_register(i, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0); | ||||||
|  | #if defined(IS31FL3733_I2C_ADDRESS_2) | ||||||
|  |     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1); | ||||||
|  | #    if defined(IS31FL3733_I2C_ADDRESS_3) | ||||||
|  |     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_3, 2); | ||||||
|  | #        if defined(IS31FL3733_I2C_ADDRESS_4) | ||||||
|  |     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_4, 3); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void is31fl3733_init(uint8_t addr, uint8_t sync) { | void is31fl3733_init(uint8_t addr, uint8_t sync) { | ||||||
|     // In order to avoid the LEDs being driven with garbage data
 |     // In order to avoid the LEDs being driven with garbage data
 | ||||||
|     // in the LED driver's PWM registers, shutdown is enabled last.
 |     // in the LED driver's PWM registers, shutdown is enabled last.
 | ||||||
| @ -174,7 +217,7 @@ void is31fl3733_init(uint8_t addr, uint8_t sync) { | |||||||
| 
 | 
 | ||||||
| void is31fl3733_set_value(int index, uint8_t value) { | void is31fl3733_set_value(int index, uint8_t value) { | ||||||
|     is31fl3733_led_t led; |     is31fl3733_led_t led; | ||||||
|     if (index >= 0 && index < LED_MATRIX_LED_COUNT) { |     if (index >= 0 && index < IS31FL3733_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); | ||||||
| 
 | 
 | ||||||
|         if (g_pwm_buffer[led.driver][led.v] == value) { |         if (g_pwm_buffer[led.driver][led.v] == value) { | ||||||
| @ -186,7 +229,7 @@ void is31fl3733_set_value(int index, uint8_t value) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void is31fl3733_set_value_all(uint8_t value) { | void is31fl3733_set_value_all(uint8_t value) { | ||||||
|     for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < IS31FL3733_LED_COUNT; i++) { | ||||||
|         is31fl3733_set_value(i, value); |         is31fl3733_set_value(i, value); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -85,8 +85,9 @@ typedef struct is31fl3733_led_t { | |||||||
|     uint8_t v; |     uint8_t v; | ||||||
| } __attribute__((packed)) is31fl3733_led_t; | } __attribute__((packed)) is31fl3733_led_t; | ||||||
| 
 | 
 | ||||||
| extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[LED_MATRIX_LED_COUNT]; | extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void is31fl3733_init_drivers(void); | ||||||
| void is31fl3733_init(uint8_t addr, uint8_t sync); | void is31fl3733_init(uint8_t addr, uint8_t sync); | ||||||
| bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); | bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); | ||||||
| bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | ||||||
| @ -119,6 +120,10 @@ void is31fl3733_flush(void); | |||||||
| #define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0b011 | #define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0b011 | ||||||
| #define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0b100 | #define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0b100 | ||||||
| 
 | 
 | ||||||
|  | #define IS31FL3733_SYNC_NONE 0b00 | ||||||
|  | #define IS31FL3733_SYNC_MASTER 0b01 | ||||||
|  | #define IS31FL3733_SYNC_SLAVE 0b10 | ||||||
|  | 
 | ||||||
| #define A_1 0x00 | #define A_1 0x00 | ||||||
| #define A_2 0x01 | #define A_2 0x01 | ||||||
| #define A_3 0x02 | #define A_3 0x02 | ||||||
|  | |||||||
| @ -62,6 +62,19 @@ | |||||||
| #    define IS31FL3733_GLOBALCURRENT 0xFF | #    define IS31FL3733_GLOBALCURRENT 0xFF | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #ifndef IS31FL3733_SYNC_1 | ||||||
|  | #    define IS31FL3733_SYNC_1 IS31FL3733_SYNC_NONE | ||||||
|  | #endif | ||||||
|  | #ifndef IS31FL3733_SYNC_2 | ||||||
|  | #    define IS31FL3733_SYNC_2 IS31FL3733_SYNC_NONE | ||||||
|  | #endif | ||||||
|  | #ifndef IS31FL3733_SYNC_3 | ||||||
|  | #    define IS31FL3733_SYNC_3 IS31FL3733_SYNC_NONE | ||||||
|  | #endif | ||||||
|  | #ifndef IS31FL3733_SYNC_4 | ||||||
|  | #    define IS31FL3733_SYNC_4 IS31FL3733_SYNC_NONE | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| // Transfer buffer for TWITransmitData()
 | // Transfer buffer for TWITransmitData()
 | ||||||
| uint8_t g_twi_transfer_buffer[20]; | uint8_t g_twi_transfer_buffer[20]; | ||||||
| 
 | 
 | ||||||
| @ -125,6 +138,36 @@ bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void is31fl3733_init_drivers(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|  |     is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1); | ||||||
|  | #if defined(IS31FL3733_I2C_ADDRESS_2) | ||||||
|  |     is31fl3733_init(IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_2); | ||||||
|  | #    if defined(IS31FL3733_I2C_ADDRESS_3) | ||||||
|  |     is31fl3733_init(IS31FL3733_I2C_ADDRESS_3, IS31FL3733_SYNC_3); | ||||||
|  | #        if defined(IS31FL3733_I2C_ADDRESS_4) | ||||||
|  |     is31fl3733_init(IS31FL3733_I2C_ADDRESS_4, IS31FL3733_SYNC_4); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < IS31FL3733_LED_COUNT; i++) { | ||||||
|  |         is31fl3733_set_led_control_register(i, true, true, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0); | ||||||
|  | #if defined(IS31FL3733_I2C_ADDRESS_2) | ||||||
|  |     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1); | ||||||
|  | #    if defined(IS31FL3733_I2C_ADDRESS_3) | ||||||
|  |     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_3, 2); | ||||||
|  | #        if defined(IS31FL3733_I2C_ADDRESS_4) | ||||||
|  |     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_4, 3); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void is31fl3733_init(uint8_t addr, uint8_t sync) { | void is31fl3733_init(uint8_t addr, uint8_t sync) { | ||||||
|     // In order to avoid the LEDs being driven with garbage data
 |     // In order to avoid the LEDs being driven with garbage data
 | ||||||
|     // in the LED driver's PWM registers, shutdown is enabled last.
 |     // in the LED driver's PWM registers, shutdown is enabled last.
 | ||||||
| @ -173,7 +216,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) { | void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     is31fl3733_led_t led; |     is31fl3733_led_t led; | ||||||
|     if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { |     if (index >= 0 && index < IS31FL3733_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); | ||||||
| 
 | 
 | ||||||
|         if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { |         if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { | ||||||
| @ -187,7 +230,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) { | void is31fl3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < IS31FL3733_LED_COUNT; i++) { | ||||||
|         is31fl3733_set_color(i, red, green, blue); |         is31fl3733_set_color(i, red, green, blue); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -110,8 +110,9 @@ typedef struct is31fl3733_led_t { | |||||||
|     uint8_t b; |     uint8_t b; | ||||||
| } __attribute__((packed)) is31fl3733_led_t; | } __attribute__((packed)) is31fl3733_led_t; | ||||||
| 
 | 
 | ||||||
| extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT]; | extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void is31fl3733_init_drivers(void); | ||||||
| void is31fl3733_init(uint8_t addr, uint8_t sync); | void is31fl3733_init(uint8_t addr, uint8_t sync); | ||||||
| bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); | bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); | ||||||
| bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | ||||||
| @ -144,6 +145,10 @@ void is31fl3733_flush(void); | |||||||
| #define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0b011 | #define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0b011 | ||||||
| #define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0b100 | #define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0b100 | ||||||
| 
 | 
 | ||||||
|  | #define IS31FL3733_SYNC_NONE 0b00 | ||||||
|  | #define IS31FL3733_SYNC_MASTER 0b01 | ||||||
|  | #define IS31FL3733_SYNC_SLAVE 0b10 | ||||||
|  | 
 | ||||||
| #define A_1 0x00 | #define A_1 0x00 | ||||||
| #define A_2 0x01 | #define A_2 0x01 | ||||||
| #define A_3 0x02 | #define A_3 0x02 | ||||||
|  | |||||||
| @ -112,6 +112,36 @@ void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void is31fl3736_init_drivers(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|  |     is31fl3736_init(IS31FL3736_I2C_ADDRESS_1); | ||||||
|  | #if defined(IS31FL3736_I2C_ADDRESS_2) | ||||||
|  |     is31fl3736_init(IS31FL3736_I2C_ADDRESS_2); | ||||||
|  | #    if defined(IS31FL3736_I2C_ADDRESS_3) | ||||||
|  |     is31fl3736_init(IS31FL3736_I2C_ADDRESS_3); | ||||||
|  | #        if defined(IS31FL3736_I2C_ADDRESS_4) | ||||||
|  |     is31fl3736_init(IS31FL3736_I2C_ADDRESS_4); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < IS31FL3736_LED_COUNT; i++) { | ||||||
|  |         is31fl3736_set_led_control_register(i, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_1, 0); | ||||||
|  | #if defined(IS31FL3736_I2C_ADDRESS_2) | ||||||
|  |     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_2, 1); | ||||||
|  | #    if defined(IS31FL3736_I2C_ADDRESS_3) | ||||||
|  |     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_3, 2); | ||||||
|  | #        if defined(IS31FL3736_I2C_ADDRESS_4) | ||||||
|  |     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_4, 3); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void is31fl3736_init(uint8_t addr) { | void is31fl3736_init(uint8_t addr) { | ||||||
|     // In order to avoid the LEDs being driven with garbage data
 |     // In order to avoid the LEDs being driven with garbage data
 | ||||||
|     // in the LED driver's PWM registers, shutdown is enabled last.
 |     // in the LED driver's PWM registers, shutdown is enabled last.
 | ||||||
| @ -159,7 +189,7 @@ void is31fl3736_init(uint8_t addr) { | |||||||
| 
 | 
 | ||||||
| void is31fl3736_set_value(int index, uint8_t value) { | void is31fl3736_set_value(int index, uint8_t value) { | ||||||
|     is31fl3736_led_t led; |     is31fl3736_led_t led; | ||||||
|     if (index >= 0 && index < LED_MATRIX_LED_COUNT) { |     if (index >= 0 && index < IS31FL3736_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_is31fl3736_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_is31fl3736_leds[index]), sizeof(led)); | ||||||
| 
 | 
 | ||||||
|         if (g_pwm_buffer[led.driver][led.v] == value) { |         if (g_pwm_buffer[led.driver][led.v] == value) { | ||||||
| @ -171,7 +201,7 @@ void is31fl3736_set_value(int index, uint8_t value) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void is31fl3736_set_value_all(uint8_t value) { | void is31fl3736_set_value_all(uint8_t value) { | ||||||
|     for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < IS31FL3736_LED_COUNT; i++) { | ||||||
|         is31fl3736_set_value(i, value); |         is31fl3736_set_value(i, value); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -80,8 +80,9 @@ typedef struct is31fl3736_led_t { | |||||||
|     uint8_t v; |     uint8_t v; | ||||||
| } __attribute__((packed)) is31fl3736_led_t; | } __attribute__((packed)) is31fl3736_led_t; | ||||||
| 
 | 
 | ||||||
| extern const is31fl3736_led_t PROGMEM g_is31fl3736_leds[LED_MATRIX_LED_COUNT]; | extern const is31fl3736_led_t PROGMEM g_is31fl3736_leds[IS31FL3736_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void is31fl3736_init_drivers(void); | ||||||
| void is31fl3736_init(uint8_t addr); | void is31fl3736_init(uint8_t addr); | ||||||
| void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); | void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); | ||||||
| void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | ||||||
|  | |||||||
| @ -112,6 +112,36 @@ void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void is31fl3736_init_drivers(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|  |     is31fl3736_init(IS31FL3736_I2C_ADDRESS_1); | ||||||
|  | #if defined(IS31FL3736_I2C_ADDRESS_2) | ||||||
|  |     is31fl3736_init(IS31FL3736_I2C_ADDRESS_2); | ||||||
|  | #    if defined(IS31FL3736_I2C_ADDRESS_3) | ||||||
|  |     is31fl3736_init(IS31FL3736_I2C_ADDRESS_3); | ||||||
|  | #        if defined(IS31FL3736_I2C_ADDRESS_4) | ||||||
|  |     is31fl3736_init(IS31FL3736_I2C_ADDRESS_4); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < IS31FL3736_LED_COUNT; i++) { | ||||||
|  |         is31fl3736_set_led_control_register(i, true, true, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_1, 0); | ||||||
|  | #if defined(IS31FL3736_I2C_ADDRESS_2) | ||||||
|  |     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_2, 1); | ||||||
|  | #    if defined(IS31FL3736_I2C_ADDRESS_3) | ||||||
|  |     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_3, 2); | ||||||
|  | #        if defined(IS31FL3736_I2C_ADDRESS_4) | ||||||
|  |     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_4, 3); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void is31fl3736_init(uint8_t addr) { | void is31fl3736_init(uint8_t addr) { | ||||||
|     // In order to avoid the LEDs being driven with garbage data
 |     // In order to avoid the LEDs being driven with garbage data
 | ||||||
|     // in the LED driver's PWM registers, shutdown is enabled last.
 |     // in the LED driver's PWM registers, shutdown is enabled last.
 | ||||||
| @ -159,7 +189,7 @@ void is31fl3736_init(uint8_t addr) { | |||||||
| 
 | 
 | ||||||
| void is31fl3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | void is31fl3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     is31fl3736_led_t led; |     is31fl3736_led_t led; | ||||||
|     if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { |     if (index >= 0 && index < IS31FL3736_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_is31fl3736_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_is31fl3736_leds[index]), sizeof(led)); | ||||||
| 
 | 
 | ||||||
|         if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { |         if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { | ||||||
| @ -173,7 +203,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) { | void is31fl3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < IS31FL3736_LED_COUNT; i++) { | ||||||
|         is31fl3736_set_color(i, red, green, blue); |         is31fl3736_set_color(i, red, green, blue); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -94,8 +94,9 @@ typedef struct is31fl3736_led_t { | |||||||
|     uint8_t b; |     uint8_t b; | ||||||
| } __attribute__((packed)) is31fl3736_led_t; | } __attribute__((packed)) is31fl3736_led_t; | ||||||
| 
 | 
 | ||||||
| extern const is31fl3736_led_t PROGMEM g_is31fl3736_leds[RGB_MATRIX_LED_COUNT]; | extern const is31fl3736_led_t PROGMEM g_is31fl3736_leds[IS31FL3736_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void is31fl3736_init_drivers(void); | ||||||
| void is31fl3736_init(uint8_t addr); | void is31fl3736_init(uint8_t addr); | ||||||
| void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); | void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); | ||||||
| void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | ||||||
|  | |||||||
| @ -115,6 +115,36 @@ void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void is31fl3737_init_drivers(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|  |     is31fl3737_init(IS31FL3737_I2C_ADDRESS_1); | ||||||
|  | #if defined(IS31FL3737_I2C_ADDRESS_2) | ||||||
|  |     is31fl3737_init(IS31FL3737_I2C_ADDRESS_2); | ||||||
|  | #    if defined(IS31FL3737_I2C_ADDRESS_3) | ||||||
|  |     is31fl3737_init(IS31FL3737_I2C_ADDRESS_3); | ||||||
|  | #        if defined(IS31FL3737_I2C_ADDRESS_4) | ||||||
|  |     is31fl3737_init(IS31FL3737_I2C_ADDRESS_4); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < IS31FL3737_LED_COUNT; i++) { | ||||||
|  |         is31fl3737_set_led_control_register(i, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_1, 0); | ||||||
|  | #if defined(IS31FL3737_I2C_ADDRESS_2) | ||||||
|  |     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_2, 1); | ||||||
|  | #    if defined(IS31FL3737_I2C_ADDRESS_3) | ||||||
|  |     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_3, 2); | ||||||
|  | #        if defined(IS31FL3737_I2C_ADDRESS_4) | ||||||
|  |     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_4, 3); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void is31fl3737_init(uint8_t addr) { | void is31fl3737_init(uint8_t addr) { | ||||||
|     // In order to avoid the LEDs being driven with garbage data
 |     // In order to avoid the LEDs being driven with garbage data
 | ||||||
|     // in the LED driver's PWM registers, shutdown is enabled last.
 |     // in the LED driver's PWM registers, shutdown is enabled last.
 | ||||||
| @ -162,7 +192,7 @@ void is31fl3737_init(uint8_t addr) { | |||||||
| 
 | 
 | ||||||
| void is31fl3737_set_value(int index, uint8_t value) { | void is31fl3737_set_value(int index, uint8_t value) { | ||||||
|     is31fl3737_led_t led; |     is31fl3737_led_t led; | ||||||
|     if (index >= 0 && index < LED_MATRIX_LED_COUNT) { |     if (index >= 0 && index < IS31FL3737_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_is31fl3737_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_is31fl3737_leds[index]), sizeof(led)); | ||||||
| 
 | 
 | ||||||
|         if (g_pwm_buffer[led.driver][led.v] == value) { |         if (g_pwm_buffer[led.driver][led.v] == value) { | ||||||
| @ -174,7 +204,7 @@ void is31fl3737_set_value(int index, uint8_t value) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void is31fl3737_set_value_all(uint8_t value) { | void is31fl3737_set_value_all(uint8_t value) { | ||||||
|     for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < IS31FL3737_LED_COUNT; i++) { | ||||||
|         is31fl3737_set_value(i, value); |         is31fl3737_set_value(i, value); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -70,8 +70,9 @@ typedef struct is31fl3737_led_t { | |||||||
|     uint8_t v; |     uint8_t v; | ||||||
| } __attribute__((packed)) is31fl3737_led_t; | } __attribute__((packed)) is31fl3737_led_t; | ||||||
| 
 | 
 | ||||||
| extern const is31fl3737_led_t PROGMEM g_is31fl3737_leds[LED_MATRIX_LED_COUNT]; | extern const is31fl3737_led_t PROGMEM g_is31fl3737_leds[IS31FL3737_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void is31fl3737_init_drivers(void); | ||||||
| void is31fl3737_init(uint8_t addr); | void is31fl3737_init(uint8_t addr); | ||||||
| void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); | void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); | ||||||
| void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | ||||||
|  | |||||||
| @ -115,6 +115,36 @@ void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void is31fl3737_init_drivers(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|  |     is31fl3737_init(IS31FL3737_I2C_ADDRESS_1); | ||||||
|  | #if defined(IS31FL3737_I2C_ADDRESS_2) | ||||||
|  |     is31fl3737_init(IS31FL3737_I2C_ADDRESS_2); | ||||||
|  | #    if defined(IS31FL3737_I2C_ADDRESS_3) | ||||||
|  |     is31fl3737_init(IS31FL3737_I2C_ADDRESS_3); | ||||||
|  | #        if defined(IS31FL3737_I2C_ADDRESS_4) | ||||||
|  |     is31fl3737_init(IS31FL3737_I2C_ADDRESS_4); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < IS31FL3737_LED_COUNT; i++) { | ||||||
|  |         is31fl3737_set_led_control_register(i, true, true, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_1, 0); | ||||||
|  | #if defined(IS31FL3737_I2C_ADDRESS_2) | ||||||
|  |     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_2, 1); | ||||||
|  | #    if defined(IS31FL3737_I2C_ADDRESS_3) | ||||||
|  |     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_3, 2); | ||||||
|  | #        if defined(IS31FL3737_I2C_ADDRESS_4) | ||||||
|  |     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_4, 3); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void is31fl3737_init(uint8_t addr) { | void is31fl3737_init(uint8_t addr) { | ||||||
|     // In order to avoid the LEDs being driven with garbage data
 |     // In order to avoid the LEDs being driven with garbage data
 | ||||||
|     // in the LED driver's PWM registers, shutdown is enabled last.
 |     // in the LED driver's PWM registers, shutdown is enabled last.
 | ||||||
| @ -162,7 +192,7 @@ void is31fl3737_init(uint8_t addr) { | |||||||
| 
 | 
 | ||||||
| void is31fl3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | void is31fl3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     is31fl3737_led_t led; |     is31fl3737_led_t led; | ||||||
|     if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { |     if (index >= 0 && index < IS31FL3737_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_is31fl3737_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_is31fl3737_leds[index]), sizeof(led)); | ||||||
| 
 | 
 | ||||||
|         if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { |         if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { | ||||||
| @ -176,7 +206,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) { | void is31fl3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < IS31FL3737_LED_COUNT; i++) { | ||||||
|         is31fl3737_set_color(i, red, green, blue); |         is31fl3737_set_color(i, red, green, blue); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -87,8 +87,9 @@ typedef struct is31fl3737_led_t { | |||||||
|     uint8_t b; |     uint8_t b; | ||||||
| } __attribute__((packed)) is31fl3737_led_t; | } __attribute__((packed)) is31fl3737_led_t; | ||||||
| 
 | 
 | ||||||
| extern const is31fl3737_led_t PROGMEM g_is31fl3737_leds[RGB_MATRIX_LED_COUNT]; | extern const is31fl3737_led_t PROGMEM g_is31fl3737_leds[IS31FL3737_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void is31fl3737_init_drivers(void); | ||||||
| void is31fl3737_init(uint8_t addr); | void is31fl3737_init(uint8_t addr); | ||||||
| void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); | void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); | ||||||
| void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | ||||||
|  | |||||||
| @ -143,6 +143,36 @@ bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void is31fl3741_init_drivers(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|  |     is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); | ||||||
|  | #if defined(IS31FL3741_I2C_ADDRESS_2) | ||||||
|  |     is31fl3741_init(IS31FL3741_I2C_ADDRESS_2); | ||||||
|  | #    if defined(IS31FL3741_I2C_ADDRESS_3) | ||||||
|  |     is31fl3741_init(IS31FL3741_I2C_ADDRESS_3); | ||||||
|  | #        if defined(IS31FL3741_I2C_ADDRESS_4) | ||||||
|  |     is31fl3741_init(IS31FL3741_I2C_ADDRESS_4); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < IS31FL3741_LED_COUNT; i++) { | ||||||
|  |         is31fl3741_set_led_control_register(i, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_1, 0); | ||||||
|  | #if defined(IS31FL3741_I2C_ADDRESS_2) | ||||||
|  |     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_2, 1); | ||||||
|  | #    if defined(IS31FL3741_I2C_ADDRESS_3) | ||||||
|  |     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_3, 2); | ||||||
|  | #        if defined(IS31FL3741_I2C_ADDRESS_4) | ||||||
|  |     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_4, 3); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void is31fl3741_init(uint8_t addr) { | void is31fl3741_init(uint8_t addr) { | ||||||
|     // In order to avoid the LEDs being driven with garbage data
 |     // In order to avoid the LEDs being driven with garbage data
 | ||||||
|     // in the LED driver's PWM registers, shutdown is enabled last.
 |     // in the LED driver's PWM registers, shutdown is enabled last.
 | ||||||
| @ -174,7 +204,7 @@ void is31fl3741_init(uint8_t addr) { | |||||||
| 
 | 
 | ||||||
| void is31fl3741_set_value(int index, uint8_t value) { | void is31fl3741_set_value(int index, uint8_t value) { | ||||||
|     is31fl3741_led_t led; |     is31fl3741_led_t led; | ||||||
|     if (index >= 0 && index < LED_MATRIX_LED_COUNT) { |     if (index >= 0 && index < IS31FL3741_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_is31fl3741_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_is31fl3741_leds[index]), sizeof(led)); | ||||||
| 
 | 
 | ||||||
|         if (g_pwm_buffer[led.driver][led.v] == value) { |         if (g_pwm_buffer[led.driver][led.v] == value) { | ||||||
| @ -186,7 +216,7 @@ void is31fl3741_set_value(int index, uint8_t value) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void is31fl3741_set_value_all(uint8_t value) { | void is31fl3741_set_value_all(uint8_t value) { | ||||||
|     for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < IS31FL3741_LED_COUNT; i++) { | ||||||
|         is31fl3741_set_value(i, value); |         is31fl3741_set_value(i, value); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -70,8 +70,9 @@ typedef struct is31fl3741_led_t { | |||||||
|     uint32_t v : 10; |     uint32_t v : 10; | ||||||
| } __attribute__((packed)) is31fl3741_led_t; | } __attribute__((packed)) is31fl3741_led_t; | ||||||
| 
 | 
 | ||||||
| extern const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT]; | extern const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void is31fl3741_init_drivers(void); | ||||||
| void is31fl3741_init(uint8_t addr); | void is31fl3741_init(uint8_t addr); | ||||||
| void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); | void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); | ||||||
| bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | ||||||
|  | |||||||
| @ -143,6 +143,36 @@ bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void is31fl3741_init_drivers(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|  |     is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); | ||||||
|  | #if defined(IS31FL3741_I2C_ADDRESS_2) | ||||||
|  |     is31fl3741_init(IS31FL3741_I2C_ADDRESS_2); | ||||||
|  | #    if defined(IS31FL3741_I2C_ADDRESS_3) | ||||||
|  |     is31fl3741_init(IS31FL3741_I2C_ADDRESS_3); | ||||||
|  | #        if defined(IS31FL3741_I2C_ADDRESS_4) | ||||||
|  |     is31fl3741_init(IS31FL3741_I2C_ADDRESS_4); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < IS31FL3741_LED_COUNT; i++) { | ||||||
|  |         is31fl3741_set_led_control_register(i, true, true, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_1, 0); | ||||||
|  | #if defined(IS31FL3741_I2C_ADDRESS_2) | ||||||
|  |     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_2, 1); | ||||||
|  | #    if defined(IS31FL3741_I2C_ADDRESS_3) | ||||||
|  |     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_3, 2); | ||||||
|  | #        if defined(IS31FL3741_I2C_ADDRESS_4) | ||||||
|  |     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_4, 3); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void is31fl3741_init(uint8_t addr) { | void is31fl3741_init(uint8_t addr) { | ||||||
|     // In order to avoid the LEDs being driven with garbage data
 |     // In order to avoid the LEDs being driven with garbage data
 | ||||||
|     // in the LED driver's PWM registers, shutdown is enabled last.
 |     // in the LED driver's PWM registers, shutdown is enabled last.
 | ||||||
| @ -174,7 +204,7 @@ void is31fl3741_init(uint8_t addr) { | |||||||
| 
 | 
 | ||||||
| void is31fl3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | void is31fl3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     is31fl3741_led_t led; |     is31fl3741_led_t led; | ||||||
|     if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { |     if (index >= 0 && index < IS31FL3741_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_is31fl3741_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_is31fl3741_leds[index]), sizeof(led)); | ||||||
| 
 | 
 | ||||||
|         if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { |         if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { | ||||||
| @ -188,7 +218,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) { | void is31fl3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < IS31FL3741_LED_COUNT; i++) { | ||||||
|         is31fl3741_set_color(i, red, green, blue); |         is31fl3741_set_color(i, red, green, blue); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -87,8 +87,9 @@ typedef struct is31fl3741_led_t { | |||||||
|     uint32_t b : 10; |     uint32_t b : 10; | ||||||
| } __attribute__((packed)) is31fl3741_led_t; | } __attribute__((packed)) is31fl3741_led_t; | ||||||
| 
 | 
 | ||||||
| extern const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT]; | extern const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void is31fl3741_init_drivers(void); | ||||||
| void is31fl3741_init(uint8_t addr); | void is31fl3741_init(uint8_t addr); | ||||||
| void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); | void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); | ||||||
| bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | ||||||
|  | |||||||
| @ -188,6 +188,41 @@ void IS31FL_common_flush(void) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef RGB_MATRIX_ENABLE | #ifdef RGB_MATRIX_ENABLE | ||||||
|  | void IS31FL_RGB_init_drivers(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|  |     IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1); | ||||||
|  | #    if defined(DRIVER_ADDR_2) | ||||||
|  |     IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2); | ||||||
|  | #        if defined(DRIVER_ADDR_3) | ||||||
|  |     IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3); | ||||||
|  | #            if defined(DRIVER_ADDR_4) | ||||||
|  |     IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4); | ||||||
|  | #            endif | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { | ||||||
|  |         IS31FL_RGB_set_scaling_buffer(i, true, true, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     // This actually updates the LED drivers
 | ||||||
|  | #    ifdef ISSI_MANUAL_SCALING | ||||||
|  |     IS31FL_set_manual_scaling_buffer(); | ||||||
|  | #    endif | ||||||
|  | 
 | ||||||
|  |     IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0); | ||||||
|  | #    if defined(DRIVER_ADDR_2) | ||||||
|  |     IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1); | ||||||
|  | #        if defined(DRIVER_ADDR_3) | ||||||
|  |     IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2); | ||||||
|  | #            if defined(DRIVER_ADDR_4) | ||||||
|  |     IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3); | ||||||
|  | #            endif | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // Colour is set by adjusting PWM register
 | // Colour is set by adjusting PWM register
 | ||||||
| void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { |     if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { | ||||||
| @ -231,6 +266,41 @@ void IS31FL_RGB_set_scaling_buffer(uint8_t index, bool red, bool green, bool blu | |||||||
| 
 | 
 | ||||||
| #elif defined(LED_MATRIX_ENABLE) | #elif defined(LED_MATRIX_ENABLE) | ||||||
| // LED Matrix Specific scripts
 | // LED Matrix Specific scripts
 | ||||||
|  | void IS31FL_simple_init_drivers(void) { | ||||||
|  |     i2c_init(); | ||||||
|  | 
 | ||||||
|  |     IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1); | ||||||
|  | #    if defined(DRIVER_ADDR_2) | ||||||
|  |     IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2); | ||||||
|  | #        if defined(DRIVER_ADDR_3) | ||||||
|  |     IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3); | ||||||
|  | #            if defined(DRIVER_ADDR_4) | ||||||
|  |     IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4); | ||||||
|  | #            endif | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { | ||||||
|  |         IS31FL_simple_set_scaling_buffer(i, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | // This actually updates the LED drivers
 | ||||||
|  | #    ifdef ISSI_MANUAL_SCALING | ||||||
|  |     IS31FL_set_manual_scaling_buffer(); | ||||||
|  | #    endif | ||||||
|  | 
 | ||||||
|  |     IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0); | ||||||
|  | #    if defined(DRIVER_ADDR_2) | ||||||
|  |     IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1); | ||||||
|  | #        if defined(DRIVER_ADDR_3) | ||||||
|  |     IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2); | ||||||
|  | #            if defined(DRIVER_ADDR_4) | ||||||
|  |     IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3); | ||||||
|  | #            endif | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value) { | void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value) { | ||||||
|     is31_led led; |     is31_led led; | ||||||
|     memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); |     memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); | ||||||
|  | |||||||
| @ -71,11 +71,13 @@ void IS31FL_common_flush(void); | |||||||
| 
 | 
 | ||||||
| #ifdef RGB_MATRIX_ENABLE | #ifdef RGB_MATRIX_ENABLE | ||||||
| // RGB Matrix Specific scripts
 | // RGB Matrix Specific scripts
 | ||||||
|  | void IS31FL_RGB_init_drivers(void); | ||||||
| void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); | 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); | void IS31FL_RGB_set_color_all(uint8_t red, uint8_t green, uint8_t blue); | ||||||
| void IS31FL_RGB_set_scaling_buffer(uint8_t index, bool red, bool green, bool blue); | void IS31FL_RGB_set_scaling_buffer(uint8_t index, bool red, bool green, bool blue); | ||||||
| #elif defined(LED_MATRIX_ENABLE) | #elif defined(LED_MATRIX_ENABLE) | ||||||
| // LED Matrix Specific scripts
 | // LED Matrix Specific scripts
 | ||||||
|  | void IS31FL_simple_init_drivers(void); | ||||||
| void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value); | void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value); | ||||||
| void IS31FL_simple_set_brightness(int index, uint8_t value); | void IS31FL_simple_set_brightness(int index, uint8_t value); | ||||||
| void IS31FL_simple_set_brigntness_all(uint8_t value); | void IS31FL_simple_set_brigntness_all(uint8_t value); | ||||||
|  | |||||||
| @ -99,6 +99,34 @@ bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void snled27351_init_drivers(void) { | ||||||
|  |     snled27351_init(SNLED27351_I2C_ADDRESS_1); | ||||||
|  | #if defined(SNLED27351_I2C_ADDRESS_2) | ||||||
|  |     snled27351_init(SNLED27351_I2C_ADDRESS_2); | ||||||
|  | #    if defined(SNLED27351_I2C_ADDRESS_3) | ||||||
|  |     snled27351_init(SNLED27351_I2C_ADDRESS_3); | ||||||
|  | #        if defined(SNLED27351_I2C_ADDRESS_4) | ||||||
|  |     snled27351_init(SNLED27351_I2C_ADDRESS_4); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < SNLED27351_LED_COUNT; i++) { | ||||||
|  |         snled27351_set_led_control_register(i, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_1, 0); | ||||||
|  | #if defined(SNLED27351_I2C_ADDRESS_2) | ||||||
|  |     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_2, 1); | ||||||
|  | #    if defined(SNLED27351_I2C_ADDRESS_3) | ||||||
|  |     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_3, 2); | ||||||
|  | #        if defined(SNLED27351_I2C_ADDRESS_4) | ||||||
|  |     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_4, 3); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void snled27351_init(uint8_t addr) { | void snled27351_init(uint8_t addr) { | ||||||
|     // Select to function page
 |     // Select to function page
 | ||||||
|     snled27351_write_register(addr, SNLED27351_REG_CONFIGURE_CMD_PAGE, SNLED27351_FUNCTION_PAGE); |     snled27351_write_register(addr, SNLED27351_REG_CONFIGURE_CMD_PAGE, SNLED27351_FUNCTION_PAGE); | ||||||
| @ -147,7 +175,7 @@ void snled27351_init(uint8_t addr) { | |||||||
| 
 | 
 | ||||||
| void snled27351_set_value(int index, uint8_t value) { | void snled27351_set_value(int index, uint8_t value) { | ||||||
|     snled27351_led_t led; |     snled27351_led_t led; | ||||||
|     if (index >= 0 && index < LED_MATRIX_LED_COUNT) { |     if (index >= 0 && index < SNLED27351_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_snled27351_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_snled27351_leds[index]), sizeof(led)); | ||||||
| 
 | 
 | ||||||
|         if (g_pwm_buffer[led.driver][led.v] == value) { |         if (g_pwm_buffer[led.driver][led.v] == value) { | ||||||
| @ -159,7 +187,7 @@ void snled27351_set_value(int index, uint8_t value) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void snled27351_set_value_all(uint8_t value) { | void snled27351_set_value_all(uint8_t value) { | ||||||
|     for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < SNLED27351_LED_COUNT; i++) { | ||||||
|         snled27351_set_value(i, value); |         snled27351_set_value(i, value); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -68,8 +68,9 @@ typedef struct snled27351_led_t { | |||||||
|     uint8_t v; |     uint8_t v; | ||||||
| } __attribute__((packed)) snled27351_led_t; | } __attribute__((packed)) snled27351_led_t; | ||||||
| 
 | 
 | ||||||
| extern const snled27351_led_t PROGMEM g_snled27351_leds[LED_MATRIX_LED_COUNT]; | extern const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void snled27351_init_drivers(void); | ||||||
| void snled27351_init(uint8_t addr); | void snled27351_init(uint8_t addr); | ||||||
| bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); | bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); | ||||||
| bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | ||||||
|  | |||||||
| @ -98,6 +98,34 @@ bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void snled27351_init_drivers(void) { | ||||||
|  |     snled27351_init(SNLED27351_I2C_ADDRESS_1); | ||||||
|  | #if defined(SNLED27351_I2C_ADDRESS_2) | ||||||
|  |     snled27351_init(SNLED27351_I2C_ADDRESS_2); | ||||||
|  | #    if defined(SNLED27351_I2C_ADDRESS_3) | ||||||
|  |     snled27351_init(SNLED27351_I2C_ADDRESS_3); | ||||||
|  | #        if defined(SNLED27351_I2C_ADDRESS_4) | ||||||
|  |     snled27351_init(SNLED27351_I2C_ADDRESS_4); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < SNLED27351_LED_COUNT; i++) { | ||||||
|  |         snled27351_set_led_control_register(i, true, true, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_1, 0); | ||||||
|  | #if defined(SNLED27351_I2C_ADDRESS_2) | ||||||
|  |     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_2, 1); | ||||||
|  | #    if defined(SNLED27351_I2C_ADDRESS_3) | ||||||
|  |     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_3, 2); | ||||||
|  | #        if defined(SNLED27351_I2C_ADDRESS_4) | ||||||
|  |     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_4, 3); | ||||||
|  | #        endif | ||||||
|  | #    endif | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void snled27351_init(uint8_t addr) { | void snled27351_init(uint8_t addr) { | ||||||
|     // Select to function page
 |     // Select to function page
 | ||||||
|     snled27351_write_register(addr, SNLED27351_REG_CONFIGURE_CMD_PAGE, SNLED27351_FUNCTION_PAGE); |     snled27351_write_register(addr, SNLED27351_REG_CONFIGURE_CMD_PAGE, SNLED27351_FUNCTION_PAGE); | ||||||
| @ -146,7 +174,7 @@ void snled27351_init(uint8_t addr) { | |||||||
| 
 | 
 | ||||||
| void snled27351_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | void snled27351_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     snled27351_led_t led; |     snled27351_led_t led; | ||||||
|     if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { |     if (index >= 0 && index < SNLED27351_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_snled27351_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_snled27351_leds[index]), sizeof(led)); | ||||||
| 
 | 
 | ||||||
|         if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { |         if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { | ||||||
| @ -160,7 +188,7 @@ void snled27351_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void snled27351_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | void snled27351_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < SNLED27351_LED_COUNT; i++) { | ||||||
|         snled27351_set_color(i, red, green, blue); |         snled27351_set_color(i, red, green, blue); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -82,8 +82,9 @@ typedef struct snled27351_led_t { | |||||||
|     uint8_t b; |     uint8_t b; | ||||||
| } __attribute__((packed)) snled27351_led_t; | } __attribute__((packed)) snled27351_led_t; | ||||||
| 
 | 
 | ||||||
| extern const snled27351_led_t PROGMEM g_snled27351_leds[RGB_MATRIX_LED_COUNT]; | extern const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void snled27351_init_drivers(void); | ||||||
| void snled27351_init(uint8_t addr); | void snled27351_init(uint8_t addr); | ||||||
| bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); | bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); | ||||||
| bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | ||||||
|  | |||||||
| @ -30,7 +30,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| #define IS31FL3741_DRIVER_COUNT 1 | #define IS31FL3741_DRIVER_COUNT 1 | ||||||
| #define DRIVER_1_LED_TOTAL 87 | #define DRIVER_1_LED_TOTAL 87 | ||||||
| #define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL | #define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL | ||||||
| #define ISSI_DRIVER_TOTAL RGB_MATRIX_LED_COUNT |  | ||||||
| 
 | 
 | ||||||
| #define RGB_MATRIX_DEFAULT_VAL 80 | #define RGB_MATRIX_DEFAULT_VAL 80 | ||||||
| #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | ||||||
|  | |||||||
| @ -23,8 +23,8 @@ | |||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #define IS31FL3731_DRIVER_COUNT 2 | ||||||
| #define DRIVER_1_LED_TOTAL 36 | #define DRIVER_1_LED_TOTAL 36 | ||||||
| #define DRIVER_2_LED_TOTAL 36 | #define DRIVER_2_LED_TOTAL 36 | ||||||
| #define ISSI_DRIVER_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | #define IS31FL3731_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | ||||||
| #define RGB_MATRIX_LED_COUNT ISSI_DRIVER_TOTAL | #define RGB_MATRIX_LED_COUNT IS31FL3731_LED_COUNT | ||||||
| 
 | 
 | ||||||
| #define RGB_MATRIX_DEFAULT_VAL 80 | #define RGB_MATRIX_DEFAULT_VAL 80 | ||||||
| #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ | |||||||
| #include "drivers/led/issi/is31fl3731.h" | #include "drivers/led/issi/is31fl3731.h" | ||||||
| 
 | 
 | ||||||
| #ifdef RGB_MATRIX_ENABLE | #ifdef RGB_MATRIX_ENABLE | ||||||
| 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
 | /* Refer to IS31 manual for these locations
 | ||||||
|  *   driver |  *   driver | ||||||
|  *   |  R location |  *   |  R location | ||||||
| @ -149,7 +149,7 @@ static void init(void) { | |||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); |     is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); |     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 = !(   ( index == 18+5) || //B5
 |         bool enabled = !(   ( index == 18+5) || //B5
 | ||||||
|                             ( index == 36+17) || //C17
 |                             ( index == 36+17) || //C17
 | ||||||
|                             ( index == 54+13) //D13
 |                             ( index == 54+13) //D13
 | ||||||
|  | |||||||
| @ -20,7 +20,7 @@ | |||||||
|  */ |  */ | ||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_DRIVER_COUNT 1 | #define IS31FL3731_DRIVER_COUNT 1 | ||||||
| #define LED_MATRIX_LED_COUNT 3 | #define IS31FL3731_LED_COUNT 3 | ||||||
| 
 | 
 | ||||||
| /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
 | ||||||
|  */ |  */ | ||||||
|  | |||||||
| @ -22,14 +22,7 @@ | |||||||
|  * init IS31FL3731 and i2c |  * init IS31FL3731 and i2c | ||||||
|  */ |  */ | ||||||
| void init_fallacy_leds(void) { | void init_fallacy_leds(void) { | ||||||
|     i2c_init(); |     is31fl3731_init_drivers(); | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); |  | ||||||
| 
 |  | ||||||
|     for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { |  | ||||||
|         is31fl3731_set_led_control_register(i, true); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -54,7 +47,7 @@ void set_fallacy_led(int index, bool state) { | |||||||
| 
 | 
 | ||||||
| /* define LED matrix
 | /* define LED matrix
 | ||||||
|  */ |  */ | ||||||
| const is31fl3731_led_t PROGMEM g_is31fl3731_leds[LED_MATRIX_LED_COUNT] = { | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { | ||||||
|     {0, C1_1}, |     {0, C1_1}, | ||||||
|     {0, C2_1}, |     {0, C2_1}, | ||||||
|     {0, C3_1}, |     {0, C3_1}, | ||||||
|  | |||||||
| @ -55,7 +55,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| 
 | 
 | ||||||
| #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3733_DRIVER_COUNT 1 | #define IS31FL3733_DRIVER_COUNT 1 | ||||||
| #define RGB_MATRIX_LED_COUNT 64 | #define IS31FL3733_LED_COUNT 64 | ||||||
| 
 | 
 | ||||||
| // These define which keys in the matrix are alphas/mods
 | // These define which keys in the matrix are alphas/mods
 | ||||||
| // Used for backlight effects so colors are different for
 | // Used for backlight effects so colors are different for
 | ||||||
|  | |||||||
| @ -55,7 +55,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| 
 | 
 | ||||||
| #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3733_DRIVER_COUNT 1 | #define IS31FL3733_DRIVER_COUNT 1 | ||||||
| #define RGB_MATRIX_LED_COUNT 64 | #define IS31FL3733_LED_COUNT 64 | ||||||
| 
 | 
 | ||||||
| // These define which keys in the matrix are alphas/mods
 | // These define which keys in the matrix are alphas/mods
 | ||||||
| // Used for backlight effects so colors are different for
 | // Used for backlight effects so colors are different for
 | ||||||
|  | |||||||
| @ -52,7 +52,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| 
 | 
 | ||||||
| #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3733_DRIVER_COUNT 1 | #define IS31FL3733_DRIVER_COUNT 1 | ||||||
| #define RGB_MATRIX_LED_COUNT 64 | #define IS31FL3733_LED_COUNT 64 | ||||||
| 
 | 
 | ||||||
| // These define which keys in the matrix are alphas/mods
 | // These define which keys in the matrix are alphas/mods
 | ||||||
| // Used for backlight effects so colors are different for
 | // Used for backlight effects so colors are different for
 | ||||||
|  | |||||||
| @ -34,7 +34,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| //#define NO_ACTION_ONESHOT
 | //#define NO_ACTION_ONESHOT
 | ||||||
| 
 | 
 | ||||||
| #ifdef RGB_MATRIX_ENABLE | #ifdef RGB_MATRIX_ENABLE | ||||||
| //#include "gpio.h"
 |  | ||||||
| // RGB Matrix Animation modes. Explicitly enabled
 | // RGB Matrix Animation modes. Explicitly enabled
 | ||||||
| // For full list of effects, see:
 | // For full list of effects, see:
 | ||||||
| // https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects
 | // https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects
 | ||||||
| @ -106,7 +105,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| #    define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | #    define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | ||||||
| #    define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_GND | #    define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_GND | ||||||
| #    define IS31FL3733_DRIVER_COUNT 2 | #    define IS31FL3733_DRIVER_COUNT 2 | ||||||
|  | #    define IS31FL3733_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | ||||||
| #    define DRIVER_1_LED_TOTAL 64 | #    define DRIVER_1_LED_TOTAL 64 | ||||||
| #    define DRIVER_2_LED_TOTAL 55 | #    define DRIVER_2_LED_TOTAL 55 | ||||||
| #    define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | #    define RGB_MATRIX_LED_COUNT IS31FL3733_LED_COUNT | ||||||
| #endif | #endif | ||||||
|  | |||||||
| @ -26,6 +26,7 @@ | |||||||
| 
 | 
 | ||||||
| #include <ch.h> | #include <ch.h> | ||||||
| #include <hal.h> | #include <hal.h> | ||||||
|  | #include "gpio.h" | ||||||
| 
 | 
 | ||||||
| #ifndef I2C_COUNT | #ifndef I2C_COUNT | ||||||
| #    define I2C_COUNT 1 | #    define I2C_COUNT 1 | ||||||
|  | |||||||
| @ -60,6 +60,19 @@ | |||||||
| #    define IS31FL3733_GLOBALCURRENT 0xFF | #    define IS31FL3733_GLOBALCURRENT 0xFF | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #ifndef IS31FL3733_SYNC_1 | ||||||
|  | #    define IS31FL3733_SYNC_1 IS31FL3733_SYNC_NONE | ||||||
|  | #endif | ||||||
|  | #ifndef IS31FL3733_SYNC_2 | ||||||
|  | #    define IS31FL3733_SYNC_2 IS31FL3733_SYNC_NONE | ||||||
|  | #endif | ||||||
|  | #ifndef IS31FL3733_SYNC_3 | ||||||
|  | #    define IS31FL3733_SYNC_3 IS31FL3733_SYNC_NONE | ||||||
|  | #endif | ||||||
|  | #ifndef IS31FL3733_SYNC_4 | ||||||
|  | #    define IS31FL3733_SYNC_4 IS31FL3733_SYNC_NONE | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| // Transfer buffer for TWITransmitData()
 | // Transfer buffer for TWITransmitData()
 | ||||||
| uint8_t g_twi_transfer_buffer[20]; | uint8_t g_twi_transfer_buffer[20]; | ||||||
| 
 | 
 | ||||||
| @ -125,6 +138,24 @@ bool is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffe | |||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void is31fl3733_init_drivers(void) { | ||||||
|  |     i2c_init(&I2CD1, I2C1_SCL_PIN, I2C1_SDA_PIN); | ||||||
|  |     is31fl3733_init(0, IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1); | ||||||
|  | #    ifdef USE_I2C2 | ||||||
|  |     i2c_init(&I2CD2, I2C2_SCL_PIN, I2C2_SDA_PIN); | ||||||
|  |     is31fl3733_init(1, IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_2); | ||||||
|  | #    endif | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < IS31FL3733_LED_COUNT; i++) { | ||||||
|  |         is31fl3733_set_led_control_register(i, true, true, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0); | ||||||
|  | #    ifdef USE_I2C2 | ||||||
|  |     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1); | ||||||
|  | #    endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync) { | void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync) { | ||||||
|     // In order to avoid the LEDs being driven with garbage data
 |     // In order to avoid the LEDs being driven with garbage data
 | ||||||
|     // in the LED driver's PWM registers, shutdown is enabled last.
 |     // in the LED driver's PWM registers, shutdown is enabled last.
 | ||||||
| @ -173,7 +204,7 @@ void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync) { | |||||||
| 
 | 
 | ||||||
| void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     is31fl3733_led_t led; |     is31fl3733_led_t led; | ||||||
|     if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { |     if (index >= 0 && index < IS31FL3733_LED_COUNT) { | ||||||
|         memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); |         memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); | ||||||
| 
 | 
 | ||||||
|         if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { |         if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { | ||||||
| @ -187,7 +218,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) { | void is31fl3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | ||||||
|     for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { |     for (int i = 0; i < IS31FL3733_LED_COUNT; i++) { | ||||||
|         is31fl3733_set_color(i, red, green, blue); |         is31fl3733_set_color(i, red, green, blue); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -46,8 +46,9 @@ typedef struct is31fl3733_led_t { | |||||||
|     uint8_t b; |     uint8_t b; | ||||||
| } __attribute__((packed)) is31fl3733_led_t; | } __attribute__((packed)) is31fl3733_led_t; | ||||||
| 
 | 
 | ||||||
| extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT]; | extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT]; | ||||||
| 
 | 
 | ||||||
|  | void is31fl3733_init_drivers(void); | ||||||
| void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync); | void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync); | ||||||
| bool is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data); | bool is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data); | ||||||
| bool is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffer); | bool is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffer); | ||||||
| @ -80,6 +81,10 @@ void is31fl3733_flush(void); | |||||||
| #define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0x03 | #define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0x03 | ||||||
| #define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0x04 | #define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0x04 | ||||||
| 
 | 
 | ||||||
|  | #define IS31FL3733_SYNC_NONE 0b00 | ||||||
|  | #define IS31FL3733_SYNC_MASTER 0b01 | ||||||
|  | #define IS31FL3733_SYNC_SLAVE 0b10 | ||||||
|  | 
 | ||||||
| #define A_1 0x00 | #define A_1 0x00 | ||||||
| #define A_2 0x01 | #define A_2 0x01 | ||||||
| #define A_3 0x02 | #define A_3 0x02 | ||||||
|  | |||||||
| @ -16,30 +16,10 @@ | |||||||
| 
 | 
 | ||||||
| #ifdef RGB_MATRIX_ENABLE | #ifdef RGB_MATRIX_ENABLE | ||||||
| #    include "rgb_matrix.h" | #    include "rgb_matrix.h" | ||||||
| #    include "i2c_master.h" |  | ||||||
| #    include "is31fl3733-dual.h" | #    include "is31fl3733-dual.h" | ||||||
| #    include "gpio.h" |  | ||||||
| 
 |  | ||||||
| static void init(void) { |  | ||||||
|     i2c_init(&I2CD1, I2C1_SCL_PIN, I2C1_SDA_PIN); |  | ||||||
|     is31fl3733_init(0, IS31FL3733_I2C_ADDRESS_1, 0); |  | ||||||
| #    ifdef USE_I2C2 |  | ||||||
|     i2c_init(&I2CD2, I2C2_SCL_PIN, I2C2_SDA_PIN); |  | ||||||
|     is31fl3733_init(1, IS31FL3733_I2C_ADDRESS_2, 0); |  | ||||||
| #    endif |  | ||||||
|     for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) { |  | ||||||
|         bool enabled = true; |  | ||||||
|         // This only caches it for later
 |  | ||||||
|         is31fl3733_set_led_control_register(index, enabled, enabled, enabled); |  | ||||||
|     } |  | ||||||
|     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0); |  | ||||||
| #    ifdef USE_I2C2 |  | ||||||
|     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1); |  | ||||||
| #    endif |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| const rgb_matrix_driver_t rgb_matrix_driver = { | const rgb_matrix_driver_t rgb_matrix_driver = { | ||||||
|     .init = init, |     .init = is31fl3733_init_drivers, | ||||||
|     .flush = is31fl3733_flush, |     .flush = is31fl3733_flush, | ||||||
|     .set_color = is31fl3733_set_color, |     .set_color = is31fl3733_set_color, | ||||||
|     .set_color_all = is31fl3733_set_color_all, |     .set_color_all = is31fl3733_set_color_all, | ||||||
|  | |||||||
| @ -20,7 +20,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| #ifdef RGB_MATRIX_ENABLE | #ifdef RGB_MATRIX_ENABLE | ||||||
| #    include "is31fl3733-dual.h" | #    include "is31fl3733-dual.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_1,  A_1,  C_1  }, | ||||||
|     { 0, B_2,  A_2,  C_2  }, |     { 0, B_2,  A_2,  C_2  }, | ||||||
|     { 0, B_3,  A_3,  C_3  }, |     { 0, B_3,  A_3,  C_3  }, | ||||||
|  | |||||||
| @ -1,5 +1,5 @@ | |||||||
| ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) | ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) | ||||||
| 	# Additional files for RGB lighting | 	# Additional files for RGB lighting | ||||||
| 	SRC += k_type-rgbdriver.c | 	SRC += k_type-rgbdriver.c is31fl3733-dual.c | ||||||
| 	QUANTUM_LIB_SRC += i2c_master.c is31fl3733-dual.c | 	QUANTUM_LIB_SRC += i2c_master.c | ||||||
| endif | endif | ||||||
|  | |||||||
| @ -53,7 +53,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA | #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA | ||||||
| #define IS31FL3733_DRIVER_COUNT 2 | #define IS31FL3733_DRIVER_COUNT 2 | ||||||
| #define RGB_MATRIX_LED_COUNT 128 | #define IS31FL3733_LED_COUNT 128 | ||||||
| 
 | 
 | ||||||
| // These define which keys in the matrix are alphas/mods
 | // These define which keys in the matrix are alphas/mods
 | ||||||
| // Used for backlight effects so colors are different for
 | // Used for backlight effects so colors are different for
 | ||||||
|  | |||||||
| @ -74,7 +74,7 @@ | |||||||
| 
 | 
 | ||||||
| #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 | #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;
 | // Underglow LEDs are WS2812, but someone might want to use RGBLIGHT for them;
 | ||||||
| // don't use those LEDs in RGB Matrix in that case.
 | // don't use those LEDs in RGB Matrix in that case.
 | ||||||
| @ -84,7 +84,7 @@ | |||||||
| #    define WS2812_LED_TOTAL 6 | #    define WS2812_LED_TOTAL 6 | ||||||
| #endif | #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 | #ifdef RGB_MATRIX_ENABLE | ||||||
| #    define RGB_MATRIX_KEYPRESSES | #    define RGB_MATRIX_KEYPRESSES | ||||||
|  | |||||||
| @ -22,7 +22,7 @@ | |||||||
| #    include "is31fl3733.h" | #    include "is31fl3733.h" | ||||||
| #    include "ws2812.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_1, A_1, C_1 }, | ||||||
|     { 0, B_2, A_2, C_2 }, |     { 0, B_2, A_2, C_2 }, | ||||||
|     { 0, B_3, A_3, C_3 }, |     { 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) { | static void rgb_matrix_driver_init(void) { | ||||||
|     i2c_init(); |     i2c_init(); | ||||||
|     is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, 0); |     is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE); | ||||||
|     for (uint8_t index = 0; index < ISSI_LED_TOTAL; index++) { |     for (uint8_t index = 0; index < IS31FL3733_LED_COUNT; index++) { | ||||||
|         bool enabled = true; |         bool enabled = true; | ||||||
|         is31fl3733_set_led_control_register(index, enabled, enabled, enabled); |         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) { | 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); |         is31fl3733_set_color(index, red, green, blue); | ||||||
|     } else { |     } else { | ||||||
| #    if WS2812_LED_TOTAL > 0 | #    if WS2812_LED_TOTAL > 0 | ||||||
|         rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].r = red; |         rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].r = red; | ||||||
|         rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].g = green; |         rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].g = green; | ||||||
|         rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].b = blue; |         rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].b = blue; | ||||||
| #    endif | #    endif | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -82,7 +82,7 @@ | |||||||
| // IS31FL3733+WS2812 driver setup used by this board the LED controller drivers
 | // IS31FL3733+WS2812 driver setup used by this board the LED controller drivers
 | ||||||
| // are compiled unconditionally).
 | // 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 | #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 180 | ||||||
| 
 | 
 | ||||||
| @ -94,7 +94,7 @@ | |||||||
| #    define WS2812_LED_TOTAL 6 | #    define WS2812_LED_TOTAL 6 | ||||||
| #endif | #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 | #ifdef RGB_MATRIX_ENABLE | ||||||
| #    define RGB_MATRIX_KEYPRESSES | #    define RGB_MATRIX_KEYPRESSES | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ | |||||||
| #    include "ws2812.h" | #    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_1, A_1, C_1 }, | ||||||
|     { 0, B_2, A_2, C_2 }, |     { 0, B_2, A_2, C_2 }, | ||||||
|     { 0, B_3, A_3, C_3 }, |     { 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) { | static void rgb_matrix_driver_init(void) { | ||||||
|     i2c_init(); |     i2c_init(); | ||||||
|     is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, 0); |     is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE); | ||||||
|     for (uint8_t index = 0; index < ISSI_LED_TOTAL; index++) { |     for (uint8_t index = 0; index < IS31FL3733_LED_COUNT; index++) { | ||||||
|         bool enabled = true; |         bool enabled = true; | ||||||
|         is31fl3733_set_led_control_register(index, enabled, enabled, enabled); |         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) { | 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); |         is31fl3733_set_color(index, red, green, blue); | ||||||
|     } else { |     } else { | ||||||
| #    if WS2812_LED_TOTAL > 0 | #    if WS2812_LED_TOTAL > 0 | ||||||
|         rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].r = red; |         rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].r = red; | ||||||
|         rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].g = green; |         rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].g = green; | ||||||
|         rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].b = blue; |         rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].b = blue; | ||||||
| #    endif | #    endif | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -81,7 +81,7 @@ | |||||||
| #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | ||||||
| #define DRIVER_1_LED_TOTAL 61 | #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;
 | // Underglow LEDs are WS2812, but someone might want to use RGBLIGHT for them;
 | ||||||
| // don't use those LEDs in RGB Matrix in that case.
 | // don't use those LEDs in RGB Matrix in that case.
 | ||||||
| @ -91,7 +91,7 @@ | |||||||
| #    define WS2812_LED_TOTAL 6 | #    define WS2812_LED_TOTAL 6 | ||||||
| #endif | #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 | #ifdef RGB_MATRIX_ENABLE | ||||||
| #    define RGB_MATRIX_KEYPRESSES | #    define RGB_MATRIX_KEYPRESSES | ||||||
|  | |||||||
| @ -21,7 +21,7 @@ | |||||||
| #    include "is31fl3733.h" | #    include "is31fl3733.h" | ||||||
| #    include "ws2812.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_1, A_1, C_1 }, | ||||||
|     { 0, B_2, A_2, C_2 }, |     { 0, B_2, A_2, C_2 }, | ||||||
|     { 0, B_3, A_3, C_3 }, |     { 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) { | static void rgb_matrix_driver_init(void) { | ||||||
|     i2c_init(); |     i2c_init(); | ||||||
|     is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, 0); |     is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE); | ||||||
|     for (uint8_t index = 0; index < ISSI_LED_TOTAL; index++) { |     for (uint8_t index = 0; index < IS31FL3733_LED_COUNT; index++) { | ||||||
|         bool enabled = true; |         bool enabled = true; | ||||||
|         is31fl3733_set_led_control_register(index, enabled, enabled, enabled); |         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) { | 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); |         is31fl3733_set_color(index, red, green, blue); | ||||||
|     } else { |     } else { | ||||||
| #    if WS2812_LED_TOTAL > 0 | #    if WS2812_LED_TOTAL > 0 | ||||||
|         rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].r = red; |         rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].r = red; | ||||||
|         rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].g = green; |         rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].g = green; | ||||||
|         rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].b = blue; |         rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].b = blue; | ||||||
| #    endif | #    endif | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -80,4 +80,4 @@ | |||||||
| 
 | 
 | ||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_DRIVER_COUNT 1 | #define IS31FL3731_DRIVER_COUNT 1 | ||||||
| #define RGB_MATRIX_LED_COUNT 20 | #define IS31FL3731_LED_COUNT 20 | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ | |||||||
| #endif | #endif | ||||||
| // rgb ring leds setting
 | // rgb ring leds setting
 | ||||||
| 
 | 
 | ||||||
| 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
 | /* Refer to IS31 manual for these locations
 | ||||||
|  *   driver |  *   driver | ||||||
|  *   |  R location |  *   |  R location | ||||||
| @ -371,13 +371,7 @@ void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds) | |||||||
| 
 | 
 | ||||||
| void rgb_ring_init(void) | void rgb_ring_init(void) | ||||||
| { | { | ||||||
|     i2c_init(); |     is31fl3731_init_drivers(); | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); |  | ||||||
|     for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) { |  | ||||||
|         bool enabled = true; |  | ||||||
|         is31fl3731_set_led_control_register(index, enabled, enabled, enabled); |  | ||||||
|     } |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void rgb_ring_task(void) | void rgb_ring_task(void) | ||||||
|  | |||||||
| @ -111,7 +111,7 @@ static void self_testing(void) | |||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             if (rgb_state.index >= ST_LEFT_END) { |             if (rgb_state.index >= ST_LEFT_END) { | ||||||
|                 for (int i = rgb_state.index - 1; i < RGB_MATRIX_LED_COUNT - rgb_state.index + 1; i++) { |                 for (int i = rgb_state.index - 1; i < IS31FL3731_LED_COUNT - rgb_state.index + 1; i++) { | ||||||
|                     is31fl3731_set_color(i, led.r, led.g, led.b); |                     is31fl3731_set_color(i, led.r, led.g, led.b); | ||||||
|                 } |                 } | ||||||
|                 if (rgb_state.index == ST_LEFT_END) { |                 if (rgb_state.index == ST_LEFT_END) { | ||||||
| @ -173,13 +173,13 @@ static void self_testing(void) | |||||||
|         } |         } | ||||||
|         break; |         break; | ||||||
|         case ST_STAGE_3: |         case ST_STAGE_3: | ||||||
|             if (rgb_state.index != RGB_MATRIX_LED_COUNT/2) { |             if (rgb_state.index != IS31FL3731_LED_COUNT/2) { | ||||||
|                 is31fl3731_set_color_all(0, 0, 0); |                 is31fl3731_set_color_all(0, 0, 0); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             // light left and right
 |             // light left and right
 | ||||||
| 
 | 
 | ||||||
|             if (rgb_state.index == RGB_MATRIX_LED_COUNT/2) { |             if (rgb_state.index == IS31FL3731_LED_COUNT/2) { | ||||||
|                 if (rgb_state.duration) { |                 if (rgb_state.duration) { | ||||||
|                     rgb_state.duration--; |                     rgb_state.duration--; | ||||||
|                 } else { |                 } else { | ||||||
| @ -207,7 +207,7 @@ static void self_testing(void) | |||||||
|     update_ticks(); |     update_ticks(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 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
 |     /* Refer to IS31 manual for these locations
 | ||||||
|      *   driver |      *   driver | ||||||
|      *   |  R location |      *   |  R location | ||||||
| @ -294,18 +294,8 @@ void matrix_init_kb(void) | |||||||
|     setPinOutput(LED_CAPS_LOCK_PIN); |     setPinOutput(LED_CAPS_LOCK_PIN); | ||||||
|     writePinLow(LED_CAPS_LOCK_PIN); |     writePinLow(LED_CAPS_LOCK_PIN); | ||||||
| 
 | 
 | ||||||
|     i2c_init(); |     is31fl3731_init_drivers(); | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | 
 | ||||||
| #ifdef IS31FL3731_I2C_ADDRESS_2 |  | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); |  | ||||||
| #endif |  | ||||||
|     for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) { |  | ||||||
|         is31fl3731_set_led_control_register(index, true, true, true); |  | ||||||
|     } |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); |  | ||||||
| #ifdef IS31FL3731_I2C_ADDRESS_2 |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1); |  | ||||||
| #endif |  | ||||||
|     update_ticks(); |     update_ticks(); | ||||||
|     matrix_init_user(); |     matrix_init_user(); | ||||||
| } | } | ||||||
| @ -350,16 +340,16 @@ void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds) | |||||||
| { | { | ||||||
|     if (rgb_state.state != NORMAL) return; |     if (rgb_state.state != NORMAL) return; | ||||||
| 
 | 
 | ||||||
|     for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { |     for (uint8_t i = 0; i < IS31FL3731_LED_COUNT; i++) { | ||||||
|         is31fl3731_set_color(i, start_led[i].r, start_led[i].g, start_led[i].b); |         is31fl3731_set_color(i, start_led[i].r, start_led[i].g, start_led[i].b); | ||||||
|     } |     } | ||||||
|     rgb_led_t leds[4]; |     rgb_led_t leds[4]; | ||||||
|     for (int i = 0; i < 4; i++) { |     for (int i = 0; i < 4; i++) { | ||||||
|         leds[i].r = start_led[RGB_MATRIX_LED_COUNT+i].g; |         leds[i].r = start_led[IS31FL3731_LED_COUNT+i].g; | ||||||
|         leds[i].g = start_led[RGB_MATRIX_LED_COUNT+i].r; |         leds[i].g = start_led[IS31FL3731_LED_COUNT+i].r; | ||||||
|         leds[i].b = start_led[RGB_MATRIX_LED_COUNT+i].b; |         leds[i].b = start_led[IS31FL3731_LED_COUNT+i].b; | ||||||
|     } |     } | ||||||
|     //ws2812_setleds(start_led+RGB_MATRIX_LED_COUNT, 4);
 |     //ws2812_setleds(start_led+IS31FL3731_LED_COUNT, 4);
 | ||||||
|     ws2812_setleds(leds, 4); |     ws2812_setleds(leds, 4); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -35,6 +35,6 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #define IS31FL3731_DRIVER_COUNT 2 | ||||||
| #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL+DRIVER_2_LED_TOTAL) | #define IS31FL3731_LED_COUNT (DRIVER_1_LED_TOTAL+DRIVER_2_LED_TOTAL) | ||||||
| 
 | 
 | ||||||
| #define USB_SUSPEND_WAKEUP_DELAY 1000 | #define USB_SUSPEND_WAKEUP_DELAY 1000 | ||||||
|  | |||||||
| @ -35,4 +35,4 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #define IS31FL3731_DRIVER_COUNT 2 | ||||||
| #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL+DRIVER_2_LED_TOTAL) | #define IS31FL3731_LED_COUNT (DRIVER_1_LED_TOTAL+DRIVER_2_LED_TOTAL) | ||||||
|  | |||||||
| @ -115,7 +115,7 @@ static void self_testing(void) | |||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             if (rgb_state.index >= ST_LEFT_END) { |             if (rgb_state.index >= ST_LEFT_END) { | ||||||
|                 for (int i = rgb_state.index - 1; i < RGB_MATRIX_LED_COUNT - rgb_state.index + 1; i++) { |                 for (int i = rgb_state.index - 1; i < IS31FL3731_LED_COUNT - rgb_state.index + 1; i++) { | ||||||
|                     is31fl3731_set_color(i, led.r, led.g, led.b); |                     is31fl3731_set_color(i, led.r, led.g, led.b); | ||||||
|                 } |                 } | ||||||
|                 if (rgb_state.index == ST_LEFT_END) { |                 if (rgb_state.index == ST_LEFT_END) { | ||||||
| @ -177,13 +177,13 @@ static void self_testing(void) | |||||||
|         } |         } | ||||||
|         break; |         break; | ||||||
|         case ST_STAGE_3: |         case ST_STAGE_3: | ||||||
|             if (rgb_state.index != RGB_MATRIX_LED_COUNT/2) { |             if (rgb_state.index != IS31FL3731_LED_COUNT/2) { | ||||||
|                 is31fl3731_set_color_all(0, 0, 0); |                 is31fl3731_set_color_all(0, 0, 0); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             // light left and right
 |             // light left and right
 | ||||||
| 
 | 
 | ||||||
|             if (rgb_state.index == RGB_MATRIX_LED_COUNT/2) { |             if (rgb_state.index == IS31FL3731_LED_COUNT/2) { | ||||||
|                 if (rgb_state.duration) { |                 if (rgb_state.duration) { | ||||||
|                     rgb_state.duration--; |                     rgb_state.duration--; | ||||||
|                 } else { |                 } else { | ||||||
| @ -211,7 +211,7 @@ static void self_testing(void) | |||||||
|     update_ticks(); |     update_ticks(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 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
 |     /* Refer to IS31 manual for these locations
 | ||||||
|      *   driver |      *   driver | ||||||
|      *   |  R location |      *   |  R location | ||||||
| @ -298,18 +298,8 @@ void matrix_init_kb(void) | |||||||
|     setPinOutput(LED_CAPS_LOCK_PIN); |     setPinOutput(LED_CAPS_LOCK_PIN); | ||||||
|     writePinLow(LED_CAPS_LOCK_PIN); |     writePinLow(LED_CAPS_LOCK_PIN); | ||||||
| 
 | 
 | ||||||
|     i2c_init(); |     is31fl3731_init_drivers(); | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | 
 | ||||||
| #ifdef IS31FL3731_I2C_ADDRESS_2 |  | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); |  | ||||||
| #endif |  | ||||||
|     for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) { |  | ||||||
|         is31fl3731_set_led_control_register(index, true, true, true); |  | ||||||
|     } |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); |  | ||||||
| #ifdef IS31FL3731_I2C_ADDRESS_2 |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1); |  | ||||||
| #endif |  | ||||||
|     update_ticks(); |     update_ticks(); | ||||||
|     matrix_init_user(); |     matrix_init_user(); | ||||||
| } | } | ||||||
| @ -352,10 +342,10 @@ void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds) | |||||||
| { | { | ||||||
|     if (rgb_state.state != NORMAL) return; |     if (rgb_state.state != NORMAL) return; | ||||||
| 
 | 
 | ||||||
|     for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { |     for (uint8_t i = 0; i < IS31FL3731_LED_COUNT; i++) { | ||||||
|         is31fl3731_set_color(i, start_led[i].r, start_led[i].g, start_led[i].b); |         is31fl3731_set_color(i, start_led[i].r, start_led[i].g, start_led[i].b); | ||||||
|     } |     } | ||||||
|     ws2812_setleds(start_led+RGB_MATRIX_LED_COUNT, 1); |     ws2812_setleds(start_led+IS31FL3731_LED_COUNT, 1); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool led_update_kb(led_t led_state) | bool led_update_kb(led_t led_state) | ||||||
|  | |||||||
| @ -53,7 +53,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA | #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA | ||||||
| #define IS31FL3733_DRIVER_COUNT 2 | #define IS31FL3733_DRIVER_COUNT 2 | ||||||
| #define RGB_MATRIX_LED_COUNT 128 | #define IS31FL3733_LED_COUNT 128 | ||||||
| 
 | 
 | ||||||
| // These define which keys in the matrix are alphas/mods
 | // These define which keys in the matrix are alphas/mods
 | ||||||
| // Used for backlight effects so colors are different for
 | // Used for backlight effects so colors are different for
 | ||||||
|  | |||||||
| @ -53,7 +53,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA | #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA | ||||||
| #define IS31FL3733_DRIVER_COUNT 2 | #define IS31FL3733_DRIVER_COUNT 2 | ||||||
| #define RGB_MATRIX_LED_COUNT 128 | #define IS31FL3733_LED_COUNT 128 | ||||||
| 
 | 
 | ||||||
| // These define which keys in the matrix are alphas/mods
 | // These define which keys in the matrix are alphas/mods
 | ||||||
| // Used for backlight effects so colors are different for
 | // Used for backlight effects so colors are different for
 | ||||||
|  | |||||||
| @ -75,7 +75,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| 
 | 
 | ||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_DRIVER_COUNT 1 | #define IS31FL3731_DRIVER_COUNT 1 | ||||||
| #define RGB_MATRIX_LED_COUNT 16 | #define IS31FL3731_LED_COUNT 16 | ||||||
| 
 | 
 | ||||||
| // These define which keys in the matrix are alphas/mods
 | // These define which keys in the matrix are alphas/mods
 | ||||||
| // Used for backlight effects so colors are different for
 | // Used for backlight effects so colors are different for
 | ||||||
|  | |||||||
| @ -59,7 +59,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA | #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA | ||||||
| #define IS31FL3733_DRIVER_COUNT 2 | #define IS31FL3733_DRIVER_COUNT 2 | ||||||
| #define RGB_MATRIX_LED_COUNT 128 | #define IS31FL3733_LED_COUNT 128 | ||||||
| 
 | 
 | ||||||
| // These define which keys in the matrix are alphas/mods
 | // These define which keys in the matrix are alphas/mods
 | ||||||
| // Used for backlight effects so colors are different for
 | // Used for backlight effects so colors are different for
 | ||||||
|  | |||||||
| @ -51,7 +51,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #define IS31FL3731_DRIVER_COUNT 2 | ||||||
| #define RGB_MATRIX_LED_COUNT 67 | #define IS31FL3731_LED_COUNT 67 | ||||||
| 
 | 
 | ||||||
| #define RGB_BACKLIGHT_ENABLED 1 | #define RGB_BACKLIGHT_ENABLED 1 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| 
 | 
 | ||||||
| #ifdef RGB_MATRIX_ENABLE | #ifdef RGB_MATRIX_ENABLE | ||||||
| 
 | 
 | ||||||
| const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { | ||||||
|     { 0, C2_1,  C3_1,  C4_1  }, |     { 0, C2_1,  C3_1,  C4_1  }, | ||||||
|     { 0, C1_1,  C3_2,  C4_2  }, |     { 0, C1_1,  C3_2,  C4_2  }, | ||||||
|     { 0, C1_2,  C2_2,  C4_3  }, |     { 0, C1_2,  C2_2,  C4_3  }, | ||||||
|  | |||||||
| @ -81,7 +81,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| // WT_RGB IS31FL3741 driver code
 | // WT_RGB IS31FL3741 driver code
 | ||||||
| #    define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND | #    define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND | ||||||
| #    define IS31FL3741_DRIVER_COUNT 1 | #    define IS31FL3741_DRIVER_COUNT 1 | ||||||
| #    define RGB_MATRIX_LED_COUNT 98 | #    define IS31FL3741_LED_COUNT 98 | ||||||
| 
 | 
 | ||||||
| #    define RGB_BACKLIGHT_ENABLED 1 | #    define RGB_BACKLIGHT_ENABLED 1 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -20,7 +20,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | |||||||
| 
 | 
 | ||||||
| #ifdef RGB_MATRIX_ENABLE | #ifdef RGB_MATRIX_ENABLE | ||||||
| 
 | 
 | ||||||
| const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = { | const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT] = { | ||||||
|     {0, CS18_SW1, CS17_SW1, CS16_SW1}, |     {0, CS18_SW1, CS17_SW1, CS16_SW1}, | ||||||
|     {0, CS18_SW2, CS17_SW2, CS16_SW2}, |     {0, CS18_SW2, CS17_SW2, CS16_SW2}, | ||||||
|     {0, CS18_SW3, CS17_SW3, CS16_SW3}, |     {0, CS18_SW3, CS17_SW3, CS16_SW3}, | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #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
 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
 | ||||||
| #define LOCKING_SUPPORT_ENABLE | #define LOCKING_SUPPORT_ENABLE | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #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
 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
 | ||||||
| #define LOCKING_SUPPORT_ENABLE | #define LOCKING_SUPPORT_ENABLE | ||||||
|  | |||||||
| @ -23,7 +23,7 @@ | |||||||
| // IS31FL3731 driver
 | // IS31FL3731 driver
 | ||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_DRIVER_COUNT 1 | #define IS31FL3731_DRIVER_COUNT 1 | ||||||
| #define RGB_MATRIX_LED_COUNT 12 | #define IS31FL3731_LED_COUNT 12 | ||||||
| 
 | 
 | ||||||
| // Enable WT RGB backlight
 | // Enable WT RGB backlight
 | ||||||
| #define RGB_BACKLIGHT_ENABLED 1 | #define RGB_BACKLIGHT_ENABLED 1 | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #define IS31FL3731_DRIVER_COUNT 2 | ||||||
| #define RGB_MATRIX_LED_COUNT 72 | #define IS31FL3731_LED_COUNT 72 | ||||||
| 
 | 
 | ||||||
| // Enable WT RGB backlight
 | // Enable WT RGB backlight
 | ||||||
| #define RGB_BACKLIGHT_ENABLED 1 | #define RGB_BACKLIGHT_ENABLED 1 | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #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
 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
 | ||||||
| #define LOCKING_SUPPORT_ENABLE | #define LOCKING_SUPPORT_ENABLE | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #define IS31FL3731_DRIVER_COUNT 2 | ||||||
| #define RGB_MATRIX_LED_COUNT 72 | #define IS31FL3731_LED_COUNT 72 | ||||||
| 
 | 
 | ||||||
| // Enable WT RGB backlight
 | // Enable WT RGB backlight
 | ||||||
| #define RGB_BACKLIGHT_ENABLED 1 | #define RGB_BACKLIGHT_ENABLED 1 | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #define IS31FL3731_DRIVER_COUNT 2 | ||||||
| #define RGB_MATRIX_LED_COUNT 72 | #define IS31FL3731_LED_COUNT 72 | ||||||
| 
 | 
 | ||||||
| // Enable WT RGB backlight
 | // Enable WT RGB backlight
 | ||||||
| #define RGB_BACKLIGHT_ENABLED 1 | #define RGB_BACKLIGHT_ENABLED 1 | ||||||
|  | |||||||
| @ -20,7 +20,7 @@ | |||||||
| /* Locking resynchronize hack */ | /* Locking resynchronize hack */ | ||||||
| #define LOCKING_RESYNC_ENABLE | #define LOCKING_RESYNC_ENABLE | ||||||
| 
 | 
 | ||||||
| #define RGB_MATRIX_LED_COUNT 6 | #define IS31FL3218_LED_COUNT 6 | ||||||
| 
 | 
 | ||||||
| #define RGB_BACKLIGHT_ENABLED 1 | #define RGB_BACKLIGHT_ENABLED 1 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -42,7 +42,7 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define IS31FL3731_I2C_ADDRESS_3 IS31FL3731_I2C_ADDRESS_SCL | #define IS31FL3731_I2C_ADDRESS_3 IS31FL3731_I2C_ADDRESS_SCL | ||||||
| #define IS31FL3731_DRIVER_COUNT 3 | #define IS31FL3731_DRIVER_COUNT 3 | ||||||
| #define RGB_MATRIX_LED_COUNT 108 | #define IS31FL3731_LED_COUNT 108 | ||||||
| 
 | 
 | ||||||
| #define RGB_BACKLIGHT_ENABLED 1 | #define RGB_BACKLIGHT_ENABLED 1 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -64,4 +64,4 @@ | |||||||
| 
 | 
 | ||||||
| #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3736_DRIVER_COUNT 1 | #define IS31FL3736_DRIVER_COUNT 1 | ||||||
| #define LED_MATRIX_LED_COUNT 96 | #define IS31FL3736_LED_COUNT 96 | ||||||
|  | |||||||
| @ -26,7 +26,7 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #define IS31FL3731_DRIVER_COUNT 2 | ||||||
| #define RGB_MATRIX_LED_COUNT 72 | #define IS31FL3731_LED_COUNT 72 | ||||||
| 
 | 
 | ||||||
| #define RGB_BACKLIGHT_ENABLED 1 | #define RGB_BACKLIGHT_ENABLED 1 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -26,7 +26,7 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #define IS31FL3731_DRIVER_COUNT 2 | ||||||
| #define RGB_MATRIX_LED_COUNT 72 | #define IS31FL3731_LED_COUNT 72 | ||||||
| 
 | 
 | ||||||
| #define RGB_BACKLIGHT_ENABLED 1 | #define RGB_BACKLIGHT_ENABLED 1 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -26,7 +26,7 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #define IS31FL3731_DRIVER_COUNT 2 | ||||||
| #define RGB_MATRIX_LED_COUNT 72 | #define IS31FL3731_LED_COUNT 72 | ||||||
| 
 | 
 | ||||||
| #define RGB_BACKLIGHT_ENABLED 1 | #define RGB_BACKLIGHT_ENABLED 1 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -64,4 +64,4 @@ | |||||||
| 
 | 
 | ||||||
| #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3736_DRIVER_COUNT 1 | #define IS31FL3736_DRIVER_COUNT 1 | ||||||
| #define LED_MATRIX_LED_COUNT 96 | #define IS31FL3736_LED_COUNT 96 | ||||||
|  | |||||||
| @ -64,4 +64,4 @@ | |||||||
| 
 | 
 | ||||||
| #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3736_DRIVER_COUNT 1 | #define IS31FL3736_DRIVER_COUNT 1 | ||||||
| #define LED_MATRIX_LED_COUNT 96 | #define IS31FL3736_LED_COUNT 96 | ||||||
|  | |||||||
| @ -64,4 +64,4 @@ | |||||||
| 
 | 
 | ||||||
| #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3736_DRIVER_COUNT 1 | #define IS31FL3736_DRIVER_COUNT 1 | ||||||
| #define LED_MATRIX_LED_COUNT 96 | #define IS31FL3736_LED_COUNT 96 | ||||||
|  | |||||||
| @ -64,4 +64,4 @@ | |||||||
| 
 | 
 | ||||||
| #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3736_DRIVER_COUNT 1 | #define IS31FL3736_DRIVER_COUNT 1 | ||||||
| #define LED_MATRIX_LED_COUNT 96 | #define IS31FL3736_LED_COUNT 96 | ||||||
|  | |||||||
| @ -64,4 +64,4 @@ | |||||||
| 
 | 
 | ||||||
| #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3736_DRIVER_COUNT 1 | #define IS31FL3736_DRIVER_COUNT 1 | ||||||
| #define LED_MATRIX_LED_COUNT 96 | #define IS31FL3736_LED_COUNT 96 | ||||||
|  | |||||||
| @ -64,4 +64,4 @@ | |||||||
| 
 | 
 | ||||||
| #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | ||||||
| #define IS31FL3736_DRIVER_COUNT 1 | #define IS31FL3736_DRIVER_COUNT 1 | ||||||
| #define LED_MATRIX_LED_COUNT 96 | #define IS31FL3736_LED_COUNT 96 | ||||||
|  | |||||||
| @ -50,7 +50,7 @@ backlight_config g_config = { | |||||||
|     .color_1 = MONO_BACKLIGHT_COLOR_1, |     .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_1}, | ||||||
|     {0, A_2}, |     {0, A_2}, | ||||||
|     {0, A_3}, |     {0, A_3}, | ||||||
| @ -170,14 +170,7 @@ uint32_t g_any_key_hit = 0; | |||||||
| 
 | 
 | ||||||
| void backlight_init_drivers(void) | void backlight_init_drivers(void) | ||||||
| { | { | ||||||
|     // Initialize I2C
 |     is31fl3736_init_drivers(); | ||||||
|     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 ); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void backlight_set_key_hit(uint8_t row, uint8_t column) | void backlight_set_key_hit(uint8_t row, uint8_t column) | ||||||
|  | |||||||
| @ -157,7 +157,7 @@ uint32_t g_any_key_hit = 0; | |||||||
| #if defined(RGB_BACKLIGHT_HS60) | #if defined(RGB_BACKLIGHT_HS60) | ||||||
| #define ISSI_ADDR_1 IS31FL3733_I2C_ADDRESS_GND_GND | #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
 | /* Refer to IS31 manual for these locations
 | ||||||
|  *   driver |  *   driver | ||||||
|  *   |  R location |  *   |  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_1 IS31FL3733_I2C_ADDRESS_GND_GND | ||||||
| #define ISSI_ADDR_2 IS31FL3733_I2C_ADDRESS_GND_SDA | #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
 | /* Refer to IS31 manual for these locations
 | ||||||
|  *   driver |  *   driver | ||||||
|  *   |  R location |  *   |  R location | ||||||
| @ -375,7 +375,7 @@ const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = { | |||||||
| #elif defined(RGB_BACKLIGHT_NEBULA12) | #elif defined(RGB_BACKLIGHT_NEBULA12) | ||||||
| #define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND | #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
 | /* Refer to IS31 manual for these locations
 | ||||||
|  *   driver |  *   driver | ||||||
|  *   |  R location |  *   |  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_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define ISSI_ADDR_3 IS31FL3731_I2C_ADDRESS_SCL | #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
 | /* Refer to IS31 manual for these locations
 | ||||||
|  *   driver |  *   driver | ||||||
|  *   |  R location |  *   |  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_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA | #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
 | /* Refer to IS31 manual for these locations
 | ||||||
|  *   driver |  *   driver | ||||||
|  *   |  R location |  *   |  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_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_VCC | #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
 | /* Refer to IS31 manual for these locations
 | ||||||
|  *   driver |  *   driver | ||||||
|  *   |   R location |  *   |   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_1 IS31FL3741_I2C_ADDRESS_GND | ||||||
| #define ISSI_ADDR_2 | #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
 | /* Refer to IS31 manual for these locations
 | ||||||
|  *   driver |  *   driver | ||||||
|  *   |   R location |  *   |   R location | ||||||
| @ -817,7 +817,7 @@ const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = { | |||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #elif defined(RGB_BACKLIGHT_M6_B) | #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}, |     {OUT1,  OUT2,  OUT3}, | ||||||
|     {OUT4,  OUT5,  OUT6}, |     {OUT4,  OUT5,  OUT6}, | ||||||
|     {OUT7,  OUT8,  OUT9}, |     {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_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define ISSI_ADDR_2 | #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_9,  C3_10, C4_10}, // LB1
 | ||||||
|     {0, C1_10, C2_10, C4_11}, // LB2
 |     {0, C1_10, C2_10, C4_11}, // LB2
 | ||||||
|     {0, C1_11, C2_11, C3_11}, // LB3
 |     {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_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA | #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
 | /* Refer to IS31 manual for these locations
 | ||||||
|  *   driver |  *   driver | ||||||
|  *   |  R location |  *   |  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 ); |         is31fl3733_set_color( index, red, green, blue ); | ||||||
|     } |     } | ||||||
| #elif defined(RGB_BACKLIGHT_DAWN60) | #elif defined(RGB_BACKLIGHT_DAWN60) | ||||||
|     if( index < RGB_MATRIX_LED_COUNT ) { |     if( index < IS31FL3731_LED_COUNT ) { | ||||||
|         is31fl3731_set_color( index, red, green, blue ); |         is31fl3731_set_color( index, red, green, blue ); | ||||||
|     } else { |     } else { | ||||||
|         g_ws2812_leds[index - RGB_MATRIX_LED_COUNT].r = red; |         g_ws2812_leds[index - IS31FL3731_LED_COUNT].r = red; | ||||||
|         g_ws2812_leds[index - RGB_MATRIX_LED_COUNT].g = green; |         g_ws2812_leds[index - IS31FL3731_LED_COUNT].g = green; | ||||||
|         g_ws2812_leds[index - RGB_MATRIX_LED_COUNT].b = blue; |         g_ws2812_leds[index - IS31FL3731_LED_COUNT].b = blue; | ||||||
|         ws2812_setleds(g_ws2812_leds, WS2812_LED_TOTAL); |         ws2812_setleds(g_ws2812_leds, WS2812_LED_TOTAL); | ||||||
|     } |     } | ||||||
| #else | #else | ||||||
| @ -2111,9 +2111,9 @@ void backlight_effect_alphas_mods(void) | |||||||
|     for (int i = 0; i < WS2812_LED_TOTAL; i++) { |     for (int i = 0; i < WS2812_LED_TOTAL; i++) { | ||||||
|         if ((RGB_UNDERGLOW_ALPHA_TOP_START <= i && i <= RGB_UNDERGLOW_ALPHA_TOP_END) || |         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)) { |             (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 { |         } 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 | #endif | ||||||
| @ -2902,7 +2902,7 @@ void backlight_init_drivers(void) | |||||||
| #if defined(RGB_BACKLIGHT_M6_B) | #if defined(RGB_BACKLIGHT_M6_B) | ||||||
|     is31fl3218_init(); |     is31fl3218_init(); | ||||||
| 
 | 
 | ||||||
|     for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ ) |     for ( int index = 0; index < IS31FL3218_LED_COUNT; index++ ) | ||||||
|     { |     { | ||||||
|         bool enabled = true; |         bool enabled = true; | ||||||
| 
 | 
 | ||||||
| @ -2913,9 +2913,9 @@ void backlight_init_drivers(void) | |||||||
|     // This actually updates the LED drivers
 |     // This actually updates the LED drivers
 | ||||||
|     is31fl3218_update_led_control_registers(); |     is31fl3218_update_led_control_registers(); | ||||||
| #elif defined(RGB_BACKLIGHT_HS60) | #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) | #if defined(HS60_ANSI) | ||||||
|         bool enabled = !( ( index == 48-1 ) || //LA48
 |         bool enabled = !( ( index == 48-1 ) || //LA48
 | ||||||
| @ -2934,10 +2934,10 @@ void backlight_init_drivers(void) | |||||||
|     // This actually updates the LED drivers
 |     // This actually updates the LED drivers
 | ||||||
|     is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 ); |     is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 ); | ||||||
| #elif defined(RGB_BACKLIGHT_NK65) | #elif defined(RGB_BACKLIGHT_NK65) | ||||||
|     is31fl3733_init( ISSI_ADDR_1, 0 ); |     is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE ); | ||||||
|     is31fl3733_init( ISSI_ADDR_2, 0 ); |     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
 |         bool enabled = !( ( index == 61-1 )   || //LA61
 | ||||||
|                           ( index > 6+64-1 ) ); //LB7-LB64
 |                           ( 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_1, 0 ); | ||||||
|     is31fl3733_update_led_control_registers( ISSI_ADDR_2, 1 ); |     is31fl3733_update_led_control_registers( ISSI_ADDR_2, 1 ); | ||||||
| #elif defined(RGB_BACKLIGHT_NK87) | #elif defined(RGB_BACKLIGHT_NK87) | ||||||
|     is31fl3733_init( ISSI_ADDR_1, 0 ); |     is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE ); | ||||||
|     is31fl3733_init( ISSI_ADDR_2, 0 ); |     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
 |         bool enabled = !( ( index == 61-1 )   || //LA61
 | ||||||
|                           ( (index >= 2+64-1) && (index <= 4+64-1) ) || |                           ( (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_1, 0 ); | ||||||
|     is31fl3733_update_led_control_registers( ISSI_ADDR_2, 1 ); |     is31fl3733_update_led_control_registers( ISSI_ADDR_2, 1 ); | ||||||
| #elif defined(RGB_BACKLIGHT_NEBULA68) | #elif defined(RGB_BACKLIGHT_NEBULA68) | ||||||
|     is31fl3733_init( ISSI_ADDR_1, 0 ); |     is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE ); | ||||||
|     is31fl3733_init( ISSI_ADDR_2, 0 ); |     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
 |         bool enabled = !( ( index == 61-1 )   || //LA61
 | ||||||
|                           ( index > 5+64-1 ) ); //LB6-LB64
 |                           ( index > 5+64-1 ) ); //LB6-LB64
 | ||||||
| @ -2995,17 +2995,17 @@ void backlight_init_drivers(void) | |||||||
| #elif defined(RGB_BACKLIGHT_PORTICO75) | #elif defined(RGB_BACKLIGHT_PORTICO75) | ||||||
|     is31fl3741_init( ISSI_ADDR_1 ); |     is31fl3741_init( ISSI_ADDR_1 ); | ||||||
| 	bool enabled = true; | 	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 ); |         is31fl3741_set_led_control_register( index, enabled, enabled, enabled ); | ||||||
|     } |     } | ||||||
|     // This actually updates the LED drivers
 |     // This actually updates the LED drivers
 | ||||||
|     is31fl3741_update_led_control_registers( ISSI_ADDR_1, 0 ); |     is31fl3741_update_led_control_registers( ISSI_ADDR_1, 0 ); | ||||||
| #elif defined(RGB_BACKLIGHT_KW_MEGA) | #elif defined(RGB_BACKLIGHT_KW_MEGA) | ||||||
|     is31fl3733_init( ISSI_ADDR_1, 0 ); |     is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE ); | ||||||
|     is31fl3733_init( ISSI_ADDR_2, 0 ); |     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
 |         bool enabled = !( ( index == 61-1 )   || //LA61
 | ||||||
|                           ( index > 6+64-1 ) ); //LB7-LB64
 |                           ( index > 6+64-1 ) ); //LB7-LB64
 | ||||||
| @ -3032,7 +3032,7 @@ void backlight_init_drivers(void) | |||||||
|     bool disable_spacebar_stab_leds = false; |     bool disable_spacebar_stab_leds = false; | ||||||
| #endif | #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
 |         // OR the possible "disabled" cases together, then NOT the result to get the enabled state
 | ||||||
|         // LC6 LD13 not present on Zeal65
 |         // LC6 LD13 not present on Zeal65
 | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #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
 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
 | ||||||
| #define LOCKING_SUPPORT_ENABLE | #define LOCKING_SUPPORT_ENABLE | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #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
 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
 | ||||||
| #define LOCKING_SUPPORT_ENABLE | #define LOCKING_SUPPORT_ENABLE | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ | |||||||
| #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | ||||||
| #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | ||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #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
 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
 | ||||||
| #define LOCKING_SUPPORT_ENABLE | #define LOCKING_SUPPORT_ENABLE | ||||||
|  | |||||||
| @ -30,8 +30,8 @@ | |||||||
| #define IS31FL3731_DRIVER_COUNT 2 | #define IS31FL3731_DRIVER_COUNT 2 | ||||||
| #define DRIVER_1_LED_TOTAL 32 | #define DRIVER_1_LED_TOTAL 32 | ||||||
| #define DRIVER_2_LED_TOTAL 32 | #define DRIVER_2_LED_TOTAL 32 | ||||||
| #define ISSI_DRIVER_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | #define IS31FL3731_LED_COUNT (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 RGB_MATRIX_LED_COUNT (IS31FL3731_LED_COUNT + WS2812_LED_TOTAL) | ||||||
| 
 | 
 | ||||||
| #define RGB_MATRIX_DEFAULT_VAL 80 | #define RGB_MATRIX_DEFAULT_VAL 80 | ||||||
| #define RGB_MATRIX_KEYPRESSES | #define RGB_MATRIX_KEYPRESSES | ||||||
|  | |||||||
| @ -25,7 +25,7 @@ | |||||||
| #ifdef RGB_MATRIX_ENABLE | #ifdef RGB_MATRIX_ENABLE | ||||||
| rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL]; | 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
 | /* Refer to IS31 manual for these locations
 | ||||||
|  *   driver |  *   driver | ||||||
|  *   |  R location |  *   |  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_14,  C8_14,  C7_14}, //D14
 | ||||||
|     {1, C9_15,  C8_15,  C6_14}, //D15
 |     {1, C9_15,  C8_15,  C6_14}, //D15
 | ||||||
|     {1, C9_16,  C7_15,  C6_15}, //D16
 |     {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)) | __attribute__ ((weak)) | ||||||
| @ -169,7 +147,7 @@ static void init(void) { | |||||||
|     i2c_init(); |     i2c_init(); | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); |     is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); |     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; |         bool enabled = true; | ||||||
|         is31fl3731_set_led_control_register(index, enabled, enabled, enabled); |         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) { | 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); |         is31fl3731_set_color(index, red, green, blue); | ||||||
|     } else { |     } else { | ||||||
|         rgb_matrix_ws2812_array[index - ISSI_DRIVER_TOTAL].r = red; |         rgb_matrix_ws2812_array[index - IS31FL3731_LED_COUNT].r = red; | ||||||
|         rgb_matrix_ws2812_array[index - ISSI_DRIVER_TOTAL].g = green; |         rgb_matrix_ws2812_array[index - IS31FL3731_LED_COUNT].g = green; | ||||||
|         rgb_matrix_ws2812_array[index - ISSI_DRIVER_TOTAL].b = blue; |         rgb_matrix_ws2812_array[index - IS31FL3731_LED_COUNT].b = blue; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -41,8 +41,7 @@ | |||||||
| 
 | 
 | ||||||
| #define IS31FL3741_DRIVER_COUNT 1 | #define IS31FL3741_DRIVER_COUNT 1 | ||||||
| #define DRIVER_1_LED_TOTAL 117 | #define DRIVER_1_LED_TOTAL 117 | ||||||
| #define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL | #define IS31FL3741_LED_COUNT DRIVER_1_LED_TOTAL | ||||||
| #define ISSI_DRIVER_TOTAL RGB_MATRIX_LED_COUNT |  | ||||||
| 
 | 
 | ||||||
| #define RGB_MATRIX_DEFAULT_VAL 80 | #define RGB_MATRIX_DEFAULT_VAL 80 | ||||||
| #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | ||||||
|  | |||||||
| @ -22,7 +22,7 @@ void matrix_io_delay(void) { __asm__ volatile("nop\nnop\nnop\n"); } | |||||||
| #ifdef RGB_MATRIX_ENABLE | #ifdef RGB_MATRIX_ENABLE | ||||||
| #include "i2c_master.h" | #include "i2c_master.h" | ||||||
| #include "drivers/led/issi/is31fl3741.h" | #include "drivers/led/issi/is31fl3741.h" | ||||||
| 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
 | /* Refer to IS31 manual for these locations
 | ||||||
|  *   driver |  *   driver | ||||||
|  *   |  R location |  *   |  R location | ||||||
| @ -189,7 +189,7 @@ led_config_t g_led_config = { { | |||||||
| static void init(void) { | static void init(void) { | ||||||
|     i2c_init(); |     i2c_init(); | ||||||
|     is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); |     is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); | ||||||
|     for (int index = 0; index < ISSI_DRIVER_TOTAL; index++) { |     for (int index = 0; index < IS31FL3741_LED_COUNT; index++) { | ||||||
|         bool enabled = !(   ( index == -1+0+13) || //A13
 |         bool enabled = !(   ( index == -1+0+13) || //A13
 | ||||||
|                             ( index == -1+13+3) || //B3
 |                             ( index == -1+13+3) || //B3
 | ||||||
|                             ( index == -1+13+13) || //B13
 |                             ( index == -1+13+13) || //B13
 | ||||||
|  | |||||||
| @ -41,8 +41,7 @@ | |||||||
| 
 | 
 | ||||||
| #define IS31FL3741_DRIVER_COUNT 1 | #define IS31FL3741_DRIVER_COUNT 1 | ||||||
| #define DRIVER_1_LED_TOTAL 117 | #define DRIVER_1_LED_TOTAL 117 | ||||||
| #define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL | #define IS31FL3741_LED_COUNT DRIVER_1_LED_TOTAL | ||||||
| #define ISSI_DRIVER_TOTAL RGB_MATRIX_LED_COUNT |  | ||||||
| 
 | 
 | ||||||
| #define RGB_MATRIX_DEFAULT_VAL 80 | #define RGB_MATRIX_DEFAULT_VAL 80 | ||||||
| #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | ||||||
|  | |||||||
| @ -22,7 +22,7 @@ void matrix_io_delay(void) { __asm__ volatile("nop\nnop\nnop\n"); } | |||||||
| #ifdef RGB_MATRIX_ENABLE | #ifdef RGB_MATRIX_ENABLE | ||||||
| #include "i2c_master.h" | #include "i2c_master.h" | ||||||
| #include "drivers/led/issi/is31fl3741.h" | #include "drivers/led/issi/is31fl3741.h" | ||||||
| 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
 | /* Refer to IS31 manual for these locations
 | ||||||
|  *   driver |  *   driver | ||||||
|  *   |  R location |  *   |  R location | ||||||
| @ -195,7 +195,7 @@ led_config_t g_led_config = { { | |||||||
| static void init(void) { | static void init(void) { | ||||||
|     i2c_init(); |     i2c_init(); | ||||||
|     is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); |     is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); | ||||||
|     for (int index = 0; index < ISSI_DRIVER_TOTAL; index++) { |     for (int index = 0; index < IS31FL3741_LED_COUNT; index++) { | ||||||
|         bool enabled = !(   ( index == -1+0+13) || //A13
 |         bool enabled = !(   ( index == -1+0+13) || //A13
 | ||||||
|                             ( index == -1+13+3) || //B3
 |                             ( index == -1+13+3) || //B3
 | ||||||
|                             ( index == -1+13+13) || //B13
 |                             ( index == -1+13+13) || //B13
 | ||||||
|  | |||||||
| @ -25,290 +25,68 @@ | |||||||
|  * in their own files. |  * in their own files. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #if defined(LED_MATRIX_IS31FL3218) || defined(LED_MATRIX_IS31FL3731) || defined(LED_MATRIX_IS31FL3733) || defined(LED_MATRIX_IS31FL3736) || defined(LED_MATRIX_IS31FL3737) || defined(LED_MATRIX_IS31FL3741) || defined(IS31FLCOMMON) || defined(LED_MATRIX_SNLED27351) | #if defined(LED_MATRIX_IS31FL3218) | ||||||
| #    include "i2c_master.h" |  | ||||||
| 
 |  | ||||||
| static void init(void) { |  | ||||||
|     i2c_init(); |  | ||||||
| 
 |  | ||||||
| #    if defined(LED_MATRIX_IS31FL3218) |  | ||||||
|     is31fl3218_init(); |  | ||||||
| 
 |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3731) |  | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); |  | ||||||
| #        if defined(IS31FL3731_I2C_ADDRESS_2) |  | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); |  | ||||||
| #            if defined(IS31FL3731_I2C_ADDRESS_3) |  | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_3); |  | ||||||
| #                if defined(IS31FL3731_I2C_ADDRESS_4) |  | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3733) |  | ||||||
| #        if !defined(IS31FL3733_SYNC_1) |  | ||||||
| #            define IS31FL3733_SYNC_1 0 |  | ||||||
| #        endif |  | ||||||
|     is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1); |  | ||||||
| #        if defined(IS31FL3733_I2C_ADDRESS_2) |  | ||||||
| #            if !defined(IS31FL3733_SYNC_2) |  | ||||||
| #                define IS31FL3733_SYNC_2 0 |  | ||||||
| #            endif |  | ||||||
|     is31fl3733_init(IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_2); |  | ||||||
| #            if defined(IS31FL3733_I2C_ADDRESS_3) |  | ||||||
| #                if !defined(IS31FL3733_SYNC_3) |  | ||||||
| #                    define IS31FL3733_SYNC_3 0 |  | ||||||
| #                endif |  | ||||||
|     is31fl3733_init(IS31FL3733_I2C_ADDRESS_3, IS31FL3733_SYNC_3); |  | ||||||
| #                if defined(IS31FL3733_I2C_ADDRESS_4) |  | ||||||
| #                    if !defined(IS31FL3733_SYNC_4) |  | ||||||
| #                        define IS31FL3733_SYNC_4 0 |  | ||||||
| #                    endif |  | ||||||
|     is31fl3733_init(IS31FL3733_I2C_ADDRESS_4, IS31FL3733_SYNC_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3736) |  | ||||||
|     is31fl3736_init(IS31FL3736_I2C_ADDRESS_1); |  | ||||||
| #        if defined(IS31FL3736_I2C_ADDRESS_2) |  | ||||||
|     is31fl3736_init(IS31FL3736_I2C_ADDRESS_2); |  | ||||||
| #            if defined(IS31FL3736_I2C_ADDRESS_3) |  | ||||||
|     is31fl3736_init(IS31FL3736_I2C_ADDRESS_3); |  | ||||||
| #                if defined(IS31FL3736_I2C_ADDRESS_4) |  | ||||||
|     is31fl3736_init(IS31FL3736_I2C_ADDRESS_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3737) |  | ||||||
|     is31fl3737_init(IS31FL3737_I2C_ADDRESS_1); |  | ||||||
| #        if defined(IS31FL3737_I2C_ADDRESS_2) |  | ||||||
|     is31fl3737_init(IS31FL3737_I2C_ADDRESS_2); |  | ||||||
| #            if defined(IS31FL3737_I2C_ADDRESS_3) |  | ||||||
|     is31fl3737_init(IS31FL3737_I2C_ADDRESS_3); |  | ||||||
| #                if defined(IS31FL3737_I2C_ADDRESS_4) |  | ||||||
|     is31fl3737_init(IS31FL3737_I2C_ADDRESS_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3741) |  | ||||||
|     is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); |  | ||||||
| #        if defined(IS31FL3741_I2C_ADDRESS_2) |  | ||||||
|     is31fl3741_init(IS31FL3741_I2C_ADDRESS_2); |  | ||||||
| #            if defined(IS31FL3741_I2C_ADDRESS_3) |  | ||||||
|     is31fl3741_init(IS31FL3741_I2C_ADDRESS_3); |  | ||||||
| #                if defined(IS31FL3741_I2C_ADDRESS_4) |  | ||||||
|     is31fl3741_init(IS31FL3741_I2C_ADDRESS_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(IS31FLCOMMON) |  | ||||||
|     IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1); |  | ||||||
| #        if defined(LED_DRIVER_ADDR_2) |  | ||||||
|     IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2); |  | ||||||
| #            if defined(LED_DRIVER_ADDR_3) |  | ||||||
|     IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3); |  | ||||||
| #                if defined(LED_DRIVER_ADDR_4) |  | ||||||
|     IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| #    elif defined(LED_MATRIX_SNLED27351) |  | ||||||
| #        if defined(LED_DRIVER_SHUTDOWN_PIN) |  | ||||||
|     setPinOutput(LED_DRIVER_SHUTDOWN_PIN); |  | ||||||
|     writePinHigh(LED_DRIVER_SHUTDOWN_PIN); |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
|     snled27351_init(SNLED27351_I2C_ADDRESS_1); |  | ||||||
| #        if defined(SNLED27351_I2C_ADDRESS_2) |  | ||||||
|     snled27351_init(SNLED27351_I2C_ADDRESS_2); |  | ||||||
| #            if defined(SNLED27351_I2C_ADDRESS_3) |  | ||||||
|     snled27351_init(SNLED27351_I2C_ADDRESS_3); |  | ||||||
| #                if defined(SNLED27351_I2C_ADDRESS_4) |  | ||||||
|     snled27351_init(SNLED27351_I2C_ADDRESS_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| #    endif |  | ||||||
| 
 |  | ||||||
|     for (int index = 0; index < LED_MATRIX_LED_COUNT; index++) { |  | ||||||
| #    if defined(LED_MATRIX_IS31FL3218) |  | ||||||
|         is31fl3218_set_led_control_register(index, true); |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3731) |  | ||||||
|         is31fl3731_set_led_control_register(index, true); |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3733) |  | ||||||
|         is31fl3733_set_led_control_register(index, true); |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3736) |  | ||||||
|         is31fl3736_set_led_control_register(index, true); |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3737) |  | ||||||
|         is31fl3737_set_led_control_register(index, true); |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3741) |  | ||||||
|         is31fl3741_set_led_control_register(index, true); |  | ||||||
| #    elif defined(IS31FLCOMMON) |  | ||||||
|         IS31FL_simple_set_scaling_buffer(index, true); |  | ||||||
| #    elif defined(LED_MATRIX_SNLED27351) |  | ||||||
|         snled27351_set_led_control_register(index, true); |  | ||||||
| #    endif |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| // This actually updates the LED drivers
 |  | ||||||
| #    if defined(LED_MATRIX_IS31FL3218) |  | ||||||
|     is31fl3218_update_led_control_registers(); |  | ||||||
| 
 |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3731) |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); |  | ||||||
| #        if defined(IS31FL3731_I2C_ADDRESS_2) |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1); |  | ||||||
| #            if defined(IS31FL3731_I2C_ADDRESS_3) |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_3, 2); |  | ||||||
| #                if defined(IS31FL3731_I2C_ADDRESS_4) |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3733) |  | ||||||
|     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0); |  | ||||||
| #        if defined(IS31FL3733_I2C_ADDRESS_2) |  | ||||||
|     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1); |  | ||||||
| #            if defined(IS31FL3733_I2C_ADDRESS_3) |  | ||||||
|     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_3, 2); |  | ||||||
| #                if defined(IS31FL3733_I2C_ADDRESS_4) |  | ||||||
|     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3736) |  | ||||||
|     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_1, 0); |  | ||||||
| #        if defined(IS31FL3736_I2C_ADDRESS_2) |  | ||||||
|     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_2, 1); |  | ||||||
| #            if defined(IS31FL3736_I2C_ADDRESS_3) |  | ||||||
|     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_3, 2); |  | ||||||
| #                if defined(IS31FL3736_I2C_ADDRESS_4) |  | ||||||
|     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3737) |  | ||||||
|     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_1, 0); |  | ||||||
| #        if defined(IS31FL3737_I2C_ADDRESS_2) |  | ||||||
|     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_2, 1); |  | ||||||
| #            if defined(IS31FL3737_I2C_ADDRESS_3) |  | ||||||
|     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_3, 2); |  | ||||||
| #                if defined(IS31FL3737_I2C_ADDRESS_4) |  | ||||||
|     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(LED_MATRIX_IS31FL3741) |  | ||||||
|     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_1, 0); |  | ||||||
| #        if defined(IS31FL3741_I2C_ADDRESS_2) |  | ||||||
|     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_2, 1); |  | ||||||
| #            if defined(IS31FL3741_I2C_ADDRESS_3) |  | ||||||
|     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_3, 2); |  | ||||||
| #                if defined(IS31FL3741_I2C_ADDRESS_4) |  | ||||||
|     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(IS31FLCOMMON) |  | ||||||
| #        ifdef ISSI_MANUAL_SCALING |  | ||||||
|     IS31FL_set_manual_scaling_buffer(); |  | ||||||
| #        endif |  | ||||||
|     IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0); |  | ||||||
| #        if defined(LED_DRIVER_ADDR_2) |  | ||||||
|     IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1); |  | ||||||
| #            if defined(LED_DRIVER_ADDR_3) |  | ||||||
|     IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2); |  | ||||||
| #                if defined(LED_DRIVER_ADDR_4) |  | ||||||
|     IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(LED_MATRIX_SNLED27351) |  | ||||||
|     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_1, 0); |  | ||||||
| #        if defined(SNLED27351_I2C_ADDRESS_2) |  | ||||||
|     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_2, 1); |  | ||||||
| #            if defined(SNLED27351_I2C_ADDRESS_3) |  | ||||||
|     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_3, 2); |  | ||||||
| #                if defined(SNLED27351_I2C_ADDRESS_4) |  | ||||||
|     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| #    endif |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #    if defined(LED_MATRIX_IS31FL3218) |  | ||||||
| const led_matrix_driver_t led_matrix_driver = { | const led_matrix_driver_t led_matrix_driver = { | ||||||
|     .init          = init, |     .init          = is31fl3218_init, | ||||||
|     .flush         = is31fl3218_update_pwm_buffers, |     .flush         = is31fl3218_update_pwm_buffers, | ||||||
|     .set_value     = is31fl3218_set_value, |     .set_value     = is31fl3218_set_value, | ||||||
|     .set_value_all = is31fl3218_set_value_all, |     .set_value_all = is31fl3218_set_value_all, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #    elif defined(LED_MATRIX_IS31FL3731) | #elif defined(LED_MATRIX_IS31FL3731) | ||||||
| const led_matrix_driver_t led_matrix_driver = { | const led_matrix_driver_t led_matrix_driver = { | ||||||
|     .init = init, |     .init          = is31fl3731_init_drivers, | ||||||
|     .flush = is31fl3731_flush, |     .flush         = is31fl3731_flush, | ||||||
|     .set_value = is31fl3731_set_value, |     .set_value     = is31fl3731_set_value, | ||||||
|     .set_value_all = is31fl3731_set_value_all, |     .set_value_all = is31fl3731_set_value_all, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #    elif defined(LED_MATRIX_IS31FL3733) | #elif defined(LED_MATRIX_IS31FL3733) | ||||||
| const led_matrix_driver_t led_matrix_driver = { | const led_matrix_driver_t led_matrix_driver = { | ||||||
|     .init = init, |     .init          = is31fl3733_init_drivers, | ||||||
|     .flush = is31fl3733_flush, |     .flush         = is31fl3733_flush, | ||||||
|     .set_value = is31fl3733_set_value, |     .set_value     = is31fl3733_set_value, | ||||||
|     .set_value_all = is31fl3733_set_value_all, |     .set_value_all = is31fl3733_set_value_all, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #    elif defined(LED_MATRIX_IS31FL3736) | #elif defined(LED_MATRIX_IS31FL3736) | ||||||
| const led_matrix_driver_t led_matrix_driver = { | const led_matrix_driver_t led_matrix_driver = { | ||||||
|     .init = init, |     .init          = is31fl3736_init_drivers, | ||||||
|     .flush = is31fl3736_flush, |     .flush         = is31fl3736_flush, | ||||||
|     .set_value = is31fl3736_set_value, |     .set_value     = is31fl3736_set_value, | ||||||
|     .set_value_all = is31fl3736_set_value_all, |     .set_value_all = is31fl3736_set_value_all, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #    elif defined(LED_MATRIX_IS31FL3737) | #elif defined(LED_MATRIX_IS31FL3737) | ||||||
| const led_matrix_driver_t led_matrix_driver = { | const led_matrix_driver_t led_matrix_driver = { | ||||||
|     .init = init, |     .init          = is31fl3737_init_drivers, | ||||||
|     .flush = is31fl3737_flush, |     .flush         = is31fl3737_flush, | ||||||
|     .set_value = is31fl3737_set_value, |     .set_value     = is31fl3737_set_value, | ||||||
|     .set_value_all = is31fl3737_set_value_all, |     .set_value_all = is31fl3737_set_value_all, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #    elif defined(LED_MATRIX_IS31FL3741) | #elif defined(LED_MATRIX_IS31FL3741) | ||||||
| const led_matrix_driver_t led_matrix_driver = { | const led_matrix_driver_t led_matrix_driver = { | ||||||
|     .init = init, |     .init          = is31fl3741_init_drivers, | ||||||
|     .flush = is31fl3741_flush, |     .flush         = is31fl3741_flush, | ||||||
|     .set_value = is31fl3741_set_value, |     .set_value     = is31fl3741_set_value, | ||||||
|     .set_value_all = is31fl3741_set_value_all, |     .set_value_all = is31fl3741_set_value_all, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #    elif defined(IS31FLCOMMON) | #elif defined(IS31FLCOMMON) | ||||||
| const led_matrix_driver_t led_matrix_driver = { | const led_matrix_driver_t led_matrix_driver = { | ||||||
|     .init = init, |     .init          = IS31FL_simple_init_drivers, | ||||||
|     .flush = IS31FL_common_flush, |     .flush         = IS31FL_common_flush, | ||||||
|     .set_value = IS31FL_simple_set_brightness, |     .set_value     = IS31FL_simple_set_brightness, | ||||||
|     .set_value_all = IS31FL_simple_set_brigntness_all, |     .set_value_all = IS31FL_simple_set_brigntness_all, | ||||||
| }; | }; | ||||||
| #    elif defined(LED_MATRIX_SNLED27351) | 
 | ||||||
|  | #elif defined(LED_MATRIX_SNLED27351) | ||||||
| const led_matrix_driver_t led_matrix_driver = { | const led_matrix_driver_t led_matrix_driver = { | ||||||
|     .init = init, |     .init          = snled27351_init_drivers, | ||||||
|     .flush = snled27351_flush, |     .flush         = snled27351_flush, | ||||||
|     .set_value = snled27351_set_value, |     .set_value     = snled27351_set_value, | ||||||
|     .set_value_all = snled27351_set_value_all, |     .set_value_all = snled27351_set_value_all, | ||||||
| }; | }; | ||||||
| #    endif | 
 | ||||||
| #endif | #endif | ||||||
|  | |||||||
| @ -24,307 +24,73 @@ | |||||||
|  * be here if shared between boards. |  * be here if shared between boards. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #if defined(RGB_MATRIX_IS31FL3218) || defined(RGB_MATRIX_IS31FL3731) || defined(RGB_MATRIX_IS31FL3733) || defined(RGB_MATRIX_IS31FL3736) || defined(RGB_MATRIX_IS31FL3737) || defined(RGB_MATRIX_IS31FL3741) || defined(IS31FLCOMMON) || defined(RGB_MATRIX_SNLED27351) | #if defined(RGB_MATRIX_IS31FL3218) | ||||||
| #    include "i2c_master.h" |  | ||||||
| 
 |  | ||||||
| static void init(void) { |  | ||||||
|     i2c_init(); |  | ||||||
| 
 |  | ||||||
| #    if defined(RGB_MATRIX_IS31FL3218) |  | ||||||
|     is31fl3218_init(); |  | ||||||
| 
 |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3731) |  | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); |  | ||||||
| #        if defined(IS31FL3731_I2C_ADDRESS_2) |  | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); |  | ||||||
| #            if defined(IS31FL3731_I2C_ADDRESS_3) |  | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_3); |  | ||||||
| #                if defined(IS31FL3731_I2C_ADDRESS_4) |  | ||||||
|     is31fl3731_init(IS31FL3731_I2C_ADDRESS_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3733) |  | ||||||
| #        if !defined(IS31FL3733_SYNC_1) |  | ||||||
| #            define IS31FL3733_SYNC_1 0 |  | ||||||
| #        endif |  | ||||||
|     is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1); |  | ||||||
| #        if defined(IS31FL3733_I2C_ADDRESS_2) |  | ||||||
| #            if !defined(IS31FL3733_SYNC_2) |  | ||||||
| #                define IS31FL3733_SYNC_2 0 |  | ||||||
| #            endif |  | ||||||
|     is31fl3733_init(IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_2); |  | ||||||
| #            if defined(IS31FL3733_I2C_ADDRESS_3) |  | ||||||
| #                if !defined(IS31FL3733_SYNC_3) |  | ||||||
| #                    define IS31FL3733_SYNC_3 0 |  | ||||||
| #                endif |  | ||||||
|     is31fl3733_init(IS31FL3733_I2C_ADDRESS_3, IS31FL3733_SYNC_3); |  | ||||||
| #                if defined(IS31FL3733_I2C_ADDRESS_4) |  | ||||||
| #                    if !defined(IS31FL3733_SYNC_4) |  | ||||||
| #                        define IS31FL3733_SYNC_4 0 |  | ||||||
| #                    endif |  | ||||||
|     is31fl3733_init(IS31FL3733_I2C_ADDRESS_4, IS31FL3733_SYNC_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3736) |  | ||||||
|     is31fl3736_init(IS31FL3736_I2C_ADDRESS_1); |  | ||||||
| #        if defined(IS31FL3736_I2C_ADDRESS_2) |  | ||||||
|     is31fl3736_init(IS31FL3736_I2C_ADDRESS_2); |  | ||||||
| #            if defined(IS31FL3736_I2C_ADDRESS_3) |  | ||||||
|     is31fl3736_init(IS31FL3736_I2C_ADDRESS_3); |  | ||||||
| #                if defined(IS31FL3736_I2C_ADDRESS_4) |  | ||||||
|     is31fl3736_init(IS31FL3736_I2C_ADDRESS_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3737) |  | ||||||
|     is31fl3737_init(IS31FL3737_I2C_ADDRESS_1); |  | ||||||
| #        if defined(IS31FL3737_I2C_ADDRESS_2) |  | ||||||
|     is31fl3737_init(IS31FL3737_I2C_ADDRESS_2); |  | ||||||
| #            if defined(IS31FL3737_I2C_ADDRESS_3) |  | ||||||
|     is31fl3737_init(IS31FL3737_I2C_ADDRESS_3); |  | ||||||
| #                if defined(IS31FL3737_I2C_ADDRESS_4) |  | ||||||
|     is31fl3737_init(IS31FL3737_I2C_ADDRESS_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3741) |  | ||||||
|     is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); |  | ||||||
| #        if defined(IS31FL3741_I2C_ADDRESS_2) |  | ||||||
|     is31fl3741_init(IS31FL3741_I2C_ADDRESS_2); |  | ||||||
| #            if defined(IS31FL3741_I2C_ADDRESS_3) |  | ||||||
|     is31fl3741_init(IS31FL3741_I2C_ADDRESS_3); |  | ||||||
| #                if defined(IS31FL3741_I2C_ADDRESS_4) |  | ||||||
|     is31fl3741_init(IS31FL3741_I2C_ADDRESS_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(IS31FLCOMMON) |  | ||||||
|     IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1); |  | ||||||
| #        if defined(DRIVER_ADDR_2) |  | ||||||
|     IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2); |  | ||||||
| #            if defined(DRIVER_ADDR_3) |  | ||||||
|     IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3); |  | ||||||
| #                if defined(DRIVER_ADDR_4) |  | ||||||
|     IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(RGB_MATRIX_SNLED27351) |  | ||||||
|     snled27351_init(SNLED27351_I2C_ADDRESS_1); |  | ||||||
| #        if defined(SNLED27351_I2C_ADDRESS_2) |  | ||||||
|     snled27351_init(SNLED27351_I2C_ADDRESS_2); |  | ||||||
| #            if defined(SNLED27351_I2C_ADDRESS_3) |  | ||||||
|     snled27351_init(SNLED27351_I2C_ADDRESS_3); |  | ||||||
| #                if defined(SNLED27351_I2C_ADDRESS_4) |  | ||||||
|     snled27351_init(SNLED27351_I2C_ADDRESS_4); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| #    endif |  | ||||||
| 
 |  | ||||||
|     for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) { |  | ||||||
|         bool enabled = true; |  | ||||||
| 
 |  | ||||||
|         // This only caches it for later
 |  | ||||||
| #    if defined(RGB_MATRIX_IS31FL3218) |  | ||||||
|         is31fl3218_set_led_control_register(index, enabled, enabled, enabled); |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3731) |  | ||||||
|         is31fl3731_set_led_control_register(index, enabled, enabled, enabled); |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3733) |  | ||||||
|         is31fl3733_set_led_control_register(index, enabled, enabled, enabled); |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3736) |  | ||||||
|         is31fl3736_set_led_control_register(index, enabled, enabled, enabled); |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3737) |  | ||||||
|         is31fl3737_set_led_control_register(index, enabled, enabled, enabled); |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3741) |  | ||||||
|         is31fl3741_set_led_control_register(index, enabled, enabled, enabled); |  | ||||||
| #    elif defined(IS31FLCOMMON) |  | ||||||
|         IS31FL_RGB_set_scaling_buffer(index, enabled, enabled, enabled); |  | ||||||
| #    elif defined(RGB_MATRIX_SNLED27351) |  | ||||||
|         snled27351_set_led_control_register(index, enabled, enabled, enabled); |  | ||||||
| #    endif |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     // This actually updates the LED drivers
 |  | ||||||
| #    if defined(RGB_MATRIX_IS31FL3218) |  | ||||||
|     is31fl3218_update_led_control_registers(); |  | ||||||
| 
 |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3731) |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); |  | ||||||
| #        if defined(IS31FL3731_I2C_ADDRESS_2) |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1); |  | ||||||
| #            if defined(IS31FL3731_I2C_ADDRESS_3) |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_3, 2); |  | ||||||
| #                if defined(IS31FL3731_I2C_ADDRESS_4) |  | ||||||
|     is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3733) |  | ||||||
|     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0); |  | ||||||
| #        if defined(IS31FL3733_I2C_ADDRESS_2) |  | ||||||
|     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1); |  | ||||||
| #            if defined(IS31FL3733_I2C_ADDRESS_3) |  | ||||||
|     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_3, 2); |  | ||||||
| #                if defined(IS31FL3733_I2C_ADDRESS_4) |  | ||||||
|     is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3736) |  | ||||||
|     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_1, 0); |  | ||||||
| #        if defined(IS31FL3736_I2C_ADDRESS_2) |  | ||||||
|     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_2, 1); |  | ||||||
| #            if defined(IS31FL3736_I2C_ADDRESS_3) |  | ||||||
|     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_3, 2); |  | ||||||
| #                if defined(IS31FL3736_I2C_ADDRESS_4) |  | ||||||
|     is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3737) |  | ||||||
|     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_1, 0); |  | ||||||
| #        if defined(IS31FL3737_I2C_ADDRESS_2) |  | ||||||
|     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_2, 1); |  | ||||||
| #            if defined(IS31FL3737_I2C_ADDRESS_3) |  | ||||||
|     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_3, 2); |  | ||||||
| #                if defined(IS31FL3737_I2C_ADDRESS_4) |  | ||||||
|     is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3741) |  | ||||||
|     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_1, 0); |  | ||||||
| #        if defined(IS31FL3741_I2C_ADDRESS_2) |  | ||||||
|     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_2, 1); |  | ||||||
| #            if defined(IS31FL3741_I2C_ADDRESS_3) |  | ||||||
|     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_3, 2); |  | ||||||
| #                if defined(IS31FL3741_I2C_ADDRESS_4) |  | ||||||
|     is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(IS31FLCOMMON) |  | ||||||
| #        ifdef ISSI_MANUAL_SCALING |  | ||||||
|     IS31FL_set_manual_scaling_buffer(); |  | ||||||
| #        endif |  | ||||||
|     IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0); |  | ||||||
| #        if defined(DRIVER_ADDR_2) |  | ||||||
|     IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1); |  | ||||||
| #            if defined(DRIVER_ADDR_3) |  | ||||||
|     IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2); |  | ||||||
| #                if defined(DRIVER_ADDR_4) |  | ||||||
|     IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| 
 |  | ||||||
| #    elif defined(RGB_MATRIX_SNLED27351) |  | ||||||
|     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_1, 0); |  | ||||||
| #        if defined(SNLED27351_I2C_ADDRESS_2) |  | ||||||
|     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_2, 1); |  | ||||||
| #            if defined(SNLED27351_I2C_ADDRESS_3) |  | ||||||
|     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_3, 2); |  | ||||||
| #                if defined(SNLED27351_I2C_ADDRESS_4) |  | ||||||
|     snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_4, 3); |  | ||||||
| #                endif |  | ||||||
| #            endif |  | ||||||
| #        endif |  | ||||||
| #    endif |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #    if defined(RGB_MATRIX_IS31FL3218) |  | ||||||
| const rgb_matrix_driver_t rgb_matrix_driver = { | const rgb_matrix_driver_t rgb_matrix_driver = { | ||||||
|     .init          = init, |     .init          = is31fl3218_init, | ||||||
|     .flush         = is31fl3218_update_pwm_buffers, |     .flush         = is31fl3218_update_pwm_buffers, | ||||||
|     .set_color     = is31fl3218_set_color, |     .set_color     = is31fl3218_set_color, | ||||||
|     .set_color_all = is31fl3218_set_color_all, |     .set_color_all = is31fl3218_set_color_all, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3731) | #elif defined(RGB_MATRIX_IS31FL3731) | ||||||
| const rgb_matrix_driver_t rgb_matrix_driver = { | const rgb_matrix_driver_t rgb_matrix_driver = { | ||||||
|     .init = init, |     .init          = is31fl3731_init_drivers, | ||||||
|     .flush = is31fl3731_flush, |     .flush         = is31fl3731_flush, | ||||||
|     .set_color = is31fl3731_set_color, |     .set_color     = is31fl3731_set_color, | ||||||
|     .set_color_all = is31fl3731_set_color_all, |     .set_color_all = is31fl3731_set_color_all, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3733) | #elif defined(RGB_MATRIX_IS31FL3733) | ||||||
| const rgb_matrix_driver_t rgb_matrix_driver = { | const rgb_matrix_driver_t rgb_matrix_driver = { | ||||||
|     .init = init, |     .init          = is31fl3733_init_drivers, | ||||||
|     .flush = is31fl3733_flush, |     .flush         = is31fl3733_flush, | ||||||
|     .set_color = is31fl3733_set_color, |     .set_color     = is31fl3733_set_color, | ||||||
|     .set_color_all = is31fl3733_set_color_all, |     .set_color_all = is31fl3733_set_color_all, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3736) | #elif defined(RGB_MATRIX_IS31FL3736) | ||||||
| const rgb_matrix_driver_t rgb_matrix_driver = { | const rgb_matrix_driver_t rgb_matrix_driver = { | ||||||
|     .init = init, |     .init          = is31fl3736_init_drivers, | ||||||
|     .flush = is31fl3736_flush, |     .flush         = is31fl3736_flush, | ||||||
|     .set_color = is31fl3736_set_color, |     .set_color     = is31fl3736_set_color, | ||||||
|     .set_color_all = is31fl3736_set_color_all, |     .set_color_all = is31fl3736_set_color_all, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3737) | #elif defined(RGB_MATRIX_IS31FL3737) | ||||||
| const rgb_matrix_driver_t rgb_matrix_driver = { | const rgb_matrix_driver_t rgb_matrix_driver = { | ||||||
|     .init = init, |     .init          = is31fl3737_init_drivers, | ||||||
|     .flush = is31fl3737_flush, |     .flush         = is31fl3737_flush, | ||||||
|     .set_color = is31fl3737_set_color, |     .set_color     = is31fl3737_set_color, | ||||||
|     .set_color_all = is31fl3737_set_color_all, |     .set_color_all = is31fl3737_set_color_all, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #    elif defined(RGB_MATRIX_IS31FL3741) | #elif defined(RGB_MATRIX_IS31FL3741) | ||||||
| const rgb_matrix_driver_t rgb_matrix_driver = { | const rgb_matrix_driver_t rgb_matrix_driver = { | ||||||
|     .init = init, |     .init          = is31fl3741_init_drivers, | ||||||
|     .flush = is31fl3741_flush, |     .flush         = is31fl3741_flush, | ||||||
|     .set_color = is31fl3741_set_color, |     .set_color     = is31fl3741_set_color, | ||||||
|     .set_color_all = is31fl3741_set_color_all, |     .set_color_all = is31fl3741_set_color_all, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #    elif defined(IS31FLCOMMON) | #elif defined(IS31FLCOMMON) | ||||||
| const rgb_matrix_driver_t rgb_matrix_driver = { | const rgb_matrix_driver_t rgb_matrix_driver = { | ||||||
|     .init = init, |     .init          = IS31FL_RGB_init_drivers, | ||||||
|     .flush = IS31FL_common_flush, |     .flush         = IS31FL_common_flush, | ||||||
|     .set_color = IS31FL_RGB_set_color, |     .set_color     = IS31FL_RGB_set_color, | ||||||
|     .set_color_all = IS31FL_RGB_set_color_all, |     .set_color_all = IS31FL_RGB_set_color_all, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #    elif defined(RGB_MATRIX_SNLED27351) | #elif defined(RGB_MATRIX_SNLED27351) | ||||||
| const rgb_matrix_driver_t rgb_matrix_driver = { | const rgb_matrix_driver_t rgb_matrix_driver = { | ||||||
|     .init = init, |     .init          = snled27351_init_drivers, | ||||||
|     .flush = snled27351_flush, |     .flush         = snled27351_flush, | ||||||
|     .set_color = snled27351_set_color, |     .set_color     = snled27351_set_color, | ||||||
|     .set_color_all = snled27351_set_color_all, |     .set_color_all = snled27351_set_color_all, | ||||||
| }; | }; | ||||||
| #    endif |  | ||||||
| 
 | 
 | ||||||
| #elif defined(RGB_MATRIX_AW20216S) | #elif defined(RGB_MATRIX_AW20216S) | ||||||
| #    include "spi_master.h" |  | ||||||
| 
 |  | ||||||
| static void init(void) { |  | ||||||
|     spi_init(); |  | ||||||
| 
 |  | ||||||
|     aw20216s_init(AW20216S_CS_PIN_1, AW20216S_EN_PIN_1); |  | ||||||
| #    if defined(AW20216S_CS_PIN_2) |  | ||||||
|     aw20216s_init(AW20216S_CS_PIN_2, AW20216S_EN_PIN_2); |  | ||||||
| #    endif |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const rgb_matrix_driver_t rgb_matrix_driver = { | const rgb_matrix_driver_t rgb_matrix_driver = { | ||||||
|     .init          = init, |     .init          = aw20216s_init_drivers, | ||||||
|     .flush         = aw20216s_flush, |     .flush         = aw20216s_flush, | ||||||
|     .set_color     = aw20216s_set_color, |     .set_color     = aw20216s_set_color, | ||||||
|     .set_color_all = aw20216s_set_color_all, |     .set_color_all = aw20216s_set_color_all, | ||||||
| @ -391,4 +157,5 @@ const rgb_matrix_driver_t rgb_matrix_driver = { | |||||||
|     .set_color     = setled, |     .set_color     = setled, | ||||||
|     .set_color_all = setled_all, |     .set_color_all = setled_all, | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
| #endif | #endif | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ryan
						Ryan