FastLED 3.9.15
Loading...
Searching...
No Matches

◆ buildExpectedUCS7604()

static fl::vector< uint8_t > buildExpectedUCS7604 ( fl::span< CRGB > leds,
fl::ClocklessEncoder encoder )
static

Build expected UCS7604 encoded bytes from LED data.

Parameters
ledsLED data span
encoderEncoder selector identifying the UCS7604 variant
Returns
Vector of expected encoded bytes (preamble + padding + pixel data)

Definition at line 129 of file AutoResearchTest.cpp.

129 {
130 fl::vector<uint8_t> expected;
131
132 // Map encoder to UCS7604Mode
133 fl::UCS7604Mode mode;
134 switch (encoder) {
137 break;
140 break;
143 break;
144 default:
145 return expected;
146 }
147
148 // Default current control (0x0F for all channels) matching channel.cpp.hpp defaults
149 fl::UCS7604CurrentControl current; // defaults to 0xF for all channels
150
151 // Create PixelIterator from LED data (RGB order, no color adjustment, no dithering)
153 auto pixel_iter = pc.as_iterator(RgbwInvalid());
154
155 // For 16-bit modes, use default gamma 2.8
157 bool use_gamma = (mode != fl::UCS7604Mode::UCS7604_MODE_8BIT_800KHZ);
158 if (use_gamma) {
160 }
161
162 // Encode using the same function the driver uses
163 fl::encodeUCS7604(pixel_iter, leds.size(), fl::back_inserter(expected),
164 mode, current, false /* is_rgbw */, gamma.get());
165
166 return expected;
167}
fl::CRGB leds[NUM_LEDS]
static fl::shared_ptr< const Gamma8 > getOrCreate(float gamma) FL_NOEXCEPT
Definition ease.cpp.hpp:459
#define DISABLE_DITHER
Disable dithering.
Definition dither_mode.h:10
@ CLOCKLESS_ENCODER_UCS7604_8BIT
UCS7604 8-bit 800KHz.
@ CLOCKLESS_ENCODER_UCS7604_16BIT
UCS7604 16-bit 800KHz.
@ CLOCKLESS_ENCODER_UCS7604_16BIT_1600
UCS7604 16-bit 1600KHz.
back_insert_iterator< Container > back_inserter(Container &c) FL_NOEXCEPT
Helper function to create a back_insert_iterator.
Definition iterator.h:139
UCS7604Mode
UCS7604 protocol configuration modes.
Definition ucs7604.h:28
@ UCS7604_MODE_8BIT_800KHZ
Definition ucs7604.h:29
@ UCS7604_MODE_16BIT_1600KHZ
Definition ucs7604.h:31
@ UCS7604_MODE_16BIT_800KHZ
Definition ucs7604.h:30
constexpr u32 gamma(float g) FL_NOEXCEPT
Definition gamma_lut.h:36
void encodeUCS7604(PixelIterator &pixel_iter, size_t num_leds, OutputIterator out, UCS7604Mode mode, const UCS7604CurrentControl &current, bool is_rgbw, const Gamma8 *gamma=nullptr)
Encode complete UCS7604 frame (preamble + padding + pixel data)
Definition ucs7604.h:209
static ColorAdjustment noAdjustment()
the per-channel scale values premixed with brightness.
Pixel controller class.
UCS7604 current control structure with 4-bit fields for each channel.
Definition ucs7604.h:35

References PixelController< RGB_ORDER, LANES, MASK >::as_iterator(), fl::back_inserter(), fl::CLOCKLESS_ENCODER_UCS7604_16BIT, fl::CLOCKLESS_ENCODER_UCS7604_16BIT_1600, fl::CLOCKLESS_ENCODER_UCS7604_8BIT, DISABLE_DITHER, fl::encodeUCS7604(), fl::Gamma8::getOrCreate(), leds, ColorAdjustment::noAdjustment(), fl::UCS7604_MODE_16BIT_1600KHZ, fl::UCS7604_MODE_16BIT_800KHZ, and fl::UCS7604_MODE_8BIT_800KHZ.

Referenced by runMultiTest(), and runTest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: