diff options
author | Drashna Jaelre <[email protected]> | 2019-12-31 08:33:49 -0800 |
---|---|---|
committer | Joel Challis <[email protected]> | 2019-12-31 16:33:49 +0000 |
commit | 7ba6456c0b2e041bb9f97dbed265c5b8b4b12192 (patch) | |
tree | 4e01ff717ab7d4c1d6d979f5d01ad8d4d841962e /quantum/color.c | |
parent | a52e55ec09c587ca58a156a6c174d51e0ad228b4 (diff) | |
download | qmk_firmware-7ba6456c0b2e041bb9f97dbed265c5b8b4b12192.tar.gz qmk_firmware-7ba6456c0b2e041bb9f97dbed265c5b8b4b12192.zip |
Use White channel on RGBW LEDs (#7678)
* Use White channel on RGBW LEDs
Co-authored-by: kwerdenker <[email protected]>
* Manually apply white channel to array
* Move where convert_rgb_to_rgbw is called
* Fix type for rgbw led struct
* Add changes to Ergodox EZ
can revert if deemed necessary
* Revert "Add changes to Ergodox EZ"
This reverts commit aa44db198d40d758ca10470eb94615513592d1dd.
* Revert "Fix type for rgbw led struct"
This reverts commit c5c744cba040201cc0d124400773cf13f8a2cf22.
* Revert "Move where convert_rgb_to_rgbw is called"
This reverts commit cd7f17caf6dd30731c54b3be54490fe4519444f9.
* Revert changes and fix up functions
* Enable white channel for Ergodox EZ as well
* Only run conversion of rgblight is enabled
Co-authored-by: kwerdenker <[email protected]>
Diffstat (limited to 'quantum/color.c')
-rw-r--r-- | quantum/color.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/quantum/color.c b/quantum/color.c index 1f398e2403..8bd52444fa 100644 --- a/quantum/color.c +++ b/quantum/color.c @@ -85,3 +85,17 @@ RGB hsv_to_rgb(HSV hsv) { return rgb; } + +#ifdef RGBW +#ifndef MIN +# define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif +void convert_rgb_to_rgbw(LED_TYPE *led) { + // Determine lowest value in all three colors, put that into + // the white channel and then shift all colors by that amount + led->w = MIN(led->r, MIN(led->g, led->b)); + led->r -= led->w; + led->g -= led->w; + led->b -= led->w; +} +#endif |