FastLED 3.10.6
Loading...
Searching...
No Matches
capabilities.cpp.hpp
Go to the documentation of this file.
1
7
8// IWYU pragma: private
9
11
12namespace fl {
13
14// ---------- PinSet ---------------------------------------------------
15
18 if (pin >= 0 && static_cast<fl::u32>(pin) < kPinSetCapacity) {
19 ps.pins.set(static_cast<fl::u32>(pin));
20 }
21 return ps;
22}
23
24bool PinSet::accepts(fl::i16 pin) const FL_NO_EXCEPT {
25 if (kind == PinSetKind::None) {
26 return false;
27 }
28 if (pin < 0 || static_cast<fl::u32>(pin) >= kPinSetCapacity) {
29 return false;
30 }
32 return true;
33 }
34 return pins.test(static_cast<fl::u32>(pin));
35}
36
37bool PinSet::acceptsAll(const PinBitset& request) const FL_NO_EXCEPT {
38 if (kind == PinSetKind::None) {
39 return request.none();
40 }
42 return true;
43 }
44 // Allowlist: every requested bit must be in `pins`.
45 for (fl::u32 i = 0; i < kPinSetCapacity; ++i) {
46 if (request.test(i) && !pins.test(i)) {
47 return false;
48 }
49 }
50 return true;
51}
52
53
54// ---------- DriverCapabilities ---------------------------------------
55
57 : name()
58 , priority(0)
59 , supports_clockless(false)
60 , supports_spi(false)
63 , spi_frequency(FreqRange::any())
65 , flags() {
66 flags.synchronized_start = 0;
67 flags.requires_dma_memory = 0;
68 flags.open_drain_capable = 0;
69 flags.mixed_protocols_ok = 0;
70 flags.reserved = 0;
71}
72
73
74// ---------- ChannelRequest -------------------------------------------
75
77 Protocol p, fl::i16 data, fl::i16 clock,
81 r.protocol = p;
82 if (data >= 0 && static_cast<fl::u32>(data) < kPinSetCapacity) {
83 r.data_pins.set(static_cast<fl::u32>(data));
84 }
85 r.clock_pin = clock;
86 r.timing = t;
87 r.frequency_hz = freq;
88 return r;
89}
90
91} // namespace fl
Declarative driver capabilities + channel-request types for the Channel Manager's predicate / depende...
P ps[MAXP]
Definition Luminova.h:57
fl::bitset_fixed< kPinSetCapacity > PinBitset
Optional< T > optional
Definition optional.h:16
InputGamut g FL_NO_EXCEPT
Definition rgbw.h:121
static constexpr fl::u32 kPinSetCapacity
Maximum pin number representable in a PinSet's bitset.
Base definition for an LED controller.
Definition crgb.hpp:179
ChipsetClocklessTiming timing
unspecified/any for Spi requests
ChannelRequest() FL_NO_EXCEPT
PinBitset data_pins
bit N set = pin N included
fl::i16 clock_pin
-1 for Clockless; single shared clock for Spi
fl::optional< fl::u32 > frequency_hz
mostly SPI override
static ChannelRequest singlePin(Protocol p, fl::i16 data, fl::i16 clock, const ChipsetClocklessTiming &t=ChipsetClocklessTiming::unspecified(), fl::optional< fl::u32 > freq=fl::optional< fl::u32 >()) FL_NO_EXCEPT
Convenience factory for the common single-pin case.
fl::u8 priority
higher = preferred
fl::u8 max_total_channels
aggregate cap; 0 = unbounded
FreqRange clockless_frequency
Aggregate frequency ranges.
fl::string_view name
diagnostics, e.g. "RMT5"
DriverCapabilities() FL_NO_EXCEPT
Definition in capabilities.cpp.hpp.
struct fl::DriverCapabilities::Flags flags
ClocklessTimingCapability clockless_timing
Clock-tree model — the ONLY chipset-support gate.
constexpr PinSet() FL_NO_EXCEPT
bool accepts(fl::i16 pin) const FL_NO_EXCEPT
True iff this set accepts the given single pin.
bool acceptsAll(const PinBitset &request) const FL_NO_EXCEPT
True iff every set bit in request is also accepted here.
static PinSet fixed(fl::i16 pin) FL_NO_EXCEPT
Factory: allowlist with a single pin (the "fixed pin" idiom).
PinSetKind kind
PinBitset pins
only meaningful when kind == Allowlist