FastLED 3.9.15
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 = 0xFF000000>
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 174 of file apa102.h.

174 {
175 static constexpr fl::u16 kBatchSize = 8;
176 const fl::u16 n = static_cast<fl::u16>(pixels.size());
177
178 // Extract uniform color scale and brightness (constant across all pixels)
180 #if FASTLED_HD_COLOR_MIXING
181 pixels.loadRGBScaleAndBrightness(&scale_r, &scale_g, &scale_b, &global_brightness);
182 #else
183 pixels.loadAndScaleRGB(&scale_r, &scale_g, &scale_b);
184 global_brightness = 255;
185 #endif
187
188 // RGB reorder indices (compile-time constant from RGB_ORDER template param)
189 const fl::u8 b0_index = (static_cast<int>(RGB_ORDER) >> 6) & 0x3;
190 const fl::u8 b1_index = (static_cast<int>(RGB_ORDER) >> 3) & 0x3;
191 const fl::u8 b2_index = static_cast<int>(RGB_ORDER) & 0x3;
192
193 mSPI.select();
195
196 // Process pixels in batches of 8 using stack-allocated buffers
198 while (remaining > 0) {
202
203 // Copy raw pixel bytes into CRGB input buffer
204 for (fl::u16 i = 0; i < batch; ++i) {
205 const fl::u8* raw = pixels.getRawPixelData();
206 input_buf[i] = CRGB(raw[0], raw[1], raw[2]);
207 pixels.advanceData();
208 }
209
213
214 for (fl::u16 i = 0; i < batch; ++i) {
215 const CRGB& rgb = gamma_buf[i].color;
217 rgb.raw[b0_index], rgb.raw[b1_index], rgb.raw[b2_index]);
218 }
219
220 remaining -= batch;
221 }
222
223 endBoundary(n);
224 mSPI.endTransaction();
225 mSPI.finalizeTransmission();
226 }
FASTLED_FORCE_INLINE void writeLed(fl::u8 brightness, fl::u8 b0, fl::u8 b1, fl::u8 b2)
Definition apa102.h:60
void startBoundary()
Definition apa102.h:42
void endBoundary(int nLeds)
Definition apa102.h:46
APA102 controller class.
Definition apa102.h:38
virtual int size() const FL_NOEXCEPT
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)

References PixelController< RGB_ORDER, LANES, MASK >::advanceData(), fl::CRGBA5::color, endBoundary(), fl::five_bit_hd_gamma_bitshift(), PixelController< RGB_ORDER, LANES, MASK >::getRawPixelData(), PixelController< RGB_ORDER, LANES, MASK >::loadAndScaleRGB(), mSPI, RGB_ORDER, PixelController< RGB_ORDER, LANES, MASK >::size(), startBoundary(), and writeLed().

Referenced by showPixels().

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