FastLED 3.10.6
Loading...
Searching...
No Matches

◆ canMatch()

HandleResult fl::canMatch ( const DriverCapabilities & caps,
fl::span< const PinGroup > groups,
const ChannelRequest & request )

Test a request (single-pin OR multi-pin ganged) against a driver's published capability data.

Parameters
capsDriver-wide descriptor (protocol gates, freq ranges, clockless timing model, flags).
groupsThe driver's per-resource group list.
requestChannel request — data_pins bitset + clock_pin + chipset timing windows + optional frequency override. A single-pin request has exactly one bit set in data_pins.
Returns
HandleResult::Yes if any group accepts the request; otherwise the strongest rejection reason observed across all groups.

Definition at line 194 of file can_match.cpp.hpp.

197 {
200 }
201 if (groups.empty()) {
202 // No groups published; nothing this driver can match concretely.
203 return HandleResult::NoPin;
204 }
205 if (request.data_pins.none()) {
206 // No pins requested — nothing to match against.
207 return HandleResult::NoPin;
208 }
209 // Driver-wide aggregate cap: a bulk request with N pins can't be
210 // served by a driver that publishes max_total_channels < N, even if
211 // an individual group's max_concurrent would otherwise fit it
212 // (CodeRabbit #3197).
213 const fl::u32 requested_count = request.data_pins.count();
214 if (caps.max_total_channels != 0u &&
215 requested_count > static_cast<fl::u32>(caps.max_total_channels)) {
217 }
218
220 for (fl::size i = 0; i < groups.size(); ++i) {
221 HandleResult r = can_match_detail::checkOneGroup(caps, groups[i], request);
222 if (r == HandleResult::Yes) {
223 return r;
224 }
226 best = r;
227 }
228 }
229 return best;
230}
constexpr bool empty() const FL_NO_EXCEPT
Definition span.h:535
constexpr fl::size size() const FL_NO_EXCEPT
Definition span.h:483
HandleResult checkOneGroup(const DriverCapabilities &caps, const PinGroup &g, const ChannelRequest &r) FL_NO_EXCEPT
bool driverProtocolGate(const DriverCapabilities &caps, Protocol p) FL_NO_EXCEPT
fl::u8 strength(HandleResult r) FL_NO_EXCEPT
HandleResult
@ NoProtocol
driver doesn't support the requested Protocol
@ NoPin
data pin not in any matching group's allowlist
@ NoCapacity
group full / driver-total cap reached
PinBitset data_pins
bit N set = pin N included
fl::u8 max_total_channels
aggregate cap; 0 = unbounded

References fl::can_match_detail::checkOneGroup(), fl::can_match_detail::driverProtocolGate(), FL_NO_EXCEPT, NoCapacity, NoPin, NoProtocol, fl::can_match_detail::strength(), and Yes.

Referenced by fl::IChannelDriver::canMatch().

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