Skip to content

sdfat(teensy): delete the FL_SDFAT_USE_ARDUINO_SPI escape hatch — it selects a path that cannot link #3980

Closed

Description

@zackees

Follow-up to #3970 / #3971 / #3972, raised in review of PR #3979.

The hatch no longer escapes anything

FL_SDFAT_USE_ARDUINO_SPI (SdSpiDriver.h:53,56) was added in #3973 as a way to force SdFat's SPI transport back onto Arduino's SPIClass if the new FastLED-owned buses misbehaved. That made sense while only Teensy 4 was converted.

Now that #3972 has converted Teensy 3.x and LC as well, the knob's only remaining effect is to select a path that cannot link. Per the premise of #3970, the Teensyduino SPI sources are compiled only when the library finder selects them from an unconditional sketch-level #include <SPI.h>, which FastLED cannot add — it breaks the host example build, and the stub platform has no SPI.h.

So defining it means "opt in to the exact undefined-symbol failure #3970 was filed about":

undefined reference to `SPIClass::begin()'
undefined reference to `SPI'
undefined reference to `SPIClass::transfer(void const*, void*, unsigned int)'

That is a trap rather than a fallback.

It also leaves #3972's acceptance criterion unmet

#3972 required that no SPIClass references remain under src/platforms/arm/teensy/sdfat/ outside comments. Exactly one survives, and it is on this branch:

src/platforms/arm/teensy/sdfat/SpiDriver/SdSpiArduinoDriver.h:51: typedef SPIClass SpiPort_t;

No default configuration on any Teensy selects it, so the practical goal is met — but the literal criterion is not, and it is cleaner to say so than to quietly declare victory.

Proposed change

  • Delete FL_SDFAT_USE_ARDUINO_SPI and the #else arms it guards in SdSpiDriver.h and SdSpiArduinoDriver.h
  • The SpiPort_t / SpiPortSettings_t typedefs collapse to the FastLED bus types unconditionally on Teensy
  • SPIClass and SPISettings then disappear from the SdFat tree entirely

Deliberately kept out of #3979 because it touches lines #3973 changed days earlier and is orthogonal to what that PR was proving.

Caveat worth weighing first

Neither LpspiBus nor DspiBus has been exercised on hardware — both #3973 and #3979 are compile/link-verified only. If someone hits a runtime problem on real silicon, this hatch is the obvious thing to reach for, even though it currently cannot link without a sketch-level include.

Two defensible orders:

  1. Delete now. The hatch does not work anyway; a user hitting a runtime bug is better served by an issue report than by a knob that trades a working build for a broken link.
  2. Wait for one hardware confirmation on a Teensy 3.x and a Teensy 4, then delete.

I lean towards (1) — a fallback that cannot link is worse than no fallback, because it costs debugging time to discover that — but this is a maintainer call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions