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

◆ end()

void fl::spi::Device::end ( )

Shutdown the SPI hardware and release resources.

Note
Waits for pending operations to complete

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

127 {
128 if (!pImpl || !pImpl->initialized) {
129 return;
130 }
131
132 // Wait for any pending operations
133 waitComplete();
134
135 // Note: Do NOT call hw->end() here!
136 // The SPIBusManager will call releaseBusHardware() (which calls hw->end())
137 // when the last device on this bus is unregistered below.
138 // Calling hw->end() here would result in calling end() twice on the same hardware.
139 pImpl->hw_backend = nullptr;
140
141 // Unregister from bus manager
142 if (pImpl->bus_handle.is_valid) {
143 SPIBusManager& mgr = getSPIBusManager();
144 mgr.unregisterDevice(pImpl->bus_handle);
145 pImpl->bus_handle = SPIBusHandle();
146 }
147
148 pImpl->initialized = false;
149 FL_LOG_SPI("SPI Device: Shutdown complete");
150}
bool waitComplete(u32 timeout_ms=(fl::numeric_limits< u32 >::max)())
Wait for pending async operation to complete.
fl::unique_ptr< Impl > pImpl
Definition device.h:134
#define FL_LOG_SPI(X)
Serial Peripheral Interface (SPI) logging Logs SPI configuration, initialization, and transfers.
Definition log.h:474

References FL_LOG_SPI, pImpl, and waitComplete().

Referenced by ~Device().

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