Skip to content

Refactor Bus enum for cross-platform portability (generic names + vendor escape hatch) #3439

Closed

Description

@zackees

Summary

Refactor Bus enum from a mixed vendor-specific + generic taxonomy into a portable, capability-based naming scheme so sketches work unmodified across platforms.

Motivation

Today's enum mixes paradigms:

// Generic:         BIT_BANG, UART, SPI, I2S, AUTO, STUB
// Vendor-specific: RMT, PARLIO, LCD_SPI, LCD_CLOCKLESS, LCD_RGB, I2S_SPI,
//                  FLEX_IO, OBJECT_FLED, LPUART

This forces sketch authors to special-case per platform: a user wanting "the best programmable I/O engine on this chip" writes Bus::OBJECT_FLED on Teensy 4.x but Bus::PARLIO on ESP32-C6 and Bus::LCD_SPI on ESP32-S3. The sketch is not portable.

Per-platform driver implementation details (which silicon, which instance, which mechanism) should be an optional power-user opt-in, not part of the everyday API surface.

Proposed portable enum — two orthogonal axes: Bus (engine type) + Which (instance)

The enum captures the engine type only. Instance selection is a separate Which template parameter that defaults to 0 (the platform's preferred instance of that engine type).

enum class Bus : u8 {
    AUTO        = 0,

    // --- universal ---
    BIT_BANG,        // Software GPIO + busy-wait. Always available.

    // --- async serial ---
    UART,            // Vendor-agnostic: UART/USART/LPUART/SERCOM-UART.

    // --- hardware SPI ---
    SPI,             // 1 strip on hardware SPI master.

    DUAL_SPI,        // 2 parallel strips (SpiHw2).
    QUAD_SPI,        // 4 parallel strips (SpiHw4).
    OCTAL_SPI,       // 8 parallel strips (SpiHw8).

    // --- hardware pulse encoder (clockless-only, dynamic worker pool) ---
    RMT,             // Single engine, K workers managed by channel manager.
                     // K shrinks as WiFi/BT reclaim RAM. No Which axis.

    // --- programmable I/O engine (clockless + SPI capable) ---
    FLEX_IO,         // Default programmable I/O engine.
};

8 user-facing engine types (down from current 15 + sprawling vendor names).

Instance selection via Which template parameter

// Default — instance 0, the platform's preferred engine for this type.
FastLED.add<Bus::FLEX_IO>(cfg);          // ObjectFLED on Teensy 4.x (which=0)
FastLED.add<Bus::SPI>(cfg);              // LPSPI4 on Teensy 4.x (which=0)
FastLED.add<Bus::UART>(cfg);             // LPUART1 on Teensy 4.x (which=0)

// Explicit instance pick — second template parameter.
FastLED.add<Bus::FLEX_IO, 1>(cfg);       // 2nd FlexIO-class engine on this platform
FastLED.add<Bus::SPI, 2>(cfg);           // 3rd hardware SPI engine
FastLED.add<Bus::UART, 5>(cfg);          // 6th UART (LPUART6 on Teensy 4.x)

Which is a u8, ranges from 0 to whatever the platform supports for that engine type. Out-of-range values resolve to the no-op stub; a BusInstanceCount<B> trait exposes the max valid Which per Bus per platform for compile-time iteration and assertion.

template<Bus B>
struct BusInstanceCount {
    static constexpr u8 value = 1;       // default: only instance 0
};

// Per-platform specializations live next to the feature macros:
#if FASTLED_HAS_LPSPI
template<> struct BusInstanceCount<Bus::SPI> { static constexpr u8 value = 4; };  // LPSPI1..4
#endif
#if FASTLED_HAS_LPUART
template<> struct BusInstanceCount<Bus::UART> { static constexpr u8 value = 8; }; // LPUART1..8
#endif
// ... etc

// Sketches can static_assert availability:
static_assert(BusInstanceCount<Bus::FLEX_IO>::value > 1,
              "this code requires a second FlexIO-class engine on the build target");
FastLED.add<Bus::FLEX_IO, 1>(cfg);

Why two axes instead of flat Bus::FLEX_IO1, Bus::FLEX_IO2, Bus::SPI1...

Property Flat enum (old) (Engine, Which) (new)
Enum value count 15 (FLEX_IO/FLEX_IO1/FLEX_IO2, SPI/SPI1/SPI2/SPI3...) 8
Adding a 5th SPI instance new enum value, every site that switches on Bus updates nothing -- <Bus::SPI, 4> already valid syntactically
Compile-time iteration over instances hand-list every numbered value for_each_instance<Bus::SPI>([](auto W){...}) -- parameter pack expansion
Conceptual model denormalized: "engine type" and "instance" conflated into one identifier orthogonal: engine type chooses driver, instance chooses which one
Bus::FLEX_IO2 ambiguity reads like "NXP FlexIO2 silicon" <Bus::FLEX_IO, 2> is unambiguous: "third FlexIO-class engine on this build"
Default instance is a separate enum value (Bus::FLEX_IO) implicit in Which = 0 -- the default IS the typed shorthand
Per-platform max-instance docs implicit: the platform "has" or "doesn't have" FLEX_IO2 explicit via BusInstanceCount<Bus::FLEX_IO>::value -- a queryable, iterable count

The (Engine, Which) split also composes cleanly with the feature-detection chain (a per-Which partial specialization picks the next available driver), and with the deviceInfo<> introspection layer (which gains the same Which parameter so deviceInfo<Bus::FLEX_IO, 0>() and deviceInfo<Bus::FLEX_IO, 1>() are distinct queries).

Note on WASM / host / test targets

There is no separate STUB slot. On host / WASM builds, Bus::FLEX_IO (and any other portable name a sketch uses) resolves to the existing host / WASM mock driver via the platform's DefaultBus<> table -- the same machinery that maps FLEX_IO to ObjectFLED on Teensy 4.x maps it to the WASM renderer in the browser. Sketches that compile against the portable enum just work in the host test harness and in WASM with no per-platform special-casing.

Key design principles

1. Engine type and instance are orthogonal axes

Bus names the engine TYPE (FlexIO-class, hardware SPI, RMT, UART, ...). Which selects the instance number (0..N). The default Which = 0 mirrors the Arduino convention of "the one most users want" (Serial, SPI, Wire). Explicit picks use the second template argument: <Bus::SPI, 2> is the Arduino SPI2 analogue.

This split eliminates the denormalization of "engine type" and "instance" into a single flat enum value, and removes the artificial enum-value ceiling on per-platform instance counts.

2. Which ONLY indexes distinct engines, NEVER workers within an engine

  • RMT is one peripheral with K worker channels (8 on -dev, 4 on S2/S3/C3, 2-4 on C6/H2/P4). K is dynamic -- shrinks when WiFi/BT reclaims RAM. Workers are channel-manager-allocated, not user-pickable. Therefore: BusInstanceCount<Bus::RMT>::value = 1. <Bus::RMT, 1> is invalid and resolves to no-op.
  • PIO0 / PIO1 on RP2040 are two distinct engines, each with 4 state machines internally. Therefore: BusInstanceCount<Bus::FLEX_IO>::value = 2 on RP2040; <Bus::FLEX_IO, 0> = PIO0, <Bus::FLEX_IO, 1> = PIO1. The 4 SMs inside each stay hidden.
  • FlexIO2 + ObjectFLED on Teensy 4.x are distinct silicon blocks (literal FlexIO vs FlexPWM+eDMA+GPIO6 composite). Therefore: BusInstanceCount<Bus::FLEX_IO>::value = 2 on Teensy 4.x; <Bus::FLEX_IO, 0> = ObjectFLED (default), <Bus::FLEX_IO, 1> = FlexIO2.
  • LPSPI1/2/3/4 on Teensy 4.x are four distinct SPI engines. Therefore: BusInstanceCount<Bus::SPI>::value = 4; <Bus::SPI, 0> = LPSPI4 (default), <Bus::SPI, 1..3> = LPSPI1/2/3.

3. FlexIO = "both clockless AND SPI from the same engine" contract

Bus::FLEX_IO denotes the class of programmable peripherals that the unified-engine rule (#3428) covers. RMT does NOT fit this (clockless-only by hardware design), so it gets its own slot. This contract is what the channel router uses to decide whether a given (Bus, Chipset) pair can be served. The Which axis selects which physical instance of that class on the current platform.

4. Which is a platform-relative index, NOT a vendor silicon number

<Bus::FLEX_IO, 2> does NOT mean "NXP's FlexIO2 silicon" -- it means "this platform's 3rd FlexIO-class engine, whichever it happens to be." The same Which value has different meanings on different chips. Vendor silicon naming lives in the read-only DeviceInfo::vendor_name field, not in the selector axis.

Bulk-parallel drivers collapse Which to 1

A natural extension of the unified-engine rule (#3428) — the peripheral is the dispatch boundary, not the mode — applies to multi-instance peripherals too: the engine class is the dispatch boundary, not the instance.

When a single driver class manages multiple hardware peripherals as a coordinated pool (RMT's K worker channels, parallel-LPUART on Teensy 4.x driving 8 strips via the inverted-TX trick, parallel-SPI multipliers, FlexIO with multiple shifters), the pool is internal to the engine. The user picks <Bus::X> and the engine internally allocates channels across the underlying peripherals. The Which axis MUST be absent because exposing individual peripherals as separate Which values would create the same fork-the-engine anti-pattern that the SPI/clockless unification rule forbids.

The principle

BusInstanceCount<B> > 1 ONLY when there are distinct silicon engines that can run independently with different drivers configured per-instance.

If a single driver class manages multiple peripherals as a coordinated pool, BusInstanceCount<B> = 1 -- the pool is internal to the engine, and Which collapses to 0.

Applied to current engine types

Bus BusInstanceCount typical value Why
BIT_BANG 1 one software driver
UART 1 (Teensy 4.x via parallel-LPUART driver) bulk parallel engine drives LPUART1..8 internally via inverted-TX + eDMA; user gets all strips from one <Bus::UART>
SPI N today, may collapse to 1 later (see follow-on below) LPSPI1..4 are 4 independent SPI engines today; user binds different chipsets per-instance
DUAL_SPI / QUAD_SPI / OCTAL_SPI 1 already bulk drivers — they coordinate N hardware SPI engines as one parallel transfer
RMT 1 single peripheral with dynamic worker pool; K shrinks under WiFi/BT memory pressure
FLEX_IO 2 on Teensy 4.x ObjectFLED (Which=0) and FlexIO2 (Which=1) are distinct driver classes with different programming models -- not a coordinated pool

The "Which collapses to 1" transition is a deliberate API event

Once a bulk-parallel driver exists for a previously per-instance Bus, that Bus's BusInstanceCount changes from N to 1 in the next release. This is a breaking-but-pre-release-acceptable change: code that previously wrote <Bus::SPI, 2> to pick LPSPI2 explicitly needs to either (a) rely on the new bulk driver allocating the strip onto LPSPI2 via the resolution chain, or (b) escape-hatch into the constexpr (Bus, Which) alias header (fl::platforms::TEENSY_LPSPI2 = {Bus::SPI, 2}) if a literal silicon pin is required.

The escape hatch exists precisely for this case: when bulk-parallel drives Which to 1 but a user needs literal silicon selection (e.g. a pin only routes to LPSPI3), they can re-introduce explicit selection via a constexpr alias without polluting the everyday API.

Follow-on: SPI

Today Bus::SPI on Teensy 4.x means LPSPI4 (single-strip default) with Which = 1..3 picking LPSPI1/2/3. Once a parallel_lpspi engine ships, Bus::SPI would resolve to "the parallel LPSPI engine, allocate strips across LPSPI1..4 automatically", and BusInstanceCount<Bus::SPI> would drop to 1 on Teensy 4.x. Tracked as a follow-on consideration; not a hard requirement for the v1 of this refactor.

Per-platform resolution table

User writes ESP32-dev ESP32-S3 ESP32-C6/H2/C5 ESP32-P4 Teensy 4.x RP2040 WASM / host
<Bus::BIT_BANG> software GPIO software GPIO software GPIO software GPIO software GPIO software GPIO mock
<Bus::UART> UART0..2 (sequential) UART0..2 (sequential) UART0..1 (sequential) UART0..4 (sequential) parallel LPUART1..8 (bulk) UART0..1 (sequential) mock
<Bus::SPI, 0..N> SPI3 / SPI2 SPI3 / SPI2 SPI2 SPI2 LPSPI4 / LPSPI1..3 (until parallel-LPSPI ships) SPI0 / SPI1 mock
<Bus::DUAL_SPI> — — — — LPSPI x2 PIO dual mock
<Bus::QUAD_SPI> — — — — LPSPI x4 PIO quad mock
<Bus::RMT> (clockless) RMT4 RMT4/5 RMT5 RMT5 falls through to FLEX_IO falls through to BIT_BANG mock
<Bus::RMT> (SPI chipset) canHandle=false → fall through same same same n/a n/a mock
<Bus::FLEX_IO, 0> (clockless) I2S-LED LCD_CAM clockless PARLIO PARLIO / LCD_RGB ObjectFLED PIO0 SM0 WASM / host mock
<Bus::FLEX_IO, 0> (SPI) I2S_SPI LCD_SPI PARLIO-SPI (pending) — ObjectFLED-SPI PIO0 SPI mock
<Bus::FLEX_IO, 1> I2S (other mode) LCD_CAM other mode PARLIO_TX_UNIT_1 LCD_RGB FlexIO2 / FlexIO2-SPI PIO1 SM0 mock
BusInstanceCount<Bus::FLEX_IO> 2 2 2 2 2 2 1
BusInstanceCount<Bus::SPI> 2 2 1 1 4 (1 once parallel-LPSPI ships) 2 1
BusInstanceCount<Bus::UART> 3 3 2 5 1 (parallel-LPUART engine) 2 1

Fall-through semantics: when canHandle() returns false, the channel manager moves to the next bus on the priority list, so portable sketches degrade gracefully on platforms that do not have a given engine. Out-of-range Which values (e.g. <Bus::SPI, 7> on a platform where BusInstanceCount<Bus::SPI>::value == 4) resolve to the no-op stub at compile time.

Resolution mechanism: feature-detection chain, not platform-name cascade

The mapping from generic Bus::X to concrete driver should NOT be a hand-written #if defined(FL_IS_TEENSY_4X) / #elif defined(FL_IS_ESP32) / ... cascade per Bus. Adding a new platform shouldn't require touching every Bus's resolution block, and adding a new driver shouldn't require touching every platform's block. Both of those mean N×M maintenance.

Instead: resolution is feature-detection-driven via a structured macro chain. Drivers publish their own presence; the resolver discovers what's available and picks the highest-priority match.

Shape

  1. Each driver TU declares a feature macro when compiled in:

    // object_fled.cpp.hpp
    #define FASTLED_HAS_OBJECTFLED 1
    
    // flexio_spi_mode.cpp.hpp
    #define FASTLED_HAS_FLEXIO 1
    
    // parlio.cpp.hpp
    #define FASTLED_HAS_PARLIO 1
    
    // lcd_cam_clockless.cpp.hpp
    #define FASTLED_HAS_LCD_CAM_CLOCKLESS 1
    
    // pio.cpp.hpp (RP2040)
    #define FASTLED_HAS_PIO 1
    
    // ... one per driver
  2. A central header zero-fills all unset feature macros so they're always testable:

    // bus_features.h -- ensures every FASTLED_HAS_* is defined (0 or 1)
    #ifndef FASTLED_HAS_OBJECTFLED
    #define FASTLED_HAS_OBJECTFLED 0
    #endif
    #ifndef FASTLED_HAS_FLEXIO
    #define FASTLED_HAS_FLEXIO 0
    #endif
    // ... one per known driver
  3. Each (Bus, Which) pair has a prioritized resolver chain -- the chain IS the priority list. With the (Engine, Which) split, the Which = 0 chain picks the highest-priority driver, the Which = 1 chain picks the second, and so on:

    // bus_info_impl.cpp.hpp -- the one platform-wiring file
    
    // Default instance (Which = 0): highest-priority driver wins.
    template<> const DeviceInfo& deviceInfo<Bus::FLEX_IO, 0>() {
        #if FASTLED_HAS_OBJECTFLED
            return detail::objectFledInfo();
        #elif FASTLED_HAS_FLEXIO
            return detail::flexioInfo();
        #elif FASTLED_HAS_PARLIO
            return detail::parlioInfo();
        #elif FASTLED_HAS_LCD_CAM_CLOCKLESS
            return detail::lcdCamClocklessInfo();
        #elif FASTLED_HAS_PIO
            return detail::pioInfo();
        #elif FASTLED_HAS_I2S_LED
            return detail::i2sLedInfo();
        #else
            return detail::busNoOp();
        #endif
    }
    
    // Second instance (Which = 1): skip the first match, pick the next.
    template<> const DeviceInfo& deviceInfo<Bus::FLEX_IO, 1>() {
        #if FASTLED_HAS_OBJECTFLED && FASTLED_HAS_FLEXIO
            return detail::flexioInfo();          // ObjectFLED took 0; FlexIO is 1
        #elif FASTLED_HAS_PIO && FASTLED_HAS_PIO1
            return detail::pio1Info();
        #else
            return detail::busNoOp();
        #endif
    }
    
    template<> const DeviceInfo& deviceInfo<Bus::SPI, 0>() {
        #if FASTLED_HAS_LPSPI
            return detail::lpspiInfo<4>();        // LPSPI4 = the default LPSPI on Teensy 4.x
        #elif FASTLED_HAS_ESP_SPI_HW
            return detail::espSpiHwInfo<0>();
        #elif FASTLED_HAS_SOFT_SPI
            return detail::softSpiInfo();
        #else
            return detail::busNoOp();
        #endif
    }
    template<> const DeviceInfo& deviceInfo<Bus::SPI, 1>() {
        #if FASTLED_HAS_LPSPI
            return detail::lpspiInfo<1>();        // LPSPI1
        #else
            return detail::busNoOp();
        #endif
    }
    // ... LPSPI2, LPSPI3 similarly
    
    template<> const DeviceInfo& deviceInfo<Bus::RMT, 0>() {
        #if FASTLED_HAS_RMT5
            return detail::rmt5Info();
        #elif FASTLED_HAS_RMT4
            return detail::rmt4Info();
        #else
            return detail::busNoOp();
        #endif
    }
  4. The primary template for unspecialized (Bus, Which) pairs returns no-op. This is what makes <Bus::SPI, 7> on a 4-instance platform compile-and-silently-degrade rather than link-error:

    // Catch-all: any (B, Which) without a specific specialization → no-op.
    template<Bus B, u8 Which>
    const DeviceInfo& deviceInfo() {
        return detail::busNoOp();
    }

    The primary template's body acts as the terminal fallback. Explicit (B, Which) specializations override it; unhandled pairs gracefully return the no-op stub.

Why this beats a platform-name cascade

Property Platform-name cascade Feature-detection chain
Adding a new platform edit every Bus block in bus_info_impl.cpp.hpp to add a new #elif defined(FL_IS_NEWPLATFORM) arm define the right FASTLED_HAS_* macros in the new platform's driver TUs -- mappings light up automatically
Adding a new driver edit every platform's block to insert it at the right priority insert one new #elif FASTLED_HAS_NEWDRIVER line in the relevant Bus's chain (centralized priority)
Driver-not-compiled-in case hidden in conditional branches; easy to forget a #else terminal #else return detail::busNoOp(); is one line per Bus; can't be forgotten because the resolver wouldn't compile without it
Priority order is spread across N platform branches per Bus explicit single-list per Bus -- reads like a config table
Driver-feature-macro reuse none -- platform identity coupled to driver presence feature macros also usable by BusTraits<>, DefaultBus<>, build-system reports, autoresearch enumeration
"Does this build include FlexIO support?" requires reading platform headers #if FASTLED_HAS_FLEXIO everywhere -- one-line check

Where feature macros are defined

Each driver TU's *_build.cpp.hpp is the natural home for its feature macro. The macro is set ONLY when the TU is compiled in by the platform's build system (Meson / PlatformIO). The unity-build wiring that already determines which driver TUs participate is the same wiring that controls which feature macros become 1.

A reference table of all FASTLED_HAS_* macros and their priority order per Bus lives in bus_features.h -- the zero-fill header above -- so contributors can see "what drivers can claim Bus::FLEX_IO, in what order" in a single file.

Composes cleanly with the deviceInfo<> design

Each chain branch calls a detail::xxxInfo() function that the corresponding driver TU defines. If the TU is compiled in, both the feature macro AND the info function exist; the chain selects them as a matched pair. If the TU is NOT compiled in, neither exists -- and the chain skips over that branch entirely, never trying to reference the missing function. No link errors, no UB, no maintenance coupling between platform names and driver names.

Vendor identification: read-only via DeviceInfo, not a separate enum

An earlier draft of this proposal included a parallel fl::platforms::Bus enum (TEENSY_FLEXIO2, ESP32_RMT, RP2040_PIO0_SM0, ...) as a "power user escape hatch." After auditing the actual use cases, we are NOT shipping that enum initially. Every behavioral need is already covered by the portable enum, and every informational need is better served by data than by a parallel selector.

Why no fl::platforms::Bus to start

Use case How the portable design handles it
Pick the framework's default peripheral <Bus::FLEX_IO> (Which = 0; DefaultBus picks the best)
Pick the other instance <Bus::FLEX_IO, 1>, <Bus::FLEX_IO, 2> (Which axis)
Know what silicon ran ("for code review / logs") deviceInfo<Bus::FLEX_IO, 0>().vendor_name returns "ObjectFLED (FlexPWM+eDMA+GPIO6)"
Pin-constrained peripheral selection Covered by Which axis + DefaultBus<> priority order; falls through if a pin is unroutable
AutoResearch enumeration of vendor instances Iterate Bus × [0..BusInstanceCount<B>::value), read vendor_name from each DeviceInfo
Bug-workaround / errata avoidance Explicit Which + vendor_name query to confirm

The selection axis is the portable enum. The identification axis is a string field on DeviceInfo. Conflating them in a parallel enum would double the template surface (FastLED.add<Bus::X> AND FastLED.add<fl::platforms::Bus::Y> overloads, parallel BusTraits<> specializations, parallel registration calls) for benefits that overlap entirely with what vendor_name provides.

If a real power-user need surfaces later

Add (Bus, Which) constexpr-pair aliases in a per-platform fl::platforms::* header -- one-liners, no new template surface, no new dispatch.

The namespace is fl::platforms (plural) to mirror the existing src/platforms/ directory layout. Earlier drafts used fl::hw ("hardware") -- dropped because the values are platform-specific peripheral aliases, not generic hardware concepts, and "hw" was opaque. fl::platforms::TEENSY_FLEXIO2 reads as "the TEENSY_FLEXIO2 identifier from the platforms layer," which matches both what the value is and where the file lives in the tree.

namespace fl::platforms {

struct BusPick { Bus bus; u8 which; };

#if defined(FL_IS_TEENSY_4X)
    constexpr BusPick TEENSY_OBJECT_FLED = { Bus::FLEX_IO, 0 };
    constexpr BusPick TEENSY_FLEXIO2     = { Bus::FLEX_IO, 1 };
    constexpr BusPick TEENSY_LPSPI4      = { Bus::SPI,     0 };
    constexpr BusPick TEENSY_LPSPI1      = { Bus::SPI,     1 };
    constexpr BusPick TEENSY_LPUART6     = { Bus::UART,    5 };
#elif defined(FL_IS_ESP32)
    constexpr BusPick ESP32_RMT          = { Bus::RMT,     0 };
    constexpr BusPick ESP32_PARLIO       = { Bus::FLEX_IO, 0 };
#endif

}

// Usage compiles to identical code as the bare (Bus, Which) form:
FastLED.add<fl::platforms::TEENSY_FLEXIO2.bus, fl::platforms::TEENSY_FLEXIO2.which, ChipsetT>(cfg);
// Or via a convenience macro:
#define FL_ADD(PICK, CHIPSET, ...) \
    FastLED.add<(PICK).bus, (PICK).which, CHIPSET>(__VA_ARGS__)
FL_ADD(fl::platforms::TEENSY_FLEXIO2, ChipsetT, cfg);

Because aliases collapse to the same (Bus, Which) pair the user could write by hand, all existing template machinery works unchanged. The aliases exist purely for documentation clarity in user code. Defer until a documented use case demands them.

Rollout

The current channel-driver API is pre-release. This refactor is a single breaking swap -- no deprecation aliases, no transition window. All callers (sketches, examples, tests, internal BusTraits<> registrations) flip to the new enum in one PR, all old vendor-named Bus::X values are removed at the same time. Any sketch in examples/ or tests/ that referenced Bus::OBJECT_FLED / Bus::PARLIO / Bus::LCD_SPI / Bus::I2S_SPI / Bus::STUB / Bus::LPUART gets updated in the same commit to use the new portable name.

What this buys

  1. Sketch portability. FastLED.add<Bus::FLEX_IO, 0, ClocklessChipset>(cfg) (or just FastLED.add<Bus::FLEX_IO, ClocklessChipset>(cfg) with Which = 0 defaulted) is what a tutorial uses; it works on any platform with any programmable-I/O peripheral -- and on WASM / host test builds, it resolves to the mock driver with no special-casing.
  2. No silicon-number collision. <Bus::FLEX_IO, 1> means "this platform's 2nd FlexIO-class engine", not "NXP FlexIO1".
  3. Orthogonal axes. Engine type (Bus) and instance (Which) are conceptually separate concerns that the API now represents as separate axes -- the flat enum used to denormalize them into one identifier.
  4. No artificial instance ceiling. Which is a u8, accommodating up to 256 instances of any engine type without needing new enum values. BusInstanceCount<B> documents the per-platform max.
  5. Worker pools stay hidden. RMT's dynamic K-channel pool is not an API concern; BusInstanceCount<Bus::RMT>::value = 1 makes the "no instance selection" semantics explicit.
  6. No mock-vs-real split in the user-facing enum. Dropping Bus::STUB and folding host/WASM into the Bus::FLEX_IO resolution chain means a sketch never needs #ifdef FL_IS_STUB to pick an engine.
  7. Tiny user-facing enum. 8 engine types cover every controller in the codebase (per the earlier cross-platform survey of ~40 distinct peripheral classes across 20+ chip families).
  8. Vendor info preserved as queryable data. deviceInfo<Bus::FLEX_IO, 0>().vendor_name returns the full silicon identity ("ObjectFLED (FlexPWM+eDMA+GPIO6)", "FlexIO2 (i.MX RT1062)", "RMT4", etc.) without forcing a parallel fl::platforms::Bus enum into the API surface. Constexpr (Bus, Which) alias headers can be added later if real power-user demand emerges.
  9. Compile-time iteration becomes natural. for_each_instance<Bus::FLEX_IO>([](auto W){ deviceInfo<Bus::FLEX_IO, W>(); }) is a parameter-pack expansion bounded by BusInstanceCount<> -- previously required hand-listing FLEX_IO, FLEX_IO1, FLEX_IO2 by name.

Device-info introspection layer

The portable enum + Which axis is also the dispatch key for a per-instance introspection API. Goal: a sketch (or a debug tool, or the AutoResearch RPC) can query <Bus::FLEX_IO, 0> and get back a structured description of what that pair resolved to on the current platform -- generic name, vendor name, capabilities, available pins, current runtime state (DMA channel, clock rate, active pin) -- without dragging JSON cost into every binary.

Shape

A function template parameterized on (Bus, u8 Which = 0) with a generic primary template (returns no-op) + explicit (B, Which) specializations in the impl TU. The primary template's no-op body is the terminal fallback for any pair not explicitly bound -- so <Bus::SPI, 7> on a 4-instance platform gracefully compiles to a no-op rather than triggering a link error.

// bus_info.h -- public API, uniform on every platform
namespace fl {

struct DeviceRuntime {
    u8   dma_channel;
    u32  clock_hz;
    u8   active_pin;
    bool initialized;
};

struct DeviceInfo {
    const char*        name;            // "FLEX_IO"
    const char*        vendor_name;     // "FlexIO2 (i.MX RT1062)" or "(unsupported)"
    Capabilities       caps;
    u8                 which;           // the Which value this DeviceInfo describes
    fl::span<const u8> available_pins;
    DeviceRuntime      runtime;         // zero-filled for no-op buses
};

// Primary template -- inline body = no-op fallback for any unspecialized (B, Which).
template<Bus B, u8 Which = 0>
inline const DeviceInfo& deviceInfo() {
    static const DeviceInfo k_unsupported{
        "(unsupported)", "no driver on this platform", {false, false}, Which, {}, {}
    };
    return k_unsupported;
}

// Specialization declarations for every (B, Which) the impl TU defines.
// Per-platform #if arms enumerate the valid pairs on each build target.
#if defined(FL_IS_TEENSY_4X)
    template<> const DeviceInfo& deviceInfo<Bus::BIT_BANG, 0>();
    template<> const DeviceInfo& deviceInfo<Bus::FLEX_IO,  0>();   // ObjectFLED
    template<> const DeviceInfo& deviceInfo<Bus::FLEX_IO,  1>();   // FlexIO2
    template<> const DeviceInfo& deviceInfo<Bus::SPI,      0>();   // LPSPI4
    template<> const DeviceInfo& deviceInfo<Bus::SPI,      1>();   // LPSPI1
    template<> const DeviceInfo& deviceInfo<Bus::SPI,      2>();   // LPSPI2
    template<> const DeviceInfo& deviceInfo<Bus::SPI,      3>();   // LPSPI3
    template<> const DeviceInfo& deviceInfo<Bus::UART,     0>();   // parallel-LPUART bulk engine (drives LPUART1..8 internally)
#elif defined(FL_IS_ESP32)
    template<> const DeviceInfo& deviceInfo<Bus::BIT_BANG, 0>();
    template<> const DeviceInfo& deviceInfo<Bus::RMT,      0>();
    template<> const DeviceInfo& deviceInfo<Bus::FLEX_IO,  0>();   // I2S-LED
    template<> const DeviceInfo& deviceInfo<Bus::FLEX_IO,  1>();
    template<> const DeviceInfo& deviceInfo<Bus::SPI,      0>();   // SPI3
    template<> const DeviceInfo& deviceInfo<Bus::SPI,      1>();   // SPI2
    template<> const DeviceInfo& deviceInfo<Bus::UART,     0>();
    template<> const DeviceInfo& deviceInfo<Bus::UART,     1>();
    template<> const DeviceInfo& deviceInfo<Bus::UART,     2>();
#endif

}

Pairs not in the active #if arm fall through to the primary template's no-op body. No link errors, no UB.

// bus_info_impl.cpp.hpp -- compiled into ONE TU. The platform-wiring file.
namespace fl {

#define FL_BUS_BIND(B, W, body) \
    template<> const DeviceInfo& deviceInfo<Bus::B, W>() { body }

FL_BUS_BIND(BIT_BANG, 0, {
    static const DeviceInfo info{
        "BIT_BANG", "software GPIO", {true, true}, 0, {}, {}
    };
    return info;
})

#if defined(FL_IS_TEENSY_4X)
    #include "platforms/arm/teensy/teensy4/flexio_spi_mode.h"
    #include "platforms/arm/teensy/teensy4/object_fled.h"

    FL_BUS_BIND(FLEX_IO, 0, {                            // ObjectFLED (default)
        static DeviceInfo info{
            "FLEX_IO", "ObjectFLED (FlexPWM+eDMA+GPIO6)",
            {true, true}, 0, kObjectFledPins, {}
        };
        info.runtime = detail::object_fled_internal::snapshot();
        return info;
    })
    FL_BUS_BIND(FLEX_IO, 1, {                            // FlexIO2 silicon
        static DeviceInfo info{
            "FLEX_IO", "FlexIO2 (i.MX RT1062)",
            {true, true}, 1, kFlexioPins, {}
        };
        info.runtime = detail::flexio_spi_internal::snapshot();
        return info;
    })
    FL_BUS_BIND(SPI, 0, { /* LPSPI4 */ })
    FL_BUS_BIND(SPI, 1, { /* LPSPI1 */ })
    FL_BUS_BIND(SPI, 2, { /* LPSPI2 */ })
    FL_BUS_BIND(SPI, 3, { /* LPSPI3 */ })
    // UART, etc.

#elif defined(FL_IS_ESP32)
    // ...same shape, different (Bus, Which) bindings
#endif
// Pairs without an explicit binding (e.g. <Bus::SPI, 7>) fall through to
// the primary template's inline no-op body. No FL_BUS_NOOP needed.

}  // namespace fl

Why this shape

  1. Header has only the pairs that the platform actually implements -- per-platform #if enumerates them. Any other (Bus, Which) pair falls through to the primary template's no-op body.
  2. Every deviceInfo<Bus::X, W>() call succeeds -- declared pairs resolve to impl TU bindings; undeclared pairs run the primary template's inline no-op. No link errors, no UB.
  3. No undefined behavior -- every implicit instantiation has a matching declared+defined specialization in scope. Fully standard C++.
  4. Single source of truth for platform support -- bus_info_impl.cpp.hpp is the one file that knows what's available where.
  5. Portable across GCC / Clang / MSVC / AVR-GCC -- no __attribute__((weak)) required.
  6. Per-driver locality preserved -- the actual snapshot functions (flexio_spi_internal::snapshot() etc.) live next to the driver they describe; the impl TU just calls them.

JSON adapter (opt-in cost)

fl::json is fat. Pulling it into every binary that has the Bus enum is unaffordable on AVR / small MCUs. The fix: package the JSON code as a separate templated adapter that's only linked when explicitly called.

template<Bus B, u8 Which = 0>
fl::json deviceJson() {
    const auto& info = deviceInfo<B, Which>();
    JsonObject obj;
    obj["name"]        = info.name;
    obj["vendor_name"] = info.vendor_name;
    obj["caps"]        = info.caps;
    obj["which"]       = info.which;
    obj["dma_channel"] = info.runtime.dma_channel;
    obj["clock_hz"]    = info.runtime.clock_hz;
    obj["active_pin"]  = info.runtime.active_pin;
    obj["initialized"] = info.runtime.initialized;
    return obj;
}

Cost properties:

Sketch behavior Linked code
Never calls deviceInfo<>() or deviceJson<>() ~one shared no-op static (~30 bytes)
Calls deviceInfo<Bus::FLEX_IO, 0>() The impl TU's (FLEX_IO, 0) binding only
Calls deviceJson<Bus::FLEX_IO, 0>() (FLEX_IO, 0) binding + fl::json serializer instantiated for ONE struct (DeviceInfo)
AutoResearch RPC enumerates all (B, W) All impl TU bindings + fl::json
Regular Blink.ino Zero introspection code

Because DeviceInfo is one plain struct, the JSON adapter is one function, not per-Bus. JSON cost is paid once per binary if anyone serializes, not multiplied by bus count.

Integration with AutoResearch

The existing AutoResearch JSON debug interface becomes a thin wrapper over deviceJson<B>() for whichever Bus the host requests. The fat JSON path lives in the AutoResearch firmware binary only (which already accepts JSON cost). Production firmware that includes bus_info.h but never queries pays nothing.

Implementation contract for coding agents

This section enumerates the concrete artifacts and conventions an implementing agent must follow. Treat everything in this section as binding. If something below contradicts what an agent thinks "would be cleaner," the section wins -- the design choices have been deliberated. Open items belong in the "Open questions" section, not in unilateral implementation choices.

Authoritative file inventory

Concern Canonical path Status
Current Bus enum src/fl/channels/bus.h replace contents of enum class Bus
Current BusTraits<> declaration src/fl/channels/bus_traits.h preserve API; gain <Bus B, u8 Which = 0> parameterization
Current DefaultBus<Chipset> table src/fl/channels/bus.h (lines ~91-152) rewrite per feature-detection chain (see below)
New bus_features.h src/fl/channels/bus_features.h (NEW) zero-fill all FASTLED_HAS_* macros to 0
New bus_info.h (public introspection) src/fl/channels/bus_info.h (NEW) primary deviceInfo<> template + per-platform specialization decls
New bus_info_impl.cpp.hpp (wiring TU) src/fl/channels/bus_info_impl.cpp.hpp (NEW) every (Bus, Which) binding lives here; included exactly once from src/fl/channels/_build.cpp.hpp
New bus_info.json.h (JSON adapter) src/fl/channels/bus_info.json.h (NEW) deviceJson<B, W>() template — separate header so callers that don't need JSON don't link fl::json
fl::platforms aliases (deferred -- not v1) src/fl/channels/platforms_aliases.h NOT in v1; only file the alias header when a real power-user case lands
Driver TU feature macros each driver's existing */drivers/<name>/_build.cpp.hpp add one #define FASTLED_HAS_<NAME> 1 per driver TU; ONLY when the TU is actually compiled in
Channels README src/fl/channels/README.md update the Bus-enum reference table; preserve the existing "unified clockless+SPI engine" section
Per-driver README src/platforms/.../drivers/<name>/README.md unchanged unless that driver's name maps differently

Existing driver directory tree (do not relocate):

  • src/platforms/arm/teensy/teensy4_common/drivers/ — flexio/, lpuart/, objectfled/
  • src/platforms/esp/32/drivers/ — rmt/, parlio/, lcd_cam/, lcd_spi/, i2s/, i2s_spi/, spi/, uart/, ble/, gpio_isr_rx/, rmt_rx/
  • src/platforms/arm/rp/rp2040/ and rp2350/ — PIO/PIO1 drivers (see directory)
  • src/platforms/wasm/ — host/WASM mock driver

The unity-build wiring chain (do not break):
src/_build.cpp.hpp → src/platforms/<family>/_build.cpp.hpp → src/platforms/<family>/drivers/<name>/_build.cpp.hpp. Adding a feature macro means editing the leaf _build.cpp.hpp only; the chain above already includes it conditionally per platform.

Exact public API (this is the contract)

namespace fl {

// 1. The portable engine-type enum.
enum class Bus : u8 {
    AUTO        = 0,
    BIT_BANG,
    UART,
    SPI,
    DUAL_SPI,
    QUAD_SPI,
    OCTAL_SPI,
    RMT,
    FLEX_IO,
};

// 2. Per-platform max-Which trait. Primary defaults to 1 (only instance 0).
template<Bus B>
struct BusInstanceCount {
    static constexpr fl::u8 value = 1;
};

// 3. Capabilities (unchanged from current bus.h).
struct Capabilities {
    bool supportsClockless;
    bool supportsSpi;
};

// 4. Per-Bus traits — parameterized on (B, Which). Primary undefined.
template<Bus B, fl::u8 Which = 0>
struct BusTraits;  // must be specialized; "implicit instantiation of undefined template" = correct error for unsupported pair

// 5. Default Bus resolution for a chipset — same shape as today, no Which axis at this layer.
template<typename Chipset>
struct DefaultBus;

// 6. Device-info introspection. Primary template = no-op fallback.
struct DeviceRuntime {
    fl::u8  dma_channel;
    fl::u32 clock_hz;
    fl::u8  active_pin;
    bool    initialized;
};

struct DeviceInfo {
    const char*        name;
    const char*        vendor_name;
    Capabilities       caps;
    fl::u8             which;
    fl::span<const fl::u8> available_pins;
    DeviceRuntime      runtime;
};

template<Bus B, fl::u8 Which = 0>
inline const DeviceInfo& deviceInfo();  // primary inline = no-op stub

// 7. JSON adapter — separate header so JSON cost is opt-in.
template<Bus B, fl::u8 Which = 0>
fl::json deviceJson();

}  // namespace fl

Do NOT introduce any of the following:

  • fl::hw namespace (use fl::platforms if/when alias header is added, per "Vendor identification" section)
  • A parallel fl::hw::Bus or fl::platforms::Bus enum (rejected; vendor identity is DeviceInfo::vendor_name string data)
  • A Bus::X_SPI enum value for any peripheral that has a Bus::X clockless mode (violates feat(teensy4/spi): massive parallel SPI driver via FlexIO and/or ObjectFLED (APA102 / SK9822 / HD108 / WS2801) #3428 unified-engine rule)
  • A separate ChannelEngineXxxSPI class for the SPI mode of a peripheral that already has ChannelEngineXxx (same rule)
  • Deprecation aliases for old vendor-named Bus::X values (single breaking swap per "Rollout" section)
  • __attribute__((weak)) to make specializations optional (not portable to MSVC; use the per-platform #if declaration pattern instead)
  • Runtime registry / function-pointer tables for deviceInfo<> (chosen design is compile-time templated; static-init registries break embedded targets)

Feature macro naming and ownership

Format: FASTLED_HAS_<DRIVER_NAME> — all caps, <DRIVER_NAME> matches the driver directory name (e.g., FASTLED_HAS_OBJECTFLED, FASTLED_HAS_FLEXIO, FASTLED_HAS_PARLIO, FASTLED_HAS_LCD_CAM_CLOCKLESS, FASTLED_HAS_LCD_SPI, FASTLED_HAS_I2S_LED, FASTLED_HAS_I2S_SPI, FASTLED_HAS_RMT4, FASTLED_HAS_RMT5, FASTLED_HAS_LPSPI, FASTLED_HAS_LPUART_PARALLEL, FASTLED_HAS_PIO, FASTLED_HAS_PIO1, FASTLED_HAS_SOFT_SPI).

Definition site: the driver's own _build.cpp.hpp, at the top, BEFORE any includes:

// src/platforms/arm/teensy/teensy4_common/drivers/objectfled/_build.cpp.hpp
#define FASTLED_HAS_OBJECTFLED 1
#include "platforms/arm/teensy/teensy4_common/drivers/objectfled/object_fled.cpp.hpp"
// ...

Zero-fill site: src/fl/channels/bus_features.h defines every known macro to 0 if undefined. This header is included by bus.h, bus_info.h, bus_traits.h, and bus_info_impl.cpp.hpp so #if FASTLED_HAS_X always works (no defined() checks needed downstream).

Adding a new driver: the implementing agent adds one new #define FASTLED_HAS_X 1 to the driver's _build.cpp.hpp AND one #ifndef FASTLED_HAS_X / #define FASTLED_HAS_X 0 / #endif block to bus_features.h. That is the full wiring.

Resolution chain priority — settled choices

Order within each chain is deliberate. Do NOT reorder without an explicit decision in this issue.

Bus::FLEX_IO: OBJECTFLED → FLEXIO → PARLIO → LCD_CAM_CLOCKLESS → PIO → I2S_LED → no-op

Bus::SPI: LPSPI → ESP_SPI_HW → SOFT_SPI → no-op

  • Rationale: LPSPI is the Teensy 4.x hardware SPI; ESP_SPI_HW covers ESP32-family hardware SPI engines (SPI2/SPI3); SOFT_SPI is the universal bit-bang fallback.

Bus::UART: LPUART_PARALLEL → ESP32_UART → SOFT_UART → no-op

  • Rationale: bulk-parallel LPUART on Teensy 4.x (per "Bulk-parallel drivers collapse Which to 1" section); ESP32 UART for ESP-family; soft fallback elsewhere.

Bus::RMT: RMT5 → RMT4 → no-op

  • Rationale: ESP-IDF 5.x RMT5 driver is preferred over the legacy 4.x driver. Non-ESP platforms get no-op.

Bus::DUAL_SPI, QUAD_SPI, OCTAL_SPI: LPSPI_PARALLEL_N → PIO_SPI_PARALLEL_N → no-op (where N is 2, 4, 8)

  • Rationale: Teensy LPSPI has hardware support for parallel SPI multiplexing; RP2040 PIO can synthesize it.

Bus::BIT_BANG: always available, single binding. No chain.

Bus::AUTO: sentinel; resolution happens at the channel-manager layer via DefaultBus<Chipset>, not in this chain. deviceInfo<Bus::AUTO, 0>() returns a sentinel DeviceInfo whose name is "(auto -- resolves per chipset)".

Build / test commands (use these exact forms)

The codebase requires bash wrapper scripts; do not invoke Python or Meson/Ninja/clang++ directly. See agents/docs/build-system.md.

bash test --cpp                 # unit tests including new bus_info tests
bash test BusInfo --debug       # ASAN/UBSAN run of just the new BusInfo tests
bash lint                       # required after every code edit batch
bash compile wasm --examples Blink   # WASM smoke test (Blink must still compile)
bash compile teensy41 --examples AutoResearch   # Teensy 4.x bring-up smoke test (only when explicitly requested)

Per-platform compilation: the implementing agent MUST NOT compile every platform's variant on every commit. The CI matrix covers cross-platform. Local validation: WASM + one ARM target + one ESP32 target is enough for design-level work.

Acceptance criteria

The work is complete when ALL of the following hold:

  1. Enum compiles: enum class Bus in src/fl/channels/bus.h contains exactly the 9 values listed in the API contract above. No OBJECT_FLED, no PARLIO, no LCD_SPI, no STUB, no FLEX_IO1, no SPI1, no numbered variants.
  2. All existing sketches in examples/ compile against the new enum on every CI platform. Sketches that referenced old vendor names (Bus::OBJECT_FLED etc.) have been updated in the same commit to use the new portable names.
  3. bash test --cpp passes -- including new tests under tests/test_bus_info.cpp that exercise deviceInfo<Bus::X, W>() for at least: BIT_BANG, UART (Which=0), SPI (Which=0..max), FLEX_IO (Which=0..max), RMT (Which=0). At least one out-of-range deviceInfo<Bus::SPI, 99>() test verifies the no-op fallback.
  4. bash lint passes clean.
  5. WASM build (bash compile wasm --examples Blink) succeeds without #ifdef FL_IS_STUB in the example.
  6. BusInstanceCount<B>::value is queryable at compile time for every Bus on every supported platform; documented in the per-platform resolution table; a static_assert test confirms expected values on at least Teensy 4.x and ESP32-S3.
  7. AutoResearch JSON RPC continues to work — the deviceJson<B, W>() adapter is wired into the existing RPC handler in examples/AutoResearch/. Test by running the AutoResearch host harness; the JSON output for the platform's active buses must include the new fields (vendor_name, which, runtime.*).
  8. No fl::hw namespace exists. No fl::platforms::Bus enum exists. (Both are deferred / rejected per design.)
  9. No Bus::X_SPI enum values introduced. (Violates feat(teensy4/spi): massive parallel SPI driver via FlexIO and/or ObjectFLED (APA102 / SK9822 / HD108 / WS2801) #3428 unified-engine rule.)
  10. CodeRabbit gate (.coderabbit.yaml) does not flag the PR for src/fl/channels/bus.h enum additions or new channel_engine_*.cpp.hpp files (rule from feat(teensy4/spi): massive parallel SPI driver via FlexIO and/or ObjectFLED (APA102 / SK9822 / HD108 / WS2801) #3428).

Suggested PR sequencing

Land this as 3-5 sequential PRs to keep each diff reviewable:

  1. PR-A: Add bus_features.h (zero-fill header) and per-driver _build.cpp.hpp #define FASTLED_HAS_* lines. No behavioral change. Verifies build system.
  2. PR-B: Rewrite enum class Bus in bus.h with the new 9-value taxonomy. Rewrite DefaultBus<> table using the feature-detection chains. Update all examples/ sketches and tests/ files that reference old vendor names. Update per-driver BusTraits<> specializations to bind to new names. This is the breaking-swap PR.
  3. PR-C: Add Which axis to BusTraits<>. Add BusInstanceCount<B> trait with per-platform specializations. Wire up <Bus::SPI, 1..3> on Teensy 4.x (the only platform with multi-instance SPI initially). Adds tests for BusInstanceCount<> and the per-instance dispatch.
  4. PR-D: Add bus_info.h + bus_info_impl.cpp.hpp with the deviceInfo<B, W>() API and the per-platform (Bus, Which) bindings. No JSON yet. Adds unit tests.
  5. PR-E: Add bus_info.json.h with deviceJson<B, W>() adapter. Wire into AutoResearch RPC. Live-validate on at least one device.

Do not bundle all five into one PR. Do not skip PR-A; the build-wiring change must land before the breaking enum swap so the new chain has something to detect.

Cross-referenced rules (treat as binding context)

  • feat(teensy4/spi): massive parallel SPI driver via FlexIO and/or ObjectFLED (APA102 / SK9822 / HD108 / WS2801) #3428 -- unified clockless+SPI engine rule. Read the whole issue before implementing. The peripheral is the dispatch boundary, not the mode.
  • src/fl/channels/README.md § "Rule: Parallel-IO peripherals — one engine for both clockless and SPI modes" -- same rule, codified in the channels README.
  • agents/docs/cpp-standards.md § "Parallel-IO Driver: Unified Clockless + SPI Engine" -- reference implementation pattern.
  • agents/docs/cpp-standards.md § "Public Settings Pattern" -- new global setters go on CFastLED, not fl::set_* free functions. (Not directly in scope here but watch for it during the refactor.)
  • CLAUDE.md root rules: stay in project root, never cd to subdirectories; always use uv run python (never bare python); always use bash wrappers (never pio/platformio/meson/ninja/clang++ directly).
  • .coderabbit.yaml -- flags both src/fl/channels/bus.h enum additions and new channel_engine_*.cpp.hpp files for compliance. PRs that touch these get extra scrutiny.

What to do if blocked

  • Ambiguous design choice not in this issue: file a sub-issue under Refactor Bus enum for cross-platform portability (generic names + vendor escape hatch) #3439 with the choice + tradeoffs; do NOT make a unilateral decision.
  • A driver TU doesn't fit the chain ordering: comment on this issue with the specific driver + proposed insertion point; the priority chains above are explicit and reorderable only by deliberation.
  • BusInstanceCount<B> value for a platform you don't have hardware for: pull data from the cross-platform controller survey referenced below; if still unsure, default to value = 1 and add a TODO comment with // TODO(#3439): confirm instance count on <platform>.
  • An existing sketch uses a removed Bus::X value with no obvious portable replacement: file a comment with the specific sketch path; do not invent a transitional alias.

Open questions

  • Should DUAL_SPI/QUAD_SPI/OCTAL_SPI be SPI_X2/SPI_X4/SPI_X8 instead, to make it more obvious they are parallel-strip multipliers (not memory-style quad-SPI)?
  • Should Bus::AUTO get a more explicit name like BEST or DEFAULT to communicate "framework picks"?
  • Do we want LCD_RGB to keep a distinct slot? It is parallel-RGB-bus and does not quite fit the "FlexIO" mold (it is pixel-clocked, not arbitrary-pattern). Could be Bus::FLEX_IO on P4 but loses some semantic.
  • DeviceInfo struct field set -- start minimal (name / vendor / caps / runtime) and grow, or design a wider struct up front (per-instance register snapshots, error counts, last-transfer timing)?
  • No-op stub: shared static (unsupported) for all platforms, or per-Bus-named stubs (e.g. "RMT (not on Teensy)")? Shared is cheaper; per-Bus is more diagnostic-friendly.
  • Parallel-LPSPI for Teensy 4.x: ship a parallel_lpspi bulk engine and collapse BusInstanceCount<Bus::SPI> from 4 to 1 on Teensy. Mirrors the parallel-LPUART precedent. If done, sketches that explicitly write <Bus::SPI, 2> to pin LPSPI2 need to either rely on bulk-engine allocation OR escape via fl::platforms::TEENSY_LPSPI2. Scope/sequencing TBD.

References

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