Create unified adapter managing multiple controllers.
22 {
23
24 if (hwControllers.
empty()) {
25 FL_WARN(
"SpiChannelEngineAdapter::create: No controllers provided");
26 return nullptr;
27 }
28
29 if (hwControllers.
size() != priorities.
size() || hwControllers.
size() != names.
size()) {
30 FL_WARN(
"SpiChannelEngineAdapter::create: Size mismatch in arguments");
31 return nullptr;
32 }
33
34 if (!adapterName || adapterName[0] == '\0') {
35 FL_WARN(
"SpiChannelEngineAdapter::create: Empty adapter name");
36 return nullptr;
37 }
38
39
41
42
43 for (
size_t i = 0; i < hwControllers.
size(); i++) {
44 if (!hwControllers[i]) {
45 FL_WARN(
"SpiChannelEngineAdapter: Null controller at index " << i);
46 continue;
47 }
48
49 adapter->mControllers.emplace_back(hwControllers[i], priorities[i], names[i]);
50
51 FL_DBG(
"SpiChannelEngineAdapter: Registered controller '" << names[i]
52 << "' (priority " << priorities[i]
53 << ", lanes: " << static_cast<int>(hwControllers[i]->getLaneCount()) << ")");
54 }
55
56 if (adapter->mControllers.empty()) {
57 FL_WARN(
"SpiChannelEngineAdapter: No valid controllers registered");
58 return nullptr;
59 }
60
61 return adapter;
62}
fl::size size() const FL_NOEXCEPT
bool empty() const FL_NOEXCEPT
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT