MCPcopy Create free account
hub / github.com/FastLED/FastLED / writeAPA102

Method writeAPA102

src/fl/chipsets/encoders/pixel_iterator.h:223–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221 /// @note Protocol: [Start:32b 0x00][LED:[0xE0|bri5][B][G][R]]×N[End:⌈N/32⌉×32b 0xFF]
222 template <typename CONTAINER_UIN8_T>
223 void writeAPA102(CONTAINER_UIN8_T* out, bool hd_gamma = false) FL_NOEXCEPT {
224 auto back_ins = fl::back_inserter(*out);
225
226 #if FASTLED_HD_COLOR_MIXING
227 if (hd_gamma) {
228 // HD gamma mode: per-LED brightness
229 auto pixel_range = makeScaledPixelRangeRGB(this);
230 auto brightness_range = makeScaledBrightnessRange(this);
231 encodeAPA102_HD(pixel_range.first, pixel_range.second,
232 brightness_range.first, back_ins);
233 return;
234 }
235 #endif
236
237 #if FASTLED_USE_GLOBAL_BRIGHTNESS == 1
238 // Global brightness mode: extract from first pixel
239 auto pixel_range = makeScaledPixelRangeRGB(this);
240 encodeAPA102_AutoBrightness(pixel_range.first, pixel_range.second,
241 back_ins);
242 #else
243 // Full brightness mode
244 auto pixel_range = makeScaledPixelRangeRGB(this);
245 encodeAPA102(pixel_range.first, pixel_range.second,
246 back_ins, 31);
247 #endif
248 }
249
250 /// @brief Encode pixels in SK9822 format (zero allocation)
251 /// @param out Output buffer to write encoded bytes

Callers 1

showPixelsMethod · 0.80

Calls 5

back_inserterFunction · 0.85
makeScaledPixelRangeRGBFunction · 0.85
encodeAPA102_HDFunction · 0.85
encodeAPA102Function · 0.85

Tested by

no test coverage detected