From 86c4c4e91de20b3f928300cfab617963c31699f9 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 29 Apr 2020 01:22:28 -0700 Subject: Convert clipping variables in rgblight.c to a structure (#7720) --- keyboards/ergodox_ez/led_i2c.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'keyboards/ergodox_ez/led_i2c.c') diff --git a/keyboards/ergodox_ez/led_i2c.c b/keyboards/ergodox_ez/led_i2c.c index 7c1ccdec5a..f5553a8b61 100644 --- a/keyboards/ergodox_ez/led_i2c.c +++ b/keyboards/ergodox_ez/led_i2c.c @@ -22,31 +22,11 @@ */ #ifdef RGBLIGHT_ENABLE -# include "ws2812.c" # include "ergodox_ez.h" extern rgblight_config_t rgblight_config; -void rgblight_set(void) { - if (!rgblight_config.enable) { - for (uint8_t i = 0; i < RGBLED_NUM; i++) { - led[i].r = 0; - led[i].g = 0; - led[i].b = 0; -#ifdef RGBW - led[i].w = 0; -#endif - } - } -#ifdef RGBW - else { - for (uint8_t i = 0; i < RGBLED_NUM; i++) { - convert_rgb_to_rgbw(&led[i]); - } - } -#endif - - uint8_t led_num = RGBLED_NUM; +void rgblight_call_driver(LED_TYPE *led, uint8_t led_num) { i2c_init(); i2c_start(0x84, ERGODOX_EZ_I2C_TIMEOUT); int i = 0; @@ -54,8 +34,8 @@ void rgblight_set(void) { // prevent right-half code from trying to bitbang all 30 // so with 30 LEDs, we count from 29 to 15 here, and the // other half does 0 to 14. - led_num = RGBLED_NUM / 2; - for (i = led_num + led_num - 1; i >= led_num; --i) + uint8_t half_led_num = RGBLED_NUM / 2; + for (i = half_led_num + half_led_num - 1; i >= half_led_num; --i) # elif defined(ERGODOX_LED_15_MIRROR) for (i = 0; i < led_num; ++i) # else // ERGDOX_LED_15 non-mirrored @@ -72,7 +52,7 @@ void rgblight_set(void) { } i2c_stop(); - ws2812_setleds(led, RGBLED_NUM); + ws2812_setleds(led, led_num); } -- cgit v1.2.3