Wait for transaction to complete.
408 {
410 return true;
411 }
412
413 if (
pImpl->completed) {
414 return true;
415 }
416
417 if (
pImpl->cancelled) {
418 pImpl->completed =
true;
419 return false;
420 }
421
422
423 if (!
pImpl->device) {
424 pImpl->completed =
true;
425 pImpl->result = fl::task::Error(
"Device pointer is null");
426 return false;
427 }
428
429 if (!
pImpl->device->isReady()) {
430 pImpl->completed =
true;
431 pImpl->result = fl::task::Error(
"Device not ready");
432 return false;
433 }
434
435#ifdef FASTLED_LOG_SPI_ENABLED
437#endif
438
440
441 if (success) {
442
443 if (
pImpl->device->pImpl) {
444 pImpl->device->pImpl->async_state.active =
false;
445 }
446 pImpl->completed =
true;
448
449#ifdef FASTLED_LOG_SPI_ENABLED
450 FL_LOG_SPI(
"Transaction: Completed successfully (waited " << (
fl::millis() - start_time) <<
"ms)");
451#endif
452 return true;
453 } else {
454
455 pImpl->completed =
true;
456 pImpl->result = fl::task::Error(
"Transaction timeout");
457 FL_WARN(
"Transaction: Timeout after " << timeout_ms <<
"ms");
458 return false;
459 }
460}
fl::unique_ptr< Impl > pImpl
#define FL_LOG_SPI(...)
Serial Peripheral Interface (SPI) logging Logs SPI configuration, initialization, and transfers.
fl::u32 millis() FL_NO_EXCEPT
Universal millisecond timer - returns milliseconds since system startup.
constexpr nullopt_t nullopt