Переглянути джерело

4 Driver support for IS31FL3737 (#18750)

* Added 4 driver support for the IS31FL3737 LED driver

* Updated docs for IS31FL3737 to support 4 drivers
Jamal Bouajjaj 2 роки тому
батько
коміт
9d4c4ceee1
2 змінених файлів з 22 додано та 2 видалено
  1. 4 2
      docs/feature_rgb_matrix.md
  2. 18 0
      quantum/rgb_matrix/rgb_matrix_drivers.c

+ 4 - 2
docs/feature_rgb_matrix.md

@@ -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

+ 18 - 0
quantum/rgb_matrix/rgb_matrix_drivers.c

@@ -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
 }