~ruther/qmk_firmware

9d4c4ceee13bfa229de6be2255e83c9c324259d6 — Jamal Bouajjaj 2 years ago ae3825a
4 Driver support for IS31FL3737 (#18750)

* Added 4 driver support for the IS31FL3737 LED driver

* Updated docs for IS31FL3737 to support 4 drivers
2 files changed, 22 insertions(+), 2 deletions(-)

M docs/feature_rgb_matrix.md
M quantum/rgb_matrix/rgb_matrix_drivers.c
M docs/feature_rgb_matrix.md => docs/feature_rgb_matrix.md +4 -2
@@ 164,7 164,7 @@ There is basic support for addressable RGB matrix lighting with the I2C IS31FL37
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3737
```
You can use between 1 and 2 IS31FL3737 IC's. Do not specify `DRIVER_ADDR_2` define for second IC if not present on your keyboard.
You can use between 1 and 4 IS31FL3737 IC's. Do not specify `DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard.

Configure the hardware via your `config.h`:



@@ 180,6 180,8 @@ Configure the hardware via your `config.h`:
| `RGB_MATRIX_LED_COUNT` | (Required) How many RGB lights are present across all drivers | |
| `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | |
| `DRIVER_ADDR_2` | (Optional) Address for the second RGB driver | |
| `DRIVER_ADDR_3` | (Optional) Address for the third RGB driver | |
| `DRIVER_ADDR_4` | (Optional) Address for the fourth RGB driver | |

The IS31FL3737 IC's have on-chip resistors that can be enabled to allow for de-ghosting of the RGB matrix. By default these resistors are not enabled (`ISSI_SWPULLUP`/`ISSI_CSPULLUP` are given the value of`PUR_0R`), the values that can be set to enable de-ghosting are as follows:



@@ 233,7 235,7 @@ const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = {
}
```

Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3737.pdf) and the header file `drivers/led/issi/is31fl3737.h`. The `driver` is the index of the driver you defined in your `config.h` (Only `0`, `1` for now).
Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3737.pdf) and the header file `drivers/led/issi/is31fl3737.h`. The `driver` is the index of the driver you defined in your `config.h` (Only `0`, `1`, `2`, or `3` for now).

---
### IS31FLCOMMON :id=is31flcommon

M quantum/rgb_matrix/rgb_matrix_drivers.c => quantum/rgb_matrix/rgb_matrix_drivers.c +18 -0
@@ 76,6 76,12 @@ static void init(void) {
    IS31FL3737_init(DRIVER_ADDR_1);
#        if defined(DRIVER_ADDR_2)
    IS31FL3737_init(DRIVER_ADDR_2);
#           if defined(DRIVER_ADDR_3)
    IS31FL3737_init(DRIVER_ADDR_3);
#               if defined(DRIVER_ADDR_4)
    IS31FL3737_init(DRIVER_ADDR_4);
#               endif
#           endif
#        endif

#    elif defined(IS31FL3741)


@@ 154,6 160,12 @@ static void init(void) {
    IS31FL3737_update_led_control_registers(DRIVER_ADDR_1, 0);
#        if defined(DRIVER_ADDR_2)
    IS31FL3737_update_led_control_registers(DRIVER_ADDR_2, 1);
#           if defined(DRIVER_ADDR_3)
    IS31FL3737_update_led_control_registers(DRIVER_ADDR_3, 2);
#               if defined(DRIVER_ADDR_4)
    IS31FL3737_update_led_control_registers(DRIVER_ADDR_4, 3);
#               endif
#           endif
#        endif

#    elif defined(IS31FL3741)


@@ 235,6 247,12 @@ static void flush(void) {
    IS31FL3737_update_pwm_buffers(DRIVER_ADDR_1, 0);
#        if defined(DRIVER_ADDR_2)
    IS31FL3737_update_pwm_buffers(DRIVER_ADDR_2, 1);
#           if defined(DRIVER_ADDR_3)
    IS31FL3737_update_pwm_buffers(DRIVER_ADDR_3, 2);
#               if defined(DRIVER_ADDR_4)
    IS31FL3737_update_pwm_buffers(DRIVER_ADDR_4, 3);
#               endif
#           endif
#        endif
}