Wait for transaction to complete.
- Parameters
-
| timeout_ms | Maximum time to wait |
- Returns
- true if completed, false on timeout
Definition at line 411 of file device.cpp.hpp.
411 {
413 return true;
414 }
415
416 if (
pImpl->completed) {
417 return true;
418 }
419
420 if (
pImpl->cancelled) {
421 pImpl->completed =
true;
422 return false;
423 }
424
425
426 if (!
pImpl->device) {
427 pImpl->completed =
true;
428 pImpl->result = fl::task::Error(
"Device pointer is null");
429 return false;
430 }
431
432 if (!
pImpl->device->isReady()) {
433 pImpl->completed =
true;
434 pImpl->result = fl::task::Error(
"Device not ready");
435 return false;
436 }
437
438
441
442 if (success) {
443
444 if (
pImpl->device->pImpl) {
445 pImpl->device->pImpl->async_state.active =
false;
446 }
447 pImpl->completed =
true;
449
451 FL_LOG_SPI(
"Transaction: Completed successfully (waited " << elapsed <<
"ms)");
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(X)
Serial Peripheral Interface (SPI) logging Logs SPI configuration, initialization, and transfers.
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
constexpr nullopt_t nullopt
References FL_LOG_SPI, FL_WARN, fl::millis(), fl::nullopt, and pImpl.
Referenced by ~Transaction().