FastLED 3.10.10
Loading...
Searching...
No Matches

◆ show()

void fl::SpiChannelEngineAdapter::show ( )
overridevirtual

Trigger transmission of enqueued data.

Note
Groups channels by clock pin, acquires DMA buffers, calls transmit()

Implements fl::IChannelDriver.

Definition at line 237 of file spi_channel_adapter.cpp.hpp.

237 {
238 if (mStreamingFrame) {
239 // Preserve the active frame and its source owners if called early.
240 if (advanceStreaming() == DriverState::BUSY) return;
241 }
242 if (mEnqueuedChannels.empty()) {
243 return;
244 }
245
246 FL_DBG("SpiChannelEngineAdapter: show() called with " << mEnqueuedChannels.size() << " channels");
247
248 // Move enqueued channels to transmitting list
250 mEnqueuedChannels.clear();
251
252 for (const auto& ctrl : mControllers) {
253 if (ctrl.controller->supportsStreaming()) {
254 mStreamingFrame = true;
257 return;
258 }
259 }
260
261 // Group adjacent channels with identical SPI bus configuration.
263
264 FL_DBG("SpiChannelEngineAdapter: Grouped into " << groups.size() << " SPI configuration groups");
265
266 // Transmit each group sequentially
267 for (size_t i = 0; i < groups.size(); i++) {
268 const ClockPinGroup& group = groups[i];
269
270 FL_DBG("SpiChannelEngineAdapter: Transmitting group with clock pin " << group.clockPin << " (" << group.channels.size() << " channels)");
271
272 if (!transmitBatch(group.channels)) {
273 FL_WARN("SpiChannelEngineAdapter: Failed to transmit batch for clock pin " << group.clockPin);
274 // Continue with other groups rather than aborting entirely
275 }
276 }
277
278 FL_DBG("SpiChannelEngineAdapter: show() complete");
279}
bool transmitBatch(fl::span< const ChannelDataPtr > channels) FL_NO_EXCEPT
Transmit a batch of channels sharing one SPI configuration.
fl::vector< ClockPinGroup > groupByClockPin(fl::span< const ChannelDataPtr > channels) FL_NO_EXCEPT
Group adjacent channels with matching pins, host, and clock rate.
DriverState advanceStreaming() FL_NO_EXCEPT
Advance ordered streaming channels after the preceding source is reaped.
fl::vector< ControllerInfo > mControllers
All managed controllers.
fl::vector< ChannelDataPtr > mEnqueuedChannels
Channels waiting for show()
fl::vector< ChannelDataPtr > mTransmittingChannels
Channels currently transmitting.
Channels sharing one SPI bus configuration.
#define FL_WARN(...)
Definition log.h:437
#define FL_DBG
Definition log.h:553
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
Definition s16x16x4.h:30

References advanceStreaming(), fl::SpiChannelEngineAdapter::ClockPinGroup::channels, fl::SpiChannelEngineAdapter::ClockPinGroup::clockPin, FL_DBG, fl::FL_NO_EXCEPT, FL_WARN, groupByClockPin(), mControllers, mEnqueuedChannels, mNextStreamingChannel, fl::fl::adl_barrier::move(), mStreamingFrame, mTransmittingChannels, fl::vector_basic::size(), and transmitBatch().

+ Here is the call graph for this function: