MCPcopy Create free account
hub / github.com/FastLED/FastLED / unregisterDevice

Method unregisterDevice

src/platforms/shared/spi_manager.cpp.hpp:84–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84bool SPIBusManager::unregisterDevice(SPIBusHandle handle) FL_NOEXCEPT {
85 if (!handle.is_valid || handle.bus_id >= mNumBuses) {
86 return false;
87 }
88
89 SPIBusInfo& bus = mBuses[handle.bus_id];
90 if (handle.lane_id >= 16) {
91 return false;
92 }
93
94 SPIDeviceInfo& device = bus.devices[handle.lane_id];
95 if (!device.is_allocated) {
96 return false; // Already deallocated
97 }
98
99 // Mark device as deallocated
100 device.is_allocated = false;
101 device.is_enabled = false;
102 device.controller = nullptr;
103
104 // Count remaining allocated devices
105 u8 allocated_count = 0;
106 for (u8 i = 0; i < bus.num_devices; i++) {
107 if (bus.devices[i].is_allocated) {
108 allocated_count++;
109 }
110 }
111
112 // If no devices remain, release Quad-SPI hardware
113 if (allocated_count == 0) {
114 releaseBusHardware(bus);
115 }
116
117 return true;
118}
119
120bool SPIBusManager::initialize() FL_NOEXCEPT {
121 bool all_ok = true;

Callers 6

endMethod · 0.80
~SPIDeviceProxyMethod · 0.80
~SPIDeviceProxyMethod · 0.80
~SPIDeviceProxyMethod · 0.80
~SPIDeviceProxyMethod · 0.80
~SPIDeviceProxyMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected