qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

ws2812.c (412B)


      1 // Copyright 2024 QMK
      2 // SPDX-License-Identifier: GPL-2.0-or-later
      3 
      4 #include "ws2812.h"
      5 
      6 #if defined(WS2812_RGBW)
      7 void ws2812_rgb_to_rgbw(ws2812_led_t *led) {
      8     // Determine lowest value in all three colors, put that into
      9     // the white channel and then shift all colors by that amount
     10     led->w = MIN(led->r, MIN(led->g, led->b));
     11     led->r -= led->w;
     12     led->g -= led->w;
     13     led->b -= led->w;
     14 }
     15 #endif