ws2812.c 412 B

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