FastLED 3.10.8
Loading...
Searching...
No Matches

◆ showPixelsGammaBitShift()

template<fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, EOrder RGB_ORDER = RGB, fl::u32 SPI_SPEED = DATA_RATE_MHZ(6), fl::FiveBitGammaCorrectionMode GAMMA_CORRECTION_MODE = fl::FiveBitGammaCorrectionMode::kFiveBitGammaCorrectionMode_Null, fl::u32 START_FRAME = 0x00000000, fl::u32 END_FRAME = 0xFFFFFFFF>
void APA102Controller< DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_SPEED, GAMMA_CORRECTION_MODE, START_FRAME, END_FRAME >::showPixelsGammaBitShift ( PixelController< RGB_ORDER > & pixels)
inlineprivate

Definition at line 184 of file apa102.h.

184 {
185 static constexpr fl::u16 kBatchSize = 8;
186 const fl::u16 n = static_cast<fl::u16>(pixels.size());
187
188 // Extract uniform color scale and brightness (constant across all pixels)
190 #if FASTLED_HD_COLOR_MIXING
191 pixels.loadRGBScaleAndBrightness(&scale_r, &scale_g, &scale_b, &global_brightness);
192 #else
193 pixels.loadAndScaleRGB(&scale_r, &scale_g, &scale_b);
194 global_brightness = 255;
195 #endif
197
198 // RGB reorder indices (compile-time constant from RGB_ORDER template param)
199 const fl::u8 b0_index = (static_cast<int>(RGB_ORDER) >> 6) & 0x3;
200 const fl::u8 b1_index = (static_cast<int>(RGB_ORDER) >> 3) & 0x3;
201 const fl::u8 b2_index = static_cast<int>(RGB_ORDER) & 0x3;
202
203 mSPI.select();
205
206 // Process pixels in batches of 8 using stack-allocated buffers
208 while (remaining > 0) {
212
213 // Copy raw pixel bytes into CRGB input buffer
214 for (fl::u16 i = 0; i < batch; ++i) {
215 const fl::u8* raw = pixels.getRawPixelData();
216 input_buf[i] = CRGB(raw[0], raw[1], raw[2]);
217 pixels.advanceData();
218 }
219
223
224 for (fl::u16 i = 0; i < batch; ++i) {
225 const CRGB& rgb = gamma_buf[i].color;
227 rgb.raw[b0_index], rgb.raw[b1_index], rgb.raw[b2_index]);
228 }
229
230 remaining -= batch;
231 }
232
233 endBoundary(n);
234 mSPI.endTransaction();
235 mSPI.finalizeTransmission();
236 }
void endBoundary(int nLeds) FL_NO_EXCEPT
Definition apa102.h:50
FASTLED_FORCE_INLINE void writeLed(fl::u8 brightness, fl::u8 b0, fl::u8 b1, fl::u8 b2) FL_NO_EXCEPT
Definition apa102.h:64
void startBoundary() FL_NO_EXCEPT
Definition apa102.h:46
APA102 controller class.
Definition apa102.h:42
VIRTUAL_IF_NOT_AVR int size() const FL_NO_EXCEPT
How many LEDs does this controller manage?
fl::CRGB CRGB
Definition crgb.h:25
FL_OPTIMIZE_FUNCTION void five_bit_hd_gamma_bitshift(fl::span< const CRGB > colors, CRGB colors_scale, u8 global_brightness, fl::span< CRGB > out_colors, fl::span< u8 > out_power_5bit) FL_NO_EXCEPT

References fl::CRGBA5::color, endBoundary(), fl::five_bit_hd_gamma_bitshift(), FL_NO_EXCEPT, mSPI, RGB_ORDER, startBoundary(), and writeLed().

Referenced by showPixels().

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