diff options
author | Drashna Jaelre <drashna@live.com> | 2020-04-29 01:22:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 10:22:28 +0200 |
commit | 86c4c4e91de20b3f928300cfab617963c31699f9 (patch) | |
tree | 15580381612f1b30568ef98a941f3f7220215feb /keyboards/ergodox_ez | |
parent | 5f5c2a219c2ae87534d203ef12e61482cac47a70 (diff) |
Convert clipping variables in rgblight.c to a structure (#7720)
Diffstat (limited to 'keyboards/ergodox_ez')
-rw-r--r-- | keyboards/ergodox_ez/led_i2c.c | 28 | ||||
-rw-r--r-- | keyboards/ergodox_ez/rules.mk | 1 |
2 files changed, 4 insertions, 25 deletions
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); } diff --git a/keyboards/ergodox_ez/rules.mk b/keyboards/ergodox_ez/rules.mk index 617ffea857..579e4f59de 100644 --- a/keyboards/ergodox_ez/rules.mk +++ b/keyboards/ergodox_ez/rules.mk @@ -31,7 +31,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 |