src/platforms/arm/rp/rp2040/README.md
Raspberry Pi Pico (RP2040) support.
fastled_arm_rp2040.h: Aggregator; includes pin and clockless.fastpin_arm_rp2040.h: Pin helpers.clockless_arm_rp2040.h: Clockless driver using PIO.pio_asm.h, pio_gen.h: PIO assembly and program generator for T1/T2/T3‑tuned clockless output.led_sysdefs_arm_rp2040.h: System defines for RP2040.spi_hw_2_rp2040.cpp: Dual-lane (2-bit) parallel SPI driver using PIO + DMA.spi_hw_4_rp2040.cpp: Quad-lane (4-bit) parallel SPI driver using PIO + DMA.spi_hw_8_rp2040.cpp: Octal-lane (8-bit) parallel SPI driver using PIO + DMA.Notes:
clockless_arm_rp2040.h configures wrap targets and delays via pio_gen.h; changes to timing require regenerating the program.FastLED now supports automatic parallel output for clockless LEDs (WS2812, etc.) using the standard FastLED.addLeds() API!
#define FASTLED_RP2040_CLOCKLESS_PIO_AUTO 1
#include <FastLED.h>
CRGB leds1[100], leds2[100], leds3[100], leds4[100];
void setup() {
// Just use standard addLeds() - automatic parallel grouping!
FastLED.addLeds<WS2812, 2, GRB>(leds1, 100); // GPIO 2
FastLED.addLeds<WS2812, 3, GRB>(leds2, 100); // GPIO 3 (auto-grouped with 2)
FastLED.addLeds<WS2812, 4, GRB>(leds3, 100); // GPIO 4 (auto-grouped with 2-3)
FastLED.addLeds<WS2812, 5, GRB>(leds4, 100); // GPIO 5 (auto-grouped with 2-4)
}
void loop() {
FastLED.show(); // All 4 strips output in parallel automatically!
}
The driver automatically:
addLeds() callsExample: Pins 2-5 (consecutive) → Single 4-lane parallel group using 1 PIO SM + 1 DMA channel
CRITICAL: Pins must be consecutive GPIO numbers for parallel output (RP2040 PIO hardware limitation).
See src/platforms/arm/rp/rpcommon/PARALLEL_AUTO.md for complete documentation.
examples/SpecialDrivers/RP/Parallel_IO.ino - Automatic parallel grouping demoThe RP2040/RP2350 platforms support parallel SPI output for controlling multiple LED strips simultaneously using the Programmable I/O (PIO) subsystem combined with DMA transfers.
Unlike traditional hardware SPI controllers that only support single-lane operation, the RP2040/RP2350 implementations use PIO state machines to achieve multi-lane parallel output:
Each active SPI controller allocates:
#include <FastLED.h>
// Configure dual-lane SPI for 2 LED strips
SpiHw2::Config config;
config.bus_num = 0; // Use SPI0 (PIO state machine 0)
config.clock_speed_hz = 4000000; // 4 MHz
config.sck_pin = 2; // Clock pin
config.data_pins[0] = 3; // First strip data pin
config.data_pins[1] = 4; // Second strip data pin
auto controllers = SpiHw2::getAll();
if (!controllers.empty()) {
controllers[0]->begin(config);
// Ready to transmit data
}
PICO_RP2040 and PICO_RP2350 macrosFASTLED_ALLOW_INTERRUPTS: Allow ISRs during show. Default 1.FASTLED_ACCURATE_CLOCK: Enabled when interrupts are allowed to maintain timing math accuracy.FASTLED_USE_PROGMEM: Default 0 (flat memory model).FASTLED_RP2040_CLOCKLESS_PIO_AUTO: Enable automatic parallel grouping for clockless LEDs (WS2812, etc.). Uses standard FastLED.addLeds() API with automatic consecutive pin detection. Default 0 (disabled).FASTLED_RP2040_CLOCKLESS_PIO: Use PIO driver for clockless. Default 1.FASTLED_RP2040_CLOCKLESS_IRQ_SHARED: Share IRQ usage between PIO and other subsystems. Default 1.FASTLED_RP2040_CLOCKLESS_M0_FALLBACK: Fallback to a Cortex‑M0 timing loop if PIO is disabled/unavailable. Default 0.Define these before including FastLED.h in your sketch.