6#define FASTLED_INTERNAL
15inline uint8_t min3(uint8_t a, uint8_t b, uint8_t c) {
31inline uint8_t divide_by_3(uint8_t x) {
32 uint16_t y = (uint16_t(x) * 85) >> 8;
33 return static_cast<uint8_t
>(y);
41 uint8_t b, uint8_t r_scale, uint8_t g_scale,
42 uint8_t b_scale, uint8_t *out_r, uint8_t *out_g,
43 uint8_t *out_b, uint8_t *out_w) {
44 (void)w_color_temperature;
48 uint8_t min_component = min3(r, g, b);
49 *out_r = r - min_component;
50 *out_g = g - min_component;
51 *out_b = b - min_component;
52 *out_w = min_component;
56 uint8_t g, uint8_t b, uint8_t r_scale,
57 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
58 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w) {
59 (void)w_color_temperature;
60 *out_r =
scale8(r, r_scale);
61 *out_g =
scale8(g, g_scale);
62 *out_b =
scale8(b, b_scale);
63 *out_w = min3(r, g, b);
67 uint8_t g, uint8_t b, uint8_t r_scale,
68 uint8_t g_scale, uint8_t b_scale,
69 uint8_t *out_r, uint8_t *out_g, uint8_t *out_b,
71 (void)w_color_temperature;
72 *out_r =
scale8(r, r_scale);
73 *out_g =
scale8(g, g_scale);
74 *out_b =
scale8(b, b_scale);
79 uint8_t g, uint8_t b, uint8_t r_scale,
80 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
81 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w) {
82 (void)w_color_temperature;
86 uint8_t min_component = min3(r, g, b);
89 if (min_component <= 84) {
90 w = 3 * min_component;
99 r_prime = r - min_component;
100 g_prime = g - min_component;
101 b_prime = b - min_component;
103 uint8_t w3 = divide_by_3(w);
117void set_rgb_2_rgbw_function(rgb_2_rgbw_function func) {
118 if (func ==
nullptr) {
122 g_user_function = func;
125void rgb_2_rgbw_user_function(uint16_t w_color_temperature, uint8_t r,
126 uint8_t g, uint8_t b, uint8_t r_scale,
127 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
128 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w) {
129 g_user_function(w_color_temperature, r, g, b, r_scale, g_scale, b_scale,
130 out_r, out_g, out_b, out_w);
133void rgbw_partial_reorder(
EOrderW w_placement, uint8_t b0, uint8_t b1,
134 uint8_t b2, uint8_t w, uint8_t *out_b0,
135 uint8_t *out_b1, uint8_t *out_b2, uint8_t *out_b3) {
137 uint8_t out[4] = {b0, b1, b2, 0};
138 switch (w_placement) {
central include file for FastLED, defines the CFastLED class/object
LIB8STATIC_ALWAYS_INLINE uint8_t scale8(uint8_t i, fract8 scale)
Scale one byte by a second one, which is treated as the numerator of a fraction whose denominator is ...
#define FASTLED_NAMESPACE_END
End of the FastLED namespace.
#define FASTLED_NAMESPACE_BEGIN
Start of the FastLED namespace.
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_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_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_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.
Functions for red, green, blue, white (RGBW) output.