FastLED 3.9.15
Loading...
Searching...
No Matches

◆ cancel()

bool fl::spi::Transaction::cancel ( )

Cancel pending transaction (if supported by platform)

Returns
true if cancelled, false if not cancellable
Note
Not all platforms support cancellation

Definition at line 470 of file device.cpp.hpp.

470 {
471 if (!pImpl || pImpl->completed) {
472 return false; // Already completed or invalid
473 }
474
475 // Note: Cancellation of in-progress DMA transfers is platform-specific
476 // and not always supported. For now, we mark it as cancelled and
477 // the next wait() call will handle it.
478
479 pImpl->cancelled = true;
480 pImpl->completed = true;
481 pImpl->result = fl::task::Error("Transaction cancelled");
482
483 // Clear async state in device
484 if (pImpl->device && pImpl->device->pImpl) {
485 pImpl->device->pImpl->async_state.active = false;
486 }
487
488 FL_LOG_SPI("Transaction: Cancelled");
489 return true;
490}
fl::unique_ptr< Impl > pImpl
Definition transaction.h:78
#define FL_LOG_SPI(X)
Serial Peripheral Interface (SPI) logging Logs SPI configuration, initialization, and transfers.
Definition log.h:474

References FL_LOG_SPI, and pImpl.