From d6cd4182b533def97f72826a850849382b9b1968 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 | 27 ++++----------------------- keyboards/ergodox_ez/rules.mk | 1 - 2 files changed, 4 insertions(+), 24 deletions(-) (limited to 'keyboards/ergodox_ez') diff --git a/keyboards/ergodox_ez/led_i2c.c b/keyboards/ergodox_ez/led_i2c.c index 8c4f81c7b7..f5553a8b61 100644 --- a/keyboards/ergodox_ez/led_i2c.c +++ b/keyboards/ergodox_ez/led_i2c.c @@ -22,30 +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 - 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; @@ -53,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 @@ -71,7 +52,7 @@ void rgblight_set(void) { } i2c_stop(); - ws2812_setleds(led, RGBLED_NUM); + ws2812_setleds(led, led_num); } diff --git a/keyboards/ergodox_ez/rules.mk b/keyboards/ergodox_ez/rules.mk index a828694e3d..3b9aa3f0a9 100644 --- a/keyboards/ergodox_ez/rules.mk +++ b/keyboards/ergodox_ez/rules.mk @@ -79,7 +79,6 @@ SWAP_HANDS_ENABLE= yes # Allow swapping hands of keyboard SLEEP_LED_ENABLE = no API_SYSEX_ENABLE = no RGBLIGHT_ENABLE = yes -RGBLIGHT_CUSTOM_DRIVER = yes RGB_MATRIX_ENABLE = no # enable later DEBOUNCE_TYPE = eager_pr -- cgit v1.2.3