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

◆ advanceStreaming()

IChannelDriver::DriverState fl::SpiChannelEngineAdapter::advanceStreaming ( )
private

Advance ordered streaming channels after the preceding source is reaped.

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

324 {
325 for (const auto& ctrl : mControllers) {
326 if (ctrl.controller->isBusy()) return DriverState::BUSY;
327 }
328
329 if (mNextStreamingChannel != 0) {
330 const auto& previous = mTransmittingChannels[mNextStreamingChannel - 1];
331 if (previous) previous->setInUse(false);
332 }
333
335 const size_t index = mNextStreamingChannel++;
336 const auto& channel = mTransmittingChannels[index];
337 if (!channel) continue;
338 if (!transmitBatch(fl::span<const ChannelDataPtr>(mTransmittingChannels.data() + index, 1))) {
339 // Report a dropped frame even with normal errors-only logging.
340 // Keep the established READY-after-failure semantics: a sticky
341 // ERROR would prevent onBeginFrame() from reaching the next retry.
342 FL_ERROR("SpiChannelEngineAdapter: SPI frame submission failed on pin "
343 << channel->getPin() << " (" << channel->getData().size() << " bytes)");
344 channel->setInUse(false);
345 continue;
346 }
347 for (const auto& ctrl : mControllers) {
348 if (ctrl.controller->isBusy()) return DriverState::BUSY;
349 }
350 channel->setInUse(false);
351 }
352
353 mTransmittingChannels.clear();
354 mStreamingFrame = false;
356 return mEnqueuedChannels.empty() ? DriverState::READY : DriverState::DRAINING;
357}
bool transmitBatch(fl::span< const ChannelDataPtr > channels) FL_NO_EXCEPT
Transmit a batch of channels sharing one SPI configuration.
fl::vector< ControllerInfo > mControllers
All managed controllers.
fl::vector< ChannelDataPtr > mEnqueuedChannels
Channels waiting for show()
fl::vector< ChannelDataPtr > mTransmittingChannels
Channels currently transmitting.
#define FL_ERROR(...)
Definition log.h:373

References FL_ERROR, fl::FL_NO_EXCEPT, mControllers, mEnqueuedChannels, mNextStreamingChannel, mStreamingFrame, mTransmittingChannels, and transmitBatch().

Referenced by poll(), and show().

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