summaryrefslogtreecommitdiff
path: root/quantum/rgblight.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2019-11-09 07:51:39 -0800
committerJoel Challis <git@zvecr.com>2019-11-09 15:51:39 +0000
commit60e4921378d879eed110f801328e9642f35fa1e9 (patch)
tree9bb36017ba58e7aedbcfee9db0bba1a3bc466359 /quantum/rgblight.c
parent78205e64a7053746b1491c0d39dbb300a55f3248 (diff)
downloadqmk_firmware-60e4921378d879eed110f801328e9642f35fa1e9.tar.gz
qmk_firmware-60e4921378d879eed110f801328e9642f35fa1e9.zip
Unify RGB and RGBW commands (#7297)
* Fix unicode in comments Co-Authored-By: fauxpark <fauxpark@gmail.com> * Remove separate RGBW implementation for a unified function * Set White to 0 in RGBW LEDs This is just to get this working, later, proper brightness can be handled elsewhere. * Use us instead of nanoseconds(?) since it renders correctly on web * Remove RGBW function from arm/ws2812.h * Remove RGBW function from arm/ws2812.c * Formatting changes * Add doc info
Diffstat (limited to 'quantum/rgblight.c')
-rw-r--r--quantum/rgblight.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index 1c197827f2..a4cbe513e1 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) {
(*led1).r = r;
(*led1).g = g;
(*led1).b = b;
+#ifdef RGBW
+ (*led1).w = 0;
+#endif
}
void rgblight_check_config(void) {
@@ -514,6 +517,9 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
led[i].r = r;
led[i].g = g;
led[i].b = b;
+#ifdef RGBW
+ led[i].w = 0;
+#endif
}
rgblight_set();
}
@@ -526,6 +532,9 @@ void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index) {
led[index].r = r;
led[index].g = g;
led[index].b = b;
+#ifdef RGBW
+ led[index].w = 0;
+#endif
rgblight_set();
}
@@ -560,6 +569,9 @@ void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8
led[i].r = r;
led[i].g = g;
led[i].b = b;
+#ifdef RGBW
+ led[i].w = 0;
+#endif
}
rgblight_set();
wait_ms(1);
@@ -595,6 +607,9 @@ void rgblight_set(void) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
+# ifdef RGBW
+ led[i].w = 0;
+# endif
}
}
# ifdef RGBLIGHT_LED_MAP
@@ -606,11 +621,7 @@ void rgblight_set(void) {
# else
start_led = led + clipping_start_pos;
# endif
-# ifdef RGBW
- ws2812_setleds_rgbw(start_led, num_leds);
-# else
ws2812_setleds(start_led, num_leds);
-# endif
}
#endif
@@ -908,6 +919,9 @@ void rgblight_effect_snake(animation_status_t *anim) {
ledp->r = 0;
ledp->g = 0;
ledp->b = 0;
+# ifdef RGBW
+ ledp->w = 0;
+# endif
for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) {
k = pos + j * increment;
if (k > RGBLED_NUM) {
@@ -965,6 +979,9 @@ void rgblight_effect_knight(animation_status_t *anim) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
+# ifdef RGBW
+ led[i].w = 0;
+# endif
}
// Determine which LEDs should be lit up
for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) {
@@ -976,6 +993,9 @@ void rgblight_effect_knight(animation_status_t *anim) {
led[cur].r = 0;
led[cur].g = 0;
led[cur].b = 0;
+# ifdef RGBW
+ led[cur].w = 0;
+# endif
}
}
rgblight_set();