70template <
typename OutputIterator>
72 u8 r_current,
u8 g_current,
87 *out++ =
static_cast<u8>(mode);
90 *out++ = r_current & 0x0F;
91 *out++ = g_current & 0x0F;
92 *out++ = b_current & 0x0F;
93 *out++ = w_current & 0x0F;
107template <
typename InputIterator,
typename OutputIterator>
109 while (first != last) {
110 const auto& pixel = *first;
125template <
typename InputIterator,
typename OutputIterator>
127 while (first != last) {
128 const auto& pixel = *first;
145template <
typename InputIterator,
typename OutputIterator>
148 while (first != last) {
149 const auto& pixel = *first;
152 u8 rgb_in[3] = { pixel[0], pixel[1], pixel[2] };
157 *out++ = rgb_out[0] >> 8;
158 *out++ = rgb_out[0] & 0xFF;
159 *out++ = rgb_out[1] >> 8;
160 *out++ = rgb_out[1] & 0xFF;
161 *out++ = rgb_out[2] >> 8;
162 *out++ = rgb_out[2] & 0xFF;
189#if !FL_PLATFORM_HAS_TINY_MEMORY
190template <
typename OutputIterator>
192 while (pixels.has(1)) {
194 pixels.loadAndScaleRGB16(&r16, &g16, &b16);
201 pixels.stepDithering();
202 pixels.advanceData();
215template <
typename InputIterator,
typename OutputIterator>
218 while (first != last) {
219 const auto& pixel = *first;
222 u8 rgbw_in[4] = { pixel[0], pixel[1], pixel[2], pixel[3] };
227 *out++ = rgbw_out[0] >> 8;
228 *out++ = rgbw_out[0] & 0xFF;
229 *out++ = rgbw_out[1] >> 8;
230 *out++ = rgbw_out[1] & 0xFF;
231 *out++ = rgbw_out[2] >> 8;
232 *out++ = rgbw_out[2] & 0xFF;
233 *out++ = rgbw_out[3] >> 8;
234 *out++ = rgbw_out[3] & 0xFF;
242 return is_rgbw ? 4u : 3u;
244 return is_rgbw ? 8u : 6u;
255 constexpr size_t kPreambleLen = 15;
258 return total + (3u - (total % 3u)) % 3u;
272template <
typename OutputIterator>
277 constexpr size_t PREAMBLE_LEN = 15;
279#if FL_PLATFORM_HAS_TINY_MEMORY
287 const size_t padding =
294 for (
size_t i = 0; i < padding; ++i) {
317#if !FL_PLATFORM_HAS_TINY_MEMORY
318 }
else if (wide_source) {
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
static fl::shared_ptr< const Gamma8 > getOrCreate(float gamma) FL_NO_EXCEPT
void encodeUCS7604_8bit_RGBW(InputIterator first, InputIterator last, OutputIterator out) FL_NO_EXCEPT
Encode RGBW pixels in UCS7604 8-bit format.
u8 u8 fract8 blur_amount FL_NO_EXCEPT
void encodeUCS7604_16bit_RGBW(InputIterator first, InputIterator last, OutputIterator out, const Gamma8 &gamma) FL_NO_EXCEPT
Encode RGBW pixels in UCS7604 16-bit format with gamma correction.
constexpr u32 gamma(float g) FL_NO_EXCEPT
size_t ucs7604FrameBytes(size_t num_leds, UCS7604Mode mode, bool is_rgbw) FL_NO_EXCEPT
Total wire bytes of a complete UCS7604 frame.
pair< detail::ScaledPixelIteratorRGBW, detail::ScaledPixelIteratorRGBW > makeScaledPixelRangeRGBW(PixelIterator *pixels) FL_NO_EXCEPT
Create RGBW input iterator range from PixelIterator.
void buildUCS7604Preamble(OutputIterator out, UCS7604Mode mode, u8 r_current, u8 g_current, u8 b_current, u8 w_current) FL_NO_EXCEPT
Build UCS7604 preamble (15 bytes)
void encodeUCS7604_16bit_RGB_wide(PixelIterator &pixels, OutputIterator out) FL_NO_EXCEPT
Wide RGB straight off the iterator, with no adapter (P8, #4042 / #4326).
UCS7604Mode
UCS7604 protocol configuration modes.
@ UCS7604_MODE_8BIT_800KHZ
@ UCS7604_MODE_16BIT_1600KHZ
@ UCS7604_MODE_16BIT_800KHZ
void encodeUCS7604_16bit_RGB(InputIterator first, InputIterator last, OutputIterator out, const Gamma8 &gamma) FL_NO_EXCEPT
Encode RGB pixels in UCS7604 16-bit format with gamma correction.
void encodeUCS7604(PixelIterator &pixel_iter, size_t num_leds, OutputIterator out, UCS7604Mode mode, const UCS7604CurrentControl ¤t, bool is_rgbw, const Gamma8 *gamma=nullptr, bool wide_source=false) FL_NO_EXCEPT
Encode complete UCS7604 frame (preamble + padding + pixel data)
void encodeUCS7604_8bit_RGB(InputIterator first, InputIterator last, OutputIterator out) FL_NO_EXCEPT
Encode RGB pixels in UCS7604 8-bit format.
size_t ucs7604BytesPerLed(UCS7604Mode mode, bool is_rgbw) FL_NO_EXCEPT
Wire bytes each LED contributes to a UCS7604 frame.
pair< detail::ScaledPixelIteratorRGB, detail::ScaledPixelIteratorRGB > makeScaledPixelRangeRGB(PixelIterator *pixels) FL_NO_EXCEPT
Create RGB input iterator range from PixelIterator.
Base definition for an LED controller.
Adapter layer bridging PixelIterator to encoder input iterators.
u8 g
Green channel current (0x0-0xF)
u8 b
Blue channel current (0x0-0xF)
u8 w
White channel current (0x0-0xF)
UCS7604CurrentControl(u8 r_, u8 g_, u8 b_, u8 w_) FL_NO_EXCEPT
Construct from individual channel values.
UCS7604CurrentControl(u8 brightness) FL_NO_EXCEPT
Construct from single brightness value (all channels)
UCS7604CurrentControl() FL_NO_EXCEPT
Default constructor - maximum brightness.
u8 r
Red channel current (0x0-0xF)
UCS7604 current control structure with 4-bit fields for each channel.