Repository navigation
Description
Context
Two-round audit at 94dab9c for #5024 confirms KL26 normal _ARMPIN at src/platforms/arm/teensy/teensy_lc/fastpin_arm_kl26.h:25-53 exposes 32-bit full output latch (port, fastset) and atomic write-one set/clear (sport, cport). It retains BitbangPin default kTwoWriteStream=false,kAtomicWrite=false (src/platforms/shared/spi_bitbang/bitbang_pin.h:34-36), missing the existing exclusive same-port stream and branchless data set/clear helper.
Actual dispatch src/platforms/arm/fastpin_arm.h selects the canonical Teensy header. src/platforms/arm/kl26/fastpin_arm_kl26.h is a legacy independently retained copy; give it an explicit synchronized-or-retired disposition. Public SoftwareSPIOutput (src/fastspi.h:107) is the reachable software writer. Default Teensy3/LC SPIOutput is hardware-only; hardware peripheral writes are excluded. FastPinBB bit-band aliases, where defined, have different semantics and must remain excluded; FASTLED_FORCE_SOFTWARE_PINS must retain fallback behavior.
Proposal
Opt normal KL26 FastPin into exclusive same-port bulk streaming and branchless set/clear data policy for public-byte/separate-port/interrupt paths. Keep CPU-cycle timing and minimum pulse guarantees. This independently defined backend gets its own child of #5024.
Acceptance criteria
- RED before implementation: actual production policy does not select optimization. GREEN after: reverting either opt-in fails a focused policy/trace assertion.
- Same-port (e.g. pins 0/1, GPIOB) nonempty bulk byte/value/pixel APIs perform 16 stores per byte plus final clock-low; cover empty/multibyte and 0x00/0xff/alternating patterns, MSB-first rising-edge samples and unrelated-bit preservation.
- Separate ports (0/2, GPIOB/GPIOD) and FAST_SPI_INTERRUPTS_WRITE_PINS use selected atomic set/clear aliases, preserve concurrent unrelated-pin changes, and avoid full-latch snapshots. Cover public writeByte, not only bulk APIs.
- Compile teensylc through real dispatch with same/separate ports, forced software pins and interrupt mode, preserving default hardware SPI selection. Exclude FastPinBB from policy applicability.
- Do not infer GPIO write cycle costs from CPU frequency; preserve delays unless supported by assembly/device evidence. Local store-count assertions do not establish hardware speed; physically measure throughput before claiming gains.
Decisions
P2 optimization. Native siblings cover other independently defined Teensy GPIO implementations; no blanket all-ARM policy. No source edits/builds during discovery; orchestrator owns RED/GREEN.
Reproduction
rg -n 'fastset|sport|cport|port_t' src/platforms/arm/teensy/teensy_lc/fastpin_arm_kl26.h
rg -n 'kTwoWriteStream|kAtomicWrite|writeBitSetClear' src/platforms/shared/spi_bitbang
All-state metadata duplicate searches software SPI Teensy and two write SPI found no identical GPIO-policy optimization issue. Existing #974 concerns cycle-delay underflow, not this missing policy.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity