aboutsummaryrefslogtreecommitdiff
path: root/quantum/rgblight.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/rgblight.c')
-rw-r--r--quantum/rgblight.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index 1c197827f..7949bb688 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -126,6 +126,9 @@ void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1) {
126 (*led1).r = r; 126 (*led1).r = r;
127 (*led1).g = g; 127 (*led1).g = g;
128 (*led1).b = b; 128 (*led1).b = b;
129#ifdef RGBW
130 (*led1).w = 0;
131#endif
129} 132}
130 133
131void rgblight_check_config(void) { 134void rgblight_check_config(void) {
@@ -186,7 +189,6 @@ void rgblight_init(void) {
186 return; 189 return;
187 } 190 }
188 191
189 debug_enable = 1; // Debug ON!
190 dprintf("rgblight_init called.\n"); 192 dprintf("rgblight_init called.\n");
191 dprintf("rgblight_init start!\n"); 193 dprintf("rgblight_init start!\n");
192 if (!eeconfig_is_enabled()) { 194 if (!eeconfig_is_enabled()) {
@@ -514,6 +516,9 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
514 led[i].r = r; 516 led[i].r = r;
515 led[i].g = g; 517 led[i].g = g;
516 led[i].b = b; 518 led[i].b = b;
519#ifdef RGBW
520 led[i].w = 0;
521#endif
517 } 522 }
518 rgblight_set(); 523 rgblight_set();
519} 524}
@@ -526,6 +531,9 @@ void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index) {
526 led[index].r = r; 531 led[index].r = r;
527 led[index].g = g; 532 led[index].g = g;
528 led[index].b = b; 533 led[index].b = b;
534#ifdef RGBW
535 led[index].w = 0;
536#endif
529 rgblight_set(); 537 rgblight_set();
530} 538}
531 539
@@ -560,6 +568,9 @@ void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8
560 led[i].r = r; 568 led[i].r = r;
561 led[i].g = g; 569 led[i].g = g;
562 led[i].b = b; 570 led[i].b = b;
571#ifdef RGBW
572 led[i].w = 0;
573#endif
563 } 574 }
564 rgblight_set(); 575 rgblight_set();
565 wait_ms(1); 576 wait_ms(1);
@@ -595,6 +606,9 @@ void rgblight_set(void) {
595 led[i].r = 0; 606 led[i].r = 0;
596 led[i].g = 0; 607 led[i].g = 0;
597 led[i].b = 0; 608 led[i].b = 0;
609# ifdef RGBW
610 led[i].w = 0;
611# endif
598 } 612 }
599 } 613 }
600# ifdef RGBLIGHT_LED_MAP 614# ifdef RGBLIGHT_LED_MAP
@@ -606,11 +620,7 @@ void rgblight_set(void) {
606# else 620# else
607 start_led = led + clipping_start_pos; 621 start_led = led + clipping_start_pos;
608# endif 622# endif
609# ifdef RGBW
610 ws2812_setleds_rgbw(start_led, num_leds);
611# else
612 ws2812_setleds(start_led, num_leds); 623 ws2812_setleds(start_led, num_leds);
613# endif
614} 624}
615#endif 625#endif
616 626
@@ -908,6 +918,9 @@ void rgblight_effect_snake(animation_status_t *anim) {
908 ledp->r = 0; 918 ledp->r = 0;
909 ledp->g = 0; 919 ledp->g = 0;
910 ledp->b = 0; 920 ledp->b = 0;
921# ifdef RGBW
922 ledp->w = 0;
923# endif
911 for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) { 924 for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) {
912 k = pos + j * increment; 925 k = pos + j * increment;
913 if (k > RGBLED_NUM) { 926 if (k > RGBLED_NUM) {
@@ -965,6 +978,9 @@ void rgblight_effect_knight(animation_status_t *anim) {
965 led[i].r = 0; 978 led[i].r = 0;
966 led[i].g = 0; 979 led[i].g = 0;
967 led[i].b = 0; 980 led[i].b = 0;
981# ifdef RGBW
982 led[i].w = 0;
983# endif
968 } 984 }
969 // Determine which LEDs should be lit up 985 // Determine which LEDs should be lit up
970 for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) { 986 for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) {
@@ -976,6 +992,9 @@ void rgblight_effect_knight(animation_status_t *anim) {
976 led[cur].r = 0; 992 led[cur].r = 0;
977 led[cur].g = 0; 993 led[cur].g = 0;
978 led[cur].b = 0; 994 led[cur].b = 0;
995# ifdef RGBW
996 led[cur].w = 0;
997# endif
979 } 998 }
980 } 999 }
981 rgblight_set(); 1000 rgblight_set();