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

Method canHandle

src/platforms/esp/32/drivers/spi/channel_driver_spi.cpp.hpp:271–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271bool ChannelEngineSpi::canHandle(const ChannelDataPtr& data) const FL_NOEXCEPT {
272 if (!data) {
273 return false;
274 }
275
276 // ⚠️ ARCHITECTURE CLARIFICATION: This is a CLOCKLESS-over-SPI driver!
277 //
278 // This driver uses SPI hardware to implement CLOCKLESS LED protocols (WS2812, SK6812, etc.),
279 // NOT true SPI protocols (APA102, SK9822, etc.). The SPI clock pin is used internally for
280 // precise timing generation but is NEVER physically connected to the LED strip - only the
281 // MOSI/data pin carries signals to the LEDs.
282 //
283 // How it works:
284 // - Clockless LED bits are encoded as SPI bit patterns via wave8 (8:1 expansion)
285 // - The SPI clock controls MOSI timing (e.g., ~6.67MHz for WS2812 = ~150ns per bit)
286 // - LEDs decode pulse widths on the data line, ignoring the clock signal
287 //
288 // ✅ CORRECTED LOGIC:
289 // Accept CLOCKLESS chipsets (WS2812, SK6812), reject TRUE SPI chipsets (APA102, SK9822)
290 // True SPI chipsets should route to SpiChannelEngineAdapter (priority 5-9), not this driver
291 //
292 // Correct routing:
293 // APA102 → SpiChannelEngineAdapter (true SPI hardware)
294 // WS2812 → ChannelEngineSpi (this driver, clockless-over-SPI)
295 return !data->isSpi(); // ✅ FIXED: Accept clockless, reject true SPI
296}
297
298void ChannelEngineSpi::configureMultiLanePins(
299 const MultiLanePinConfig &pinConfig) FL_NOEXCEPT {

Callers

nothing calls this directly

Calls 1

isSpiMethod · 0.45

Tested by

no test coverage detected