diff options
| author | Ryan <fauxpark@gmail.com> | 2024-02-09 22:37:18 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-09 22:37:18 +1100 |
| commit | a5ea619139cb08f49cbfa440984ee2604f7104ba (patch) | |
| tree | 3c74866000ad48901829c4bd60ef4b704a130f26 /keyboards/wilba_tech | |
| parent | 137938b67afbf35fd34f2e5cbe3c5c6367a1d0cc (diff) | |
LED drivers: place I2C addresses into an array (#22975)
Diffstat (limited to 'keyboards/wilba_tech')
| -rw-r--r-- | keyboards/wilba_tech/wt_rgb_backlight.c | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/keyboards/wilba_tech/wt_rgb_backlight.c b/keyboards/wilba_tech/wt_rgb_backlight.c index 72ddb34ee7..cf36288705 100644 --- a/keyboards/wilba_tech/wt_rgb_backlight.c +++ b/keyboards/wilba_tech/wt_rgb_backlight.c | |||
| @@ -980,34 +980,34 @@ void backlight_update_pwm_buffers(void) | |||
| 980 | #if defined(RGB_BACKLIGHT_M6_B) | 980 | #if defined(RGB_BACKLIGHT_M6_B) |
| 981 | is31fl3218_update_pwm_buffers(); | 981 | is31fl3218_update_pwm_buffers(); |
| 982 | #elif defined(RGB_BACKLIGHT_PORTICO75) | 982 | #elif defined(RGB_BACKLIGHT_PORTICO75) |
| 983 | is31fl3741_update_pwm_buffers( IS31FL3741_I2C_ADDRESS_1, 0 ); | 983 | is31fl3741_update_pwm_buffers( 0 ); |
| 984 | is31fl3741_update_led_control_registers( IS31FL3741_I2C_ADDRESS_1, 0 ); | 984 | is31fl3741_update_led_control_registers( 0 ); |
| 985 | #elif defined(RGB_BACKLIGHT_M10_C) | 985 | #elif defined(RGB_BACKLIGHT_M10_C) |
| 986 | is31fl3731_update_pwm_buffers( IS31FL3731_I2C_ADDRESS_1, 0 ); | 986 | is31fl3731_update_pwm_buffers( 0 ); |
| 987 | is31fl3731_update_led_control_registers( IS31FL3731_I2C_ADDRESS_1, 0 ); | 987 | is31fl3731_update_led_control_registers( 0 ); |
| 988 | #elif defined(RGB_BACKLIGHT_HS60) | 988 | #elif defined(RGB_BACKLIGHT_HS60) |
| 989 | is31fl3733_update_pwm_buffers( IS31FL3733_I2C_ADDRESS_1, 0 ); | 989 | is31fl3733_update_pwm_buffers( 0 ); |
| 990 | is31fl3733_update_led_control_registers( IS31FL3733_I2C_ADDRESS_1, 0 ); | 990 | is31fl3733_update_led_control_registers( 0 ); |
| 991 | #elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_NK87) || defined(RGB_BACKLIGHT_KW_MEGA) | 991 | #elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_NK87) || defined(RGB_BACKLIGHT_KW_MEGA) |
| 992 | is31fl3733_update_pwm_buffers( IS31FL3733_I2C_ADDRESS_1, 0 ); | 992 | is31fl3733_update_pwm_buffers( 0 ); |
| 993 | is31fl3733_update_pwm_buffers( IS31FL3733_I2C_ADDRESS_2, 1 ); | 993 | is31fl3733_update_pwm_buffers( 1 ); |
| 994 | is31fl3733_update_led_control_registers( IS31FL3733_I2C_ADDRESS_1, 0 ); | 994 | is31fl3733_update_led_control_registers( 0 ); |
| 995 | is31fl3733_update_led_control_registers( IS31FL3733_I2C_ADDRESS_2, 1 ); | 995 | is31fl3733_update_led_control_registers( 1 ); |
| 996 | #elif defined(RGB_BACKLIGHT_NEBULA12) | 996 | #elif defined(RGB_BACKLIGHT_NEBULA12) |
| 997 | is31fl3731_update_pwm_buffers( IS31FL3731_I2C_ADDRESS_1, 0 ); | 997 | is31fl3731_update_pwm_buffers( 0 ); |
| 998 | is31fl3731_update_led_control_registers( IS31FL3731_I2C_ADDRESS_1, 0 ); | 998 | is31fl3731_update_led_control_registers( 0 ); |
| 999 | #elif defined(RGB_BACKLIGHT_U80_A) | 999 | #elif defined(RGB_BACKLIGHT_U80_A) |
| 1000 | static uint8_t driver = 0; | 1000 | static uint8_t driver = 0; |
| 1001 | switch ( driver ) | 1001 | switch ( driver ) |
| 1002 | { | 1002 | { |
| 1003 | case 0: | 1003 | case 0: |
| 1004 | is31fl3731_update_pwm_buffers( IS31FL3731_I2C_ADDRESS_1, 0 ); | 1004 | is31fl3731_update_pwm_buffers( 0 ); |
| 1005 | break; | 1005 | break; |
| 1006 | case 1: | 1006 | case 1: |
| 1007 | is31fl3731_update_pwm_buffers( IS31FL3731_I2C_ADDRESS_2, 1 ); | 1007 | is31fl3731_update_pwm_buffers( 1 ); |
| 1008 | break; | 1008 | break; |
| 1009 | case 2: | 1009 | case 2: |
| 1010 | is31fl3731_update_pwm_buffers( IS31FL3731_I2C_ADDRESS_3, 2 ); | 1010 | is31fl3731_update_pwm_buffers( 2 ); |
| 1011 | break; | 1011 | break; |
| 1012 | } | 1012 | } |
| 1013 | if ( ++driver > 2 ) | 1013 | if ( ++driver > 2 ) |
| @@ -1015,10 +1015,10 @@ void backlight_update_pwm_buffers(void) | |||
| 1015 | driver = 0; | 1015 | driver = 0; |
| 1016 | } | 1016 | } |
| 1017 | #else | 1017 | #else |
| 1018 | is31fl3731_update_pwm_buffers( IS31FL3731_I2C_ADDRESS_1, 0 ); | 1018 | is31fl3731_update_pwm_buffers( 0 ); |
| 1019 | is31fl3731_update_pwm_buffers( IS31FL3731_I2C_ADDRESS_2, 1 ); | 1019 | is31fl3731_update_pwm_buffers( 1 ); |
| 1020 | is31fl3731_update_led_control_registers( IS31FL3731_I2C_ADDRESS_1, 0 ); | 1020 | is31fl3731_update_led_control_registers( 0 ); |
| 1021 | is31fl3731_update_led_control_registers( IS31FL3731_I2C_ADDRESS_2, 1 ); | 1021 | is31fl3731_update_led_control_registers( 1 ); |
| 1022 | #endif | 1022 | #endif |
| 1023 | } | 1023 | } |
| 1024 | 1024 | ||
| @@ -2134,7 +2134,7 @@ void backlight_init_drivers(void) | |||
| 2134 | // This actually updates the LED drivers | 2134 | // This actually updates the LED drivers |
| 2135 | is31fl3218_update_led_control_registers(); | 2135 | is31fl3218_update_led_control_registers(); |
| 2136 | #elif defined(RGB_BACKLIGHT_HS60) | 2136 | #elif defined(RGB_BACKLIGHT_HS60) |
| 2137 | is31fl3733_init( IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE ); | 2137 | is31fl3733_init( 0 ); |
| 2138 | 2138 | ||
| 2139 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) | 2139 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) |
| 2140 | { | 2140 | { |
| @@ -2153,10 +2153,10 @@ void backlight_init_drivers(void) | |||
| 2153 | is31fl3733_set_led_control_register( index, enabled, enabled, enabled ); | 2153 | is31fl3733_set_led_control_register( index, enabled, enabled, enabled ); |
| 2154 | } | 2154 | } |
| 2155 | // This actually updates the LED drivers | 2155 | // This actually updates the LED drivers |
| 2156 | is31fl3733_update_led_control_registers( IS31FL3733_I2C_ADDRESS_1, 0 ); | 2156 | is31fl3733_update_led_control_registers( 0 ); |
| 2157 | #elif defined(RGB_BACKLIGHT_NK65) | 2157 | #elif defined(RGB_BACKLIGHT_NK65) |
| 2158 | is31fl3733_init( IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE ); | 2158 | is31fl3733_init( 0 ); |
| 2159 | is31fl3733_init( IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_NONE ); | 2159 | is31fl3733_init( 1 ); |
| 2160 | 2160 | ||
| 2161 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) | 2161 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) |
| 2162 | { | 2162 | { |
| @@ -2167,11 +2167,11 @@ void backlight_init_drivers(void) | |||
| 2167 | } | 2167 | } |
| 2168 | is31fl3733_set_led_control_register( 7+64-1, 0, 1, 0 ); //Enable LB7 green enable for indicators | 2168 | is31fl3733_set_led_control_register( 7+64-1, 0, 1, 0 ); //Enable LB7 green enable for indicators |
| 2169 | // This actually updates the LED drivers | 2169 | // This actually updates the LED drivers |
| 2170 | is31fl3733_update_led_control_registers( IS31FL3733_I2C_ADDRESS_1, 0 ); | 2170 | is31fl3733_update_led_control_registers( 0 ); |
| 2171 | is31fl3733_update_led_control_registers( IS31FL3733_I2C_ADDRESS_2, 1 ); | 2171 | is31fl3733_update_led_control_registers( 1 ); |
| 2172 | #elif defined(RGB_BACKLIGHT_NK87) | 2172 | #elif defined(RGB_BACKLIGHT_NK87) |
| 2173 | is31fl3733_init( IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE ); | 2173 | is31fl3733_init( 0 ); |
| 2174 | is31fl3733_init( IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_NONE ); | 2174 | is31fl3733_init( 1 ); |
| 2175 | 2175 | ||
| 2176 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) | 2176 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) |
| 2177 | { | 2177 | { |
| @@ -2197,11 +2197,11 @@ void backlight_init_drivers(void) | |||
| 2197 | } | 2197 | } |
| 2198 | is31fl3733_set_led_control_register( 48+64-1, 0, 0, 1 ); //Enable LB48 blue enable for indicators | 2198 | is31fl3733_set_led_control_register( 48+64-1, 0, 0, 1 ); //Enable LB48 blue enable for indicators |
| 2199 | // This actually updates the LED drivers | 2199 | // This actually updates the LED drivers |
| 2200 | is31fl3733_update_led_control_registers( IS31FL3733_I2C_ADDRESS_1, 0 ); | 2200 | is31fl3733_update_led_control_registers( 0 ); |
| 2201 | is31fl3733_update_led_control_registers( IS31FL3733_I2C_ADDRESS_2, 1 ); | 2201 | is31fl3733_update_led_control_registers( 1 ); |
| 2202 | #elif defined(RGB_BACKLIGHT_NEBULA68) | 2202 | #elif defined(RGB_BACKLIGHT_NEBULA68) |
| 2203 | is31fl3733_init( IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE ); | 2203 | is31fl3733_init( 0 ); |
| 2204 | is31fl3733_init( IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_NONE ); | 2204 | is31fl3733_init( 1 ); |
| 2205 | 2205 | ||
| 2206 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) | 2206 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) |
| 2207 | { | 2207 | { |
| @@ -2211,20 +2211,20 @@ void backlight_init_drivers(void) | |||
| 2211 | is31fl3733_set_led_control_register( index, enabled, enabled, enabled ); | 2211 | is31fl3733_set_led_control_register( index, enabled, enabled, enabled ); |
| 2212 | } | 2212 | } |
| 2213 | // This actually updates the LED drivers | 2213 | // This actually updates the LED drivers |
| 2214 | is31fl3733_update_led_control_registers( IS31FL3733_I2C_ADDRESS_1, 0 ); | 2214 | is31fl3733_update_led_control_registers( 0 ); |
| 2215 | is31fl3733_update_led_control_registers( IS31FL3733_I2C_ADDRESS_2, 1 ); | 2215 | is31fl3733_update_led_control_registers( 1 ); |
| 2216 | #elif defined(RGB_BACKLIGHT_PORTICO75) | 2216 | #elif defined(RGB_BACKLIGHT_PORTICO75) |
| 2217 | is31fl3741_init( IS31FL3741_I2C_ADDRESS_1 ); | 2217 | is31fl3741_init( 0 ); |
| 2218 | bool enabled = true; | 2218 | bool enabled = true; |
| 2219 | for ( int index = 0; index < IS31FL3741_LED_COUNT; index++ ) | 2219 | for ( int index = 0; index < IS31FL3741_LED_COUNT; index++ ) |
| 2220 | { | 2220 | { |
| 2221 | is31fl3741_set_led_control_register( index, enabled, enabled, enabled ); | 2221 | is31fl3741_set_led_control_register( index, enabled, enabled, enabled ); |
| 2222 | } | 2222 | } |
| 2223 | // This actually updates the LED drivers | 2223 | // This actually updates the LED drivers |
| 2224 | is31fl3741_update_led_control_registers( IS31FL3741_I2C_ADDRESS_1, 0 ); | 2224 | is31fl3741_update_led_control_registers( 0 ); |
| 2225 | #elif defined(RGB_BACKLIGHT_KW_MEGA) | 2225 | #elif defined(RGB_BACKLIGHT_KW_MEGA) |
| 2226 | is31fl3733_init( IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_NONE ); | 2226 | is31fl3733_init( 0 ); |
| 2227 | is31fl3733_init( IS31FL3733_I2C_ADDRESS_2, IS31FL3733_SYNC_NONE ); | 2227 | is31fl3733_init( 1 ); |
| 2228 | 2228 | ||
| 2229 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) | 2229 | for ( int index = 0; index < IS31FL3733_LED_COUNT; index++ ) |
| 2230 | { | 2230 | { |
| @@ -2234,18 +2234,18 @@ void backlight_init_drivers(void) | |||
| 2234 | is31fl3733_set_led_control_register( index, enabled, enabled, enabled ); | 2234 | is31fl3733_set_led_control_register( index, enabled, enabled, enabled ); |
| 2235 | } | 2235 | } |
| 2236 | // This actually updates the LED drivers | 2236 | // This actually updates the LED drivers |
| 2237 | is31fl3733_update_led_control_registers( IS31FL3733_I2C_ADDRESS_1, 0 ); | 2237 | is31fl3733_update_led_control_registers( 0 ); |
| 2238 | is31fl3733_update_led_control_registers( IS31FL3733_I2C_ADDRESS_2, 1 ); | 2238 | is31fl3733_update_led_control_registers( 1 ); |
| 2239 | #else | 2239 | #else |
| 2240 | // Init the #1 driver | 2240 | // Init the #1 driver |
| 2241 | is31fl3731_init( IS31FL3731_I2C_ADDRESS_1 ); | 2241 | is31fl3731_init( 0 ); |
| 2242 | // Init the #2 driver (if used) | 2242 | // Init the #2 driver (if used) |
| 2243 | #if !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_M10_C) | 2243 | #if !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_M10_C) |
| 2244 | is31fl3731_init( IS31FL3731_I2C_ADDRESS_2 ); | 2244 | is31fl3731_init( 1 ); |
| 2245 | #endif | 2245 | #endif |
| 2246 | // Init the #3 driver (if used) | 2246 | // Init the #3 driver (if used) |
| 2247 | #if defined(RGB_BACKLIGHT_U80_A) | 2247 | #if defined(RGB_BACKLIGHT_U80_A) |
| 2248 | is31fl3731_init( IS31FL3731_I2C_ADDRESS_3 ); | 2248 | is31fl3731_init( 2 ); |
| 2249 | #endif | 2249 | #endif |
| 2250 | 2250 | ||
| 2251 | // Experimental feature, not in configuration yet | 2251 | // Experimental feature, not in configuration yet |
| @@ -2378,12 +2378,12 @@ void backlight_init_drivers(void) | |||
| 2378 | } | 2378 | } |
| 2379 | // This actually updates the LED drivers | 2379 | // This actually updates the LED drivers |
| 2380 | // TODO: refactor this to use DRIVER_COUNT | 2380 | // TODO: refactor this to use DRIVER_COUNT |
| 2381 | is31fl3731_update_led_control_registers( IS31FL3731_I2C_ADDRESS_1, 0 ); | 2381 | is31fl3731_update_led_control_registers( 0 ); |
| 2382 | #if !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_M10_C) | 2382 | #if !defined(RGB_BACKLIGHT_NEBULA12) && !defined(RGB_BACKLIGHT_M10_C) |
| 2383 | is31fl3731_update_led_control_registers( IS31FL3731_I2C_ADDRESS_2, 1 ); | 2383 | is31fl3731_update_led_control_registers( 1 ); |
| 2384 | #endif | 2384 | #endif |
| 2385 | #if defined(RGB_BACKLIGHT_U80_A) | 2385 | #if defined(RGB_BACKLIGHT_U80_A) |
| 2386 | is31fl3731_update_led_control_registers( IS31FL3731_I2C_ADDRESS_3, 2 ); | 2386 | is31fl3731_update_led_control_registers( 2 ); |
| 2387 | #endif | 2387 | #endif |
| 2388 | #endif | 2388 | #endif |
| 2389 | 2389 | ||
