summaryrefslogtreecommitdiff
path: root/keyboards/input_club/k_type/is31fl3733-dual.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/input_club/k_type/is31fl3733-dual.c')
-rw-r--r--keyboards/input_club/k_type/is31fl3733-dual.c35
1 files changed, 33 insertions, 2 deletions
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 @@
# define IS31FL3733_GLOBALCURRENT 0xFF
#endif
+#ifndef IS31FL3733_SYNC_1
+# define IS31FL3733_SYNC_1 IS31FL3733_SYNC_NONE
+#endif
+#ifndef IS31FL3733_SYNC_2
+# define IS31FL3733_SYNC_2 IS31FL3733_SYNC_NONE
+#endif
+#ifndef IS31FL3733_SYNC_3
+# define IS31FL3733_SYNC_3 IS31FL3733_SYNC_NONE
+#endif
+#ifndef IS31FL3733_SYNC_4
+# define IS31FL3733_SYNC_4 IS31FL3733_SYNC_NONE
+#endif
+
// Transfer buffer for TWITransmitData()
uint8_t g_twi_transfer_buffer[20];
@@ -125,6 +138,24 @@ bool is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffe
return true;
}
+void is31fl3733_init_drivers(void) {
+ i2c_init(&I2CD1, I2C1_SCL_PIN, I2C1_SDA_PIN);
+ is31fl3733_init(0, IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1);
+# ifdef USE_I2C2
+ i2c_init(&I2CD2, I2C2_SCL_PIN, I2C2_SDA_PIN);
+ is31fl3733_init(1, IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_2);
+# endif
+
+ for (int i = 0; i < IS31FL3733_LED_COUNT; i++) {
+ is31fl3733_set_led_control_register(i, true, true, true);
+ }
+
+ is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_1, 0);
+# ifdef USE_I2C2
+ is31fl3733_update_led_control_registers(IS31FL3733_I2C_ADDRESS_2, 1);
+# endif
+}
+
void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync) {
// In order to avoid the LEDs being driven with garbage data
// in the LED driver's PWM registers, shutdown is enabled last.
@@ -173,7 +204,7 @@ void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync) {
void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
is31fl3733_led_t led;
- if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
+ if (index >= 0 && index < IS31FL3733_LED_COUNT) {
memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led));
if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) {
@@ -187,7 +218,7 @@ void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
}
void is31fl3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
+ for (int i = 0; i < IS31FL3733_LED_COUNT; i++) {
is31fl3733_set_color(i, red, green, blue);
}
}