diff options
| author | Ryan <fauxpark@gmail.com> | 2023-11-01 11:53:45 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-01 00:53:45 +0000 |
| commit | b52aca0af83fade24c56b4bb7369f18183123bd3 (patch) | |
| tree | 9b553c4b771717cc334f3c8683052bc701472c4d | |
| parent | eac8e6788871a087eafdc5492eee425a7205d727 (diff) | |
Relocate LED driver init code (#22365)
100 files changed, 795 insertions, 798 deletions
diff --git a/drivers/led/aw20216s.c b/drivers/led/aw20216s.c index 988cb6e9f6..8f3ebec510 100644 --- a/drivers/led/aw20216s.c +++ b/drivers/led/aw20216s.c | |||
| @@ -126,6 +126,15 @@ static inline void aw20216s_auto_lowpower(pin_t cs_pin) { | |||
| 126 | aw20216s_write_register(cs_pin, AW20216S_PAGE_FUNCTION, AW20216S_REG_MIXFUNCTION, AW20216S_MIXCR_DEFAULT | AW20216S_LPEN); | 126 | aw20216s_write_register(cs_pin, AW20216S_PAGE_FUNCTION, AW20216S_REG_MIXFUNCTION, AW20216S_MIXCR_DEFAULT | AW20216S_LPEN); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | void aw20216s_init_drivers(void) { | ||
| 130 | spi_init(); | ||
| 131 | |||
| 132 | aw20216s_init(AW20216S_CS_PIN_1, AW20216S_EN_PIN_1); | ||
| 133 | #if defined(AW20216S_CS_PIN_2) | ||
| 134 | aw20216s_init(AW20216S_CS_PIN_2, AW20216S_EN_PIN_2); | ||
| 135 | #endif | ||
| 136 | } | ||
| 137 | |||
| 129 | void aw20216s_init(pin_t cs_pin, pin_t en_pin) { | 138 | void aw20216s_init(pin_t cs_pin, pin_t en_pin) { |
| 130 | setPinOutput(en_pin); | 139 | setPinOutput(en_pin); |
| 131 | writePinHigh(en_pin); | 140 | writePinHigh(en_pin); |
| @@ -155,7 +164,7 @@ void aw20216s_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | |||
| 155 | } | 164 | } |
| 156 | 165 | ||
| 157 | void aw20216s_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | 166 | void aw20216s_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { |
| 158 | for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { | 167 | for (uint8_t i = 0; i < AW20216S_LED_COUNT; i++) { |
| 159 | aw20216s_set_color(i, red, green, blue); | 168 | aw20216s_set_color(i, red, green, blue); |
| 160 | } | 169 | } |
| 161 | } | 170 | } |
diff --git a/drivers/led/aw20216s.h b/drivers/led/aw20216s.h index 4060126446..0d6bd3c189 100644 --- a/drivers/led/aw20216s.h +++ b/drivers/led/aw20216s.h | |||
| @@ -65,8 +65,9 @@ typedef struct aw20216s_led_t { | |||
| 65 | uint8_t b; | 65 | uint8_t b; |
| 66 | } aw20216s_led_t; | 66 | } aw20216s_led_t; |
| 67 | 67 | ||
| 68 | extern const aw20216s_led_t PROGMEM g_aw20216s_leds[RGB_MATRIX_LED_COUNT]; | 68 | extern const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT]; |
| 69 | 69 | ||
| 70 | void aw20216s_init_drivers(void); | ||
| 70 | void aw20216s_init(pin_t cs_pin, pin_t en_pin); | 71 | void aw20216s_init(pin_t cs_pin, pin_t en_pin); |
| 71 | void aw20216s_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); | 72 | void aw20216s_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); |
| 72 | void aw20216s_set_color_all(uint8_t red, uint8_t green, uint8_t blue); | 73 | void aw20216s_set_color_all(uint8_t red, uint8_t green, uint8_t blue); |
diff --git a/drivers/led/issi/is31fl3218-simple.c b/drivers/led/issi/is31fl3218-simple.c index a78dedfcf1..bdf3187fe1 100644 --- a/drivers/led/issi/is31fl3218-simple.c +++ b/drivers/led/issi/is31fl3218-simple.c | |||
| @@ -68,6 +68,8 @@ void is31fl3218_write_pwm_buffer(uint8_t *pwm_buffer) { | |||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | void is31fl3218_init(void) { | 70 | void is31fl3218_init(void) { |
| 71 | i2c_init(); | ||
| 72 | |||
| 71 | // In case we ever want to reinitialize (?) | 73 | // In case we ever want to reinitialize (?) |
| 72 | is31fl3218_write_register(IS31FL3218_REG_RESET, 0x00); | 74 | is31fl3218_write_register(IS31FL3218_REG_RESET, 0x00); |
| 73 | 75 | ||
| @@ -86,11 +88,17 @@ void is31fl3218_init(void) { | |||
| 86 | 88 | ||
| 87 | // Load PWM registers and LED Control register data | 89 | // Load PWM registers and LED Control register data |
| 88 | is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01); | 90 | is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01); |
| 91 | |||
| 92 | for (int i = 0; i < IS31FL3218_LED_COUNT; i++) { | ||
| 93 | is31fl3218_set_led_control_register(i, true); | ||
| 94 | } | ||
| 95 | |||
| 96 | is31fl3218_update_led_control_registers(); | ||
| 89 | } | 97 | } |
| 90 | 98 | ||
| 91 | void is31fl3218_set_value(int index, uint8_t value) { | 99 | void is31fl3218_set_value(int index, uint8_t value) { |
| 92 | is31fl3218_led_t led; | 100 | is31fl3218_led_t led; |
| 93 | if (index >= 0 && index < LED_MATRIX_LED_COUNT) { | 101 | if (index >= 0 && index < IS31FL3218_LED_COUNT) { |
| 94 | memcpy_P(&led, (&g_is31fl3218_leds[index]), sizeof(led)); | 102 | memcpy_P(&led, (&g_is31fl3218_leds[index]), sizeof(led)); |
| 95 | } | 103 | } |
| 96 | if (g_pwm_buffer[led.v - IS31FL3218_REG_PWM] == value) { | 104 | if (g_pwm_buffer[led.v - IS31FL3218_REG_PWM] == value) { |
| @@ -101,7 +109,7 @@ void is31fl3218_set_value(int index, uint8_t value) { | |||
| 101 | } | 109 | } |
| 102 | 110 | ||
| 103 | void is31fl3218_set_value_all(uint8_t value) { | 111 | void is31fl3218_set_value_all(uint8_t value) { |
| 104 | for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { | 112 | for (int i = 0; i < IS31FL3218_LED_COUNT; i++) { |
| 105 | is31fl3218_set_value(i, value); | 113 | is31fl3218_set_value(i, value); |
| 106 | } | 114 | } |
| 107 | } | 115 | } |
diff --git a/drivers/led/issi/is31fl3218-simple.h b/drivers/led/issi/is31fl3218-simple.h index 34a4886957..959990a93f 100644 --- a/drivers/led/issi/is31fl3218-simple.h +++ b/drivers/led/issi/is31fl3218-simple.h | |||
| @@ -30,7 +30,7 @@ typedef struct is31fl3218_led_t { | |||
| 30 | uint8_t v; | 30 | uint8_t v; |
| 31 | } __attribute__((packed)) is31fl3218_led_t; | 31 | } __attribute__((packed)) is31fl3218_led_t; |
| 32 | 32 | ||
| 33 | extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[LED_MATRIX_LED_COUNT]; | 33 | extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT]; |
| 34 | 34 | ||
| 35 | void is31fl3218_init(void); | 35 | void is31fl3218_init(void); |
| 36 | 36 | ||
diff --git a/drivers/led/issi/is31fl3218.c b/drivers/led/issi/is31fl3218.c index 87a0acfc08..04523a3c01 100644 --- a/drivers/led/issi/is31fl3218.c +++ b/drivers/led/issi/is31fl3218.c | |||
| @@ -68,6 +68,8 @@ void is31fl3218_write_pwm_buffer(uint8_t *pwm_buffer) { | |||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | void is31fl3218_init(void) { | 70 | void is31fl3218_init(void) { |
| 71 | i2c_init(); | ||
| 72 | |||
| 71 | // In case we ever want to reinitialize (?) | 73 | // In case we ever want to reinitialize (?) |
| 72 | is31fl3218_write_register(IS31FL3218_REG_RESET, 0x00); | 74 | is31fl3218_write_register(IS31FL3218_REG_RESET, 0x00); |
| 73 | 75 | ||
| @@ -86,11 +88,17 @@ void is31fl3218_init(void) { | |||
| 86 | 88 | ||
| 87 | // Load PWM registers and LED Control register data | 89 | // Load PWM registers and LED Control register data |
| 88 | is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01); | 90 | is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01); |
| 91 | |||
| 92 | for (int i = 0; i < IS31FL3218_LED_COUNT; i++) { | ||
| 93 | is31fl3218_set_led_control_register(i, true, true, true); | ||
| 94 | } | ||
| 95 | |||
| 96 | is31fl3218_update_led_control_registers(); | ||
| 89 | } | 97 | } |
| 90 | 98 | ||
| 91 | void is31fl3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 99 | void is31fl3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 92 | is31fl3218_led_t led; | 100 | is31fl3218_led_t led; |
| 93 | if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { | 101 | if (index >= 0 && index < IS31FL3218_LED_COUNT) { |
| 94 | memcpy_P(&led, (&g_is31fl3218_leds[index]), sizeof(led)); | 102 | memcpy_P(&led, (&g_is31fl3218_leds[index]), sizeof(led)); |
| 95 | } | 103 | } |
| 96 | 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) { | 104 | 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) { | |||
| 103 | } | 111 | } |
| 104 | 112 | ||
| 105 | void is31fl3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | 113 | void is31fl3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { |
| 106 | for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { | 114 | for (int i = 0; i < IS31FL3218_LED_COUNT; i++) { |
| 107 | is31fl3218_set_color(i, red, green, blue); | 115 | is31fl3218_set_color(i, red, green, blue); |
| 108 | } | 116 | } |
| 109 | } | 117 | } |
diff --git a/drivers/led/issi/is31fl3218.h b/drivers/led/issi/is31fl3218.h index 844e11f490..c48bc2f238 100644 --- a/drivers/led/issi/is31fl3218.h +++ b/drivers/led/issi/is31fl3218.h | |||
| @@ -32,7 +32,7 @@ typedef struct is31fl3218_led_t { | |||
| 32 | uint8_t b; | 32 | uint8_t b; |
| 33 | } __attribute__((packed)) is31fl3218_led_t; | 33 | } __attribute__((packed)) is31fl3218_led_t; |
| 34 | 34 | ||
| 35 | extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[RGB_MATRIX_LED_COUNT]; | 35 | extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT]; |
| 36 | 36 | ||
| 37 | void is31fl3218_init(void); | 37 | void is31fl3218_init(void); |
| 38 | 38 | ||
diff --git a/drivers/led/issi/is31fl3731-simple.c b/drivers/led/issi/is31fl3731-simple.c index adf2ccfca0..3663d30c10 100644 --- a/drivers/led/issi/is31fl3731-simple.c +++ b/drivers/led/issi/is31fl3731-simple.c | |||
| @@ -104,6 +104,36 @@ void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | void is31fl3731_init_drivers(void) { | ||
| 108 | i2c_init(); | ||
| 109 | |||
| 110 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | ||
| 111 | #if defined(IS31FL3731_I2C_ADDRESS_2) | ||
| 112 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); | ||
| 113 | # if defined(IS31FL3731_I2C_ADDRESS_3) | ||
| 114 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_3); | ||
| 115 | # if defined(IS31FL3731_I2C_ADDRESS_4) | ||
| 116 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_4); | ||
| 117 | # endif | ||
| 118 | # endif | ||
| 119 | #endif | ||
| 120 | |||
| 121 | for (int i = 0; i < IS31FL3731_LED_COUNT; i++) { | ||
| 122 | is31fl3731_set_led_control_register(i, true); | ||
| 123 | } | ||
| 124 | |||
| 125 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); | ||
| 126 | #if defined(IS31FL3731_I2C_ADDRESS_2) | ||
| 127 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1); | ||
| 128 | # if defined(IS31FL3731_I2C_ADDRESS_3) | ||
| 129 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_3, 2); | ||
| 130 | # if defined(IS31FL3731_I2C_ADDRESS_4) | ||
| 131 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_4, 3); | ||
| 132 | # endif | ||
| 133 | # endif | ||
| 134 | #endif | ||
| 135 | } | ||
| 136 | |||
| 107 | void is31fl3731_init(uint8_t addr) { | 137 | void is31fl3731_init(uint8_t addr) { |
| 108 | // In order to avoid the LEDs being driven with garbage data | 138 | // In order to avoid the LEDs being driven with garbage data |
| 109 | // in the LED driver's PWM registers, first enable software shutdown, | 139 | // in the LED driver's PWM registers, first enable software shutdown, |
| @@ -161,7 +191,7 @@ void is31fl3731_init(uint8_t addr) { | |||
| 161 | 191 | ||
| 162 | void is31fl3731_set_value(int index, uint8_t value) { | 192 | void is31fl3731_set_value(int index, uint8_t value) { |
| 163 | is31fl3731_led_t led; | 193 | is31fl3731_led_t led; |
| 164 | if (index >= 0 && index < LED_MATRIX_LED_COUNT) { | 194 | if (index >= 0 && index < IS31FL3731_LED_COUNT) { |
| 165 | memcpy_P(&led, (&g_is31fl3731_leds[index]), sizeof(led)); | 195 | memcpy_P(&led, (&g_is31fl3731_leds[index]), sizeof(led)); |
| 166 | 196 | ||
| 167 | // Subtract 0x24 to get the second index of g_pwm_buffer | 197 | // Subtract 0x24 to get the second index of g_pwm_buffer |
| @@ -175,7 +205,7 @@ void is31fl3731_set_value(int index, uint8_t value) { | |||
| 175 | } | 205 | } |
| 176 | 206 | ||
| 177 | void is31fl3731_set_value_all(uint8_t value) { | 207 | void is31fl3731_set_value_all(uint8_t value) { |
| 178 | for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { | 208 | for (int i = 0; i < IS31FL3731_LED_COUNT; i++) { |
| 179 | is31fl3731_set_value(i, value); | 209 | is31fl3731_set_value(i, value); |
| 180 | } | 210 | } |
| 181 | } | 211 | } |
diff --git a/drivers/led/issi/is31fl3731-simple.h b/drivers/led/issi/is31fl3731-simple.h index 2ab253717c..32504c1933 100644 --- a/drivers/led/issi/is31fl3731-simple.h +++ b/drivers/led/issi/is31fl3731-simple.h | |||
| @@ -66,8 +66,9 @@ typedef struct is31fl3731_led_t { | |||
| 66 | uint8_t v; | 66 | uint8_t v; |
| 67 | } __attribute__((packed)) is31fl3731_led_t; | 67 | } __attribute__((packed)) is31fl3731_led_t; |
| 68 | 68 | ||
| 69 | extern const is31fl3731_led_t PROGMEM g_is31fl3731_leds[LED_MATRIX_LED_COUNT]; | 69 | extern const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT]; |
| 70 | 70 | ||
| 71 | void is31fl3731_init_drivers(void); | ||
| 71 | void is31fl3731_init(uint8_t addr); | 72 | void is31fl3731_init(uint8_t addr); |
| 72 | void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 73 | void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
| 73 | void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | 74 | void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); |
diff --git a/drivers/led/issi/is31fl3731.c b/drivers/led/issi/is31fl3731.c index 767c0da0d9..42abd8ed38 100644 --- a/drivers/led/issi/is31fl3731.c +++ b/drivers/led/issi/is31fl3731.c | |||
| @@ -101,6 +101,36 @@ void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | void is31fl3731_init_drivers(void) { | ||
| 105 | i2c_init(); | ||
| 106 | |||
| 107 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | ||
| 108 | #if defined(IS31FL3731_I2C_ADDRESS_2) | ||
| 109 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); | ||
| 110 | # if defined(IS31FL3731_I2C_ADDRESS_3) | ||
| 111 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_3); | ||
| 112 | # if defined(IS31FL3731_I2C_ADDRESS_4) | ||
| 113 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_4); | ||
| 114 | # endif | ||
| 115 | # endif | ||
| 116 | #endif | ||
| 117 | |||
| 118 | for (int i = 0; i < IS31FL3731_LED_COUNT; i++) { | ||
| 119 | is31fl3731_set_led_control_register(i, true, true, true); | ||
| 120 | } | ||
| 121 | |||
| 122 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); | ||
| 123 | #if defined(IS31FL3731_I2C_ADDRESS_2) | ||
| 124 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1); | ||
| 125 | # if defined(IS31FL3731_I2C_ADDRESS_3) | ||
| 126 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_3, 2); | ||
| 127 | # if defined(IS31FL3731_I2C_ADDRESS_4) | ||
| 128 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_4, 3); | ||
| 129 | # endif | ||
| 130 | # endif | ||
| 131 | #endif | ||
| 132 | } | ||
| 133 | |||
| 104 | void is31fl3731_init(uint8_t addr) { | 134 | void is31fl3731_init(uint8_t addr) { |
| 105 | // In order to avoid the LEDs being driven with garbage data | 135 | // In order to avoid the LEDs being driven with garbage data |
| 106 | // in the LED driver's PWM registers, first enable software shutdown, | 136 | // in the LED driver's PWM registers, first enable software shutdown, |
| @@ -158,7 +188,7 @@ void is31fl3731_init(uint8_t addr) { | |||
| 158 | 188 | ||
| 159 | void is31fl3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 189 | void is31fl3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 160 | is31fl3731_led_t led; | 190 | is31fl3731_led_t led; |
| 161 | if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { | 191 | if (index >= 0 && index < IS31FL3731_LED_COUNT) { |
| 162 | memcpy_P(&led, (&g_is31fl3731_leds[index]), sizeof(led)); | 192 | memcpy_P(&led, (&g_is31fl3731_leds[index]), sizeof(led)); |
| 163 | 193 | ||
| 164 | // Subtract 0x24 to get the second index of g_pwm_buffer | 194 | // 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) { | |||
| 173 | } | 203 | } |
| 174 | 204 | ||
| 175 | void is31fl3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | 205 | void is31fl3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { |
| 176 | for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { | 206 | for (int i = 0; i < IS31FL3731_LED_COUNT; i++) { |
| 177 | is31fl3731_set_color(i, red, green, blue); | 207 | is31fl3731_set_color(i, red, green, blue); |
| 178 | } | 208 | } |
| 179 | } | 209 | } |
diff --git a/drivers/led/issi/is31fl3731.h b/drivers/led/issi/is31fl3731.h index 756c5b473a..73fa018897 100644 --- a/drivers/led/issi/is31fl3731.h +++ b/drivers/led/issi/is31fl3731.h | |||
| @@ -67,8 +67,9 @@ typedef struct is31fl3731_led_t { | |||
| 67 | uint8_t b; | 67 | uint8_t b; |
| 68 | } __attribute__((packed)) is31fl3731_led_t; | 68 | } __attribute__((packed)) is31fl3731_led_t; |
| 69 | 69 | ||
| 70 | extern const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT]; | 70 | extern const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT]; |
| 71 | 71 | ||
| 72 | void is31fl3731_init_drivers(void); | ||
| 72 | void is31fl3731_init(uint8_t addr); | 73 | void is31fl3731_init(uint8_t addr); |
| 73 | void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 74 | void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
| 74 | void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | 75 | void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); |
diff --git a/drivers/led/issi/is31fl3733-simple.c b/drivers/led/issi/is31fl3733-simple.c index dbbf86a8f5..aa1b02450c 100644 --- a/drivers/led/issi/is31fl3733-simple.c +++ b/drivers/led/issi/is31fl3733-simple.c | |||
| @@ -63,6 +63,19 @@ | |||
| 63 | # define IS31FL3733_GLOBALCURRENT 0xFF | 63 | # define IS31FL3733_GLOBALCURRENT 0xFF |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | #ifndef IS31FL3733_SYNC_1 | ||
| 67 | # define IS31FL3733_SYNC_1 IS31FL3733_SYNC_NONE | ||
| 68 | #endif | ||
| 69 | #ifndef IS31FL3733_SYNC_2 | ||
| 70 | # define IS31FL3733_SYNC_2 IS31FL3733_SYNC_NONE | ||
| 71 | #endif | ||
| 72 | #ifndef IS31FL3733_SYNC_3 | ||
| 73 | # define IS31FL3733_SYNC_3 IS31FL3733_SYNC_NONE | ||
| 74 | #endif | ||
| 75 | #ifndef IS31FL3733_SYNC_4 | ||
| 76 | # define IS31FL3733_SYNC_4 IS31FL3733_SYNC_NONE | ||
| 77 | #endif | ||
| 78 | |||
| 66 | // Transfer buffer for TWITransmitData() | 79 | // Transfer buffer for TWITransmitData() |
| 67 | uint8_t g_twi_transfer_buffer[20]; | 80 | uint8_t g_twi_transfer_buffer[20]; |
| 68 | 81 | ||
| @@ -126,6 +139,36 @@ bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||
| 126 | return true; | 139 | return true; |
| 127 | } | 140 | } |
| 128 | 141 | ||
| 142 | void is31fl3733_init_drivers(void) { | ||
| 143 | i2c_init(); | ||
| 144 | |||
| 145 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1); | ||
| 146 | #if defined(IS31FL3733_I2C_ADDRESS_2) | ||
| 147 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_2); | ||
| 148 | # if defined(IS31FL3733_I2C_ADDRESS_3) | ||
| 149 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_3, IS31FL3733_SYNC_3); | ||
| 150 | # if defined(IS31FL3733_I2C_ADDRESS_4) | ||
| 151 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_4, IS31FL3733_SYNC_4); | ||
| 152 | # endif | ||
| 153 | # endif | ||
| 154 | #endif | ||
| 155 | |||
| 156 | for (int i = 0; i < IS31FL3733_LED_COUNT; i++) { | ||
| 157 | is31fl3733_set_led_control_register(i, true); | ||
| 158 | } | ||
| 159 | |||
| 160 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0); | ||
| 161 | #if defined(IS31FL3733_I2C_ADDRESS_2) | ||
| 162 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1); | ||
| 163 | # if defined(IS31FL3733_I2C_ADDRESS_3) | ||
| 164 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_3, 2); | ||
| 165 | # if defined(IS31FL3733_I2C_ADDRESS_4) | ||
| 166 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_4, 3); | ||
| 167 | # endif | ||
| 168 | # endif | ||
| 169 | #endif | ||
| 170 | } | ||
| 171 | |||
| 129 | void is31fl3733_init(uint8_t addr, uint8_t sync) { | 172 | void is31fl3733_init(uint8_t addr, uint8_t sync) { |
| 130 | // In order to avoid the LEDs being driven with garbage data | 173 | // In order to avoid the LEDs being driven with garbage data |
| 131 | // in the LED driver's PWM registers, shutdown is enabled last. | 174 | // in the LED driver's PWM registers, shutdown is enabled last. |
| @@ -174,7 +217,7 @@ void is31fl3733_init(uint8_t addr, uint8_t sync) { | |||
| 174 | 217 | ||
| 175 | void is31fl3733_set_value(int index, uint8_t value) { | 218 | void is31fl3733_set_value(int index, uint8_t value) { |
| 176 | is31fl3733_led_t led; | 219 | is31fl3733_led_t led; |
| 177 | if (index >= 0 && index < LED_MATRIX_LED_COUNT) { | 220 | if (index >= 0 && index < IS31FL3733_LED_COUNT) { |
| 178 | memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); | 221 | memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); |
| 179 | 222 | ||
| 180 | if (g_pwm_buffer[led.driver][led.v] == value) { | 223 | if (g_pwm_buffer[led.driver][led.v] == value) { |
| @@ -186,7 +229,7 @@ void is31fl3733_set_value(int index, uint8_t value) { | |||
| 186 | } | 229 | } |
| 187 | 230 | ||
| 188 | void is31fl3733_set_value_all(uint8_t value) { | 231 | void is31fl3733_set_value_all(uint8_t value) { |
| 189 | for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { | 232 | for (int i = 0; i < IS31FL3733_LED_COUNT; i++) { |
| 190 | is31fl3733_set_value(i, value); | 233 | is31fl3733_set_value(i, value); |
| 191 | } | 234 | } |
| 192 | } | 235 | } |
diff --git a/drivers/led/issi/is31fl3733-simple.h b/drivers/led/issi/is31fl3733-simple.h index e9f68e3506..367af43c6a 100644 --- a/drivers/led/issi/is31fl3733-simple.h +++ b/drivers/led/issi/is31fl3733-simple.h | |||
| @@ -85,8 +85,9 @@ typedef struct is31fl3733_led_t { | |||
| 85 | uint8_t v; | 85 | uint8_t v; |
| 86 | } __attribute__((packed)) is31fl3733_led_t; | 86 | } __attribute__((packed)) is31fl3733_led_t; |
| 87 | 87 | ||
| 88 | extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[LED_MATRIX_LED_COUNT]; | 88 | extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT]; |
| 89 | 89 | ||
| 90 | void is31fl3733_init_drivers(void); | ||
| 90 | void is31fl3733_init(uint8_t addr, uint8_t sync); | 91 | void is31fl3733_init(uint8_t addr, uint8_t sync); |
| 91 | bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 92 | bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
| 92 | bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | 93 | bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); |
| @@ -119,6 +120,10 @@ void is31fl3733_flush(void); | |||
| 119 | #define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0b011 | 120 | #define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0b011 |
| 120 | #define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0b100 | 121 | #define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0b100 |
| 121 | 122 | ||
| 123 | #define IS31FL3733_SYNC_NONE 0b00 | ||
| 124 | #define IS31FL3733_SYNC_MASTER 0b01 | ||
| 125 | #define IS31FL3733_SYNC_SLAVE 0b10 | ||
| 126 | |||
| 122 | #define A_1 0x00 | 127 | #define A_1 0x00 |
| 123 | #define A_2 0x01 | 128 | #define A_2 0x01 |
| 124 | #define A_3 0x02 | 129 | #define A_3 0x02 |
diff --git a/drivers/led/issi/is31fl3733.c b/drivers/led/issi/is31fl3733.c index 35ec96a55a..24b0733030 100644 --- a/drivers/led/issi/is31fl3733.c +++ b/drivers/led/issi/is31fl3733.c | |||
| @@ -62,6 +62,19 @@ | |||
| 62 | # define IS31FL3733_GLOBALCURRENT 0xFF | 62 | # define IS31FL3733_GLOBALCURRENT 0xFF |
| 63 | #endif | 63 | #endif |
| 64 | 64 | ||
| 65 | #ifndef IS31FL3733_SYNC_1 | ||
| 66 | # define IS31FL3733_SYNC_1 IS31FL3733_SYNC_NONE | ||
| 67 | #endif | ||
| 68 | #ifndef IS31FL3733_SYNC_2 | ||
| 69 | # define IS31FL3733_SYNC_2 IS31FL3733_SYNC_NONE | ||
| 70 | #endif | ||
| 71 | #ifndef IS31FL3733_SYNC_3 | ||
| 72 | # define IS31FL3733_SYNC_3 IS31FL3733_SYNC_NONE | ||
| 73 | #endif | ||
| 74 | #ifndef IS31FL3733_SYNC_4 | ||
| 75 | # define IS31FL3733_SYNC_4 IS31FL3733_SYNC_NONE | ||
| 76 | #endif | ||
| 77 | |||
| 65 | // Transfer buffer for TWITransmitData() | 78 | // Transfer buffer for TWITransmitData() |
| 66 | uint8_t g_twi_transfer_buffer[20]; | 79 | uint8_t g_twi_transfer_buffer[20]; |
| 67 | 80 | ||
| @@ -125,6 +138,36 @@ bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||
| 125 | return true; | 138 | return true; |
| 126 | } | 139 | } |
| 127 | 140 | ||
| 141 | void is31fl3733_init_drivers(void) { | ||
| 142 | i2c_init(); | ||
| 143 | |||
| 144 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1); | ||
| 145 | #if defined(IS31FL3733_I2C_ADDRESS_2) | ||
| 146 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_2); | ||
| 147 | # if defined(IS31FL3733_I2C_ADDRESS_3) | ||
| 148 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_3, IS31FL3733_SYNC_3); | ||
| 149 | # if defined(IS31FL3733_I2C_ADDRESS_4) | ||
| 150 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_4, IS31FL3733_SYNC_4); | ||
| 151 | # endif | ||
| 152 | # endif | ||
| 153 | #endif | ||
| 154 | |||
| 155 | for (int i = 0; i < IS31FL3733_LED_COUNT; i++) { | ||
| 156 | is31fl3733_set_led_control_register(i, true, true, true); | ||
| 157 | } | ||
| 158 | |||
| 159 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0); | ||
| 160 | #if defined(IS31FL3733_I2C_ADDRESS_2) | ||
| 161 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1); | ||
| 162 | # if defined(IS31FL3733_I2C_ADDRESS_3) | ||
| 163 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_3, 2); | ||
| 164 | # if defined(IS31FL3733_I2C_ADDRESS_4) | ||
| 165 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_4, 3); | ||
| 166 | # endif | ||
| 167 | # endif | ||
| 168 | #endif | ||
| 169 | } | ||
| 170 | |||
| 128 | void is31fl3733_init(uint8_t addr, uint8_t sync) { | 171 | void is31fl3733_init(uint8_t addr, uint8_t sync) { |
| 129 | // In order to avoid the LEDs being driven with garbage data | 172 | // In order to avoid the LEDs being driven with garbage data |
| 130 | // in the LED driver's PWM registers, shutdown is enabled last. | 173 | // in the LED driver's PWM registers, shutdown is enabled last. |
| @@ -173,7 +216,7 @@ void is31fl3733_init(uint8_t addr, uint8_t sync) { | |||
| 173 | 216 | ||
| 174 | void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 217 | void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 175 | is31fl3733_led_t led; | 218 | is31fl3733_led_t led; |
| 176 | if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { | 219 | if (index >= 0 && index < IS31FL3733_LED_COUNT) { |
| 177 | memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); | 220 | memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); |
| 178 | 221 | ||
| 179 | 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) { | 222 | 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) { | |||
| 187 | } | 230 | } |
| 188 | 231 | ||
| 189 | void is31fl3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | 232 | void is31fl3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { |
| 190 | for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { | 233 | for (int i = 0; i < IS31FL3733_LED_COUNT; i++) { |
| 191 | is31fl3733_set_color(i, red, green, blue); | 234 | is31fl3733_set_color(i, red, green, blue); |
| 192 | } | 235 | } |
| 193 | } | 236 | } |
diff --git a/drivers/led/issi/is31fl3733.h b/drivers/led/issi/is31fl3733.h index bda6f1908f..4902b3c1d7 100644 --- a/drivers/led/issi/is31fl3733.h +++ b/drivers/led/issi/is31fl3733.h | |||
| @@ -110,8 +110,9 @@ typedef struct is31fl3733_led_t { | |||
| 110 | uint8_t b; | 110 | uint8_t b; |
| 111 | } __attribute__((packed)) is31fl3733_led_t; | 111 | } __attribute__((packed)) is31fl3733_led_t; |
| 112 | 112 | ||
| 113 | extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT]; | 113 | extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT]; |
| 114 | 114 | ||
| 115 | void is31fl3733_init_drivers(void); | ||
| 115 | void is31fl3733_init(uint8_t addr, uint8_t sync); | 116 | void is31fl3733_init(uint8_t addr, uint8_t sync); |
| 116 | bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 117 | bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
| 117 | bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | 118 | bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); |
| @@ -144,6 +145,10 @@ void is31fl3733_flush(void); | |||
| 144 | #define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0b011 | 145 | #define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0b011 |
| 145 | #define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0b100 | 146 | #define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0b100 |
| 146 | 147 | ||
| 148 | #define IS31FL3733_SYNC_NONE 0b00 | ||
| 149 | #define IS31FL3733_SYNC_MASTER 0b01 | ||
| 150 | #define IS31FL3733_SYNC_SLAVE 0b10 | ||
| 151 | |||
| 147 | #define A_1 0x00 | 152 | #define A_1 0x00 |
| 148 | #define A_2 0x01 | 153 | #define A_2 0x01 |
| 149 | #define A_3 0x02 | 154 | #define A_3 0x02 |
diff --git a/drivers/led/issi/is31fl3736-simple.c b/drivers/led/issi/is31fl3736-simple.c index d8262c3416..2876533819 100644 --- a/drivers/led/issi/is31fl3736-simple.c +++ b/drivers/led/issi/is31fl3736-simple.c | |||
| @@ -112,6 +112,36 @@ void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||
| 112 | } | 112 | } |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | void is31fl3736_init_drivers(void) { | ||
| 116 | i2c_init(); | ||
| 117 | |||
| 118 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_1); | ||
| 119 | #if defined(IS31FL3736_I2C_ADDRESS_2) | ||
| 120 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_2); | ||
| 121 | # if defined(IS31FL3736_I2C_ADDRESS_3) | ||
| 122 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_3); | ||
| 123 | # if defined(IS31FL3736_I2C_ADDRESS_4) | ||
| 124 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_4); | ||
| 125 | # endif | ||
| 126 | # endif | ||
| 127 | #endif | ||
| 128 | |||
| 129 | for (int i = 0; i < IS31FL3736_LED_COUNT; i++) { | ||
| 130 | is31fl3736_set_led_control_register(i, true); | ||
| 131 | } | ||
| 132 | |||
| 133 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_1, 0); | ||
| 134 | #if defined(IS31FL3736_I2C_ADDRESS_2) | ||
| 135 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_2, 1); | ||
| 136 | # if defined(IS31FL3736_I2C_ADDRESS_3) | ||
| 137 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_3, 2); | ||
| 138 | # if defined(IS31FL3736_I2C_ADDRESS_4) | ||
| 139 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_4, 3); | ||
| 140 | # endif | ||
| 141 | # endif | ||
| 142 | #endif | ||
| 143 | } | ||
| 144 | |||
| 115 | void is31fl3736_init(uint8_t addr) { | 145 | void is31fl3736_init(uint8_t addr) { |
| 116 | // In order to avoid the LEDs being driven with garbage data | 146 | // In order to avoid the LEDs being driven with garbage data |
| 117 | // in the LED driver's PWM registers, shutdown is enabled last. | 147 | // in the LED driver's PWM registers, shutdown is enabled last. |
| @@ -159,7 +189,7 @@ void is31fl3736_init(uint8_t addr) { | |||
| 159 | 189 | ||
| 160 | void is31fl3736_set_value(int index, uint8_t value) { | 190 | void is31fl3736_set_value(int index, uint8_t value) { |
| 161 | is31fl3736_led_t led; | 191 | is31fl3736_led_t led; |
| 162 | if (index >= 0 && index < LED_MATRIX_LED_COUNT) { | 192 | if (index >= 0 && index < IS31FL3736_LED_COUNT) { |
| 163 | memcpy_P(&led, (&g_is31fl3736_leds[index]), sizeof(led)); | 193 | memcpy_P(&led, (&g_is31fl3736_leds[index]), sizeof(led)); |
| 164 | 194 | ||
| 165 | if (g_pwm_buffer[led.driver][led.v] == value) { | 195 | if (g_pwm_buffer[led.driver][led.v] == value) { |
| @@ -171,7 +201,7 @@ void is31fl3736_set_value(int index, uint8_t value) { | |||
| 171 | } | 201 | } |
| 172 | 202 | ||
| 173 | void is31fl3736_set_value_all(uint8_t value) { | 203 | void is31fl3736_set_value_all(uint8_t value) { |
| 174 | for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { | 204 | for (int i = 0; i < IS31FL3736_LED_COUNT; i++) { |
| 175 | is31fl3736_set_value(i, value); | 205 | is31fl3736_set_value(i, value); |
| 176 | } | 206 | } |
| 177 | } | 207 | } |
diff --git a/drivers/led/issi/is31fl3736-simple.h b/drivers/led/issi/is31fl3736-simple.h index fe3cec9564..88422ec3a4 100644 --- a/drivers/led/issi/is31fl3736-simple.h +++ b/drivers/led/issi/is31fl3736-simple.h | |||
| @@ -80,8 +80,9 @@ typedef struct is31fl3736_led_t { | |||
| 80 | uint8_t v; | 80 | uint8_t v; |
| 81 | } __attribute__((packed)) is31fl3736_led_t; | 81 | } __attribute__((packed)) is31fl3736_led_t; |
| 82 | 82 | ||
| 83 | extern const is31fl3736_led_t PROGMEM g_is31fl3736_leds[LED_MATRIX_LED_COUNT]; | 83 | extern const is31fl3736_led_t PROGMEM g_is31fl3736_leds[IS31FL3736_LED_COUNT]; |
| 84 | 84 | ||
| 85 | void is31fl3736_init_drivers(void); | ||
| 85 | void is31fl3736_init(uint8_t addr); | 86 | void is31fl3736_init(uint8_t addr); |
| 86 | void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 87 | void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
| 87 | void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | 88 | void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); |
diff --git a/drivers/led/issi/is31fl3736.c b/drivers/led/issi/is31fl3736.c index 4edf1b04c8..ad421e5cf2 100644 --- a/drivers/led/issi/is31fl3736.c +++ b/drivers/led/issi/is31fl3736.c | |||
| @@ -112,6 +112,36 @@ void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||
| 112 | } | 112 | } |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | void is31fl3736_init_drivers(void) { | ||
| 116 | i2c_init(); | ||
| 117 | |||
| 118 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_1); | ||
| 119 | #if defined(IS31FL3736_I2C_ADDRESS_2) | ||
| 120 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_2); | ||
| 121 | # if defined(IS31FL3736_I2C_ADDRESS_3) | ||
| 122 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_3); | ||
| 123 | # if defined(IS31FL3736_I2C_ADDRESS_4) | ||
| 124 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_4); | ||
| 125 | # endif | ||
| 126 | # endif | ||
| 127 | #endif | ||
| 128 | |||
| 129 | for (int i = 0; i < IS31FL3736_LED_COUNT; i++) { | ||
| 130 | is31fl3736_set_led_control_register(i, true, true, true); | ||
| 131 | } | ||
| 132 | |||
| 133 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_1, 0); | ||
| 134 | #if defined(IS31FL3736_I2C_ADDRESS_2) | ||
| 135 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_2, 1); | ||
| 136 | # if defined(IS31FL3736_I2C_ADDRESS_3) | ||
| 137 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_3, 2); | ||
| 138 | # if defined(IS31FL3736_I2C_ADDRESS_4) | ||
| 139 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_4, 3); | ||
| 140 | # endif | ||
| 141 | # endif | ||
| 142 | #endif | ||
| 143 | } | ||
| 144 | |||
| 115 | void is31fl3736_init(uint8_t addr) { | 145 | void is31fl3736_init(uint8_t addr) { |
| 116 | // In order to avoid the LEDs being driven with garbage data | 146 | // In order to avoid the LEDs being driven with garbage data |
| 117 | // in the LED driver's PWM registers, shutdown is enabled last. | 147 | // in the LED driver's PWM registers, shutdown is enabled last. |
| @@ -159,7 +189,7 @@ void is31fl3736_init(uint8_t addr) { | |||
| 159 | 189 | ||
| 160 | void is31fl3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 190 | void is31fl3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 161 | is31fl3736_led_t led; | 191 | is31fl3736_led_t led; |
| 162 | if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { | 192 | if (index >= 0 && index < IS31FL3736_LED_COUNT) { |
| 163 | memcpy_P(&led, (&g_is31fl3736_leds[index]), sizeof(led)); | 193 | memcpy_P(&led, (&g_is31fl3736_leds[index]), sizeof(led)); |
| 164 | 194 | ||
| 165 | 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) { | 195 | 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) { | |||
| 173 | } | 203 | } |
| 174 | 204 | ||
| 175 | void is31fl3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | 205 | void is31fl3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { |
| 176 | for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { | 206 | for (int i = 0; i < IS31FL3736_LED_COUNT; i++) { |
| 177 | is31fl3736_set_color(i, red, green, blue); | 207 | is31fl3736_set_color(i, red, green, blue); |
| 178 | } | 208 | } |
| 179 | } | 209 | } |
diff --git a/drivers/led/issi/is31fl3736.h b/drivers/led/issi/is31fl3736.h index 728021ae29..b64fdf9d1c 100644 --- a/drivers/led/issi/is31fl3736.h +++ b/drivers/led/issi/is31fl3736.h | |||
| @@ -94,8 +94,9 @@ typedef struct is31fl3736_led_t { | |||
| 94 | uint8_t b; | 94 | uint8_t b; |
| 95 | } __attribute__((packed)) is31fl3736_led_t; | 95 | } __attribute__((packed)) is31fl3736_led_t; |
| 96 | 96 | ||
| 97 | extern const is31fl3736_led_t PROGMEM g_is31fl3736_leds[RGB_MATRIX_LED_COUNT]; | 97 | extern const is31fl3736_led_t PROGMEM g_is31fl3736_leds[IS31FL3736_LED_COUNT]; |
| 98 | 98 | ||
| 99 | void is31fl3736_init_drivers(void); | ||
| 99 | void is31fl3736_init(uint8_t addr); | 100 | void is31fl3736_init(uint8_t addr); |
| 100 | void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 101 | void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
| 101 | void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | 102 | void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); |
diff --git a/drivers/led/issi/is31fl3737-simple.c b/drivers/led/issi/is31fl3737-simple.c index 7a4263d9af..aa6eba982c 100644 --- a/drivers/led/issi/is31fl3737-simple.c +++ b/drivers/led/issi/is31fl3737-simple.c | |||
| @@ -115,6 +115,36 @@ void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||
| 115 | } | 115 | } |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | void is31fl3737_init_drivers(void) { | ||
| 119 | i2c_init(); | ||
| 120 | |||
| 121 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_1); | ||
| 122 | #if defined(IS31FL3737_I2C_ADDRESS_2) | ||
| 123 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_2); | ||
| 124 | # if defined(IS31FL3737_I2C_ADDRESS_3) | ||
| 125 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_3); | ||
| 126 | # if defined(IS31FL3737_I2C_ADDRESS_4) | ||
| 127 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_4); | ||
| 128 | # endif | ||
| 129 | # endif | ||
| 130 | #endif | ||
| 131 | |||
| 132 | for (int i = 0; i < IS31FL3737_LED_COUNT; i++) { | ||
| 133 | is31fl3737_set_led_control_register(i, true); | ||
| 134 | } | ||
| 135 | |||
| 136 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_1, 0); | ||
| 137 | #if defined(IS31FL3737_I2C_ADDRESS_2) | ||
| 138 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_2, 1); | ||
| 139 | # if defined(IS31FL3737_I2C_ADDRESS_3) | ||
| 140 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_3, 2); | ||
| 141 | # if defined(IS31FL3737_I2C_ADDRESS_4) | ||
| 142 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_4, 3); | ||
| 143 | # endif | ||
| 144 | # endif | ||
| 145 | #endif | ||
| 146 | } | ||
| 147 | |||
| 118 | void is31fl3737_init(uint8_t addr) { | 148 | void is31fl3737_init(uint8_t addr) { |
| 119 | // In order to avoid the LEDs being driven with garbage data | 149 | // In order to avoid the LEDs being driven with garbage data |
| 120 | // in the LED driver's PWM registers, shutdown is enabled last. | 150 | // in the LED driver's PWM registers, shutdown is enabled last. |
| @@ -162,7 +192,7 @@ void is31fl3737_init(uint8_t addr) { | |||
| 162 | 192 | ||
| 163 | void is31fl3737_set_value(int index, uint8_t value) { | 193 | void is31fl3737_set_value(int index, uint8_t value) { |
| 164 | is31fl3737_led_t led; | 194 | is31fl3737_led_t led; |
| 165 | if (index >= 0 && index < LED_MATRIX_LED_COUNT) { | 195 | if (index >= 0 && index < IS31FL3737_LED_COUNT) { |
| 166 | memcpy_P(&led, (&g_is31fl3737_leds[index]), sizeof(led)); | 196 | memcpy_P(&led, (&g_is31fl3737_leds[index]), sizeof(led)); |
| 167 | 197 | ||
| 168 | if (g_pwm_buffer[led.driver][led.v] == value) { | 198 | if (g_pwm_buffer[led.driver][led.v] == value) { |
| @@ -174,7 +204,7 @@ void is31fl3737_set_value(int index, uint8_t value) { | |||
| 174 | } | 204 | } |
| 175 | 205 | ||
| 176 | void is31fl3737_set_value_all(uint8_t value) { | 206 | void is31fl3737_set_value_all(uint8_t value) { |
| 177 | for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { | 207 | for (int i = 0; i < IS31FL3737_LED_COUNT; i++) { |
| 178 | is31fl3737_set_value(i, value); | 208 | is31fl3737_set_value(i, value); |
| 179 | } | 209 | } |
| 180 | } | 210 | } |
diff --git a/drivers/led/issi/is31fl3737-simple.h b/drivers/led/issi/is31fl3737-simple.h index b177d4fb0a..4c7af02176 100644 --- a/drivers/led/issi/is31fl3737-simple.h +++ b/drivers/led/issi/is31fl3737-simple.h | |||
| @@ -70,8 +70,9 @@ typedef struct is31fl3737_led_t { | |||
| 70 | uint8_t v; | 70 | uint8_t v; |
| 71 | } __attribute__((packed)) is31fl3737_led_t; | 71 | } __attribute__((packed)) is31fl3737_led_t; |
| 72 | 72 | ||
| 73 | extern const is31fl3737_led_t PROGMEM g_is31fl3737_leds[LED_MATRIX_LED_COUNT]; | 73 | extern const is31fl3737_led_t PROGMEM g_is31fl3737_leds[IS31FL3737_LED_COUNT]; |
| 74 | 74 | ||
| 75 | void is31fl3737_init_drivers(void); | ||
| 75 | void is31fl3737_init(uint8_t addr); | 76 | void is31fl3737_init(uint8_t addr); |
| 76 | void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 77 | void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
| 77 | void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | 78 | void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); |
diff --git a/drivers/led/issi/is31fl3737.c b/drivers/led/issi/is31fl3737.c index d769bb9707..75544231ec 100644 --- a/drivers/led/issi/is31fl3737.c +++ b/drivers/led/issi/is31fl3737.c | |||
| @@ -115,6 +115,36 @@ void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||
| 115 | } | 115 | } |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | void is31fl3737_init_drivers(void) { | ||
| 119 | i2c_init(); | ||
| 120 | |||
| 121 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_1); | ||
| 122 | #if defined(IS31FL3737_I2C_ADDRESS_2) | ||
| 123 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_2); | ||
| 124 | # if defined(IS31FL3737_I2C_ADDRESS_3) | ||
| 125 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_3); | ||
| 126 | # if defined(IS31FL3737_I2C_ADDRESS_4) | ||
| 127 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_4); | ||
| 128 | # endif | ||
| 129 | # endif | ||
| 130 | #endif | ||
| 131 | |||
| 132 | for (int i = 0; i < IS31FL3737_LED_COUNT; i++) { | ||
| 133 | is31fl3737_set_led_control_register(i, true, true, true); | ||
| 134 | } | ||
| 135 | |||
| 136 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_1, 0); | ||
| 137 | #if defined(IS31FL3737_I2C_ADDRESS_2) | ||
| 138 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_2, 1); | ||
| 139 | # if defined(IS31FL3737_I2C_ADDRESS_3) | ||
| 140 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_3, 2); | ||
| 141 | # if defined(IS31FL3737_I2C_ADDRESS_4) | ||
| 142 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_4, 3); | ||
| 143 | # endif | ||
| 144 | # endif | ||
| 145 | #endif | ||
| 146 | } | ||
| 147 | |||
| 118 | void is31fl3737_init(uint8_t addr) { | 148 | void is31fl3737_init(uint8_t addr) { |
| 119 | // In order to avoid the LEDs being driven with garbage data | 149 | // In order to avoid the LEDs being driven with garbage data |
| 120 | // in the LED driver's PWM registers, shutdown is enabled last. | 150 | // in the LED driver's PWM registers, shutdown is enabled last. |
| @@ -162,7 +192,7 @@ void is31fl3737_init(uint8_t addr) { | |||
| 162 | 192 | ||
| 163 | void is31fl3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 193 | void is31fl3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 164 | is31fl3737_led_t led; | 194 | is31fl3737_led_t led; |
| 165 | if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { | 195 | if (index >= 0 && index < IS31FL3737_LED_COUNT) { |
| 166 | memcpy_P(&led, (&g_is31fl3737_leds[index]), sizeof(led)); | 196 | memcpy_P(&led, (&g_is31fl3737_leds[index]), sizeof(led)); |
| 167 | 197 | ||
| 168 | 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) { | 198 | 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) { | |||
| 176 | } | 206 | } |
| 177 | 207 | ||
| 178 | void is31fl3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | 208 | void is31fl3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { |
| 179 | for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { | 209 | for (int i = 0; i < IS31FL3737_LED_COUNT; i++) { |
| 180 | is31fl3737_set_color(i, red, green, blue); | 210 | is31fl3737_set_color(i, red, green, blue); |
| 181 | } | 211 | } |
| 182 | } | 212 | } |
diff --git a/drivers/led/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h index 12f84e3bfe..fadab70c74 100644 --- a/drivers/led/issi/is31fl3737.h +++ b/drivers/led/issi/is31fl3737.h | |||
| @@ -87,8 +87,9 @@ typedef struct is31fl3737_led_t { | |||
| 87 | uint8_t b; | 87 | uint8_t b; |
| 88 | } __attribute__((packed)) is31fl3737_led_t; | 88 | } __attribute__((packed)) is31fl3737_led_t; |
| 89 | 89 | ||
| 90 | extern const is31fl3737_led_t PROGMEM g_is31fl3737_leds[RGB_MATRIX_LED_COUNT]; | 90 | extern const is31fl3737_led_t PROGMEM g_is31fl3737_leds[IS31FL3737_LED_COUNT]; |
| 91 | 91 | ||
| 92 | void is31fl3737_init_drivers(void); | ||
| 92 | void is31fl3737_init(uint8_t addr); | 93 | void is31fl3737_init(uint8_t addr); |
| 93 | void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 94 | void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
| 94 | void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | 95 | void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); |
diff --git a/drivers/led/issi/is31fl3741-simple.c b/drivers/led/issi/is31fl3741-simple.c index c7335866ec..8e77a6446d 100644 --- a/drivers/led/issi/is31fl3741-simple.c +++ b/drivers/led/issi/is31fl3741-simple.c | |||
| @@ -143,6 +143,36 @@ bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||
| 143 | return true; | 143 | return true; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | void is31fl3741_init_drivers(void) { | ||
| 147 | i2c_init(); | ||
| 148 | |||
| 149 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); | ||
| 150 | #if defined(IS31FL3741_I2C_ADDRESS_2) | ||
| 151 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_2); | ||
| 152 | # if defined(IS31FL3741_I2C_ADDRESS_3) | ||
| 153 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_3); | ||
| 154 | # if defined(IS31FL3741_I2C_ADDRESS_4) | ||
| 155 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_4); | ||
| 156 | # endif | ||
| 157 | # endif | ||
| 158 | #endif | ||
| 159 | |||
| 160 | for (int i = 0; i < IS31FL3741_LED_COUNT; i++) { | ||
| 161 | is31fl3741_set_led_control_register(i, true); | ||
| 162 | } | ||
| 163 | |||
| 164 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_1, 0); | ||
| 165 | #if defined(IS31FL3741_I2C_ADDRESS_2) | ||
| 166 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_2, 1); | ||
| 167 | # if defined(IS31FL3741_I2C_ADDRESS_3) | ||
| 168 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_3, 2); | ||
| 169 | # if defined(IS31FL3741_I2C_ADDRESS_4) | ||
| 170 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_4, 3); | ||
| 171 | # endif | ||
| 172 | # endif | ||
| 173 | #endif | ||
| 174 | } | ||
| 175 | |||
| 146 | void is31fl3741_init(uint8_t addr) { | 176 | void is31fl3741_init(uint8_t addr) { |
| 147 | // In order to avoid the LEDs being driven with garbage data | 177 | // In order to avoid the LEDs being driven with garbage data |
| 148 | // in the LED driver's PWM registers, shutdown is enabled last. | 178 | // in the LED driver's PWM registers, shutdown is enabled last. |
| @@ -174,7 +204,7 @@ void is31fl3741_init(uint8_t addr) { | |||
| 174 | 204 | ||
| 175 | void is31fl3741_set_value(int index, uint8_t value) { | 205 | void is31fl3741_set_value(int index, uint8_t value) { |
| 176 | is31fl3741_led_t led; | 206 | is31fl3741_led_t led; |
| 177 | if (index >= 0 && index < LED_MATRIX_LED_COUNT) { | 207 | if (index >= 0 && index < IS31FL3741_LED_COUNT) { |
| 178 | memcpy_P(&led, (&g_is31fl3741_leds[index]), sizeof(led)); | 208 | memcpy_P(&led, (&g_is31fl3741_leds[index]), sizeof(led)); |
| 179 | 209 | ||
| 180 | if (g_pwm_buffer[led.driver][led.v] == value) { | 210 | if (g_pwm_buffer[led.driver][led.v] == value) { |
| @@ -186,7 +216,7 @@ void is31fl3741_set_value(int index, uint8_t value) { | |||
| 186 | } | 216 | } |
| 187 | 217 | ||
| 188 | void is31fl3741_set_value_all(uint8_t value) { | 218 | void is31fl3741_set_value_all(uint8_t value) { |
| 189 | for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { | 219 | for (int i = 0; i < IS31FL3741_LED_COUNT; i++) { |
| 190 | is31fl3741_set_value(i, value); | 220 | is31fl3741_set_value(i, value); |
| 191 | } | 221 | } |
| 192 | } | 222 | } |
diff --git a/drivers/led/issi/is31fl3741-simple.h b/drivers/led/issi/is31fl3741-simple.h index 8ecc330298..d97591fa60 100644 --- a/drivers/led/issi/is31fl3741-simple.h +++ b/drivers/led/issi/is31fl3741-simple.h | |||
| @@ -70,8 +70,9 @@ typedef struct is31fl3741_led_t { | |||
| 70 | uint32_t v : 10; | 70 | uint32_t v : 10; |
| 71 | } __attribute__((packed)) is31fl3741_led_t; | 71 | } __attribute__((packed)) is31fl3741_led_t; |
| 72 | 72 | ||
| 73 | extern const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT]; | 73 | extern const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT]; |
| 74 | 74 | ||
| 75 | void is31fl3741_init_drivers(void); | ||
| 75 | void is31fl3741_init(uint8_t addr); | 76 | void is31fl3741_init(uint8_t addr); |
| 76 | void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 77 | void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
| 77 | bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | 78 | bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); |
diff --git a/drivers/led/issi/is31fl3741.c b/drivers/led/issi/is31fl3741.c index 5e4ed711ca..f316b76157 100644 --- a/drivers/led/issi/is31fl3741.c +++ b/drivers/led/issi/is31fl3741.c | |||
| @@ -143,6 +143,36 @@ bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||
| 143 | return true; | 143 | return true; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | void is31fl3741_init_drivers(void) { | ||
| 147 | i2c_init(); | ||
| 148 | |||
| 149 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); | ||
| 150 | #if defined(IS31FL3741_I2C_ADDRESS_2) | ||
| 151 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_2); | ||
| 152 | # if defined(IS31FL3741_I2C_ADDRESS_3) | ||
| 153 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_3); | ||
| 154 | # if defined(IS31FL3741_I2C_ADDRESS_4) | ||
| 155 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_4); | ||
| 156 | # endif | ||
| 157 | # endif | ||
| 158 | #endif | ||
| 159 | |||
| 160 | for (int i = 0; i < IS31FL3741_LED_COUNT; i++) { | ||
| 161 | is31fl3741_set_led_control_register(i, true, true, true); | ||
| 162 | } | ||
| 163 | |||
| 164 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_1, 0); | ||
| 165 | #if defined(IS31FL3741_I2C_ADDRESS_2) | ||
| 166 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_2, 1); | ||
| 167 | # if defined(IS31FL3741_I2C_ADDRESS_3) | ||
| 168 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_3, 2); | ||
| 169 | # if defined(IS31FL3741_I2C_ADDRESS_4) | ||
| 170 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_4, 3); | ||
| 171 | # endif | ||
| 172 | # endif | ||
| 173 | #endif | ||
| 174 | } | ||
| 175 | |||
| 146 | void is31fl3741_init(uint8_t addr) { | 176 | void is31fl3741_init(uint8_t addr) { |
| 147 | // In order to avoid the LEDs being driven with garbage data | 177 | // In order to avoid the LEDs being driven with garbage data |
| 148 | // in the LED driver's PWM registers, shutdown is enabled last. | 178 | // in the LED driver's PWM registers, shutdown is enabled last. |
| @@ -174,7 +204,7 @@ void is31fl3741_init(uint8_t addr) { | |||
| 174 | 204 | ||
| 175 | void is31fl3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 205 | void is31fl3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 176 | is31fl3741_led_t led; | 206 | is31fl3741_led_t led; |
| 177 | if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { | 207 | if (index >= 0 && index < IS31FL3741_LED_COUNT) { |
| 178 | memcpy_P(&led, (&g_is31fl3741_leds[index]), sizeof(led)); | 208 | memcpy_P(&led, (&g_is31fl3741_leds[index]), sizeof(led)); |
| 179 | 209 | ||
| 180 | 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) { | 210 | 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) { | |||
| 188 | } | 218 | } |
| 189 | 219 | ||
| 190 | void is31fl3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | 220 | void is31fl3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { |
| 191 | for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { | 221 | for (int i = 0; i < IS31FL3741_LED_COUNT; i++) { |
| 192 | is31fl3741_set_color(i, red, green, blue); | 222 | is31fl3741_set_color(i, red, green, blue); |
| 193 | } | 223 | } |
| 194 | } | 224 | } |
diff --git a/drivers/led/issi/is31fl3741.h b/drivers/led/issi/is31fl3741.h index 13e132efa0..1febb6398b 100644 --- a/drivers/led/issi/is31fl3741.h +++ b/drivers/led/issi/is31fl3741.h | |||
| @@ -87,8 +87,9 @@ typedef struct is31fl3741_led_t { | |||
| 87 | uint32_t b : 10; | 87 | uint32_t b : 10; |
| 88 | } __attribute__((packed)) is31fl3741_led_t; | 88 | } __attribute__((packed)) is31fl3741_led_t; |
| 89 | 89 | ||
| 90 | extern const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT]; | 90 | extern const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT]; |
| 91 | 91 | ||
| 92 | void is31fl3741_init_drivers(void); | ||
| 92 | void is31fl3741_init(uint8_t addr); | 93 | void is31fl3741_init(uint8_t addr); |
| 93 | void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 94 | void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
| 94 | bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | 95 | bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); |
diff --git a/drivers/led/issi/is31flcommon.c b/drivers/led/issi/is31flcommon.c index 850f23c831..d6b9bce93d 100644 --- a/drivers/led/issi/is31flcommon.c +++ b/drivers/led/issi/is31flcommon.c | |||
| @@ -188,6 +188,41 @@ void IS31FL_common_flush(void) { | |||
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | #ifdef RGB_MATRIX_ENABLE | 190 | #ifdef RGB_MATRIX_ENABLE |
| 191 | void IS31FL_RGB_init_drivers(void) { | ||
| 192 | i2c_init(); | ||
| 193 | |||
| 194 | IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1); | ||
| 195 | # if defined(DRIVER_ADDR_2) | ||
| 196 | IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2); | ||
| 197 | # if defined(DRIVER_ADDR_3) | ||
| 198 | IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3); | ||
| 199 | # if defined(DRIVER_ADDR_4) | ||
| 200 | IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4); | ||
| 201 | # endif | ||
| 202 | # endif | ||
| 203 | # endif | ||
| 204 | |||
| 205 | for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { | ||
| 206 | IS31FL_RGB_set_scaling_buffer(i, true, true, true); | ||
| 207 | } | ||
| 208 | |||
| 209 | // This actually updates the LED drivers | ||
| 210 | # ifdef ISSI_MANUAL_SCALING | ||
| 211 | IS31FL_set_manual_scaling_buffer(); | ||
| 212 | # endif | ||
| 213 | |||
| 214 | IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0); | ||
| 215 | # if defined(DRIVER_ADDR_2) | ||
| 216 | IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1); | ||
| 217 | # if defined(DRIVER_ADDR_3) | ||
| 218 | IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2); | ||
| 219 | # if defined(DRIVER_ADDR_4) | ||
| 220 | IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3); | ||
| 221 | # endif | ||
| 222 | # endif | ||
| 223 | # endif | ||
| 224 | } | ||
| 225 | |||
| 191 | // Colour is set by adjusting PWM register | 226 | // Colour is set by adjusting PWM register |
| 192 | void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 227 | void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 193 | if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { | 228 | 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 | |||
| 231 | 266 | ||
| 232 | #elif defined(LED_MATRIX_ENABLE) | 267 | #elif defined(LED_MATRIX_ENABLE) |
| 233 | // LED Matrix Specific scripts | 268 | // LED Matrix Specific scripts |
| 269 | void IS31FL_simple_init_drivers(void) { | ||
| 270 | i2c_init(); | ||
| 271 | |||
| 272 | IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1); | ||
| 273 | # if defined(DRIVER_ADDR_2) | ||
| 274 | IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2); | ||
| 275 | # if defined(DRIVER_ADDR_3) | ||
| 276 | IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3); | ||
| 277 | # if defined(DRIVER_ADDR_4) | ||
| 278 | IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4); | ||
| 279 | # endif | ||
| 280 | # endif | ||
| 281 | # endif | ||
| 282 | |||
| 283 | for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { | ||
| 284 | IS31FL_simple_set_scaling_buffer(i, true); | ||
| 285 | } | ||
| 286 | |||
| 287 | // This actually updates the LED drivers | ||
| 288 | # ifdef ISSI_MANUAL_SCALING | ||
| 289 | IS31FL_set_manual_scaling_buffer(); | ||
| 290 | # endif | ||
| 291 | |||
| 292 | IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0); | ||
| 293 | # if defined(DRIVER_ADDR_2) | ||
| 294 | IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1); | ||
| 295 | # if defined(DRIVER_ADDR_3) | ||
| 296 | IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2); | ||
| 297 | # if defined(DRIVER_ADDR_4) | ||
| 298 | IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3); | ||
| 299 | # endif | ||
| 300 | # endif | ||
| 301 | # endif | ||
| 302 | } | ||
| 303 | |||
| 234 | void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value) { | 304 | void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value) { |
| 235 | is31_led led; | 305 | is31_led led; |
| 236 | memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); | 306 | memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); |
diff --git a/drivers/led/issi/is31flcommon.h b/drivers/led/issi/is31flcommon.h index c380f2a8d6..94ec9ae3ce 100644 --- a/drivers/led/issi/is31flcommon.h +++ b/drivers/led/issi/is31flcommon.h | |||
| @@ -71,11 +71,13 @@ void IS31FL_common_flush(void); | |||
| 71 | 71 | ||
| 72 | #ifdef RGB_MATRIX_ENABLE | 72 | #ifdef RGB_MATRIX_ENABLE |
| 73 | // RGB Matrix Specific scripts | 73 | // RGB Matrix Specific scripts |
| 74 | void IS31FL_RGB_init_drivers(void); | ||
| 74 | void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); | 75 | void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); |
| 75 | void IS31FL_RGB_set_color_all(uint8_t red, uint8_t green, uint8_t blue); | 76 | void IS31FL_RGB_set_color_all(uint8_t red, uint8_t green, uint8_t blue); |
| 76 | void IS31FL_RGB_set_scaling_buffer(uint8_t index, bool red, bool green, bool blue); | 77 | void IS31FL_RGB_set_scaling_buffer(uint8_t index, bool red, bool green, bool blue); |
| 77 | #elif defined(LED_MATRIX_ENABLE) | 78 | #elif defined(LED_MATRIX_ENABLE) |
| 78 | // LED Matrix Specific scripts | 79 | // LED Matrix Specific scripts |
| 80 | void IS31FL_simple_init_drivers(void); | ||
| 79 | void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value); | 81 | void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value); |
| 80 | void IS31FL_simple_set_brightness(int index, uint8_t value); | 82 | void IS31FL_simple_set_brightness(int index, uint8_t value); |
| 81 | void IS31FL_simple_set_brigntness_all(uint8_t value); | 83 | void IS31FL_simple_set_brigntness_all(uint8_t value); |
diff --git a/drivers/led/snled27351-simple.c b/drivers/led/snled27351-simple.c index 882fe4e8b4..c274506f83 100644 --- a/drivers/led/snled27351-simple.c +++ b/drivers/led/snled27351-simple.c | |||
| @@ -99,6 +99,34 @@ bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||
| 99 | return true; | 99 | return true; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | void snled27351_init_drivers(void) { | ||
| 103 | snled27351_init(SNLED27351_I2C_ADDRESS_1); | ||
| 104 | #if defined(SNLED27351_I2C_ADDRESS_2) | ||
| 105 | snled27351_init(SNLED27351_I2C_ADDRESS_2); | ||
| 106 | # if defined(SNLED27351_I2C_ADDRESS_3) | ||
| 107 | snled27351_init(SNLED27351_I2C_ADDRESS_3); | ||
| 108 | # if defined(SNLED27351_I2C_ADDRESS_4) | ||
| 109 | snled27351_init(SNLED27351_I2C_ADDRESS_4); | ||
| 110 | # endif | ||
| 111 | # endif | ||
| 112 | #endif | ||
| 113 | |||
| 114 | for (int i = 0; i < SNLED27351_LED_COUNT; i++) { | ||
| 115 | snled27351_set_led_control_register(i, true); | ||
| 116 | } | ||
| 117 | |||
| 118 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_1, 0); | ||
| 119 | #if defined(SNLED27351_I2C_ADDRESS_2) | ||
| 120 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_2, 1); | ||
| 121 | # if defined(SNLED27351_I2C_ADDRESS_3) | ||
| 122 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_3, 2); | ||
| 123 | # if defined(SNLED27351_I2C_ADDRESS_4) | ||
| 124 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_4, 3); | ||
| 125 | # endif | ||
| 126 | # endif | ||
| 127 | #endif | ||
| 128 | } | ||
| 129 | |||
| 102 | void snled27351_init(uint8_t addr) { | 130 | void snled27351_init(uint8_t addr) { |
| 103 | // Select to function page | 131 | // Select to function page |
| 104 | snled27351_write_register(addr, SNLED27351_REG_CONFIGURE_CMD_PAGE, SNLED27351_FUNCTION_PAGE); | 132 | snled27351_write_register(addr, SNLED27351_REG_CONFIGURE_CMD_PAGE, SNLED27351_FUNCTION_PAGE); |
| @@ -147,7 +175,7 @@ void snled27351_init(uint8_t addr) { | |||
| 147 | 175 | ||
| 148 | void snled27351_set_value(int index, uint8_t value) { | 176 | void snled27351_set_value(int index, uint8_t value) { |
| 149 | snled27351_led_t led; | 177 | snled27351_led_t led; |
| 150 | if (index >= 0 && index < LED_MATRIX_LED_COUNT) { | 178 | if (index >= 0 && index < SNLED27351_LED_COUNT) { |
| 151 | memcpy_P(&led, (&g_snled27351_leds[index]), sizeof(led)); | 179 | memcpy_P(&led, (&g_snled27351_leds[index]), sizeof(led)); |
| 152 | 180 | ||
| 153 | if (g_pwm_buffer[led.driver][led.v] == value) { | 181 | if (g_pwm_buffer[led.driver][led.v] == value) { |
| @@ -159,7 +187,7 @@ void snled27351_set_value(int index, uint8_t value) { | |||
| 159 | } | 187 | } |
| 160 | 188 | ||
| 161 | void snled27351_set_value_all(uint8_t value) { | 189 | void snled27351_set_value_all(uint8_t value) { |
| 162 | for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { | 190 | for (int i = 0; i < SNLED27351_LED_COUNT; i++) { |
| 163 | snled27351_set_value(i, value); | 191 | snled27351_set_value(i, value); |
| 164 | } | 192 | } |
| 165 | } | 193 | } |
diff --git a/drivers/led/snled27351-simple.h b/drivers/led/snled27351-simple.h index e8238071a5..64257202b9 100644 --- a/drivers/led/snled27351-simple.h +++ b/drivers/led/snled27351-simple.h | |||
| @@ -68,8 +68,9 @@ typedef struct snled27351_led_t { | |||
| 68 | uint8_t v; | 68 | uint8_t v; |
| 69 | } __attribute__((packed)) snled27351_led_t; | 69 | } __attribute__((packed)) snled27351_led_t; |
| 70 | 70 | ||
| 71 | extern const snled27351_led_t PROGMEM g_snled27351_leds[LED_MATRIX_LED_COUNT]; | 71 | extern const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT]; |
| 72 | 72 | ||
| 73 | void snled27351_init_drivers(void); | ||
| 73 | void snled27351_init(uint8_t addr); | 74 | void snled27351_init(uint8_t addr); |
| 74 | bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 75 | bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
| 75 | bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | 76 | bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); |
diff --git a/drivers/led/snled27351.c b/drivers/led/snled27351.c index 198b190dac..2746737a5a 100644 --- a/drivers/led/snled27351.c +++ b/drivers/led/snled27351.c | |||
| @@ -98,6 +98,34 @@ bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||
| 98 | return true; | 98 | return true; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | void snled27351_init_drivers(void) { | ||
| 102 | snled27351_init(SNLED27351_I2C_ADDRESS_1); | ||
| 103 | #if defined(SNLED27351_I2C_ADDRESS_2) | ||
| 104 | snled27351_init(SNLED27351_I2C_ADDRESS_2); | ||
| 105 | # if defined(SNLED27351_I2C_ADDRESS_3) | ||
| 106 | snled27351_init(SNLED27351_I2C_ADDRESS_3); | ||
| 107 | # if defined(SNLED27351_I2C_ADDRESS_4) | ||
| 108 | snled27351_init(SNLED27351_I2C_ADDRESS_4); | ||
| 109 | # endif | ||
| 110 | # endif | ||
| 111 | #endif | ||
| 112 | |||
| 113 | for (int i = 0; i < SNLED27351_LED_COUNT; i++) { | ||
| 114 | snled27351_set_led_control_register(i, true, true, true); | ||
| 115 | } | ||
| 116 | |||
| 117 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_1, 0); | ||
| 118 | #if defined(SNLED27351_I2C_ADDRESS_2) | ||
| 119 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_2, 1); | ||
| 120 | # if defined(SNLED27351_I2C_ADDRESS_3) | ||
| 121 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_3, 2); | ||
| 122 | # if defined(SNLED27351_I2C_ADDRESS_4) | ||
| 123 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_4, 3); | ||
| 124 | # endif | ||
| 125 | # endif | ||
| 126 | #endif | ||
| 127 | } | ||
| 128 | |||
| 101 | void snled27351_init(uint8_t addr) { | 129 | void snled27351_init(uint8_t addr) { |
| 102 | // Select to function page | 130 | // Select to function page |
| 103 | snled27351_write_register(addr, SNLED27351_REG_CONFIGURE_CMD_PAGE, SNLED27351_FUNCTION_PAGE); | 131 | snled27351_write_register(addr, SNLED27351_REG_CONFIGURE_CMD_PAGE, SNLED27351_FUNCTION_PAGE); |
| @@ -146,7 +174,7 @@ void snled27351_init(uint8_t addr) { | |||
| 146 | 174 | ||
| 147 | void snled27351_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 175 | void snled27351_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 148 | snled27351_led_t led; | 176 | snled27351_led_t led; |
| 149 | if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { | 177 | if (index >= 0 && index < SNLED27351_LED_COUNT) { |
| 150 | memcpy_P(&led, (&g_snled27351_leds[index]), sizeof(led)); | 178 | memcpy_P(&led, (&g_snled27351_leds[index]), sizeof(led)); |
| 151 | 179 | ||
| 152 | 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) { | 180 | 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) { | |||
| 160 | } | 188 | } |
| 161 | 189 | ||
| 162 | void snled27351_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | 190 | void snled27351_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { |
| 163 | for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { | 191 | for (int i = 0; i < SNLED27351_LED_COUNT; i++) { |
| 164 | snled27351_set_color(i, red, green, blue); | 192 | snled27351_set_color(i, red, green, blue); |
| 165 | } | 193 | } |
| 166 | } | 194 | } |
diff --git a/drivers/led/snled27351.h b/drivers/led/snled27351.h index e92ca71799..cecd552dbb 100644 --- a/drivers/led/snled27351.h +++ b/drivers/led/snled27351.h | |||
| @@ -82,8 +82,9 @@ typedef struct snled27351_led_t { | |||
| 82 | uint8_t b; | 82 | uint8_t b; |
| 83 | } __attribute__((packed)) snled27351_led_t; | 83 | } __attribute__((packed)) snled27351_led_t; |
| 84 | 84 | ||
| 85 | extern const snled27351_led_t PROGMEM g_snled27351_leds[RGB_MATRIX_LED_COUNT]; | 85 | extern const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT]; |
| 86 | 86 | ||
| 87 | void snled27351_init_drivers(void); | ||
| 87 | void snled27351_init(uint8_t addr); | 88 | void snled27351_init(uint8_t addr); |
| 88 | bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 89 | bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
| 89 | bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | 90 | bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); |
diff --git a/keyboards/acheron/apollo/87h/gamma/config.h b/keyboards/acheron/apollo/87h/gamma/config.h index e8600a18f1..151239ba33 100644 --- a/keyboards/acheron/apollo/87h/gamma/config.h +++ b/keyboards/acheron/apollo/87h/gamma/config.h | |||
| @@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 30 | #define IS31FL3741_DRIVER_COUNT 1 | 30 | #define IS31FL3741_DRIVER_COUNT 1 |
| 31 | #define DRIVER_1_LED_TOTAL 87 | 31 | #define DRIVER_1_LED_TOTAL 87 |
| 32 | #define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL | 32 | #define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL |
| 33 | #define ISSI_DRIVER_TOTAL RGB_MATRIX_LED_COUNT | ||
| 34 | 33 | ||
| 35 | #define RGB_MATRIX_DEFAULT_VAL 80 | 34 | #define RGB_MATRIX_DEFAULT_VAL 80 |
| 36 | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | 35 | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS |
diff --git a/keyboards/aeboards/satellite/rev1/config.h b/keyboards/aeboards/satellite/rev1/config.h index fcf3105f0f..7a06288394 100644 --- a/keyboards/aeboards/satellite/rev1/config.h +++ b/keyboards/aeboards/satellite/rev1/config.h | |||
| @@ -23,8 +23,8 @@ | |||
| 23 | #define IS31FL3731_DRIVER_COUNT 2 | 23 | #define IS31FL3731_DRIVER_COUNT 2 |
| 24 | #define DRIVER_1_LED_TOTAL 36 | 24 | #define DRIVER_1_LED_TOTAL 36 |
| 25 | #define DRIVER_2_LED_TOTAL 36 | 25 | #define DRIVER_2_LED_TOTAL 36 |
| 26 | #define ISSI_DRIVER_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | 26 | #define IS31FL3731_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) |
| 27 | #define RGB_MATRIX_LED_COUNT ISSI_DRIVER_TOTAL | 27 | #define RGB_MATRIX_LED_COUNT IS31FL3731_LED_COUNT |
| 28 | 28 | ||
| 29 | #define RGB_MATRIX_DEFAULT_VAL 80 | 29 | #define RGB_MATRIX_DEFAULT_VAL 80 |
| 30 | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | 30 | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS |
diff --git a/keyboards/aeboards/satellite/rev1/rev1.c b/keyboards/aeboards/satellite/rev1/rev1.c index 4c6e7d6d7c..6727894e06 100644 --- a/keyboards/aeboards/satellite/rev1/rev1.c +++ b/keyboards/aeboards/satellite/rev1/rev1.c | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | #include "drivers/led/issi/is31fl3731.h" | 18 | #include "drivers/led/issi/is31fl3731.h" |
| 19 | 19 | ||
| 20 | #ifdef RGB_MATRIX_ENABLE | 20 | #ifdef RGB_MATRIX_ENABLE |
| 21 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | 21 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { |
| 22 | /* Refer to IS31 manual for these locations | 22 | /* Refer to IS31 manual for these locations |
| 23 | * driver | 23 | * driver |
| 24 | * | R location | 24 | * | R location |
| @@ -149,7 +149,7 @@ static void init(void) { | |||
| 149 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | 149 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); |
| 150 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); | 150 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); |
| 151 | 151 | ||
| 152 | for (int index = 0; index < ISSI_DRIVER_TOTAL; index++) { | 152 | for (int index = 0; index < IS31FL3731_LED_COUNT; index++) { |
| 153 | bool enabled = !( ( index == 18+5) || //B5 | 153 | bool enabled = !( ( index == 18+5) || //B5 |
| 154 | ( index == 36+17) || //C17 | 154 | ( index == 36+17) || //C17 |
| 155 | ( index == 54+13) //D13 | 155 | ( index == 54+13) //D13 |
diff --git a/keyboards/fallacy/config.h b/keyboards/fallacy/config.h index 254f809c34..65cea1d5c1 100755 --- a/keyboards/fallacy/config.h +++ b/keyboards/fallacy/config.h | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | */ | 20 | */ |
| 21 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 21 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 22 | #define IS31FL3731_DRIVER_COUNT 1 | 22 | #define IS31FL3731_DRIVER_COUNT 1 |
| 23 | #define LED_MATRIX_LED_COUNT 3 | 23 | #define IS31FL3731_LED_COUNT 3 |
| 24 | 24 | ||
| 25 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap | 25 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap |
| 26 | */ | 26 | */ |
diff --git a/keyboards/fallacy/indicators.c b/keyboards/fallacy/indicators.c index a8630d2e11..b95786db41 100755 --- a/keyboards/fallacy/indicators.c +++ b/keyboards/fallacy/indicators.c | |||
| @@ -22,14 +22,7 @@ | |||
| 22 | * init IS31FL3731 and i2c | 22 | * init IS31FL3731 and i2c |
| 23 | */ | 23 | */ |
| 24 | void init_fallacy_leds(void) { | 24 | void init_fallacy_leds(void) { |
| 25 | i2c_init(); | 25 | is31fl3731_init_drivers(); |
| 26 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | ||
| 27 | |||
| 28 | for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { | ||
| 29 | is31fl3731_set_led_control_register(i, true); | ||
| 30 | } | ||
| 31 | |||
| 32 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); | ||
| 33 | } | 26 | } |
| 34 | 27 | ||
| 35 | 28 | ||
| @@ -54,7 +47,7 @@ void set_fallacy_led(int index, bool state) { | |||
| 54 | 47 | ||
| 55 | /* define LED matrix | 48 | /* define LED matrix |
| 56 | */ | 49 | */ |
| 57 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[LED_MATRIX_LED_COUNT] = { | 50 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { |
| 58 | {0, C1_1}, | 51 | {0, C1_1}, |
| 59 | {0, C2_1}, | 52 | {0, C2_1}, |
| 60 | {0, C3_1}, | 53 | {0, C3_1}, |
diff --git a/keyboards/hs60/v2/ansi/config.h b/keyboards/hs60/v2/ansi/config.h index 3600b30feb..e4dc24dc33 100644 --- a/keyboards/hs60/v2/ansi/config.h +++ b/keyboards/hs60/v2/ansi/config.h | |||
| @@ -55,7 +55,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 55 | 55 | ||
| 56 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | 56 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND |
| 57 | #define IS31FL3733_DRIVER_COUNT 1 | 57 | #define IS31FL3733_DRIVER_COUNT 1 |
| 58 | #define RGB_MATRIX_LED_COUNT 64 | 58 | #define IS31FL3733_LED_COUNT 64 |
| 59 | 59 | ||
| 60 | // These define which keys in the matrix are alphas/mods | 60 | // These define which keys in the matrix are alphas/mods |
| 61 | // Used for backlight effects so colors are different for | 61 | // Used for backlight effects so colors are different for |
diff --git a/keyboards/hs60/v2/hhkb/config.h b/keyboards/hs60/v2/hhkb/config.h index bdc27435cf..029e1ebb18 100644 --- a/keyboards/hs60/v2/hhkb/config.h +++ b/keyboards/hs60/v2/hhkb/config.h | |||
| @@ -55,7 +55,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 55 | 55 | ||
| 56 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | 56 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND |
| 57 | #define IS31FL3733_DRIVER_COUNT 1 | 57 | #define IS31FL3733_DRIVER_COUNT 1 |
| 58 | #define RGB_MATRIX_LED_COUNT 64 | 58 | #define IS31FL3733_LED_COUNT 64 |
| 59 | 59 | ||
| 60 | // These define which keys in the matrix are alphas/mods | 60 | // These define which keys in the matrix are alphas/mods |
| 61 | // Used for backlight effects so colors are different for | 61 | // Used for backlight effects so colors are different for |
diff --git a/keyboards/hs60/v2/iso/config.h b/keyboards/hs60/v2/iso/config.h index 9a9a4ed623..52cada51a6 100644 --- a/keyboards/hs60/v2/iso/config.h +++ b/keyboards/hs60/v2/iso/config.h | |||
| @@ -52,7 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 52 | 52 | ||
| 53 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | 53 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND |
| 54 | #define IS31FL3733_DRIVER_COUNT 1 | 54 | #define IS31FL3733_DRIVER_COUNT 1 |
| 55 | #define RGB_MATRIX_LED_COUNT 64 | 55 | #define IS31FL3733_LED_COUNT 64 |
| 56 | 56 | ||
| 57 | // These define which keys in the matrix are alphas/mods | 57 | // These define which keys in the matrix are alphas/mods |
| 58 | // Used for backlight effects so colors are different for | 58 | // Used for backlight effects so colors are different for |
diff --git a/keyboards/input_club/k_type/config.h b/keyboards/input_club/k_type/config.h index d6abd39a83..c188038a82 100644 --- a/keyboards/input_club/k_type/config.h +++ b/keyboards/input_club/k_type/config.h | |||
| @@ -34,7 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 34 | //#define NO_ACTION_ONESHOT | 34 | //#define NO_ACTION_ONESHOT |
| 35 | 35 | ||
| 36 | #ifdef RGB_MATRIX_ENABLE | 36 | #ifdef RGB_MATRIX_ENABLE |
| 37 | //#include "gpio.h" | ||
| 38 | // RGB Matrix Animation modes. Explicitly enabled | 37 | // RGB Matrix Animation modes. Explicitly enabled |
| 39 | // For full list of effects, see: | 38 | // For full list of effects, see: |
| 40 | // https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects | 39 | // 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/>. | |||
| 106 | # define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | 105 | # define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND |
| 107 | # define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_GND | 106 | # define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_GND |
| 108 | # define IS31FL3733_DRIVER_COUNT 2 | 107 | # define IS31FL3733_DRIVER_COUNT 2 |
| 108 | # define IS31FL3733_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | ||
| 109 | # define DRIVER_1_LED_TOTAL 64 | 109 | # define DRIVER_1_LED_TOTAL 64 |
| 110 | # define DRIVER_2_LED_TOTAL 55 | 110 | # define DRIVER_2_LED_TOTAL 55 |
| 111 | # define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | 111 | # define RGB_MATRIX_LED_COUNT IS31FL3733_LED_COUNT |
| 112 | #endif | 112 | #endif |
diff --git a/keyboards/input_club/k_type/i2c_master.h b/keyboards/input_club/k_type/i2c_master.h index d4e9d6878f..db4f12e43c 100644 --- a/keyboards/input_club/k_type/i2c_master.h +++ b/keyboards/input_club/k_type/i2c_master.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | #include <ch.h> | 27 | #include <ch.h> |
| 28 | #include <hal.h> | 28 | #include <hal.h> |
| 29 | #include "gpio.h" | ||
| 29 | 30 | ||
| 30 | #ifndef I2C_COUNT | 31 | #ifndef I2C_COUNT |
| 31 | # define I2C_COUNT 1 | 32 | # define I2C_COUNT 1 |
diff --git a/keyboards/input_club/k_type/is31fl3733-dual.c b/keyboards/input_club/k_type/is31fl3733-dual.c index 54e9d76960..0b6c6a607c 100644 --- a/keyboards/input_club/k_type/is31fl3733-dual.c +++ b/keyboards/input_club/k_type/is31fl3733-dual.c | |||
| @@ -60,6 +60,19 @@ | |||
| 60 | # define IS31FL3733_GLOBALCURRENT 0xFF | 60 | # define IS31FL3733_GLOBALCURRENT 0xFF |
| 61 | #endif | 61 | #endif |
| 62 | 62 | ||
| 63 | #ifndef IS31FL3733_SYNC_1 | ||
| 64 | # define IS31FL3733_SYNC_1 IS31FL3733_SYNC_NONE | ||
| 65 | #endif | ||
| 66 | #ifndef IS31FL3733_SYNC_2 | ||
| 67 | # define IS31FL3733_SYNC_2 IS31FL3733_SYNC_NONE | ||
| 68 | #endif | ||
| 69 | #ifndef IS31FL3733_SYNC_3 | ||
| 70 | # define IS31FL3733_SYNC_3 IS31FL3733_SYNC_NONE | ||
| 71 | #endif | ||
| 72 | #ifndef IS31FL3733_SYNC_4 | ||
| 73 | # define IS31FL3733_SYNC_4 IS31FL3733_SYNC_NONE | ||
| 74 | #endif | ||
| 75 | |||
| 63 | // Transfer buffer for TWITransmitData() | 76 | // Transfer buffer for TWITransmitData() |
| 64 | uint8_t g_twi_transfer_buffer[20]; | 77 | uint8_t g_twi_transfer_buffer[20]; |
| 65 | 78 | ||
| @@ -125,6 +138,24 @@ bool is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffe | |||
| 125 | return true; | 138 | return true; |
| 126 | } | 139 | } |
| 127 | 140 | ||
| 141 | void is31fl3733_init_drivers(void) { | ||
| 142 | i2c_init(&I2CD1, I2C1_SCL_PIN, I2C1_SDA_PIN); | ||
| 143 | is31fl3733_init(0, IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1); | ||
| 144 | # ifdef USE_I2C2 | ||
| 145 | i2c_init(&I2CD2, I2C2_SCL_PIN, I2C2_SDA_PIN); | ||
| 146 | is31fl3733_init(1, IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_2); | ||
| 147 | # endif | ||
| 148 | |||
| 149 | for (int i = 0; i < IS31FL3733_LED_COUNT; i++) { | ||
| 150 | is31fl3733_set_led_control_register(i, true, true, true); | ||
| 151 | } | ||
| 152 | |||
| 153 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0); | ||
| 154 | # ifdef USE_I2C2 | ||
| 155 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1); | ||
| 156 | # endif | ||
| 157 | } | ||
| 158 | |||
| 128 | void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync) { | 159 | void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync) { |
| 129 | // In order to avoid the LEDs being driven with garbage data | 160 | // In order to avoid the LEDs being driven with garbage data |
| 130 | // in the LED driver's PWM registers, shutdown is enabled last. | 161 | // 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) { | |||
| 173 | 204 | ||
| 174 | void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 205 | void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 175 | is31fl3733_led_t led; | 206 | is31fl3733_led_t led; |
| 176 | if (index >= 0 && index < RGB_MATRIX_LED_COUNT) { | 207 | if (index >= 0 && index < IS31FL3733_LED_COUNT) { |
| 177 | memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); | 208 | memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); |
| 178 | 209 | ||
| 179 | 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) { | 210 | 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) { | |||
| 187 | } | 218 | } |
| 188 | 219 | ||
| 189 | void is31fl3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { | 220 | void is31fl3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { |
| 190 | for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { | 221 | for (int i = 0; i < IS31FL3733_LED_COUNT; i++) { |
| 191 | is31fl3733_set_color(i, red, green, blue); | 222 | is31fl3733_set_color(i, red, green, blue); |
| 192 | } | 223 | } |
| 193 | } | 224 | } |
diff --git a/keyboards/input_club/k_type/is31fl3733-dual.h b/keyboards/input_club/k_type/is31fl3733-dual.h index 33943af320..696c234b67 100644 --- a/keyboards/input_club/k_type/is31fl3733-dual.h +++ b/keyboards/input_club/k_type/is31fl3733-dual.h | |||
| @@ -46,8 +46,9 @@ typedef struct is31fl3733_led_t { | |||
| 46 | uint8_t b; | 46 | uint8_t b; |
| 47 | } __attribute__((packed)) is31fl3733_led_t; | 47 | } __attribute__((packed)) is31fl3733_led_t; |
| 48 | 48 | ||
| 49 | extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT]; | 49 | extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT]; |
| 50 | 50 | ||
| 51 | void is31fl3733_init_drivers(void); | ||
| 51 | void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync); | 52 | void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync); |
| 52 | bool is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data); | 53 | bool is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data); |
| 53 | bool is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffer); | 54 | bool is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffer); |
| @@ -80,6 +81,10 @@ void is31fl3733_flush(void); | |||
| 80 | #define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0x03 | 81 | #define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0x03 |
| 81 | #define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0x04 | 82 | #define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0x04 |
| 82 | 83 | ||
| 84 | #define IS31FL3733_SYNC_NONE 0b00 | ||
| 85 | #define IS31FL3733_SYNC_MASTER 0b01 | ||
| 86 | #define IS31FL3733_SYNC_SLAVE 0b10 | ||
| 87 | |||
| 83 | #define A_1 0x00 | 88 | #define A_1 0x00 |
| 84 | #define A_2 0x01 | 89 | #define A_2 0x01 |
| 85 | #define A_3 0x02 | 90 | #define A_3 0x02 |
diff --git a/keyboards/input_club/k_type/k_type-rgbdriver.c b/keyboards/input_club/k_type/k_type-rgbdriver.c index 1e8132e6dc..e4d2d2d04b 100644 --- a/keyboards/input_club/k_type/k_type-rgbdriver.c +++ b/keyboards/input_club/k_type/k_type-rgbdriver.c | |||
| @@ -16,30 +16,10 @@ | |||
| 16 | 16 | ||
| 17 | #ifdef RGB_MATRIX_ENABLE | 17 | #ifdef RGB_MATRIX_ENABLE |
| 18 | # include "rgb_matrix.h" | 18 | # include "rgb_matrix.h" |
| 19 | # include "i2c_master.h" | ||
| 20 | # include "is31fl3733-dual.h" | 19 | # include "is31fl3733-dual.h" |
| 21 | # include "gpio.h" | ||
| 22 | |||
| 23 | static void init(void) { | ||
| 24 | i2c_init(&I2CD1, I2C1_SCL_PIN, I2C1_SDA_PIN); | ||
| 25 | is31fl3733_init(0, IS31FL3733_I2C_ADDRESS_1, 0); | ||
| 26 | # ifdef USE_I2C2 | ||
| 27 | i2c_init(&I2CD2, I2C2_SCL_PIN, I2C2_SDA_PIN); | ||
| 28 | is31fl3733_init(1, IS31FL3733_I2C_ADDRESS_2, 0); | ||
| 29 | # endif | ||
| 30 | for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) { | ||
| 31 | bool enabled = true; | ||
| 32 | // This only caches it for later | ||
| 33 | is31fl3733_set_led_control_register(index, enabled, enabled, enabled); | ||
| 34 | } | ||
| 35 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0); | ||
| 36 | # ifdef USE_I2C2 | ||
| 37 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1); | ||
| 38 | # endif | ||
| 39 | } | ||
| 40 | 20 | ||
| 41 | const rgb_matrix_driver_t rgb_matrix_driver = { | 21 | const rgb_matrix_driver_t rgb_matrix_driver = { |
| 42 | .init = init, | 22 | .init = is31fl3733_init_drivers, |
| 43 | .flush = is31fl3733_flush, | 23 | .flush = is31fl3733_flush, |
| 44 | .set_color = is31fl3733_set_color, | 24 | .set_color = is31fl3733_set_color, |
| 45 | .set_color_all = is31fl3733_set_color_all, | 25 | .set_color_all = is31fl3733_set_color_all, |
diff --git a/keyboards/input_club/k_type/k_type.c b/keyboards/input_club/k_type/k_type.c index c6d06b51dc..e97007fc70 100644 --- a/keyboards/input_club/k_type/k_type.c +++ b/keyboards/input_club/k_type/k_type.c | |||
| @@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 20 | #ifdef RGB_MATRIX_ENABLE | 20 | #ifdef RGB_MATRIX_ENABLE |
| 21 | # include "is31fl3733-dual.h" | 21 | # include "is31fl3733-dual.h" |
| 22 | 22 | ||
| 23 | const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = { | 23 | const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = { |
| 24 | { 0, B_1, A_1, C_1 }, | 24 | { 0, B_1, A_1, C_1 }, |
| 25 | { 0, B_2, A_2, C_2 }, | 25 | { 0, B_2, A_2, C_2 }, |
| 26 | { 0, B_3, A_3, C_3 }, | 26 | { 0, B_3, A_3, C_3 }, |
diff --git a/keyboards/input_club/k_type/post_rules.mk b/keyboards/input_club/k_type/post_rules.mk index 897e422b05..ba750e2624 100644 --- a/keyboards/input_club/k_type/post_rules.mk +++ b/keyboards/input_club/k_type/post_rules.mk | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) | 1 | ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) |
| 2 | # Additional files for RGB lighting | 2 | # Additional files for RGB lighting |
| 3 | SRC += k_type-rgbdriver.c | 3 | SRC += k_type-rgbdriver.c is31fl3733-dual.c |
| 4 | QUANTUM_LIB_SRC += i2c_master.c is31fl3733-dual.c | 4 | QUANTUM_LIB_SRC += i2c_master.c |
| 5 | endif | 5 | endif |
diff --git a/keyboards/keebwerk/mega/ansi/config.h b/keyboards/keebwerk/mega/ansi/config.h index ee98c95636..c3b90cc2ca 100755 --- a/keyboards/keebwerk/mega/ansi/config.h +++ b/keyboards/keebwerk/mega/ansi/config.h | |||
| @@ -53,7 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 53 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | 53 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND |
| 54 | #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA | 54 | #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA |
| 55 | #define IS31FL3733_DRIVER_COUNT 2 | 55 | #define IS31FL3733_DRIVER_COUNT 2 |
| 56 | #define RGB_MATRIX_LED_COUNT 128 | 56 | #define IS31FL3733_LED_COUNT 128 |
| 57 | 57 | ||
| 58 | // These define which keys in the matrix are alphas/mods | 58 | // These define which keys in the matrix are alphas/mods |
| 59 | // Used for backlight effects so colors are different for | 59 | // Used for backlight effects so colors are different for |
diff --git a/keyboards/kprepublic/bm60hsrgb/rev2/config.h b/keyboards/kprepublic/bm60hsrgb/rev2/config.h index 9349838622..8d194f5ccb 100644 --- a/keyboards/kprepublic/bm60hsrgb/rev2/config.h +++ b/keyboards/kprepublic/bm60hsrgb/rev2/config.h | |||
| @@ -74,7 +74,7 @@ | |||
| 74 | 74 | ||
| 75 | #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 | 75 | #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 |
| 76 | 76 | ||
| 77 | #define ISSI_LED_TOTAL DRIVER_1_LED_TOTAL | 77 | #define IS31FL3733_LED_COUNT DRIVER_1_LED_TOTAL |
| 78 | 78 | ||
| 79 | // Underglow LEDs are WS2812, but someone might want to use RGBLIGHT for them; | 79 | // Underglow LEDs are WS2812, but someone might want to use RGBLIGHT for them; |
| 80 | // don't use those LEDs in RGB Matrix in that case. | 80 | // don't use those LEDs in RGB Matrix in that case. |
| @@ -84,7 +84,7 @@ | |||
| 84 | # define WS2812_LED_TOTAL 6 | 84 | # define WS2812_LED_TOTAL 6 |
| 85 | #endif | 85 | #endif |
| 86 | 86 | ||
| 87 | #define RGB_MATRIX_LED_COUNT (ISSI_LED_TOTAL + WS2812_LED_TOTAL) | 87 | #define RGB_MATRIX_LED_COUNT (IS31FL3733_LED_COUNT + WS2812_LED_TOTAL) |
| 88 | 88 | ||
| 89 | #ifdef RGB_MATRIX_ENABLE | 89 | #ifdef RGB_MATRIX_ENABLE |
| 90 | # define RGB_MATRIX_KEYPRESSES | 90 | # define RGB_MATRIX_KEYPRESSES |
diff --git a/keyboards/kprepublic/bm60hsrgb/rev2/rev2.c b/keyboards/kprepublic/bm60hsrgb/rev2/rev2.c index 8b786d7cfb..0e9b3d318d 100644 --- a/keyboards/kprepublic/bm60hsrgb/rev2/rev2.c +++ b/keyboards/kprepublic/bm60hsrgb/rev2/rev2.c | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | # include "is31fl3733.h" | 22 | # include "is31fl3733.h" |
| 23 | # include "ws2812.h" | 23 | # include "ws2812.h" |
| 24 | 24 | ||
| 25 | const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = { | 25 | const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = { |
| 26 | { 0, B_1, A_1, C_1 }, | 26 | { 0, B_1, A_1, C_1 }, |
| 27 | { 0, B_2, A_2, C_2 }, | 27 | { 0, B_2, A_2, C_2 }, |
| 28 | { 0, B_3, A_3, C_3 }, | 28 | { 0, B_3, A_3, C_3 }, |
| @@ -153,8 +153,8 @@ rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL]; | |||
| 153 | 153 | ||
| 154 | static void rgb_matrix_driver_init(void) { | 154 | static void rgb_matrix_driver_init(void) { |
| 155 | i2c_init(); | 155 | i2c_init(); |
| 156 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, 0); | 156 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE); |
| 157 | for (uint8_t index = 0; index < ISSI_LED_TOTAL; index++) { | 157 | for (uint8_t index = 0; index < IS31FL3733_LED_COUNT; index++) { |
| 158 | bool enabled = true; | 158 | bool enabled = true; |
| 159 | is31fl3733_set_led_control_register(index, enabled, enabled, enabled); | 159 | is31fl3733_set_led_control_register(index, enabled, enabled, enabled); |
| 160 | } | 160 | } |
| @@ -169,13 +169,13 @@ static void rgb_matrix_driver_flush(void) { | |||
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 171 | static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 172 | if (index < ISSI_LED_TOTAL) { | 172 | if (index < IS31FL3733_LED_COUNT) { |
| 173 | is31fl3733_set_color(index, red, green, blue); | 173 | is31fl3733_set_color(index, red, green, blue); |
| 174 | } else { | 174 | } else { |
| 175 | # if WS2812_LED_TOTAL > 0 | 175 | # if WS2812_LED_TOTAL > 0 |
| 176 | rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].r = red; | 176 | rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].r = red; |
| 177 | rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].g = green; | 177 | rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].g = green; |
| 178 | rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].b = blue; | 178 | rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].b = blue; |
| 179 | # endif | 179 | # endif |
| 180 | } | 180 | } |
| 181 | } | 181 | } |
diff --git a/keyboards/kprepublic/bm60hsrgb_iso/rev2/config.h b/keyboards/kprepublic/bm60hsrgb_iso/rev2/config.h index acd30f0659..b22c384460 100644 --- a/keyboards/kprepublic/bm60hsrgb_iso/rev2/config.h +++ b/keyboards/kprepublic/bm60hsrgb_iso/rev2/config.h | |||
| @@ -82,7 +82,7 @@ | |||
| 82 | // IS31FL3733+WS2812 driver setup used by this board the LED controller drivers | 82 | // IS31FL3733+WS2812 driver setup used by this board the LED controller drivers |
| 83 | // are compiled unconditionally). | 83 | // are compiled unconditionally). |
| 84 | 84 | ||
| 85 | #define ISSI_LED_TOTAL DRIVER_1_LED_TOTAL | 85 | #define IS31FL3733_LED_COUNT DRIVER_1_LED_TOTAL |
| 86 | 86 | ||
| 87 | #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 180 | 87 | #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 180 |
| 88 | 88 | ||
| @@ -94,7 +94,7 @@ | |||
| 94 | # define WS2812_LED_TOTAL 6 | 94 | # define WS2812_LED_TOTAL 6 |
| 95 | #endif | 95 | #endif |
| 96 | 96 | ||
| 97 | #define RGB_MATRIX_LED_COUNT (ISSI_LED_TOTAL + WS2812_LED_TOTAL) | 97 | #define RGB_MATRIX_LED_COUNT (IS31FL3733_LED_COUNT + WS2812_LED_TOTAL) |
| 98 | 98 | ||
| 99 | #ifdef RGB_MATRIX_ENABLE | 99 | #ifdef RGB_MATRIX_ENABLE |
| 100 | # define RGB_MATRIX_KEYPRESSES | 100 | # define RGB_MATRIX_KEYPRESSES |
diff --git a/keyboards/kprepublic/bm60hsrgb_iso/rev2/rev2.c b/keyboards/kprepublic/bm60hsrgb_iso/rev2/rev2.c index 02dd4ab6ce..2cfe18e08e 100644 --- a/keyboards/kprepublic/bm60hsrgb_iso/rev2/rev2.c +++ b/keyboards/kprepublic/bm60hsrgb_iso/rev2/rev2.c | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | # include "ws2812.h" | 24 | # include "ws2812.h" |
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | const PROGMEM is31fl3733_led_t g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = { | 27 | const PROGMEM is31fl3733_led_t g_is31fl3733_leds[IS31FL3733_LED_COUNT] = { |
| 28 | { 0, B_1, A_1, C_1 }, | 28 | { 0, B_1, A_1, C_1 }, |
| 29 | { 0, B_2, A_2, C_2 }, | 29 | { 0, B_2, A_2, C_2 }, |
| 30 | { 0, B_3, A_3, C_3 }, | 30 | { 0, B_3, A_3, C_3 }, |
| @@ -153,8 +153,8 @@ rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL]; | |||
| 153 | 153 | ||
| 154 | static void rgb_matrix_driver_init(void) { | 154 | static void rgb_matrix_driver_init(void) { |
| 155 | i2c_init(); | 155 | i2c_init(); |
| 156 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, 0); | 156 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE); |
| 157 | for (uint8_t index = 0; index < ISSI_LED_TOTAL; index++) { | 157 | for (uint8_t index = 0; index < IS31FL3733_LED_COUNT; index++) { |
| 158 | bool enabled = true; | 158 | bool enabled = true; |
| 159 | is31fl3733_set_led_control_register(index, enabled, enabled, enabled); | 159 | is31fl3733_set_led_control_register(index, enabled, enabled, enabled); |
| 160 | } | 160 | } |
| @@ -169,13 +169,13 @@ static void rgb_matrix_driver_flush(void) { | |||
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 171 | static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 172 | if (index < ISSI_LED_TOTAL) { | 172 | if (index < IS31FL3733_LED_COUNT) { |
| 173 | is31fl3733_set_color(index, red, green, blue); | 173 | is31fl3733_set_color(index, red, green, blue); |
| 174 | } else { | 174 | } else { |
| 175 | # if WS2812_LED_TOTAL > 0 | 175 | # if WS2812_LED_TOTAL > 0 |
| 176 | rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].r = red; | 176 | rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].r = red; |
| 177 | rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].g = green; | 177 | rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].g = green; |
| 178 | rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].b = blue; | 178 | rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].b = blue; |
| 179 | # endif | 179 | # endif |
| 180 | } | 180 | } |
| 181 | } | 181 | } |
diff --git a/keyboards/kprepublic/bm60hsrgb_poker/rev2/config.h b/keyboards/kprepublic/bm60hsrgb_poker/rev2/config.h index 7fd7575148..57cb40dc24 100644 --- a/keyboards/kprepublic/bm60hsrgb_poker/rev2/config.h +++ b/keyboards/kprepublic/bm60hsrgb_poker/rev2/config.h | |||
| @@ -81,7 +81,7 @@ | |||
| 81 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | 81 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND |
| 82 | #define DRIVER_1_LED_TOTAL 61 | 82 | #define DRIVER_1_LED_TOTAL 61 |
| 83 | 83 | ||
| 84 | #define ISSI_LED_TOTAL DRIVER_1_LED_TOTAL | 84 | #define IS31FL3733_LED_COUNT DRIVER_1_LED_TOTAL |
| 85 | 85 | ||
| 86 | // Underglow LEDs are WS2812, but someone might want to use RGBLIGHT for them; | 86 | // Underglow LEDs are WS2812, but someone might want to use RGBLIGHT for them; |
| 87 | // don't use those LEDs in RGB Matrix in that case. | 87 | // don't use those LEDs in RGB Matrix in that case. |
| @@ -91,7 +91,7 @@ | |||
| 91 | # define WS2812_LED_TOTAL 6 | 91 | # define WS2812_LED_TOTAL 6 |
| 92 | #endif | 92 | #endif |
| 93 | 93 | ||
| 94 | #define RGB_MATRIX_LED_COUNT (ISSI_LED_TOTAL + WS2812_LED_TOTAL) | 94 | #define RGB_MATRIX_LED_COUNT (IS31FL3733_LED_COUNT + WS2812_LED_TOTAL) |
| 95 | 95 | ||
| 96 | #ifdef RGB_MATRIX_ENABLE | 96 | #ifdef RGB_MATRIX_ENABLE |
| 97 | # define RGB_MATRIX_KEYPRESSES | 97 | # define RGB_MATRIX_KEYPRESSES |
diff --git a/keyboards/kprepublic/bm60hsrgb_poker/rev2/rev2.c b/keyboards/kprepublic/bm60hsrgb_poker/rev2/rev2.c index f76c45e6c5..2e66a3096e 100644 --- a/keyboards/kprepublic/bm60hsrgb_poker/rev2/rev2.c +++ b/keyboards/kprepublic/bm60hsrgb_poker/rev2/rev2.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | # include "is31fl3733.h" | 21 | # include "is31fl3733.h" |
| 22 | # include "ws2812.h" | 22 | # include "ws2812.h" |
| 23 | 23 | ||
| 24 | const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = { | 24 | const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = { |
| 25 | { 0, B_1, A_1, C_1 }, | 25 | { 0, B_1, A_1, C_1 }, |
| 26 | { 0, B_2, A_2, C_2 }, | 26 | { 0, B_2, A_2, C_2 }, |
| 27 | { 0, B_3, A_3, C_3 }, | 27 | { 0, B_3, A_3, C_3 }, |
| @@ -149,8 +149,8 @@ rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL]; | |||
| 149 | 149 | ||
| 150 | static void rgb_matrix_driver_init(void) { | 150 | static void rgb_matrix_driver_init(void) { |
| 151 | i2c_init(); | 151 | i2c_init(); |
| 152 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, 0); | 152 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE); |
| 153 | for (uint8_t index = 0; index < ISSI_LED_TOTAL; index++) { | 153 | for (uint8_t index = 0; index < IS31FL3733_LED_COUNT; index++) { |
| 154 | bool enabled = true; | 154 | bool enabled = true; |
| 155 | is31fl3733_set_led_control_register(index, enabled, enabled, enabled); | 155 | is31fl3733_set_led_control_register(index, enabled, enabled, enabled); |
| 156 | } | 156 | } |
| @@ -165,13 +165,13 @@ static void rgb_matrix_driver_flush(void) { | |||
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 167 | static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 168 | if (index < ISSI_LED_TOTAL) { | 168 | if (index < IS31FL3733_LED_COUNT) { |
| 169 | is31fl3733_set_color(index, red, green, blue); | 169 | is31fl3733_set_color(index, red, green, blue); |
| 170 | } else { | 170 | } else { |
| 171 | # if WS2812_LED_TOTAL > 0 | 171 | # if WS2812_LED_TOTAL > 0 |
| 172 | rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].r = red; | 172 | rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].r = red; |
| 173 | rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].g = green; | 173 | rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].g = green; |
| 174 | rgb_matrix_ws2812_array[index - ISSI_LED_TOTAL].b = blue; | 174 | rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].b = blue; |
| 175 | # endif | 175 | # endif |
| 176 | } | 176 | } |
| 177 | } | 177 | } |
diff --git a/keyboards/matrix/m20add/config.h b/keyboards/matrix/m20add/config.h index aba2357357..51b050ca7c 100644 --- a/keyboards/matrix/m20add/config.h +++ b/keyboards/matrix/m20add/config.h | |||
| @@ -80,4 +80,4 @@ | |||
| 80 | 80 | ||
| 81 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 81 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 82 | #define IS31FL3731_DRIVER_COUNT 1 | 82 | #define IS31FL3731_DRIVER_COUNT 1 |
| 83 | #define RGB_MATRIX_LED_COUNT 20 | 83 | #define IS31FL3731_LED_COUNT 20 |
diff --git a/keyboards/matrix/m20add/rgb_ring.c b/keyboards/matrix/m20add/rgb_ring.c index 553a3d5360..f3fbe83d72 100644 --- a/keyboards/matrix/m20add/rgb_ring.c +++ b/keyboards/matrix/m20add/rgb_ring.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | #endif | 30 | #endif |
| 31 | // rgb ring leds setting | 31 | // rgb ring leds setting |
| 32 | 32 | ||
| 33 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | 33 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { |
| 34 | /* Refer to IS31 manual for these locations | 34 | /* Refer to IS31 manual for these locations |
| 35 | * driver | 35 | * driver |
| 36 | * | R location | 36 | * | R location |
| @@ -371,13 +371,7 @@ void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds) | |||
| 371 | 371 | ||
| 372 | void rgb_ring_init(void) | 372 | void rgb_ring_init(void) |
| 373 | { | 373 | { |
| 374 | i2c_init(); | 374 | is31fl3731_init_drivers(); |
| 375 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | ||
| 376 | for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) { | ||
| 377 | bool enabled = true; | ||
| 378 | is31fl3731_set_led_control_register(index, enabled, enabled, enabled); | ||
| 379 | } | ||
| 380 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); | ||
| 381 | } | 375 | } |
| 382 | 376 | ||
| 383 | void rgb_ring_task(void) | 377 | void rgb_ring_task(void) |
diff --git a/keyboards/neson_design/700e/700e.c b/keyboards/neson_design/700e/700e.c index d4aa336edb..9def73d6a4 100644 --- a/keyboards/neson_design/700e/700e.c +++ b/keyboards/neson_design/700e/700e.c | |||
| @@ -111,7 +111,7 @@ static void self_testing(void) | |||
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | if (rgb_state.index >= ST_LEFT_END) { | 113 | if (rgb_state.index >= ST_LEFT_END) { |
| 114 | for (int i = rgb_state.index - 1; i < RGB_MATRIX_LED_COUNT - rgb_state.index + 1; i++) { | 114 | for (int i = rgb_state.index - 1; i < IS31FL3731_LED_COUNT - rgb_state.index + 1; i++) { |
| 115 | is31fl3731_set_color(i, led.r, led.g, led.b); | 115 | is31fl3731_set_color(i, led.r, led.g, led.b); |
| 116 | } | 116 | } |
| 117 | if (rgb_state.index == ST_LEFT_END) { | 117 | if (rgb_state.index == ST_LEFT_END) { |
| @@ -173,13 +173,13 @@ static void self_testing(void) | |||
| 173 | } | 173 | } |
| 174 | break; | 174 | break; |
| 175 | case ST_STAGE_3: | 175 | case ST_STAGE_3: |
| 176 | if (rgb_state.index != RGB_MATRIX_LED_COUNT/2) { | 176 | if (rgb_state.index != IS31FL3731_LED_COUNT/2) { |
| 177 | is31fl3731_set_color_all(0, 0, 0); | 177 | is31fl3731_set_color_all(0, 0, 0); |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | // light left and right | 180 | // light left and right |
| 181 | 181 | ||
| 182 | if (rgb_state.index == RGB_MATRIX_LED_COUNT/2) { | 182 | if (rgb_state.index == IS31FL3731_LED_COUNT/2) { |
| 183 | if (rgb_state.duration) { | 183 | if (rgb_state.duration) { |
| 184 | rgb_state.duration--; | 184 | rgb_state.duration--; |
| 185 | } else { | 185 | } else { |
| @@ -207,7 +207,7 @@ static void self_testing(void) | |||
| 207 | update_ticks(); | 207 | update_ticks(); |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | 210 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { |
| 211 | /* Refer to IS31 manual for these locations | 211 | /* Refer to IS31 manual for these locations |
| 212 | * driver | 212 | * driver |
| 213 | * | R location | 213 | * | R location |
| @@ -294,18 +294,8 @@ void matrix_init_kb(void) | |||
| 294 | setPinOutput(LED_CAPS_LOCK_PIN); | 294 | setPinOutput(LED_CAPS_LOCK_PIN); |
| 295 | writePinLow(LED_CAPS_LOCK_PIN); | 295 | writePinLow(LED_CAPS_LOCK_PIN); |
| 296 | 296 | ||
| 297 | i2c_init(); | 297 | is31fl3731_init_drivers(); |
| 298 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | 298 | |
| 299 | #ifdef IS31FL3731_I2C_ADDRESS_2 | ||
| 300 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); | ||
| 301 | #endif | ||
| 302 | for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) { | ||
| 303 | is31fl3731_set_led_control_register(index, true, true, true); | ||
| 304 | } | ||
| 305 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); | ||
| 306 | #ifdef IS31FL3731_I2C_ADDRESS_2 | ||
| 307 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1); | ||
| 308 | #endif | ||
| 309 | update_ticks(); | 299 | update_ticks(); |
| 310 | matrix_init_user(); | 300 | matrix_init_user(); |
| 311 | } | 301 | } |
| @@ -350,16 +340,16 @@ void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds) | |||
| 350 | { | 340 | { |
| 351 | if (rgb_state.state != NORMAL) return; | 341 | if (rgb_state.state != NORMAL) return; |
| 352 | 342 | ||
| 353 | for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { | 343 | for (uint8_t i = 0; i < IS31FL3731_LED_COUNT; i++) { |
| 354 | is31fl3731_set_color(i, start_led[i].r, start_led[i].g, start_led[i].b); | 344 | is31fl3731_set_color(i, start_led[i].r, start_led[i].g, start_led[i].b); |
| 355 | } | 345 | } |
| 356 | rgb_led_t leds[4]; | 346 | rgb_led_t leds[4]; |
| 357 | for (int i = 0; i < 4; i++) { | 347 | for (int i = 0; i < 4; i++) { |
| 358 | leds[i].r = start_led[RGB_MATRIX_LED_COUNT+i].g; | 348 | leds[i].r = start_led[IS31FL3731_LED_COUNT+i].g; |
| 359 | leds[i].g = start_led[RGB_MATRIX_LED_COUNT+i].r; | 349 | leds[i].g = start_led[IS31FL3731_LED_COUNT+i].r; |
| 360 | leds[i].b = start_led[RGB_MATRIX_LED_COUNT+i].b; | 350 | leds[i].b = start_led[IS31FL3731_LED_COUNT+i].b; |
| 361 | } | 351 | } |
| 362 | //ws2812_setleds(start_led+RGB_MATRIX_LED_COUNT, 4); | 352 | //ws2812_setleds(start_led+IS31FL3731_LED_COUNT, 4); |
| 363 | ws2812_setleds(leds, 4); | 353 | ws2812_setleds(leds, 4); |
| 364 | } | 354 | } |
| 365 | 355 | ||
diff --git a/keyboards/neson_design/700e/config.h b/keyboards/neson_design/700e/config.h index bd1d9888ec..4cecb6165a 100644 --- a/keyboards/neson_design/700e/config.h +++ b/keyboards/neson_design/700e/config.h | |||
| @@ -35,6 +35,6 @@ | |||
| 35 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 35 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 36 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC | 36 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC |
| 37 | #define IS31FL3731_DRIVER_COUNT 2 | 37 | #define IS31FL3731_DRIVER_COUNT 2 |
| 38 | #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL+DRIVER_2_LED_TOTAL) | 38 | #define IS31FL3731_LED_COUNT (DRIVER_1_LED_TOTAL+DRIVER_2_LED_TOTAL) |
| 39 | 39 | ||
| 40 | #define USB_SUSPEND_WAKEUP_DELAY 1000 | 40 | #define USB_SUSPEND_WAKEUP_DELAY 1000 |
diff --git a/keyboards/neson_design/n6/config.h b/keyboards/neson_design/n6/config.h index 22a25a0d92..847b26eb25 100644 --- a/keyboards/neson_design/n6/config.h +++ b/keyboards/neson_design/n6/config.h | |||
| @@ -35,4 +35,4 @@ | |||
| 35 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 35 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 36 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC | 36 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC |
| 37 | #define IS31FL3731_DRIVER_COUNT 2 | 37 | #define IS31FL3731_DRIVER_COUNT 2 |
| 38 | #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL+DRIVER_2_LED_TOTAL) | 38 | #define IS31FL3731_LED_COUNT (DRIVER_1_LED_TOTAL+DRIVER_2_LED_TOTAL) |
diff --git a/keyboards/neson_design/n6/n6.c b/keyboards/neson_design/n6/n6.c index 5f3ae3a169..38b634eeb7 100644 --- a/keyboards/neson_design/n6/n6.c +++ b/keyboards/neson_design/n6/n6.c | |||
| @@ -115,7 +115,7 @@ static void self_testing(void) | |||
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | if (rgb_state.index >= ST_LEFT_END) { | 117 | if (rgb_state.index >= ST_LEFT_END) { |
| 118 | for (int i = rgb_state.index - 1; i < RGB_MATRIX_LED_COUNT - rgb_state.index + 1; i++) { | 118 | for (int i = rgb_state.index - 1; i < IS31FL3731_LED_COUNT - rgb_state.index + 1; i++) { |
| 119 | is31fl3731_set_color(i, led.r, led.g, led.b); | 119 | is31fl3731_set_color(i, led.r, led.g, led.b); |
| 120 | } | 120 | } |
| 121 | if (rgb_state.index == ST_LEFT_END) { | 121 | if (rgb_state.index == ST_LEFT_END) { |
| @@ -177,13 +177,13 @@ static void self_testing(void) | |||
| 177 | } | 177 | } |
| 178 | break; | 178 | break; |
| 179 | case ST_STAGE_3: | 179 | case ST_STAGE_3: |
| 180 | if (rgb_state.index != RGB_MATRIX_LED_COUNT/2) { | 180 | if (rgb_state.index != IS31FL3731_LED_COUNT/2) { |
| 181 | is31fl3731_set_color_all(0, 0, 0); | 181 | is31fl3731_set_color_all(0, 0, 0); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | // light left and right | 184 | // light left and right |
| 185 | 185 | ||
| 186 | if (rgb_state.index == RGB_MATRIX_LED_COUNT/2) { | 186 | if (rgb_state.index == IS31FL3731_LED_COUNT/2) { |
| 187 | if (rgb_state.duration) { | 187 | if (rgb_state.duration) { |
| 188 | rgb_state.duration--; | 188 | rgb_state.duration--; |
| 189 | } else { | 189 | } else { |
| @@ -211,7 +211,7 @@ static void self_testing(void) | |||
| 211 | update_ticks(); | 211 | update_ticks(); |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | 214 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { |
| 215 | /* Refer to IS31 manual for these locations | 215 | /* Refer to IS31 manual for these locations |
| 216 | * driver | 216 | * driver |
| 217 | * | R location | 217 | * | R location |
| @@ -298,18 +298,8 @@ void matrix_init_kb(void) | |||
| 298 | setPinOutput(LED_CAPS_LOCK_PIN); | 298 | setPinOutput(LED_CAPS_LOCK_PIN); |
| 299 | writePinLow(LED_CAPS_LOCK_PIN); | 299 | writePinLow(LED_CAPS_LOCK_PIN); |
| 300 | 300 | ||
| 301 | i2c_init(); | 301 | is31fl3731_init_drivers(); |
| 302 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | 302 | |
| 303 | #ifdef IS31FL3731_I2C_ADDRESS_2 | ||
| 304 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); | ||
| 305 | #endif | ||
| 306 | for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) { | ||
| 307 | is31fl3731_set_led_control_register(index, true, true, true); | ||
| 308 | } | ||
| 309 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); | ||
| 310 | #ifdef IS31FL3731_I2C_ADDRESS_2 | ||
| 311 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1); | ||
| 312 | #endif | ||
| 313 | update_ticks(); | 303 | update_ticks(); |
| 314 | matrix_init_user(); | 304 | matrix_init_user(); |
| 315 | } | 305 | } |
| @@ -352,10 +342,10 @@ void rgblight_call_driver(rgb_led_t *start_led, uint8_t num_leds) | |||
| 352 | { | 342 | { |
| 353 | if (rgb_state.state != NORMAL) return; | 343 | if (rgb_state.state != NORMAL) return; |
| 354 | 344 | ||
| 355 | for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { | 345 | for (uint8_t i = 0; i < IS31FL3731_LED_COUNT; i++) { |
| 356 | is31fl3731_set_color(i, start_led[i].r, start_led[i].g, start_led[i].b); | 346 | is31fl3731_set_color(i, start_led[i].r, start_led[i].g, start_led[i].b); |
| 357 | } | 347 | } |
| 358 | ws2812_setleds(start_led+RGB_MATRIX_LED_COUNT, 1); | 348 | ws2812_setleds(start_led+IS31FL3731_LED_COUNT, 1); |
| 359 | } | 349 | } |
| 360 | 350 | ||
| 361 | bool led_update_kb(led_t led_state) | 351 | bool led_update_kb(led_t led_state) |
diff --git a/keyboards/novelkeys/nk65/config.h b/keyboards/novelkeys/nk65/config.h index 4dc1ab9165..bbba5cd7d8 100755 --- a/keyboards/novelkeys/nk65/config.h +++ b/keyboards/novelkeys/nk65/config.h | |||
| @@ -53,7 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 53 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | 53 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND |
| 54 | #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA | 54 | #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA |
| 55 | #define IS31FL3733_DRIVER_COUNT 2 | 55 | #define IS31FL3733_DRIVER_COUNT 2 |
| 56 | #define RGB_MATRIX_LED_COUNT 128 | 56 | #define IS31FL3733_LED_COUNT 128 |
| 57 | 57 | ||
| 58 | // These define which keys in the matrix are alphas/mods | 58 | // These define which keys in the matrix are alphas/mods |
| 59 | // Used for backlight effects so colors are different for | 59 | // Used for backlight effects so colors are different for |
diff --git a/keyboards/novelkeys/nk87/config.h b/keyboards/novelkeys/nk87/config.h index 3b3e9309c1..41ecb8a8e3 100755 --- a/keyboards/novelkeys/nk87/config.h +++ b/keyboards/novelkeys/nk87/config.h | |||
| @@ -53,7 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 53 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | 53 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND |
| 54 | #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA | 54 | #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA |
| 55 | #define IS31FL3733_DRIVER_COUNT 2 | 55 | #define IS31FL3733_DRIVER_COUNT 2 |
| 56 | #define RGB_MATRIX_LED_COUNT 128 | 56 | #define IS31FL3733_LED_COUNT 128 |
| 57 | 57 | ||
| 58 | // These define which keys in the matrix are alphas/mods | 58 | // These define which keys in the matrix are alphas/mods |
| 59 | // Used for backlight effects so colors are different for | 59 | // Used for backlight effects so colors are different for |
diff --git a/keyboards/spaceholdings/nebula12/config.h b/keyboards/spaceholdings/nebula12/config.h index 5e4b48927f..512b775136 100755 --- a/keyboards/spaceholdings/nebula12/config.h +++ b/keyboards/spaceholdings/nebula12/config.h | |||
| @@ -75,7 +75,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 75 | 75 | ||
| 76 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 76 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 77 | #define IS31FL3731_DRIVER_COUNT 1 | 77 | #define IS31FL3731_DRIVER_COUNT 1 |
| 78 | #define RGB_MATRIX_LED_COUNT 16 | 78 | #define IS31FL3731_LED_COUNT 16 |
| 79 | 79 | ||
| 80 | // These define which keys in the matrix are alphas/mods | 80 | // These define which keys in the matrix are alphas/mods |
| 81 | // Used for backlight effects so colors are different for | 81 | // Used for backlight effects so colors are different for |
diff --git a/keyboards/spaceholdings/nebula68/config.h b/keyboards/spaceholdings/nebula68/config.h index 0283a4a036..1ad24d364c 100755 --- a/keyboards/spaceholdings/nebula68/config.h +++ b/keyboards/spaceholdings/nebula68/config.h | |||
| @@ -59,7 +59,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 59 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND | 59 | #define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND |
| 60 | #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA | 60 | #define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_GND_SDA |
| 61 | #define IS31FL3733_DRIVER_COUNT 2 | 61 | #define IS31FL3733_DRIVER_COUNT 2 |
| 62 | #define RGB_MATRIX_LED_COUNT 128 | 62 | #define IS31FL3733_LED_COUNT 128 |
| 63 | 63 | ||
| 64 | // These define which keys in the matrix are alphas/mods | 64 | // These define which keys in the matrix are alphas/mods |
| 65 | // Used for backlight effects so colors are different for | 65 | // Used for backlight effects so colors are different for |
diff --git a/keyboards/tkc/portico/config.h b/keyboards/tkc/portico/config.h index 5599f2a36b..2a1056b4a5 100644 --- a/keyboards/tkc/portico/config.h +++ b/keyboards/tkc/portico/config.h | |||
| @@ -51,7 +51,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 51 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 51 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 52 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC | 52 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC |
| 53 | #define IS31FL3731_DRIVER_COUNT 2 | 53 | #define IS31FL3731_DRIVER_COUNT 2 |
| 54 | #define RGB_MATRIX_LED_COUNT 67 | 54 | #define IS31FL3731_LED_COUNT 67 |
| 55 | 55 | ||
| 56 | #define RGB_BACKLIGHT_ENABLED 1 | 56 | #define RGB_BACKLIGHT_ENABLED 1 |
| 57 | 57 | ||
diff --git a/keyboards/tkc/portico/portico.c b/keyboards/tkc/portico/portico.c index bbb09ef8f6..72f8754f6c 100644 --- a/keyboards/tkc/portico/portico.c +++ b/keyboards/tkc/portico/portico.c | |||
| @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 19 | 19 | ||
| 20 | #ifdef RGB_MATRIX_ENABLE | 20 | #ifdef RGB_MATRIX_ENABLE |
| 21 | 21 | ||
| 22 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | 22 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { |
| 23 | { 0, C2_1, C3_1, C4_1 }, | 23 | { 0, C2_1, C3_1, C4_1 }, |
| 24 | { 0, C1_1, C3_2, C4_2 }, | 24 | { 0, C1_1, C3_2, C4_2 }, |
| 25 | { 0, C1_2, C2_2, C4_3 }, | 25 | { 0, C1_2, C2_2, C4_3 }, |
diff --git a/keyboards/tkc/portico75/config.h b/keyboards/tkc/portico75/config.h index 756dfbb54a..3a9b50baca 100644 --- a/keyboards/tkc/portico75/config.h +++ b/keyboards/tkc/portico75/config.h | |||
| @@ -81,7 +81,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 81 | // WT_RGB IS31FL3741 driver code | 81 | // WT_RGB IS31FL3741 driver code |
| 82 | # define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND | 82 | # define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND |
| 83 | # define IS31FL3741_DRIVER_COUNT 1 | 83 | # define IS31FL3741_DRIVER_COUNT 1 |
| 84 | # define RGB_MATRIX_LED_COUNT 98 | 84 | # define IS31FL3741_LED_COUNT 98 |
| 85 | 85 | ||
| 86 | # define RGB_BACKLIGHT_ENABLED 1 | 86 | # define RGB_BACKLIGHT_ENABLED 1 |
| 87 | 87 | ||
diff --git a/keyboards/tkc/portico75/portico75.c b/keyboards/tkc/portico75/portico75.c index 69d6256071..f0751483aa 100644 --- a/keyboards/tkc/portico75/portico75.c +++ b/keyboards/tkc/portico75/portico75.c | |||
| @@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 20 | 20 | ||
| 21 | #ifdef RGB_MATRIX_ENABLE | 21 | #ifdef RGB_MATRIX_ENABLE |
| 22 | 22 | ||
| 23 | const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = { | 23 | const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT] = { |
| 24 | {0, CS18_SW1, CS17_SW1, CS16_SW1}, | 24 | {0, CS18_SW1, CS17_SW1, CS16_SW1}, |
| 25 | {0, CS18_SW2, CS17_SW2, CS16_SW2}, | 25 | {0, CS18_SW2, CS17_SW2, CS16_SW2}, |
| 26 | {0, CS18_SW3, CS17_SW3, CS16_SW3}, | 26 | {0, CS18_SW3, CS17_SW3, CS16_SW3}, |
diff --git a/keyboards/wilba_tech/rama_works_kara/config.h b/keyboards/wilba_tech/rama_works_kara/config.h index 5d8c9df820..09aac7a552 100644 --- a/keyboards/wilba_tech/rama_works_kara/config.h +++ b/keyboards/wilba_tech/rama_works_kara/config.h | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 19 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 20 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | 20 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA |
| 21 | #define IS31FL3731_DRIVER_COUNT 2 | 21 | #define IS31FL3731_DRIVER_COUNT 2 |
| 22 | #define RGB_MATRIX_LED_COUNT 72 | 22 | #define IS31FL3731_LED_COUNT 72 |
| 23 | 23 | ||
| 24 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap | 24 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap |
| 25 | #define LOCKING_SUPPORT_ENABLE | 25 | #define LOCKING_SUPPORT_ENABLE |
diff --git a/keyboards/wilba_tech/rama_works_koyu/config.h b/keyboards/wilba_tech/rama_works_koyu/config.h index aad4cd12ac..512cff857b 100644 --- a/keyboards/wilba_tech/rama_works_koyu/config.h +++ b/keyboards/wilba_tech/rama_works_koyu/config.h | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 19 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 20 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | 20 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA |
| 21 | #define IS31FL3731_DRIVER_COUNT 2 | 21 | #define IS31FL3731_DRIVER_COUNT 2 |
| 22 | #define RGB_MATRIX_LED_COUNT 72 | 22 | #define IS31FL3731_LED_COUNT 72 |
| 23 | 23 | ||
| 24 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap | 24 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap |
| 25 | #define LOCKING_SUPPORT_ENABLE | 25 | #define LOCKING_SUPPORT_ENABLE |
diff --git a/keyboards/wilba_tech/rama_works_m10_c/config.h b/keyboards/wilba_tech/rama_works_m10_c/config.h index 529896f6ed..1e0d943b96 100644 --- a/keyboards/wilba_tech/rama_works_m10_c/config.h +++ b/keyboards/wilba_tech/rama_works_m10_c/config.h | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | // IS31FL3731 driver | 23 | // IS31FL3731 driver |
| 24 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 24 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 25 | #define IS31FL3731_DRIVER_COUNT 1 | 25 | #define IS31FL3731_DRIVER_COUNT 1 |
| 26 | #define RGB_MATRIX_LED_COUNT 12 | 26 | #define IS31FL3731_LED_COUNT 12 |
| 27 | 27 | ||
| 28 | // Enable WT RGB backlight | 28 | // Enable WT RGB backlight |
| 29 | #define RGB_BACKLIGHT_ENABLED 1 | 29 | #define RGB_BACKLIGHT_ENABLED 1 |
diff --git a/keyboards/wilba_tech/rama_works_m50_a/config.h b/keyboards/wilba_tech/rama_works_m50_a/config.h index 599550b91f..98149ffa14 100644 --- a/keyboards/wilba_tech/rama_works_m50_a/config.h +++ b/keyboards/wilba_tech/rama_works_m50_a/config.h | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 24 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 25 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | 25 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA |
| 26 | #define IS31FL3731_DRIVER_COUNT 2 | 26 | #define IS31FL3731_DRIVER_COUNT 2 |
| 27 | #define RGB_MATRIX_LED_COUNT 72 | 27 | #define IS31FL3731_LED_COUNT 72 |
| 28 | 28 | ||
| 29 | // Enable WT RGB backlight | 29 | // Enable WT RGB backlight |
| 30 | #define RGB_BACKLIGHT_ENABLED 1 | 30 | #define RGB_BACKLIGHT_ENABLED 1 |
diff --git a/keyboards/wilba_tech/rama_works_m60_a/config.h b/keyboards/wilba_tech/rama_works_m60_a/config.h index bc7d7e6128..c291ba2db3 100644 --- a/keyboards/wilba_tech/rama_works_m60_a/config.h +++ b/keyboards/wilba_tech/rama_works_m60_a/config.h | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 19 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 20 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | 20 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA |
| 21 | #define IS31FL3731_DRIVER_COUNT 2 | 21 | #define IS31FL3731_DRIVER_COUNT 2 |
| 22 | #define RGB_MATRIX_LED_COUNT 72 | 22 | #define IS31FL3731_LED_COUNT 72 |
| 23 | 23 | ||
| 24 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap | 24 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap |
| 25 | #define LOCKING_SUPPORT_ENABLE | 25 | #define LOCKING_SUPPORT_ENABLE |
diff --git a/keyboards/wilba_tech/rama_works_m65_b/config.h b/keyboards/wilba_tech/rama_works_m65_b/config.h index b3e381d77d..9807fbc874 100644 --- a/keyboards/wilba_tech/rama_works_m65_b/config.h +++ b/keyboards/wilba_tech/rama_works_m65_b/config.h | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 24 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 25 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | 25 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA |
| 26 | #define IS31FL3731_DRIVER_COUNT 2 | 26 | #define IS31FL3731_DRIVER_COUNT 2 |
| 27 | #define RGB_MATRIX_LED_COUNT 72 | 27 | #define IS31FL3731_LED_COUNT 72 |
| 28 | 28 | ||
| 29 | // Enable WT RGB backlight | 29 | // Enable WT RGB backlight |
| 30 | #define RGB_BACKLIGHT_ENABLED 1 | 30 | #define RGB_BACKLIGHT_ENABLED 1 |
diff --git a/keyboards/wilba_tech/rama_works_m65_bx/config.h b/keyboards/wilba_tech/rama_works_m65_bx/config.h index 8070e917d7..64da89ff9e 100644 --- a/keyboards/wilba_tech/rama_works_m65_bx/config.h +++ b/keyboards/wilba_tech/rama_works_m65_bx/config.h | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 24 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 25 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | 25 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA |
| 26 | #define IS31FL3731_DRIVER_COUNT 2 | 26 | #define IS31FL3731_DRIVER_COUNT 2 |
| 27 | #define RGB_MATRIX_LED_COUNT 72 | 27 | #define IS31FL3731_LED_COUNT 72 |
| 28 | 28 | ||
| 29 | // Enable WT RGB backlight | 29 | // Enable WT RGB backlight |
| 30 | #define RGB_BACKLIGHT_ENABLED 1 | 30 | #define RGB_BACKLIGHT_ENABLED 1 |
diff --git a/keyboards/wilba_tech/rama_works_m6_b/config.h b/keyboards/wilba_tech/rama_works_m6_b/config.h index 27a5e72c04..112cd500be 100644 --- a/keyboards/wilba_tech/rama_works_m6_b/config.h +++ b/keyboards/wilba_tech/rama_works_m6_b/config.h | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | /* Locking resynchronize hack */ | 20 | /* Locking resynchronize hack */ |
| 21 | #define LOCKING_RESYNC_ENABLE | 21 | #define LOCKING_RESYNC_ENABLE |
| 22 | 22 | ||
| 23 | #define RGB_MATRIX_LED_COUNT 6 | 23 | #define IS31FL3218_LED_COUNT 6 |
| 24 | 24 | ||
| 25 | #define RGB_BACKLIGHT_ENABLED 1 | 25 | #define RGB_BACKLIGHT_ENABLED 1 |
| 26 | 26 | ||
diff --git a/keyboards/wilba_tech/rama_works_u80_a/config.h b/keyboards/wilba_tech/rama_works_u80_a/config.h index 4ab2d53c3c..2a0da80fed 100644 --- a/keyboards/wilba_tech/rama_works_u80_a/config.h +++ b/keyboards/wilba_tech/rama_works_u80_a/config.h | |||
| @@ -42,7 +42,7 @@ | |||
| 42 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | 42 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA |
| 43 | #define IS31FL3731_I2C_ADDRESS_3 IS31FL3731_I2C_ADDRESS_SCL | 43 | #define IS31FL3731_I2C_ADDRESS_3 IS31FL3731_I2C_ADDRESS_SCL |
| 44 | #define IS31FL3731_DRIVER_COUNT 3 | 44 | #define IS31FL3731_DRIVER_COUNT 3 |
| 45 | #define RGB_MATRIX_LED_COUNT 108 | 45 | #define IS31FL3731_LED_COUNT 108 |
| 46 | 46 | ||
| 47 | #define RGB_BACKLIGHT_ENABLED 1 | 47 | #define RGB_BACKLIGHT_ENABLED 1 |
| 48 | 48 | ||
diff --git a/keyboards/wilba_tech/wt60_a/config.h b/keyboards/wilba_tech/wt60_a/config.h index c9d448fbb8..25a6f25a1c 100644 --- a/keyboards/wilba_tech/wt60_a/config.h +++ b/keyboards/wilba_tech/wt60_a/config.h | |||
| @@ -64,4 +64,4 @@ | |||
| 64 | 64 | ||
| 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND |
| 66 | #define IS31FL3736_DRIVER_COUNT 1 | 66 | #define IS31FL3736_DRIVER_COUNT 1 |
| 67 | #define LED_MATRIX_LED_COUNT 96 | 67 | #define IS31FL3736_LED_COUNT 96 |
diff --git a/keyboards/wilba_tech/wt60_b/config.h b/keyboards/wilba_tech/wt60_b/config.h index c5fb1b32c7..926136f332 100644 --- a/keyboards/wilba_tech/wt60_b/config.h +++ b/keyboards/wilba_tech/wt60_b/config.h | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 26 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 27 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | 27 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA |
| 28 | #define IS31FL3731_DRIVER_COUNT 2 | 28 | #define IS31FL3731_DRIVER_COUNT 2 |
| 29 | #define RGB_MATRIX_LED_COUNT 72 | 29 | #define IS31FL3731_LED_COUNT 72 |
| 30 | 30 | ||
| 31 | #define RGB_BACKLIGHT_ENABLED 1 | 31 | #define RGB_BACKLIGHT_ENABLED 1 |
| 32 | 32 | ||
diff --git a/keyboards/wilba_tech/wt60_bx/config.h b/keyboards/wilba_tech/wt60_bx/config.h index f87d9ff48e..85ab052437 100644 --- a/keyboards/wilba_tech/wt60_bx/config.h +++ b/keyboards/wilba_tech/wt60_bx/config.h | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 26 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 27 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | 27 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA |
| 28 | #define IS31FL3731_DRIVER_COUNT 2 | 28 | #define IS31FL3731_DRIVER_COUNT 2 |
| 29 | #define RGB_MATRIX_LED_COUNT 72 | 29 | #define IS31FL3731_LED_COUNT 72 |
| 30 | 30 | ||
| 31 | #define RGB_BACKLIGHT_ENABLED 1 | 31 | #define RGB_BACKLIGHT_ENABLED 1 |
| 32 | 32 | ||
diff --git a/keyboards/wilba_tech/wt60_c/config.h b/keyboards/wilba_tech/wt60_c/config.h index 4a1b8b6ad2..ca7366bc32 100644 --- a/keyboards/wilba_tech/wt60_c/config.h +++ b/keyboards/wilba_tech/wt60_c/config.h | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 26 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 27 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | 27 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA |
| 28 | #define IS31FL3731_DRIVER_COUNT 2 | 28 | #define IS31FL3731_DRIVER_COUNT 2 |
| 29 | #define RGB_MATRIX_LED_COUNT 72 | 29 | #define IS31FL3731_LED_COUNT 72 |
| 30 | 30 | ||
| 31 | #define RGB_BACKLIGHT_ENABLED 1 | 31 | #define RGB_BACKLIGHT_ENABLED 1 |
| 32 | 32 | ||
diff --git a/keyboards/wilba_tech/wt65_a/config.h b/keyboards/wilba_tech/wt65_a/config.h index 04d607e77a..88f28ac844 100644 --- a/keyboards/wilba_tech/wt65_a/config.h +++ b/keyboards/wilba_tech/wt65_a/config.h | |||
| @@ -64,4 +64,4 @@ | |||
| 64 | 64 | ||
| 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND |
| 66 | #define IS31FL3736_DRIVER_COUNT 1 | 66 | #define IS31FL3736_DRIVER_COUNT 1 |
| 67 | #define LED_MATRIX_LED_COUNT 96 | 67 | #define IS31FL3736_LED_COUNT 96 |
diff --git a/keyboards/wilba_tech/wt65_b/config.h b/keyboards/wilba_tech/wt65_b/config.h index 780b3c80c4..164caecd00 100644 --- a/keyboards/wilba_tech/wt65_b/config.h +++ b/keyboards/wilba_tech/wt65_b/config.h | |||
| @@ -64,4 +64,4 @@ | |||
| 64 | 64 | ||
| 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND |
| 66 | #define IS31FL3736_DRIVER_COUNT 1 | 66 | #define IS31FL3736_DRIVER_COUNT 1 |
| 67 | #define LED_MATRIX_LED_COUNT 96 | 67 | #define IS31FL3736_LED_COUNT 96 |
diff --git a/keyboards/wilba_tech/wt75_a/config.h b/keyboards/wilba_tech/wt75_a/config.h index 29399e148a..a8185a6807 100644 --- a/keyboards/wilba_tech/wt75_a/config.h +++ b/keyboards/wilba_tech/wt75_a/config.h | |||
| @@ -64,4 +64,4 @@ | |||
| 64 | 64 | ||
| 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND |
| 66 | #define IS31FL3736_DRIVER_COUNT 1 | 66 | #define IS31FL3736_DRIVER_COUNT 1 |
| 67 | #define LED_MATRIX_LED_COUNT 96 | 67 | #define IS31FL3736_LED_COUNT 96 |
diff --git a/keyboards/wilba_tech/wt75_b/config.h b/keyboards/wilba_tech/wt75_b/config.h index 71ca6891ca..4834251691 100644 --- a/keyboards/wilba_tech/wt75_b/config.h +++ b/keyboards/wilba_tech/wt75_b/config.h | |||
| @@ -64,4 +64,4 @@ | |||
| 64 | 64 | ||
| 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND |
| 66 | #define IS31FL3736_DRIVER_COUNT 1 | 66 | #define IS31FL3736_DRIVER_COUNT 1 |
| 67 | #define LED_MATRIX_LED_COUNT 96 | 67 | #define IS31FL3736_LED_COUNT 96 |
diff --git a/keyboards/wilba_tech/wt75_c/config.h b/keyboards/wilba_tech/wt75_c/config.h index b404dccfbb..d1e81992f5 100644 --- a/keyboards/wilba_tech/wt75_c/config.h +++ b/keyboards/wilba_tech/wt75_c/config.h | |||
| @@ -64,4 +64,4 @@ | |||
| 64 | 64 | ||
| 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND |
| 66 | #define IS31FL3736_DRIVER_COUNT 1 | 66 | #define IS31FL3736_DRIVER_COUNT 1 |
| 67 | #define LED_MATRIX_LED_COUNT 96 | 67 | #define IS31FL3736_LED_COUNT 96 |
diff --git a/keyboards/wilba_tech/wt80_a/config.h b/keyboards/wilba_tech/wt80_a/config.h index a1f8fbdef6..c6594c1689 100644 --- a/keyboards/wilba_tech/wt80_a/config.h +++ b/keyboards/wilba_tech/wt80_a/config.h | |||
| @@ -64,4 +64,4 @@ | |||
| 64 | 64 | ||
| 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND | 65 | #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND |
| 66 | #define IS31FL3736_DRIVER_COUNT 1 | 66 | #define IS31FL3736_DRIVER_COUNT 1 |
| 67 | #define LED_MATRIX_LED_COUNT 96 | 67 | #define IS31FL3736_LED_COUNT 96 |
diff --git a/keyboards/wilba_tech/wt_mono_backlight.c b/keyboards/wilba_tech/wt_mono_backlight.c index 4add18b14e..e218f0af4b 100644 --- a/keyboards/wilba_tech/wt_mono_backlight.c +++ b/keyboards/wilba_tech/wt_mono_backlight.c | |||
| @@ -50,7 +50,7 @@ backlight_config g_config = { | |||
| 50 | .color_1 = MONO_BACKLIGHT_COLOR_1, | 50 | .color_1 = MONO_BACKLIGHT_COLOR_1, |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | const is31fl3736_led_t PROGMEM g_is31fl3736_leds[LED_MATRIX_LED_COUNT] = { | 53 | const is31fl3736_led_t PROGMEM g_is31fl3736_leds[IS31FL3736_LED_COUNT] = { |
| 54 | {0, A_1}, | 54 | {0, A_1}, |
| 55 | {0, A_2}, | 55 | {0, A_2}, |
| 56 | {0, A_3}, | 56 | {0, A_3}, |
| @@ -170,14 +170,7 @@ uint32_t g_any_key_hit = 0; | |||
| 170 | 170 | ||
| 171 | void backlight_init_drivers(void) | 171 | void backlight_init_drivers(void) |
| 172 | { | 172 | { |
| 173 | // Initialize I2C | 173 | is31fl3736_init_drivers(); |
| 174 | i2c_init(); | ||
| 175 | is31fl3736_init( IS31FL3736_I2C_ADDRESS_1 ); | ||
| 176 | |||
| 177 | for ( uint8_t index = 0; index < 96; index++ ) { | ||
| 178 | is31fl3736_set_led_control_register( index, true ); | ||
| 179 | } | ||
| 180 | is31fl3736_update_led_control_registers( IS31FL3736_I2C_ADDRESS_1, 0 ); | ||
| 181 | } | 174 | } |
| 182 | 175 | ||
| 183 | void backlight_set_key_hit(uint8_t row, uint8_t column) | 176 | void backlight_set_key_hit(uint8_t row, uint8_t column) |
diff --git a/keyboards/wilba_tech/wt_rgb_backlight.c b/keyboards/wilba_tech/wt_rgb_backlight.c index 1c865deecf..8bd04c840f 100644 --- a/keyboards/wilba_tech/wt_rgb_backlight.c +++ b/keyboards/wilba_tech/wt_rgb_backlight.c | |||
| @@ -157,7 +157,7 @@ uint32_t g_any_key_hit = 0; | |||
| 157 | #if defined(RGB_BACKLIGHT_HS60) | 157 | #if defined(RGB_BACKLIGHT_HS60) |
| 158 | #define ISSI_ADDR_1 IS31FL3733_I2C_ADDRESS_GND_GND | 158 | #define ISSI_ADDR_1 IS31FL3733_I2C_ADDRESS_GND_GND |
| 159 | 159 | ||
| 160 | const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = { | 160 | const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = { |
| 161 | /* Refer to IS31 manual for these locations | 161 | /* Refer to IS31 manual for these locations |
| 162 | * driver | 162 | * driver |
| 163 | * | R location | 163 | * | R location |
| @@ -234,7 +234,7 @@ const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = { | |||
| 234 | #define ISSI_ADDR_1 IS31FL3733_I2C_ADDRESS_GND_GND | 234 | #define ISSI_ADDR_1 IS31FL3733_I2C_ADDRESS_GND_GND |
| 235 | #define ISSI_ADDR_2 IS31FL3733_I2C_ADDRESS_GND_SDA | 235 | #define ISSI_ADDR_2 IS31FL3733_I2C_ADDRESS_GND_SDA |
| 236 | 236 | ||
| 237 | const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = { | 237 | const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = { |
| 238 | /* Refer to IS31 manual for these locations | 238 | /* Refer to IS31 manual for these locations |
| 239 | * driver | 239 | * driver |
| 240 | * | R location | 240 | * | R location |
| @@ -375,7 +375,7 @@ const is31fl3733_led_t PROGMEM g_is31fl3733_leds[RGB_MATRIX_LED_COUNT] = { | |||
| 375 | #elif defined(RGB_BACKLIGHT_NEBULA12) | 375 | #elif defined(RGB_BACKLIGHT_NEBULA12) |
| 376 | #define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND | 376 | #define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND |
| 377 | 377 | ||
| 378 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | 378 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { |
| 379 | /* Refer to IS31 manual for these locations | 379 | /* Refer to IS31 manual for these locations |
| 380 | * driver | 380 | * driver |
| 381 | * | R location | 381 | * | R location |
| @@ -406,7 +406,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | |||
| 406 | #define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA | 406 | #define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA |
| 407 | #define ISSI_ADDR_3 IS31FL3731_I2C_ADDRESS_SCL | 407 | #define ISSI_ADDR_3 IS31FL3731_I2C_ADDRESS_SCL |
| 408 | 408 | ||
| 409 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | 409 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { |
| 410 | /* Refer to IS31 manual for these locations | 410 | /* Refer to IS31 manual for these locations |
| 411 | * driver | 411 | * driver |
| 412 | * | R location | 412 | * | R location |
| @@ -531,7 +531,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | |||
| 531 | #define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND | 531 | #define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND |
| 532 | #define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA | 532 | #define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA |
| 533 | 533 | ||
| 534 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | 534 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { |
| 535 | /* Refer to IS31 manual for these locations | 535 | /* Refer to IS31 manual for these locations |
| 536 | * driver | 536 | * driver |
| 537 | * | R location | 537 | * | R location |
| @@ -610,7 +610,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | |||
| 610 | #define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND | 610 | #define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND |
| 611 | #define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_VCC | 611 | #define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_VCC |
| 612 | 612 | ||
| 613 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | 613 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { |
| 614 | /* Refer to IS31 manual for these locations | 614 | /* Refer to IS31 manual for these locations |
| 615 | * driver | 615 | * driver |
| 616 | * | R location | 616 | * | R location |
| @@ -694,7 +694,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | |||
| 694 | #define ISSI_ADDR_1 IS31FL3741_I2C_ADDRESS_GND | 694 | #define ISSI_ADDR_1 IS31FL3741_I2C_ADDRESS_GND |
| 695 | #define ISSI_ADDR_2 | 695 | #define ISSI_ADDR_2 |
| 696 | 696 | ||
| 697 | const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = { | 697 | const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT] = { |
| 698 | /* Refer to IS31 manual for these locations | 698 | /* Refer to IS31 manual for these locations |
| 699 | * driver | 699 | * driver |
| 700 | * | R location | 700 | * | R location |
| @@ -817,7 +817,7 @@ const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = { | |||
| 817 | }; | 817 | }; |
| 818 | 818 | ||
| 819 | #elif defined(RGB_BACKLIGHT_M6_B) | 819 | #elif defined(RGB_BACKLIGHT_M6_B) |
| 820 | const is31fl3218_led_t PROGMEM g_is31fl3218_leds[RGB_MATRIX_LED_COUNT] = { | 820 | const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT] = { |
| 821 | {OUT1, OUT2, OUT3}, | 821 | {OUT1, OUT2, OUT3}, |
| 822 | {OUT4, OUT5, OUT6}, | 822 | {OUT4, OUT5, OUT6}, |
| 823 | {OUT7, OUT8, OUT9}, | 823 | {OUT7, OUT8, OUT9}, |
| @@ -829,7 +829,7 @@ const is31fl3218_led_t PROGMEM g_is31fl3218_leds[RGB_MATRIX_LED_COUNT] = { | |||
| 829 | #define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND | 829 | #define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND |
| 830 | #define ISSI_ADDR_2 | 830 | #define ISSI_ADDR_2 |
| 831 | 831 | ||
| 832 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | 832 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { |
| 833 | {0, C1_9, C3_10, C4_10}, // LB1 | 833 | {0, C1_9, C3_10, C4_10}, // LB1 |
| 834 | {0, C1_10, C2_10, C4_11}, // LB2 | 834 | {0, C1_10, C2_10, C4_11}, // LB2 |
| 835 | {0, C1_11, C2_11, C3_11}, // LB3 | 835 | {0, C1_11, C2_11, C3_11}, // LB3 |
| @@ -847,7 +847,7 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | |||
| 847 | #define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND | 847 | #define ISSI_ADDR_1 IS31FL3731_I2C_ADDRESS_GND |
| 848 | #define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA | 848 | #define ISSI_ADDR_2 IS31FL3731_I2C_ADDRESS_SDA |
| 849 | 849 | ||
| 850 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | 850 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { |
| 851 | /* Refer to IS31 manual for these locations | 851 | /* Refer to IS31 manual for these locations |
| 852 | * driver | 852 | * driver |
| 853 | * | R location | 853 | * | R location |
| @@ -1817,12 +1817,12 @@ void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) | |||
| 1817 | is31fl3733_set_color( index, red, green, blue ); | 1817 | is31fl3733_set_color( index, red, green, blue ); |
| 1818 | } | 1818 | } |
| 1819 | #elif defined(RGB_BACKLIGHT_DAWN60) | 1819 | #elif defined(RGB_BACKLIGHT_DAWN60) |
| 1820 | if( index < RGB_MATRIX_LED_COUNT ) { | 1820 | if( index < IS31FL3731_LED_COUNT ) { |
| 1821 | is31fl3731_set_color( index, red, green, blue ); | 1821 | is31fl3731_set_color( index, red, green, blue ); |
| 1822 | } else { | 1822 | } else { |
| 1823 | g_ws2812_leds[index - RGB_MATRIX_LED_COUNT].r = red; | 1823 | g_ws2812_leds[index - IS31FL3731_LED_COUNT].r = red; |
| 1824 | g_ws2812_leds[index - RGB_MATRIX_LED_COUNT].g = green; | 1824 | g_ws2812_leds[index - IS31FL3731_LED_COUNT].g = green; |
| 1825 | g_ws2812_leds[index - RGB_MATRIX_LED_COUNT].b = blue; | 1825 | g_ws2812_leds[index - IS31FL3731_LED_COUNT].b = blue; |
| 1826 | ws2812_setleds(g_ws2812_leds, WS2812_LED_TOTAL); | 1826 | ws2812_setleds(g_ws2812_leds, WS2812_LED_TOTAL); |
| 1827 | } | 1827 | } |
| 1828 | #else | 1828 | #else |
| @@ -2111,9 +2111,9 @@ void backlight_effect_alphas_mods(void) | |||
| 2111 | for (int i = 0; i < WS2812_LED_TOTAL; i++) { | 2111 | for (int i = 0; i < WS2812_LED_TOTAL; i++) { |
| 2112 | if ((RGB_UNDERGLOW_ALPHA_TOP_START <= i && i <= RGB_UNDERGLOW_ALPHA_TOP_END) || | 2112 | if ((RGB_UNDERGLOW_ALPHA_TOP_START <= i && i <= RGB_UNDERGLOW_ALPHA_TOP_END) || |
| 2113 | (RGB_UNDERGLOW_ALPHA_BOT_START <= i && i <= RGB_UNDERGLOW_ALPHA_BOT_END)) { | 2113 | (RGB_UNDERGLOW_ALPHA_BOT_START <= i && i <= RGB_UNDERGLOW_ALPHA_BOT_END)) { |
| 2114 | backlight_set_color(i + RGB_MATRIX_LED_COUNT, rgb1.r, rgb1.g, rgb1.b); | 2114 | backlight_set_color(i + IS31FL3731_LED_COUNT, rgb1.r, rgb1.g, rgb1.b); |
| 2115 | } else { | 2115 | } else { |
| 2116 | backlight_set_color(i + RGB_MATRIX_LED_COUNT, rgb2.r, rgb2.g, rgb2.b); | 2116 | backlight_set_color(i + IS31FL3731_LED_COUNT, rgb2.r, rgb2.g, rgb2.b); |
| 2117 | } | 2117 | } |
| 2118 | } | 2118 | } |
| 2119 | #endif | 2119 | #endif |
| @@ -2902,7 +2902,7 @@ void backlight_init_drivers(void) | |||
| 2902 | #if defined(RGB_BACKLIGHT_M6_B) | 2902 | #if defined(RGB_BACKLIGHT_M6_B) |
| 2903 | is31fl3218_init(); | 2903 | is31fl3218_init(); |
| 2904 | 2904 | ||
| 2905 | for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ ) | 2905 | for ( int index = 0; index < IS31FL3218_LED_COUNT; index++ ) |
| 2906 | { | 2906 | { |
| 2907 | bool enabled = true; | 2907 | bool enabled = true; |
| 2908 | 2908 | ||
| @@ -2913,9 +2913,9 @@ void backlight_init_drivers(void) | |||
| 2913 | // This actually updates the LED drivers | 2913 | // This actually updates the LED drivers |
| 2914 | is31fl3218_update_led_control_registers(); | 2914 | is31fl3218_update_led_control_registers(); |
| 2915 | #elif defined(RGB_BACKLIGHT_HS60) | 2915 | #elif defined(RGB_BACKLIGHT_HS60) |
| 2916 | is31fl3733_init( ISSI_ADDR_1, 0 ); | 2916 | is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE ); |
| 2917 | 2917 | ||
| 2918 | for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ ) | 2918 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) |
| 2919 | { | 2919 | { |
| 2920 | #if defined(HS60_ANSI) | 2920 | #if defined(HS60_ANSI) |
| 2921 | bool enabled = !( ( index == 48-1 ) || //LA48 | 2921 | bool enabled = !( ( index == 48-1 ) || //LA48 |
| @@ -2934,10 +2934,10 @@ void backlight_init_drivers(void) | |||
| 2934 | // This actually updates the LED drivers | 2934 | // This actually updates the LED drivers |
| 2935 | is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 ); | 2935 | is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 ); |
| 2936 | #elif defined(RGB_BACKLIGHT_NK65) | 2936 | #elif defined(RGB_BACKLIGHT_NK65) |
| 2937 | is31fl3733_init( ISSI_ADDR_1, 0 ); | 2937 | is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE ); |
| 2938 | is31fl3733_init( ISSI_ADDR_2, 0 ); | 2938 | is31fl3733_init( ISSI_ADDR_2, IS31FL3733_SYNC_NONE ); |
| 2939 | 2939 | ||
| 2940 | for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ ) | 2940 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) |
| 2941 | { | 2941 | { |
| 2942 | bool enabled = !( ( index == 61-1 ) || //LA61 | 2942 | bool enabled = !( ( index == 61-1 ) || //LA61 |
| 2943 | ( index > 6+64-1 ) ); //LB7-LB64 | 2943 | ( index > 6+64-1 ) ); //LB7-LB64 |
| @@ -2949,10 +2949,10 @@ void backlight_init_drivers(void) | |||
| 2949 | is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 ); | 2949 | is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 ); |
| 2950 | is31fl3733_update_led_control_registers( ISSI_ADDR_2, 1 ); | 2950 | is31fl3733_update_led_control_registers( ISSI_ADDR_2, 1 ); |
| 2951 | #elif defined(RGB_BACKLIGHT_NK87) | 2951 | #elif defined(RGB_BACKLIGHT_NK87) |
| 2952 | is31fl3733_init( ISSI_ADDR_1, 0 ); | 2952 | is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE ); |
| 2953 | is31fl3733_init( ISSI_ADDR_2, 0 ); | 2953 | is31fl3733_init( ISSI_ADDR_2, IS31FL3733_SYNC_NONE ); |
| 2954 | 2954 | ||
| 2955 | for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ ) | 2955 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) |
| 2956 | { | 2956 | { |
| 2957 | bool enabled = !( ( index == 61-1 ) || //LA61 | 2957 | bool enabled = !( ( index == 61-1 ) || //LA61 |
| 2958 | ( (index >= 2+64-1) && (index <= 4+64-1) ) || | 2958 | ( (index >= 2+64-1) && (index <= 4+64-1) ) || |
| @@ -2979,10 +2979,10 @@ void backlight_init_drivers(void) | |||
| 2979 | is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 ); | 2979 | is31fl3733_update_led_control_registers( ISSI_ADDR_1, 0 ); |
| 2980 | is31fl3733_update_led_control_registers( ISSI_ADDR_2, 1 ); | 2980 | is31fl3733_update_led_control_registers( ISSI_ADDR_2, 1 ); |
| 2981 | #elif defined(RGB_BACKLIGHT_NEBULA68) | 2981 | #elif defined(RGB_BACKLIGHT_NEBULA68) |
| 2982 | is31fl3733_init( ISSI_ADDR_1, 0 ); | 2982 | is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE ); |
| 2983 | is31fl3733_init( ISSI_ADDR_2, 0 ); | 2983 | is31fl3733_init( ISSI_ADDR_2, IS31FL3733_SYNC_NONE ); |
| 2984 | 2984 | ||
| 2985 | for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ ) | 2985 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) |
| 2986 | { | 2986 | { |
| 2987 | bool enabled = !( ( index == 61-1 ) || //LA61 | 2987 | bool enabled = !( ( index == 61-1 ) || //LA61 |
| 2988 | ( index > 5+64-1 ) ); //LB6-LB64 | 2988 | ( index > 5+64-1 ) ); //LB6-LB64 |
| @@ -2995,17 +2995,17 @@ void backlight_init_drivers(void) | |||
| 2995 | #elif defined(RGB_BACKLIGHT_PORTICO75) | 2995 | #elif defined(RGB_BACKLIGHT_PORTICO75) |
| 2996 | is31fl3741_init( ISSI_ADDR_1 ); | 2996 | is31fl3741_init( ISSI_ADDR_1 ); |
| 2997 | bool enabled = true; | 2997 | bool enabled = true; |
| 2998 | for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ ) | 2998 | for ( int index = 0; index < IS31FL3741_LED_COUNT; index++ ) |
| 2999 | { | 2999 | { |
| 3000 | is31fl3741_set_led_control_register( index, enabled, enabled, enabled ); | 3000 | is31fl3741_set_led_control_register( index, enabled, enabled, enabled ); |
| 3001 | } | 3001 | } |
| 3002 | // This actually updates the LED drivers | 3002 | // This actually updates the LED drivers |
| 3003 | is31fl3741_update_led_control_registers( ISSI_ADDR_1, 0 ); | 3003 | is31fl3741_update_led_control_registers( ISSI_ADDR_1, 0 ); |
| 3004 | #elif defined(RGB_BACKLIGHT_KW_MEGA) | 3004 | #elif defined(RGB_BACKLIGHT_KW_MEGA) |
| 3005 | is31fl3733_init( ISSI_ADDR_1, 0 ); | 3005 | is31fl3733_init( ISSI_ADDR_1, IS31FL3733_SYNC_NONE ); |
| 3006 | is31fl3733_init( ISSI_ADDR_2, 0 ); | 3006 | is31fl3733_init( ISSI_ADDR_2, IS31FL3733_SYNC_NONE ); |
| 3007 | 3007 | ||
| 3008 | for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ ) | 3008 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) |
| 3009 | { | 3009 | { |
| 3010 | bool enabled = !( ( index == 61-1 ) || //LA61 | 3010 | bool enabled = !( ( index == 61-1 ) || //LA61 |
| 3011 | ( index > 6+64-1 ) ); //LB7-LB64 | 3011 | ( index > 6+64-1 ) ); //LB7-LB64 |
| @@ -3032,7 +3032,7 @@ void backlight_init_drivers(void) | |||
| 3032 | bool disable_spacebar_stab_leds = false; | 3032 | bool disable_spacebar_stab_leds = false; |
| 3033 | #endif | 3033 | #endif |
| 3034 | 3034 | ||
| 3035 | for ( int index = 0; index < RGB_MATRIX_LED_COUNT; index++ ) | 3035 | for ( int index = 0; index < BACKLIGHT_LED_COUNT; index++ ) |
| 3036 | { | 3036 | { |
| 3037 | // OR the possible "disabled" cases together, then NOT the result to get the enabled state | 3037 | // OR the possible "disabled" cases together, then NOT the result to get the enabled state |
| 3038 | // LC6 LD13 not present on Zeal65 | 3038 | // LC6 LD13 not present on Zeal65 |
diff --git a/keyboards/wilba_tech/zeal60/config.h b/keyboards/wilba_tech/zeal60/config.h index 3233c6187d..830dd6d78a 100644 --- a/keyboards/wilba_tech/zeal60/config.h +++ b/keyboards/wilba_tech/zeal60/config.h | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 19 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 20 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | 20 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA |
| 21 | #define IS31FL3731_DRIVER_COUNT 2 | 21 | #define IS31FL3731_DRIVER_COUNT 2 |
| 22 | #define RGB_MATRIX_LED_COUNT 72 | 22 | #define IS31FL3731_LED_COUNT 72 |
| 23 | 23 | ||
| 24 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap | 24 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap |
| 25 | #define LOCKING_SUPPORT_ENABLE | 25 | #define LOCKING_SUPPORT_ENABLE |
diff --git a/keyboards/wilba_tech/zeal65/config.h b/keyboards/wilba_tech/zeal65/config.h index 1046ee8108..a7d1b81f84 100644 --- a/keyboards/wilba_tech/zeal65/config.h +++ b/keyboards/wilba_tech/zeal65/config.h | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 19 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 20 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | 20 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA |
| 21 | #define IS31FL3731_DRIVER_COUNT 2 | 21 | #define IS31FL3731_DRIVER_COUNT 2 |
| 22 | #define RGB_MATRIX_LED_COUNT 72 | 22 | #define IS31FL3731_LED_COUNT 72 |
| 23 | 23 | ||
| 24 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap | 24 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap |
| 25 | #define LOCKING_SUPPORT_ENABLE | 25 | #define LOCKING_SUPPORT_ENABLE |
diff --git a/keyboards/xelus/dawn60/rev1/config.h b/keyboards/xelus/dawn60/rev1/config.h index c7945df3d6..a2a127f0a4 100644 --- a/keyboards/xelus/dawn60/rev1/config.h +++ b/keyboards/xelus/dawn60/rev1/config.h | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND | 19 | #define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND |
| 20 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA | 20 | #define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA |
| 21 | #define IS31FL3731_DRIVER_COUNT 2 | 21 | #define IS31FL3731_DRIVER_COUNT 2 |
| 22 | #define RGB_MATRIX_LED_COUNT 64 | 22 | #define IS31FL3731_LED_COUNT 64 |
| 23 | 23 | ||
| 24 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap | 24 | // Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap |
| 25 | #define LOCKING_SUPPORT_ENABLE | 25 | #define LOCKING_SUPPORT_ENABLE |
diff --git a/keyboards/xelus/dawn60/rev1_qmk/config.h b/keyboards/xelus/dawn60/rev1_qmk/config.h index 33629a8ef3..e0ffe30843 100644 --- a/keyboards/xelus/dawn60/rev1_qmk/config.h +++ b/keyboards/xelus/dawn60/rev1_qmk/config.h | |||
| @@ -30,8 +30,8 @@ | |||
| 30 | #define IS31FL3731_DRIVER_COUNT 2 | 30 | #define IS31FL3731_DRIVER_COUNT 2 |
| 31 | #define DRIVER_1_LED_TOTAL 32 | 31 | #define DRIVER_1_LED_TOTAL 32 |
| 32 | #define DRIVER_2_LED_TOTAL 32 | 32 | #define DRIVER_2_LED_TOTAL 32 |
| 33 | #define ISSI_DRIVER_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | 33 | #define IS31FL3731_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) |
| 34 | #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL + WS2812_LED_TOTAL) | 34 | #define RGB_MATRIX_LED_COUNT (IS31FL3731_LED_COUNT + WS2812_LED_TOTAL) |
| 35 | 35 | ||
| 36 | #define RGB_MATRIX_DEFAULT_VAL 80 | 36 | #define RGB_MATRIX_DEFAULT_VAL 80 |
| 37 | #define RGB_MATRIX_KEYPRESSES | 37 | #define RGB_MATRIX_KEYPRESSES |
diff --git a/keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c b/keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c index da83d358b9..35ac5a06b2 100644 --- a/keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c +++ b/keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #ifdef RGB_MATRIX_ENABLE | 25 | #ifdef RGB_MATRIX_ENABLE |
| 26 | rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL]; | 26 | rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL]; |
| 27 | 27 | ||
| 28 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | 28 | const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { |
| 29 | /* Refer to IS31 manual for these locations | 29 | /* Refer to IS31 manual for these locations |
| 30 | * driver | 30 | * driver |
| 31 | * | R location | 31 | * | R location |
| @@ -99,28 +99,6 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { | |||
| 99 | {1, C9_14, C8_14, C7_14}, //D14 | 99 | {1, C9_14, C8_14, C7_14}, //D14 |
| 100 | {1, C9_15, C8_15, C6_14}, //D15 | 100 | {1, C9_15, C8_15, C6_14}, //D15 |
| 101 | {1, C9_16, C7_15, C6_15}, //D16 | 101 | {1, C9_16, C7_15, C6_15}, //D16 |
| 102 | |||
| 103 | //fake underglows 1- 20 | ||
| 104 | {2, 0, 0, 0}, | ||
| 105 | {2, 0, 0, 0}, | ||
| 106 | {2, 0, 0, 0}, | ||
| 107 | {2, 0, 0, 0}, | ||
| 108 | {2, 0, 0, 0}, | ||
| 109 | {2, 0, 0, 0}, | ||
| 110 | {2, 0, 0, 0}, | ||
| 111 | {2, 0, 0, 0}, | ||
| 112 | {2, 0, 0, 0}, | ||
| 113 | {2, 0, 0, 0}, | ||
| 114 | {2, 0, 0, 0}, | ||
| 115 | {2, 0, 0, 0}, | ||
| 116 | {2, 0, 0, 0}, | ||
| 117 | {2, 0, 0, 0}, | ||
| 118 | {2, 0, 0, 0}, | ||
| 119 | {2, 0, 0, 0}, | ||
| 120 | {2, 0, 0, 0}, | ||
| 121 | {2, 0, 0, 0}, | ||
| 122 | {2, 0, 0, 0}, | ||
| 123 | {2, 0, 0, 0} | ||
| 124 | }; | 102 | }; |
| 125 | 103 | ||
| 126 | __attribute__ ((weak)) | 104 | __attribute__ ((weak)) |
| @@ -169,7 +147,7 @@ static void init(void) { | |||
| 169 | i2c_init(); | 147 | i2c_init(); |
| 170 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | 148 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); |
| 171 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); | 149 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); |
| 172 | for (int index = 0; index < ISSI_DRIVER_TOTAL; index++) { | 150 | for (int index = 0; index < IS31FL3731_LED_COUNT; index++) { |
| 173 | bool enabled = true; | 151 | bool enabled = true; |
| 174 | is31fl3731_set_led_control_register(index, enabled, enabled, enabled); | 152 | is31fl3731_set_led_control_register(index, enabled, enabled, enabled); |
| 175 | } | 153 | } |
| @@ -187,12 +165,12 @@ static void flush(void) { | |||
| 187 | } | 165 | } |
| 188 | 166 | ||
| 189 | static void set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 167 | static void set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 190 | if (index < ISSI_DRIVER_TOTAL) { | 168 | if (index < IS31FL3731_LED_COUNT) { |
| 191 | is31fl3731_set_color(index, red, green, blue); | 169 | is31fl3731_set_color(index, red, green, blue); |
| 192 | } else { | 170 | } else { |
| 193 | rgb_matrix_ws2812_array[index - ISSI_DRIVER_TOTAL].r = red; | 171 | rgb_matrix_ws2812_array[index - IS31FL3731_LED_COUNT].r = red; |
| 194 | rgb_matrix_ws2812_array[index - ISSI_DRIVER_TOTAL].g = green; | 172 | rgb_matrix_ws2812_array[index - IS31FL3731_LED_COUNT].g = green; |
| 195 | rgb_matrix_ws2812_array[index - ISSI_DRIVER_TOTAL].b = blue; | 173 | rgb_matrix_ws2812_array[index - IS31FL3731_LED_COUNT].b = blue; |
| 196 | } | 174 | } |
| 197 | } | 175 | } |
| 198 | 176 | ||
diff --git a/keyboards/xelus/pachi/rgb/rev1/config.h b/keyboards/xelus/pachi/rgb/rev1/config.h index e51a176c84..8d86a977c1 100644 --- a/keyboards/xelus/pachi/rgb/rev1/config.h +++ b/keyboards/xelus/pachi/rgb/rev1/config.h | |||
| @@ -41,8 +41,7 @@ | |||
| 41 | 41 | ||
| 42 | #define IS31FL3741_DRIVER_COUNT 1 | 42 | #define IS31FL3741_DRIVER_COUNT 1 |
| 43 | #define DRIVER_1_LED_TOTAL 117 | 43 | #define DRIVER_1_LED_TOTAL 117 |
| 44 | #define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL | 44 | #define IS31FL3741_LED_COUNT DRIVER_1_LED_TOTAL |
| 45 | #define ISSI_DRIVER_TOTAL RGB_MATRIX_LED_COUNT | ||
| 46 | 45 | ||
| 47 | #define RGB_MATRIX_DEFAULT_VAL 80 | 46 | #define RGB_MATRIX_DEFAULT_VAL 80 |
| 48 | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | 47 | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS |
diff --git a/keyboards/xelus/pachi/rgb/rev1/rev1.c b/keyboards/xelus/pachi/rgb/rev1/rev1.c index 1a3d9b2f4d..e43726115e 100644 --- a/keyboards/xelus/pachi/rgb/rev1/rev1.c +++ b/keyboards/xelus/pachi/rgb/rev1/rev1.c | |||
| @@ -22,7 +22,7 @@ void matrix_io_delay(void) { __asm__ volatile("nop\nnop\nnop\n"); } | |||
| 22 | #ifdef RGB_MATRIX_ENABLE | 22 | #ifdef RGB_MATRIX_ENABLE |
| 23 | #include "i2c_master.h" | 23 | #include "i2c_master.h" |
| 24 | #include "drivers/led/issi/is31fl3741.h" | 24 | #include "drivers/led/issi/is31fl3741.h" |
| 25 | const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = { | 25 | const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT] = { |
| 26 | /* Refer to IS31 manual for these locations | 26 | /* Refer to IS31 manual for these locations |
| 27 | * driver | 27 | * driver |
| 28 | * | R location | 28 | * | R location |
| @@ -189,7 +189,7 @@ led_config_t g_led_config = { { | |||
| 189 | static void init(void) { | 189 | static void init(void) { |
| 190 | i2c_init(); | 190 | i2c_init(); |
| 191 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); | 191 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); |
| 192 | for (int index = 0; index < ISSI_DRIVER_TOTAL; index++) { | 192 | for (int index = 0; index < IS31FL3741_LED_COUNT; index++) { |
| 193 | bool enabled = !( ( index == -1+0+13) || //A13 | 193 | bool enabled = !( ( index == -1+0+13) || //A13 |
| 194 | ( index == -1+13+3) || //B3 | 194 | ( index == -1+13+3) || //B3 |
| 195 | ( index == -1+13+13) || //B13 | 195 | ( index == -1+13+13) || //B13 |
diff --git a/keyboards/xelus/pachi/rgb/rev2/config.h b/keyboards/xelus/pachi/rgb/rev2/config.h index da989e16a2..0afc9e2a43 100644 --- a/keyboards/xelus/pachi/rgb/rev2/config.h +++ b/keyboards/xelus/pachi/rgb/rev2/config.h | |||
| @@ -41,8 +41,7 @@ | |||
| 41 | 41 | ||
| 42 | #define IS31FL3741_DRIVER_COUNT 1 | 42 | #define IS31FL3741_DRIVER_COUNT 1 |
| 43 | #define DRIVER_1_LED_TOTAL 117 | 43 | #define DRIVER_1_LED_TOTAL 117 |
| 44 | #define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL | 44 | #define IS31FL3741_LED_COUNT DRIVER_1_LED_TOTAL |
| 45 | #define ISSI_DRIVER_TOTAL RGB_MATRIX_LED_COUNT | ||
| 46 | 45 | ||
| 47 | #define RGB_MATRIX_DEFAULT_VAL 80 | 46 | #define RGB_MATRIX_DEFAULT_VAL 80 |
| 48 | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | 47 | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS |
diff --git a/keyboards/xelus/pachi/rgb/rev2/rev2.c b/keyboards/xelus/pachi/rgb/rev2/rev2.c index 729b6b0545..25d1406653 100644 --- a/keyboards/xelus/pachi/rgb/rev2/rev2.c +++ b/keyboards/xelus/pachi/rgb/rev2/rev2.c | |||
| @@ -22,7 +22,7 @@ void matrix_io_delay(void) { __asm__ volatile("nop\nnop\nnop\n"); } | |||
| 22 | #ifdef RGB_MATRIX_ENABLE | 22 | #ifdef RGB_MATRIX_ENABLE |
| 23 | #include "i2c_master.h" | 23 | #include "i2c_master.h" |
| 24 | #include "drivers/led/issi/is31fl3741.h" | 24 | #include "drivers/led/issi/is31fl3741.h" |
| 25 | const is31fl3741_led_t PROGMEM g_is31fl3741_leds[RGB_MATRIX_LED_COUNT] = { | 25 | const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT] = { |
| 26 | /* Refer to IS31 manual for these locations | 26 | /* Refer to IS31 manual for these locations |
| 27 | * driver | 27 | * driver |
| 28 | * | R location | 28 | * | R location |
| @@ -195,7 +195,7 @@ led_config_t g_led_config = { { | |||
| 195 | static void init(void) { | 195 | static void init(void) { |
| 196 | i2c_init(); | 196 | i2c_init(); |
| 197 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); | 197 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); |
| 198 | for (int index = 0; index < ISSI_DRIVER_TOTAL; index++) { | 198 | for (int index = 0; index < IS31FL3741_LED_COUNT; index++) { |
| 199 | bool enabled = !( ( index == -1+0+13) || //A13 | 199 | bool enabled = !( ( index == -1+0+13) || //A13 |
| 200 | ( index == -1+13+3) || //B3 | 200 | ( index == -1+13+3) || //B3 |
| 201 | ( index == -1+13+13) || //B13 | 201 | ( index == -1+13+13) || //B13 |
diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c index ab8da3353a..117bed9851 100644 --- a/quantum/led_matrix/led_matrix_drivers.c +++ b/quantum/led_matrix/led_matrix_drivers.c | |||
| @@ -25,290 +25,68 @@ | |||
| 25 | * in their own files. | 25 | * in their own files. |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | #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) | 28 | #if defined(LED_MATRIX_IS31FL3218) |
| 29 | # include "i2c_master.h" | ||
| 30 | |||
| 31 | static void init(void) { | ||
| 32 | i2c_init(); | ||
| 33 | |||
| 34 | # if defined(LED_MATRIX_IS31FL3218) | ||
| 35 | is31fl3218_init(); | ||
| 36 | |||
| 37 | # elif defined(LED_MATRIX_IS31FL3731) | ||
| 38 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | ||
| 39 | # if defined(IS31FL3731_I2C_ADDRESS_2) | ||
| 40 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); | ||
| 41 | # if defined(IS31FL3731_I2C_ADDRESS_3) | ||
| 42 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_3); | ||
| 43 | # if defined(IS31FL3731_I2C_ADDRESS_4) | ||
| 44 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_4); | ||
| 45 | # endif | ||
| 46 | # endif | ||
| 47 | # endif | ||
| 48 | |||
| 49 | # elif defined(LED_MATRIX_IS31FL3733) | ||
| 50 | # if !defined(IS31FL3733_SYNC_1) | ||
| 51 | # define IS31FL3733_SYNC_1 0 | ||
| 52 | # endif | ||
| 53 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1); | ||
| 54 | # if defined(IS31FL3733_I2C_ADDRESS_2) | ||
| 55 | # if !defined(IS31FL3733_SYNC_2) | ||
| 56 | # define IS31FL3733_SYNC_2 0 | ||
| 57 | # endif | ||
| 58 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_2); | ||
| 59 | # if defined(IS31FL3733_I2C_ADDRESS_3) | ||
| 60 | # if !defined(IS31FL3733_SYNC_3) | ||
| 61 | # define IS31FL3733_SYNC_3 0 | ||
| 62 | # endif | ||
| 63 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_3, IS31FL3733_SYNC_3); | ||
| 64 | # if defined(IS31FL3733_I2C_ADDRESS_4) | ||
| 65 | # if !defined(IS31FL3733_SYNC_4) | ||
| 66 | # define IS31FL3733_SYNC_4 0 | ||
| 67 | # endif | ||
| 68 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_4, IS31FL3733_SYNC_4); | ||
| 69 | # endif | ||
| 70 | # endif | ||
| 71 | # endif | ||
| 72 | |||
| 73 | # elif defined(LED_MATRIX_IS31FL3736) | ||
| 74 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_1); | ||
| 75 | # if defined(IS31FL3736_I2C_ADDRESS_2) | ||
| 76 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_2); | ||
| 77 | # if defined(IS31FL3736_I2C_ADDRESS_3) | ||
| 78 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_3); | ||
| 79 | # if defined(IS31FL3736_I2C_ADDRESS_4) | ||
| 80 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_4); | ||
| 81 | # endif | ||
| 82 | # endif | ||
| 83 | # endif | ||
| 84 | |||
| 85 | # elif defined(LED_MATRIX_IS31FL3737) | ||
| 86 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_1); | ||
| 87 | # if defined(IS31FL3737_I2C_ADDRESS_2) | ||
| 88 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_2); | ||
| 89 | # if defined(IS31FL3737_I2C_ADDRESS_3) | ||
| 90 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_3); | ||
| 91 | # if defined(IS31FL3737_I2C_ADDRESS_4) | ||
| 92 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_4); | ||
| 93 | # endif | ||
| 94 | # endif | ||
| 95 | # endif | ||
| 96 | |||
| 97 | # elif defined(LED_MATRIX_IS31FL3741) | ||
| 98 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); | ||
| 99 | # if defined(IS31FL3741_I2C_ADDRESS_2) | ||
| 100 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_2); | ||
| 101 | # if defined(IS31FL3741_I2C_ADDRESS_3) | ||
| 102 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_3); | ||
| 103 | # if defined(IS31FL3741_I2C_ADDRESS_4) | ||
| 104 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_4); | ||
| 105 | # endif | ||
| 106 | # endif | ||
| 107 | # endif | ||
| 108 | |||
| 109 | # elif defined(IS31FLCOMMON) | ||
| 110 | IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1); | ||
| 111 | # if defined(LED_DRIVER_ADDR_2) | ||
| 112 | IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2); | ||
| 113 | # if defined(LED_DRIVER_ADDR_3) | ||
| 114 | IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3); | ||
| 115 | # if defined(LED_DRIVER_ADDR_4) | ||
| 116 | IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4); | ||
| 117 | # endif | ||
| 118 | # endif | ||
| 119 | # endif | ||
| 120 | # elif defined(LED_MATRIX_SNLED27351) | ||
| 121 | # if defined(LED_DRIVER_SHUTDOWN_PIN) | ||
| 122 | setPinOutput(LED_DRIVER_SHUTDOWN_PIN); | ||
| 123 | writePinHigh(LED_DRIVER_SHUTDOWN_PIN); | ||
| 124 | # endif | ||
| 125 | |||
| 126 | snled27351_init(SNLED27351_I2C_ADDRESS_1); | ||
| 127 | # if defined(SNLED27351_I2C_ADDRESS_2) | ||
| 128 | snled27351_init(SNLED27351_I2C_ADDRESS_2); | ||
| 129 | # if defined(SNLED27351_I2C_ADDRESS_3) | ||
| 130 | snled27351_init(SNLED27351_I2C_ADDRESS_3); | ||
| 131 | # if defined(SNLED27351_I2C_ADDRESS_4) | ||
| 132 | snled27351_init(SNLED27351_I2C_ADDRESS_4); | ||
| 133 | # endif | ||
| 134 | # endif | ||
| 135 | # endif | ||
| 136 | # endif | ||
| 137 | |||
| 138 | for (int index = 0; index < LED_MATRIX_LED_COUNT; index++) { | ||
| 139 | # if defined(LED_MATRIX_IS31FL3218) | ||
| 140 | is31fl3218_set_led_control_register(index, true); | ||
| 141 | # elif defined(LED_MATRIX_IS31FL3731) | ||
| 142 | is31fl3731_set_led_control_register(index, true); | ||
| 143 | # elif defined(LED_MATRIX_IS31FL3733) | ||
| 144 | is31fl3733_set_led_control_register(index, true); | ||
| 145 | # elif defined(LED_MATRIX_IS31FL3736) | ||
| 146 | is31fl3736_set_led_control_register(index, true); | ||
| 147 | # elif defined(LED_MATRIX_IS31FL3737) | ||
| 148 | is31fl3737_set_led_control_register(index, true); | ||
| 149 | # elif defined(LED_MATRIX_IS31FL3741) | ||
| 150 | is31fl3741_set_led_control_register(index, true); | ||
| 151 | # elif defined(IS31FLCOMMON) | ||
| 152 | IS31FL_simple_set_scaling_buffer(index, true); | ||
| 153 | # elif defined(LED_MATRIX_SNLED27351) | ||
| 154 | snled27351_set_led_control_register(index, true); | ||
| 155 | # endif | ||
| 156 | } | ||
| 157 | |||
| 158 | // This actually updates the LED drivers | ||
| 159 | # if defined(LED_MATRIX_IS31FL3218) | ||
| 160 | is31fl3218_update_led_control_registers(); | ||
| 161 | |||
| 162 | # elif defined(LED_MATRIX_IS31FL3731) | ||
| 163 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); | ||
| 164 | # if defined(IS31FL3731_I2C_ADDRESS_2) | ||
| 165 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1); | ||
| 166 | # if defined(IS31FL3731_I2C_ADDRESS_3) | ||
| 167 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_3, 2); | ||
| 168 | # if defined(IS31FL3731_I2C_ADDRESS_4) | ||
| 169 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_4, 3); | ||
| 170 | # endif | ||
| 171 | # endif | ||
| 172 | # endif | ||
| 173 | |||
| 174 | # elif defined(LED_MATRIX_IS31FL3733) | ||
| 175 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0); | ||
| 176 | # if defined(IS31FL3733_I2C_ADDRESS_2) | ||
| 177 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1); | ||
| 178 | # if defined(IS31FL3733_I2C_ADDRESS_3) | ||
| 179 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_3, 2); | ||
| 180 | # if defined(IS31FL3733_I2C_ADDRESS_4) | ||
| 181 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_4, 3); | ||
| 182 | # endif | ||
| 183 | # endif | ||
| 184 | # endif | ||
| 185 | |||
| 186 | # elif defined(LED_MATRIX_IS31FL3736) | ||
| 187 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_1, 0); | ||
| 188 | # if defined(IS31FL3736_I2C_ADDRESS_2) | ||
| 189 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_2, 1); | ||
| 190 | # if defined(IS31FL3736_I2C_ADDRESS_3) | ||
| 191 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_3, 2); | ||
| 192 | # if defined(IS31FL3736_I2C_ADDRESS_4) | ||
| 193 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_4, 3); | ||
| 194 | # endif | ||
| 195 | # endif | ||
| 196 | # endif | ||
| 197 | |||
| 198 | # elif defined(LED_MATRIX_IS31FL3737) | ||
| 199 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_1, 0); | ||
| 200 | # if defined(IS31FL3737_I2C_ADDRESS_2) | ||
| 201 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_2, 1); | ||
| 202 | # if defined(IS31FL3737_I2C_ADDRESS_3) | ||
| 203 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_3, 2); | ||
| 204 | # if defined(IS31FL3737_I2C_ADDRESS_4) | ||
| 205 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_4, 3); | ||
| 206 | # endif | ||
| 207 | # endif | ||
| 208 | # endif | ||
| 209 | |||
| 210 | # elif defined(LED_MATRIX_IS31FL3741) | ||
| 211 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_1, 0); | ||
| 212 | # if defined(IS31FL3741_I2C_ADDRESS_2) | ||
| 213 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_2, 1); | ||
| 214 | # if defined(IS31FL3741_I2C_ADDRESS_3) | ||
| 215 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_3, 2); | ||
| 216 | # if defined(IS31FL3741_I2C_ADDRESS_4) | ||
| 217 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_4, 3); | ||
| 218 | # endif | ||
| 219 | # endif | ||
| 220 | # endif | ||
| 221 | |||
| 222 | # elif defined(IS31FLCOMMON) | ||
| 223 | # ifdef ISSI_MANUAL_SCALING | ||
| 224 | IS31FL_set_manual_scaling_buffer(); | ||
| 225 | # endif | ||
| 226 | IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0); | ||
| 227 | # if defined(LED_DRIVER_ADDR_2) | ||
| 228 | IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1); | ||
| 229 | # if defined(LED_DRIVER_ADDR_3) | ||
| 230 | IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2); | ||
| 231 | # if defined(LED_DRIVER_ADDR_4) | ||
| 232 | IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3); | ||
| 233 | # endif | ||
| 234 | # endif | ||
| 235 | # endif | ||
| 236 | |||
| 237 | # elif defined(LED_MATRIX_SNLED27351) | ||
| 238 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_1, 0); | ||
| 239 | # if defined(SNLED27351_I2C_ADDRESS_2) | ||
| 240 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_2, 1); | ||
| 241 | # if defined(SNLED27351_I2C_ADDRESS_3) | ||
| 242 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_3, 2); | ||
| 243 | # if defined(SNLED27351_I2C_ADDRESS_4) | ||
| 244 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_4, 3); | ||
| 245 | # endif | ||
| 246 | # endif | ||
| 247 | # endif | ||
| 248 | # endif | ||
| 249 | } | ||
| 250 | |||
| 251 | # if defined(LED_MATRIX_IS31FL3218) | ||
| 252 | const led_matrix_driver_t led_matrix_driver = { | 29 | const led_matrix_driver_t led_matrix_driver = { |
| 253 | .init = init, | 30 | .init = is31fl3218_init, |
| 254 | .flush = is31fl3218_update_pwm_buffers, | 31 | .flush = is31fl3218_update_pwm_buffers, |
| 255 | .set_value = is31fl3218_set_value, | 32 | .set_value = is31fl3218_set_value, |
| 256 | .set_value_all = is31fl3218_set_value_all, | 33 | .set_value_all = is31fl3218_set_value_all, |
| 257 | }; | 34 | }; |
| 258 | 35 | ||
| 259 | # elif defined(LED_MATRIX_IS31FL3731) | 36 | #elif defined(LED_MATRIX_IS31FL3731) |
| 260 | const led_matrix_driver_t led_matrix_driver = { | 37 | const led_matrix_driver_t led_matrix_driver = { |
| 261 | .init = init, | 38 | .init = is31fl3731_init_drivers, |
| 262 | .flush = is31fl3731_flush, | 39 | .flush = is31fl3731_flush, |
| 263 | .set_value = is31fl3731_set_value, | 40 | .set_value = is31fl3731_set_value, |
| 264 | .set_value_all = is31fl3731_set_value_all, | 41 | .set_value_all = is31fl3731_set_value_all, |
| 265 | }; | 42 | }; |
| 266 | 43 | ||
| 267 | # elif defined(LED_MATRIX_IS31FL3733) | 44 | #elif defined(LED_MATRIX_IS31FL3733) |
| 268 | const led_matrix_driver_t led_matrix_driver = { | 45 | const led_matrix_driver_t led_matrix_driver = { |
| 269 | .init = init, | 46 | .init = is31fl3733_init_drivers, |
| 270 | .flush = is31fl3733_flush, | 47 | .flush = is31fl3733_flush, |
| 271 | .set_value = is31fl3733_set_value, | 48 | .set_value = is31fl3733_set_value, |
| 272 | .set_value_all = is31fl3733_set_value_all, | 49 | .set_value_all = is31fl3733_set_value_all, |
| 273 | }; | 50 | }; |
| 274 | 51 | ||
| 275 | # elif defined(LED_MATRIX_IS31FL3736) | 52 | #elif defined(LED_MATRIX_IS31FL3736) |
| 276 | const led_matrix_driver_t led_matrix_driver = { | 53 | const led_matrix_driver_t led_matrix_driver = { |
| 277 | .init = init, | 54 | .init = is31fl3736_init_drivers, |
| 278 | .flush = is31fl3736_flush, | 55 | .flush = is31fl3736_flush, |
| 279 | .set_value = is31fl3736_set_value, | 56 | .set_value = is31fl3736_set_value, |
| 280 | .set_value_all = is31fl3736_set_value_all, | 57 | .set_value_all = is31fl3736_set_value_all, |
| 281 | }; | 58 | }; |
| 282 | 59 | ||
| 283 | # elif defined(LED_MATRIX_IS31FL3737) | 60 | #elif defined(LED_MATRIX_IS31FL3737) |
| 284 | const led_matrix_driver_t led_matrix_driver = { | 61 | const led_matrix_driver_t led_matrix_driver = { |
| 285 | .init = init, | 62 | .init = is31fl3737_init_drivers, |
| 286 | .flush = is31fl3737_flush, | 63 | .flush = is31fl3737_flush, |
| 287 | .set_value = is31fl3737_set_value, | 64 | .set_value = is31fl3737_set_value, |
| 288 | .set_value_all = is31fl3737_set_value_all, | 65 | .set_value_all = is31fl3737_set_value_all, |
| 289 | }; | 66 | }; |
| 290 | 67 | ||
| 291 | # elif defined(LED_MATRIX_IS31FL3741) | 68 | #elif defined(LED_MATRIX_IS31FL3741) |
| 292 | const led_matrix_driver_t led_matrix_driver = { | 69 | const led_matrix_driver_t led_matrix_driver = { |
| 293 | .init = init, | 70 | .init = is31fl3741_init_drivers, |
| 294 | .flush = is31fl3741_flush, | 71 | .flush = is31fl3741_flush, |
| 295 | .set_value = is31fl3741_set_value, | 72 | .set_value = is31fl3741_set_value, |
| 296 | .set_value_all = is31fl3741_set_value_all, | 73 | .set_value_all = is31fl3741_set_value_all, |
| 297 | }; | 74 | }; |
| 298 | 75 | ||
| 299 | # elif defined(IS31FLCOMMON) | 76 | #elif defined(IS31FLCOMMON) |
| 300 | const led_matrix_driver_t led_matrix_driver = { | 77 | const led_matrix_driver_t led_matrix_driver = { |
| 301 | .init = init, | 78 | .init = IS31FL_simple_init_drivers, |
| 302 | .flush = IS31FL_common_flush, | 79 | .flush = IS31FL_common_flush, |
| 303 | .set_value = IS31FL_simple_set_brightness, | 80 | .set_value = IS31FL_simple_set_brightness, |
| 304 | .set_value_all = IS31FL_simple_set_brigntness_all, | 81 | .set_value_all = IS31FL_simple_set_brigntness_all, |
| 305 | }; | 82 | }; |
| 306 | # elif defined(LED_MATRIX_SNLED27351) | 83 | |
| 84 | #elif defined(LED_MATRIX_SNLED27351) | ||
| 307 | const led_matrix_driver_t led_matrix_driver = { | 85 | const led_matrix_driver_t led_matrix_driver = { |
| 308 | .init = init, | 86 | .init = snled27351_init_drivers, |
| 309 | .flush = snled27351_flush, | 87 | .flush = snled27351_flush, |
| 310 | .set_value = snled27351_set_value, | 88 | .set_value = snled27351_set_value, |
| 311 | .set_value_all = snled27351_set_value_all, | 89 | .set_value_all = snled27351_set_value_all, |
| 312 | }; | 90 | }; |
| 313 | # endif | 91 | |
| 314 | #endif | 92 | #endif |
diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c index 0fe93ee077..0f979cb233 100644 --- a/quantum/rgb_matrix/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix/rgb_matrix_drivers.c | |||
| @@ -24,307 +24,73 @@ | |||
| 24 | * be here if shared between boards. | 24 | * be here if shared between boards. |
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | #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) | 27 | #if defined(RGB_MATRIX_IS31FL3218) |
| 28 | # include "i2c_master.h" | ||
| 29 | |||
| 30 | static void init(void) { | ||
| 31 | i2c_init(); | ||
| 32 | |||
| 33 | # if defined(RGB_MATRIX_IS31FL3218) | ||
| 34 | is31fl3218_init(); | ||
| 35 | |||
| 36 | # elif defined(RGB_MATRIX_IS31FL3731) | ||
| 37 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_1); | ||
| 38 | # if defined(IS31FL3731_I2C_ADDRESS_2) | ||
| 39 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_2); | ||
| 40 | # if defined(IS31FL3731_I2C_ADDRESS_3) | ||
| 41 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_3); | ||
| 42 | # if defined(IS31FL3731_I2C_ADDRESS_4) | ||
| 43 | is31fl3731_init(IS31FL3731_I2C_ADDRESS_4); | ||
| 44 | # endif | ||
| 45 | # endif | ||
| 46 | # endif | ||
| 47 | |||
| 48 | # elif defined(RGB_MATRIX_IS31FL3733) | ||
| 49 | # if !defined(IS31FL3733_SYNC_1) | ||
| 50 | # define IS31FL3733_SYNC_1 0 | ||
| 51 | # endif | ||
| 52 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1); | ||
| 53 | # if defined(IS31FL3733_I2C_ADDRESS_2) | ||
| 54 | # if !defined(IS31FL3733_SYNC_2) | ||
| 55 | # define IS31FL3733_SYNC_2 0 | ||
| 56 | # endif | ||
| 57 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_2); | ||
| 58 | # if defined(IS31FL3733_I2C_ADDRESS_3) | ||
| 59 | # if !defined(IS31FL3733_SYNC_3) | ||
| 60 | # define IS31FL3733_SYNC_3 0 | ||
| 61 | # endif | ||
| 62 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_3, IS31FL3733_SYNC_3); | ||
| 63 | # if defined(IS31FL3733_I2C_ADDRESS_4) | ||
| 64 | # if !defined(IS31FL3733_SYNC_4) | ||
| 65 | # define IS31FL3733_SYNC_4 0 | ||
| 66 | # endif | ||
| 67 | is31fl3733_init(IS31FL3733_I2C_ADDRESS_4, IS31FL3733_SYNC_4); | ||
| 68 | # endif | ||
| 69 | # endif | ||
| 70 | # endif | ||
| 71 | |||
| 72 | # elif defined(RGB_MATRIX_IS31FL3736) | ||
| 73 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_1); | ||
| 74 | # if defined(IS31FL3736_I2C_ADDRESS_2) | ||
| 75 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_2); | ||
| 76 | # if defined(IS31FL3736_I2C_ADDRESS_3) | ||
| 77 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_3); | ||
| 78 | # if defined(IS31FL3736_I2C_ADDRESS_4) | ||
| 79 | is31fl3736_init(IS31FL3736_I2C_ADDRESS_4); | ||
| 80 | # endif | ||
| 81 | # endif | ||
| 82 | # endif | ||
| 83 | |||
| 84 | # elif defined(RGB_MATRIX_IS31FL3737) | ||
| 85 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_1); | ||
| 86 | # if defined(IS31FL3737_I2C_ADDRESS_2) | ||
| 87 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_2); | ||
| 88 | # if defined(IS31FL3737_I2C_ADDRESS_3) | ||
| 89 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_3); | ||
| 90 | # if defined(IS31FL3737_I2C_ADDRESS_4) | ||
| 91 | is31fl3737_init(IS31FL3737_I2C_ADDRESS_4); | ||
| 92 | # endif | ||
| 93 | # endif | ||
| 94 | # endif | ||
| 95 | |||
| 96 | # elif defined(RGB_MATRIX_IS31FL3741) | ||
| 97 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_1); | ||
| 98 | # if defined(IS31FL3741_I2C_ADDRESS_2) | ||
| 99 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_2); | ||
| 100 | # if defined(IS31FL3741_I2C_ADDRESS_3) | ||
| 101 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_3); | ||
| 102 | # if defined(IS31FL3741_I2C_ADDRESS_4) | ||
| 103 | is31fl3741_init(IS31FL3741_I2C_ADDRESS_4); | ||
| 104 | # endif | ||
| 105 | # endif | ||
| 106 | # endif | ||
| 107 | |||
| 108 | # elif defined(IS31FLCOMMON) | ||
| 109 | IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1); | ||
| 110 | # if defined(DRIVER_ADDR_2) | ||
| 111 | IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2); | ||
| 112 | # if defined(DRIVER_ADDR_3) | ||
| 113 | IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3); | ||
| 114 | # if defined(DRIVER_ADDR_4) | ||
| 115 | IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4); | ||
| 116 | # endif | ||
| 117 | # endif | ||
| 118 | # endif | ||
| 119 | |||
| 120 | # elif defined(RGB_MATRIX_SNLED27351) | ||
| 121 | snled27351_init(SNLED27351_I2C_ADDRESS_1); | ||
| 122 | # if defined(SNLED27351_I2C_ADDRESS_2) | ||
| 123 | snled27351_init(SNLED27351_I2C_ADDRESS_2); | ||
| 124 | # if defined(SNLED27351_I2C_ADDRESS_3) | ||
| 125 | snled27351_init(SNLED27351_I2C_ADDRESS_3); | ||
| 126 | # if defined(SNLED27351_I2C_ADDRESS_4) | ||
| 127 | snled27351_init(SNLED27351_I2C_ADDRESS_4); | ||
| 128 | # endif | ||
| 129 | # endif | ||
| 130 | # endif | ||
| 131 | # endif | ||
| 132 | |||
| 133 | for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) { | ||
| 134 | bool enabled = true; | ||
| 135 | |||
| 136 | // This only caches it for later | ||
| 137 | # if defined(RGB_MATRIX_IS31FL3218) | ||
| 138 | is31fl3218_set_led_control_register(index, enabled, enabled, enabled); | ||
| 139 | # elif defined(RGB_MATRIX_IS31FL3731) | ||
| 140 | is31fl3731_set_led_control_register(index, enabled, enabled, enabled); | ||
| 141 | # elif defined(RGB_MATRIX_IS31FL3733) | ||
| 142 | is31fl3733_set_led_control_register(index, enabled, enabled, enabled); | ||
| 143 | # elif defined(RGB_MATRIX_IS31FL3736) | ||
| 144 | is31fl3736_set_led_control_register(index, enabled, enabled, enabled); | ||
| 145 | # elif defined(RGB_MATRIX_IS31FL3737) | ||
| 146 | is31fl3737_set_led_control_register(index, enabled, enabled, enabled); | ||
| 147 | # elif defined(RGB_MATRIX_IS31FL3741) | ||
| 148 | is31fl3741_set_led_control_register(index, enabled, enabled, enabled); | ||
| 149 | # elif defined(IS31FLCOMMON) | ||
| 150 | IS31FL_RGB_set_scaling_buffer(index, enabled, enabled, enabled); | ||
| 151 | # elif defined(RGB_MATRIX_SNLED27351) | ||
| 152 | snled27351_set_led_control_register(index, enabled, enabled, enabled); | ||
| 153 | # endif | ||
| 154 | } | ||
| 155 | |||
| 156 | // This actually updates the LED drivers | ||
| 157 | # if defined(RGB_MATRIX_IS31FL3218) | ||
| 158 | is31fl3218_update_led_control_registers(); | ||
| 159 | |||
| 160 | # elif defined(RGB_MATRIX_IS31FL3731) | ||
| 161 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_1, 0); | ||
| 162 | # if defined(IS31FL3731_I2C_ADDRESS_2) | ||
| 163 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_2, 1); | ||
| 164 | # if defined(IS31FL3731_I2C_ADDRESS_3) | ||
| 165 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_3, 2); | ||
| 166 | # if defined(IS31FL3731_I2C_ADDRESS_4) | ||
| 167 | is31fl3731_update_led_control_registers(IS31FL3731_I2C_ADDRESS_4, 3); | ||
| 168 | # endif | ||
| 169 | # endif | ||
| 170 | # endif | ||
| 171 | |||
| 172 | # elif defined(RGB_MATRIX_IS31FL3733) | ||
| 173 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0); | ||
| 174 | # if defined(IS31FL3733_I2C_ADDRESS_2) | ||
| 175 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1); | ||
| 176 | # if defined(IS31FL3733_I2C_ADDRESS_3) | ||
| 177 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_3, 2); | ||
| 178 | # if defined(IS31FL3733_I2C_ADDRESS_4) | ||
| 179 | is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_4, 3); | ||
| 180 | # endif | ||
| 181 | # endif | ||
| 182 | # endif | ||
| 183 | |||
| 184 | # elif defined(RGB_MATRIX_IS31FL3736) | ||
| 185 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_1, 0); | ||
| 186 | # if defined(IS31FL3736_I2C_ADDRESS_2) | ||
| 187 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_2, 1); | ||
| 188 | # if defined(IS31FL3736_I2C_ADDRESS_3) | ||
| 189 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_3, 2); | ||
| 190 | # if defined(IS31FL3736_I2C_ADDRESS_4) | ||
| 191 | is31fl3736_update_led_control_registers(IS31FL3736_I2C_ADDRESS_4, 3); | ||
| 192 | # endif | ||
| 193 | # endif | ||
| 194 | # endif | ||
| 195 | |||
| 196 | # elif defined(RGB_MATRIX_IS31FL3737) | ||
| 197 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_1, 0); | ||
| 198 | # if defined(IS31FL3737_I2C_ADDRESS_2) | ||
| 199 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_2, 1); | ||
| 200 | # if defined(IS31FL3737_I2C_ADDRESS_3) | ||
| 201 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_3, 2); | ||
| 202 | # if defined(IS31FL3737_I2C_ADDRESS_4) | ||
| 203 | is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_4, 3); | ||
| 204 | # endif | ||
| 205 | # endif | ||
| 206 | # endif | ||
| 207 | |||
| 208 | # elif defined(RGB_MATRIX_IS31FL3741) | ||
| 209 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_1, 0); | ||
| 210 | # if defined(IS31FL3741_I2C_ADDRESS_2) | ||
| 211 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_2, 1); | ||
| 212 | # if defined(IS31FL3741_I2C_ADDRESS_3) | ||
| 213 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_3, 2); | ||
| 214 | # if defined(IS31FL3741_I2C_ADDRESS_4) | ||
| 215 | is31fl3741_update_led_control_registers(IS31FL3741_I2C_ADDRESS_4, 3); | ||
| 216 | # endif | ||
| 217 | # endif | ||
| 218 | # endif | ||
| 219 | |||
| 220 | # elif defined(IS31FLCOMMON) | ||
| 221 | # ifdef ISSI_MANUAL_SCALING | ||
| 222 | IS31FL_set_manual_scaling_buffer(); | ||
| 223 | # endif | ||
| 224 | IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0); | ||
| 225 | # if defined(DRIVER_ADDR_2) | ||
| 226 | IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1); | ||
| 227 | # if defined(DRIVER_ADDR_3) | ||
| 228 | IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2); | ||
| 229 | # if defined(DRIVER_ADDR_4) | ||
| 230 | IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3); | ||
| 231 | # endif | ||
| 232 | # endif | ||
| 233 | # endif | ||
| 234 | |||
| 235 | # elif defined(RGB_MATRIX_SNLED27351) | ||
| 236 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_1, 0); | ||
| 237 | # if defined(SNLED27351_I2C_ADDRESS_2) | ||
| 238 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_2, 1); | ||
| 239 | # if defined(SNLED27351_I2C_ADDRESS_3) | ||
| 240 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_3, 2); | ||
| 241 | # if defined(SNLED27351_I2C_ADDRESS_4) | ||
| 242 | snled27351_update_led_control_registers(SNLED27351_I2C_ADDRESS_4, 3); | ||
| 243 | # endif | ||
| 244 | # endif | ||
| 245 | # endif | ||
| 246 | # endif | ||
| 247 | } | ||
| 248 | |||
| 249 | # if defined(RGB_MATRIX_IS31FL3218) | ||
| 250 | const rgb_matrix_driver_t rgb_matrix_driver = { | 28 | const rgb_matrix_driver_t rgb_matrix_driver = { |
| 251 | .init = init, | 29 | .init = is31fl3218_init, |
| 252 | .flush = is31fl3218_update_pwm_buffers, | 30 | .flush = is31fl3218_update_pwm_buffers, |
| 253 | .set_color = is31fl3218_set_color, | 31 | .set_color = is31fl3218_set_color, |
| 254 | .set_color_all = is31fl3218_set_color_all, | 32 | .set_color_all = is31fl3218_set_color_all, |
| 255 | }; | 33 | }; |
| 256 | 34 | ||
| 257 | # elif defined(RGB_MATRIX_IS31FL3731) | 35 | #elif defined(RGB_MATRIX_IS31FL3731) |
| 258 | const rgb_matrix_driver_t rgb_matrix_driver = { | 36 | const rgb_matrix_driver_t rgb_matrix_driver = { |
| 259 | .init = init, | 37 | .init = is31fl3731_init_drivers, |
| 260 | .flush = is31fl3731_flush, | 38 | .flush = is31fl3731_flush, |
| 261 | .set_color = is31fl3731_set_color, | 39 | .set_color = is31fl3731_set_color, |
| 262 | .set_color_all = is31fl3731_set_color_all, | 40 | .set_color_all = is31fl3731_set_color_all, |
| 263 | }; | 41 | }; |
| 264 | 42 | ||
| 265 | # elif defined(RGB_MATRIX_IS31FL3733) | 43 | #elif defined(RGB_MATRIX_IS31FL3733) |
| 266 | const rgb_matrix_driver_t rgb_matrix_driver = { | 44 | const rgb_matrix_driver_t rgb_matrix_driver = { |
| 267 | .init = init, | 45 | .init = is31fl3733_init_drivers, |
| 268 | .flush = is31fl3733_flush, | 46 | .flush = is31fl3733_flush, |
| 269 | .set_color = is31fl3733_set_color, | 47 | .set_color = is31fl3733_set_color, |
| 270 | .set_color_all = is31fl3733_set_color_all, | 48 | .set_color_all = is31fl3733_set_color_all, |
| 271 | }; | 49 | }; |
| 272 | 50 | ||
| 273 | # elif defined(RGB_MATRIX_IS31FL3736) | 51 | #elif defined(RGB_MATRIX_IS31FL3736) |
| 274 | const rgb_matrix_driver_t rgb_matrix_driver = { | 52 | const rgb_matrix_driver_t rgb_matrix_driver = { |
| 275 | .init = init, | 53 | .init = is31fl3736_init_drivers, |
| 276 | .flush = is31fl3736_flush, | 54 | .flush = is31fl3736_flush, |
| 277 | .set_color = is31fl3736_set_color, | 55 | .set_color = is31fl3736_set_color, |
| 278 | .set_color_all = is31fl3736_set_color_all, | 56 | .set_color_all = is31fl3736_set_color_all, |
| 279 | }; | 57 | }; |
| 280 | 58 | ||
| 281 | # elif defined(RGB_MATRIX_IS31FL3737) | 59 | #elif defined(RGB_MATRIX_IS31FL3737) |
| 282 | const rgb_matrix_driver_t rgb_matrix_driver = { | 60 | const rgb_matrix_driver_t rgb_matrix_driver = { |
| 283 | .init = init, | 61 | .init = is31fl3737_init_drivers, |
| 284 | .flush = is31fl3737_flush, | 62 | .flush = is31fl3737_flush, |
| 285 | .set_color = is31fl3737_set_color, | 63 | .set_color = is31fl3737_set_color, |
| 286 | .set_color_all = is31fl3737_set_color_all, | 64 | .set_color_all = is31fl3737_set_color_all, |
| 287 | }; | 65 | }; |
| 288 | 66 | ||
| 289 | # elif defined(RGB_MATRIX_IS31FL3741) | 67 | #elif defined(RGB_MATRIX_IS31FL3741) |
| 290 | const rgb_matrix_driver_t rgb_matrix_driver = { | 68 | const rgb_matrix_driver_t rgb_matrix_driver = { |
| 291 | .init = init, | 69 | .init = is31fl3741_init_drivers, |
| 292 | .flush = is31fl3741_flush, | 70 | .flush = is31fl3741_flush, |
| 293 | .set_color = is31fl3741_set_color, | 71 | .set_color = is31fl3741_set_color, |
| 294 | .set_color_all = is31fl3741_set_color_all, | 72 | .set_color_all = is31fl3741_set_color_all, |
| 295 | }; | 73 | }; |
| 296 | 74 | ||
| 297 | # elif defined(IS31FLCOMMON) | 75 | #elif defined(IS31FLCOMMON) |
| 298 | const rgb_matrix_driver_t rgb_matrix_driver = { | 76 | const rgb_matrix_driver_t rgb_matrix_driver = { |
| 299 | .init = init, | 77 | .init = IS31FL_RGB_init_drivers, |
| 300 | .flush = IS31FL_common_flush, | 78 | .flush = IS31FL_common_flush, |
| 301 | .set_color = IS31FL_RGB_set_color, | 79 | .set_color = IS31FL_RGB_set_color, |
| 302 | .set_color_all = IS31FL_RGB_set_color_all, | 80 | .set_color_all = IS31FL_RGB_set_color_all, |
| 303 | }; | 81 | }; |
| 304 | 82 | ||
| 305 | # elif defined(RGB_MATRIX_SNLED27351) | 83 | #elif defined(RGB_MATRIX_SNLED27351) |
| 306 | const rgb_matrix_driver_t rgb_matrix_driver = { | 84 | const rgb_matrix_driver_t rgb_matrix_driver = { |
| 307 | .init = init, | 85 | .init = snled27351_init_drivers, |
| 308 | .flush = snled27351_flush, | 86 | .flush = snled27351_flush, |
| 309 | .set_color = snled27351_set_color, | 87 | .set_color = snled27351_set_color, |
| 310 | .set_color_all = snled27351_set_color_all, | 88 | .set_color_all = snled27351_set_color_all, |
| 311 | }; | 89 | }; |
| 312 | # endif | ||
| 313 | 90 | ||
| 314 | #elif defined(RGB_MATRIX_AW20216S) | 91 | #elif defined(RGB_MATRIX_AW20216S) |
| 315 | # include "spi_master.h" | ||
| 316 | |||
| 317 | static void init(void) { | ||
| 318 | spi_init(); | ||
| 319 | |||
| 320 | aw20216s_init(AW20216S_CS_PIN_1, AW20216S_EN_PIN_1); | ||
| 321 | # if defined(AW20216S_CS_PIN_2) | ||
| 322 | aw20216s_init(AW20216S_CS_PIN_2, AW20216S_EN_PIN_2); | ||
| 323 | # endif | ||
| 324 | } | ||
| 325 | |||
| 326 | const rgb_matrix_driver_t rgb_matrix_driver = { | 92 | const rgb_matrix_driver_t rgb_matrix_driver = { |
| 327 | .init = init, | 93 | .init = aw20216s_init_drivers, |
| 328 | .flush = aw20216s_flush, | 94 | .flush = aw20216s_flush, |
| 329 | .set_color = aw20216s_set_color, | 95 | .set_color = aw20216s_set_color, |
| 330 | .set_color_all = aw20216s_set_color_all, | 96 | .set_color_all = aw20216s_set_color_all, |
| @@ -391,4 +157,5 @@ const rgb_matrix_driver_t rgb_matrix_driver = { | |||
| 391 | .set_color = setled, | 157 | .set_color = setled, |
| 392 | .set_color_all = setled_all, | 158 | .set_color_all = setled_all, |
| 393 | }; | 159 | }; |
| 160 | |||
| 394 | #endif | 161 | #endif |
