FastLED 3.10.8
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 125 of file device.cpp.hpp.

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

References FL_LOG_SPI, fl::FL_NO_EXCEPT, pImpl, and waitComplete().

Referenced by ~Device().

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