diff options
Diffstat (limited to 'drivers/led/issi/is31fl3737-simple.c')
-rw-r--r-- | drivers/led/issi/is31fl3737-simple.c | 34 |
1 files changed, 32 insertions, 2 deletions
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) { } } +void is31fl3737_init_drivers(void) { + i2c_init(); + + is31fl3737_init(IS31FL3737_I2C_ADDRESS_1); +#if defined(IS31FL3737_I2C_ADDRESS_2) + is31fl3737_init(IS31FL3737_I2C_ADDRESS_2); +# if defined(IS31FL3737_I2C_ADDRESS_3) + is31fl3737_init(IS31FL3737_I2C_ADDRESS_3); +# if defined(IS31FL3737_I2C_ADDRESS_4) + is31fl3737_init(IS31FL3737_I2C_ADDRESS_4); +# endif +# endif +#endif + + for (int i = 0; i < IS31FL3737_LED_COUNT; i++) { + is31fl3737_set_led_control_register(i, true); + } + + is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_1, 0); +#if defined(IS31FL3737_I2C_ADDRESS_2) + is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_2, 1); +# if defined(IS31FL3737_I2C_ADDRESS_3) + is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_3, 2); +# if defined(IS31FL3737_I2C_ADDRESS_4) + is31fl3737_update_led_control_registers(IS31FL3737_I2C_ADDRESS_4, 3); +# endif +# endif +#endif +} + void is31fl3737_init(uint8_t addr) { // In order to avoid the LEDs being driven with garbage data // in the LED driver's PWM registers, shutdown is enabled last. @@ -162,7 +192,7 @@ void is31fl3737_init(uint8_t addr) { void is31fl3737_set_value(int index, uint8_t value) { is31fl3737_led_t led; - if (index >= 0 && index < LED_MATRIX_LED_COUNT) { + if (index >= 0 && index < IS31FL3737_LED_COUNT) { memcpy_P(&led, (&g_is31fl3737_leds[index]), sizeof(led)); if (g_pwm_buffer[led.driver][led.v] == value) { @@ -174,7 +204,7 @@ void is31fl3737_set_value(int index, uint8_t value) { } void is31fl3737_set_value_all(uint8_t value) { - for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) { + for (int i = 0; i < IS31FL3737_LED_COUNT; i++) { is31fl3737_set_value(i, value); } } |