aboutsummaryrefslogtreecommitdiff
path: root/keyboards/ergodox_ez/led_i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/ergodox_ez/led_i2c.c')
-rw-r--r--keyboards/ergodox_ez/led_i2c.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/keyboards/ergodox_ez/led_i2c.c b/keyboards/ergodox_ez/led_i2c.c
index 7c1ccdec5..f5553a8b6 100644
--- a/keyboards/ergodox_ez/led_i2c.c
+++ b/keyboards/ergodox_ez/led_i2c.c
@@ -22,31 +22,11 @@
22 */ 22 */
23#ifdef RGBLIGHT_ENABLE 23#ifdef RGBLIGHT_ENABLE
24 24
25# include "ws2812.c"
26# include "ergodox_ez.h" 25# include "ergodox_ez.h"
27 26
28extern rgblight_config_t rgblight_config; 27extern rgblight_config_t rgblight_config;
29 28
30void rgblight_set(void) { 29void rgblight_call_driver(LED_TYPE *led, uint8_t led_num) {
31 if (!rgblight_config.enable) {
32 for (uint8_t i = 0; i < RGBLED_NUM; i++) {
33 led[i].r = 0;
34 led[i].g = 0;
35 led[i].b = 0;
36#ifdef RGBW
37 led[i].w = 0;
38#endif
39 }
40 }
41#ifdef RGBW
42 else {
43 for (uint8_t i = 0; i < RGBLED_NUM; i++) {
44 convert_rgb_to_rgbw(&led[i]);
45 }
46 }
47#endif
48
49 uint8_t led_num = RGBLED_NUM;
50 i2c_init(); 30 i2c_init();
51 i2c_start(0x84, ERGODOX_EZ_I2C_TIMEOUT); 31 i2c_start(0x84, ERGODOX_EZ_I2C_TIMEOUT);
52 int i = 0; 32 int i = 0;
@@ -54,8 +34,8 @@ void rgblight_set(void) {
54 // prevent right-half code from trying to bitbang all 30 34 // prevent right-half code from trying to bitbang all 30
55 // so with 30 LEDs, we count from 29 to 15 here, and the 35 // so with 30 LEDs, we count from 29 to 15 here, and the
56 // other half does 0 to 14. 36 // other half does 0 to 14.
57 led_num = RGBLED_NUM / 2; 37 uint8_t half_led_num = RGBLED_NUM / 2;
58 for (i = led_num + led_num - 1; i >= led_num; --i) 38 for (i = half_led_num + half_led_num - 1; i >= half_led_num; --i)
59# elif defined(ERGODOX_LED_15_MIRROR) 39# elif defined(ERGODOX_LED_15_MIRROR)
60 for (i = 0; i < led_num; ++i) 40 for (i = 0; i < led_num; ++i)
61# else // ERGDOX_LED_15 non-mirrored 41# else // ERGDOX_LED_15 non-mirrored
@@ -72,7 +52,7 @@ void rgblight_set(void) {
72 } 52 }
73 i2c_stop(); 53 i2c_stop();
74 54
75 ws2812_setleds(led, RGBLED_NUM); 55 ws2812_setleds(led, led_num);
76} 56}
77 57
78 58