Repository navigation
fix(esp32): link forced software pins in SoftwareSPIOutput; add fastPinLoopback (#5067) - #5391
Conversation
…inLoopback (#5067) With FASTLED_FORCE_SOFTWARE_PINS on ESP32, the FastPin specializations now derive from NoPinMapPin (since #5241), but BitbangPin<FastPin<PIN>> fell back to BitbangPinDefaults, whose delay() calls fl::delaycycles<N>. That template is only defined out of line for N <= 50, so SoftwareSPIOutput at practical rates failed to link (esp32c6, DATA_RATE_KHZ(250): undefined fl::delaycycles<314>/<317>). Share the inline cycle-counter delay between the native and forced policies; only the native one keeps the atomic MMIO write. AutoResearch gains fastPinLoopback: over the board-discovered jumper it checks FastPin levels and toggle order, clock LOW after init, eight MSB-first bytes with TX as SoftwareSPIOutput data, and 64 clock edges with TX as clock. It reports whether the selected route is the NoPinMapPin fallback.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 8 minutes. View limit details
Note
|
Memory usage (this PR vs. its merge base)Change in
|
Part of #5067.
What was still broken
#5241 (fadc722) made ESP32's explicit
FastPin<N>specializations derive fromNoPinMapPinwhenFASTLED_FORCE_SOFTWARE_PINSis defined. That part works. The SDK builds below confirm it. But the forced route still had noBitbangPin<FastPin<PIN>>specialization. It fell back toBitbangPinDefaults::delay(), which callsfl::delaycycles<N>(), and that template is only defined out of line for N <= 50. So the publicSoftwareSPIOutputcould not link on a forced ESP32 at practical rates.RED (esp32c6, real SDK link, forced,
SoftwareSPIOutput<2, 3, DATA_RATE_KHZ(250)>):Fix
src/platforms/esp/32/core/fastpin_esp32.hmoves the existing inline cycle-counterdelay()intoEsp32BitbangDelay. The native policy (atomic W1TS/W1TC write) and the new forced policy (writes go through the core pin API) both inherit it. TheFL_ESP32_ENABLE_FAST_SOFTWARE_SPI=0legacy branch is unchanged.GREEN: the same producer links.
GenericSoftwareSPIOutput<2,3,640>::writeBytemakes 16 calls toNoPinMapPin<2>and 16 toNoPinMapPin<3>, and its delays usecsrr 0x7e2(the cycle counter). It has no0x60091references.On-device harness
examples/AutoResearch/AutoResearchFastPinLoopback.hadds thefastPinLoopbackRPC (ESP32 only). It uses the board-discovered jumper (findConnectedPins) and reports:FastPin<TX>is theNoPinMapPinfallbackinit()SoftwareSPIOutputdata, decoded from RX edgesESP32-C6 on
/dev/ttyACM1. Discovered jumper TX=GPIO0 to RX=GPIO1. Spare pins are the default SPI pins 18/19.--define FASTLED_FORCE_SOFTWARE_PINSValidation
uv run pytest ci/tests/test_esp32_forced_software_pins.py: the new contract fails without the header change and passes with it.bash lintis green./code-review lowfound no issues.