FastLED 3.9.7
Loading...
Searching...
No Matches
rgbw.h File Reference

Detailed Description

Functions for red, green, blue, white (RGBW) output.

Definition in file rgbw.h.

#include <stdint.h>
#include "fl/force_inline.h"
#include "fl/namespace.h"
#include "eorder.h"

Go to the source code of this file.

Classes

struct  Rgbw
 
struct  RgbwInvalid
 
struct  RgbwDefault
 
struct  RgbwWhiteIsOff
 

Typedefs

typedef void(* rgb_2_rgbw_function) (uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)
 

Enumerations

enum  RGBW_MODE {
  kRGBWInvalid , kRGBWNullWhitePixel , kRGBWExactColors , kRGBWBoostedWhite ,
  kRGBWMaxBrightness , kRGBWUserFunction
}
 
enum  { kRGBWDefaultColorTemp = 6000 }
 

Functions

void rgb_2_rgbw_exact (uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)
 Converts RGB to RGBW using a color transfer method from saturated color channels to white.
 
void rgb_2_rgbw_max_brightness (uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)
 The minimum brigthness of the RGB channels is used to set the W channel.
 
void rgb_2_rgbw_null_white_pixel (uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)
 Converts RGB to RGBW with the W channel set to black, always.
 
void rgb_2_rgbw_white_boosted (uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)
 Converts RGB to RGBW with a boosted white channel.
 
void rgb_2_rgbw_user_function (uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)
 
void set_rgb_2_rgbw_function (rgb_2_rgbw_function func)
 
FASTLED_FORCE_INLINE void rgb_2_rgbw (RGBW_MODE mode, uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)
 Converts RGB to RGBW using one of the functions.
 
template<RGBW_MODE MODE>
FASTLED_FORCE_INLINE void rgb_2_rgbw (uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)
 
void rgbw_partial_reorder (EOrderW w_placement, uint8_t b0, uint8_t b1, uint8_t b2, uint8_t w, uint8_t *out_b0, uint8_t *out_b1, uint8_t *out_b2, uint8_t *out_b3)
 

Typedef Documentation

◆ rgb_2_rgbw_function

typedef void(* rgb_2_rgbw_function) (uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)

Definition at line 75 of file rgbw.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Definition at line 24 of file rgbw.h.

◆ RGBW_MODE

enum RGBW_MODE

Definition at line 15 of file rgbw.h.

Function Documentation

◆ rgb_2_rgbw() [1/2]

FASTLED_FORCE_INLINE void rgb_2_rgbw ( RGBW_MODE mode,
uint16_t w_color_temperature,
uint8_t r,
uint8_t g,
uint8_t b,
uint8_t r_scale,
uint8_t g_scale,
uint8_t b_scale,
uint8_t * out_r,
uint8_t * out_g,
uint8_t * out_b,
uint8_t * out_w )

Converts RGB to RGBW using one of the functions.

Dynamic version of the rgb_w_rgbw function with less chance for the compiler to optimize.

Definition at line 139 of file rgbw.h.

◆ rgb_2_rgbw() [2/2]

template<RGBW_MODE MODE>
FASTLED_FORCE_INLINE void rgb_2_rgbw ( uint16_t w_color_temperature,
uint8_t r,
uint8_t g,
uint8_t b,
uint8_t r_scale,
uint8_t g_scale,
uint8_t b_scale,
uint8_t * out_r,
uint8_t * out_g,
uint8_t * out_b,
uint8_t * out_w )

Definition at line 174 of file rgbw.h.

◆ rgb_2_rgbw_exact()

void rgb_2_rgbw_exact ( uint16_t w_color_temperature,
uint8_t r,
uint8_t g,
uint8_t b,
uint8_t r_scale,
uint8_t g_scale,
uint8_t b_scale,
uint8_t * out_r,
uint8_t * out_g,
uint8_t * out_b,
uint8_t * out_w )

Converts RGB to RGBW using a color transfer method from saturated color channels to white.

This is designed to produce the most accurate white point for a given color temperature and reduces power usage of the chip since a white led is much more efficient than three color channels of the same power mixing together. However the pixel will never achieve full brightness since the white channel is 3x more efficient than the color channels mixed together, so in this mode the max brightness of a given pixel is reduced.

RGB(255, 255, 255) -> RGBW(0, 0, 0, 85)
RGB(255, 0, 0) -> RGBW(255, 0, 0, 0)
@ RGB
Red, Green, Blue (0012)
Definition eorder.h:15

Definition at line 40 of file rgbw.cpp.

◆ rgb_2_rgbw_max_brightness()

void rgb_2_rgbw_max_brightness ( uint16_t w_color_temperature,
uint8_t r,
uint8_t g,
uint8_t b,
uint8_t r_scale,
uint8_t g_scale,
uint8_t b_scale,
uint8_t * out_r,
uint8_t * out_g,
uint8_t * out_b,
uint8_t * out_w )

The minimum brigthness of the RGB channels is used to set the W channel.

This will allow the max brightness of the led chipset to be used. However the leds will appear over-desaturated in this mode.

RGB(255, 255, 255) -> RGBW(255, 255, 255, 255)
RGB(1, 0, 0) -> RGBW(1, 0, 0, 1)

Definition at line 55 of file rgbw.cpp.

◆ rgb_2_rgbw_null_white_pixel()

void rgb_2_rgbw_null_white_pixel ( uint16_t w_color_temperature,
uint8_t r,
uint8_t g,
uint8_t b,
uint8_t r_scale,
uint8_t g_scale,
uint8_t b_scale,
uint8_t * out_r,
uint8_t * out_g,
uint8_t * out_b,
uint8_t * out_w )

Converts RGB to RGBW with the W channel set to black, always.

RGB(255, 255, 255) -> RGBW(255, 255, 255, 0)

Definition at line 66 of file rgbw.cpp.

◆ rgb_2_rgbw_user_function()

void rgb_2_rgbw_user_function ( uint16_t w_color_temperature,
uint8_t r,
uint8_t g,
uint8_t b,
uint8_t r_scale,
uint8_t g_scale,
uint8_t b_scale,
uint8_t * out_r,
uint8_t * out_g,
uint8_t * out_b,
uint8_t * out_w )

Definition at line 125 of file rgbw.cpp.

◆ rgb_2_rgbw_white_boosted()

void rgb_2_rgbw_white_boosted ( uint16_t w_color_temperature,
uint8_t r,
uint8_t g,
uint8_t b,
uint8_t r_scale,
uint8_t g_scale,
uint8_t b_scale,
uint8_t * out_r,
uint8_t * out_g,
uint8_t * out_b,
uint8_t * out_w )

Converts RGB to RGBW with a boosted white channel.

Definition at line 78 of file rgbw.cpp.

◆ rgbw_partial_reorder()

void rgbw_partial_reorder ( EOrderW w_placement,
uint8_t b0,
uint8_t b1,
uint8_t b2,
uint8_t w,
uint8_t * out_b0,
uint8_t * out_b1,
uint8_t * out_b2,
uint8_t * out_b3 )

Definition at line 133 of file rgbw.cpp.

◆ set_rgb_2_rgbw_function()

void set_rgb_2_rgbw_function ( rgb_2_rgbw_function func)

Definition at line 117 of file rgbw.cpp.