Skip to content

fix(nrf52): build FASTLED_FORCE_SOFTWARE_SPI through the generic bit-bang SPIOutput (#5120) - #5169

Merged
zackees merged 1 commit into
masterfrom
fix/nrf52-force-software-spi-5120
Nov 8, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/nrf52-force-software-spi-5120

Conversation

@zackees

@zackees zackees commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Closes #5120. Part of #5024.

Part 1: P1 short-form pins (already fixed)

_FL_DEFPIN in fastpin_arm_nrf52_variants.h now takes the port number from BOARD_PORT and passes BOARD_PIN & 31. This landed in #5149, so _FL_DEFPIN(2, 10, 1) gives NRF_GPIO_PIN_MAP(1, 10). This PR does not change it.

Part 2: FASTLED_FORCE_SOFTWARE_SPI did not compile

The define compiles out NRF52HardwareSPIOutput, but spi_device_proxy.h and spi_output_template.h still named it.

  • spi_device_proxy.h: compiled only when software SPI is not forced.
  • spi_output_template.h: under the define, it uses the generic bit-bang SPIOutput (platforms/shared/spi_bitbang/spi_output_template.h), the same route nRF51 uses.

Evidence

  • RED: on master, bash compile adafruit_feather_nrf52840_sense --examples Apa102 --defines FASTLED_FORCE_SOFTWARE_SPI fails with spi_device_proxy.h:60:20: error: 'NRF52HardwareSPIOutput' was not declared in this scope.
  • GREEN: the same command builds (52464 B flash). The ELF has 2 SoftwareSPIOutput symbols and no NRF52HardwareSPIOutput or SPIDeviceProxy.
  • Normal mode unchanged: Apa102 and Blink build. Apa102 still links the hardware path (9 NRF52HardwareSPIOutput/SPIDeviceProxy symbols, no software SPI symbols).
  • Lint: bash lint exits 0.

Limits

  • Not run on hardware. The bit-bang output is the shared generic one, and its timing on nRF52 is not measured here.
  • No hosted job builds nRF52 with this define, so there is no regression test for the compile.

Summary by CodeRabbit

  • Bug Fixes
    • Forced software SPI now uses the generic bit-bang output on NRF52 platforms instead of the hardware SPI proxy.

@zackees
zackees enabled auto-merge November 8, 2026 18:54
@github-actions github-actions Bot added the sanitized Title, body and conversation screened; review text requires separate screening. label Nov 8, 2026
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The NRF52 SPI output now uses the shared bit-bang implementation when FASTLED_FORCE_SOFTWARE_SPI is defined. The NRF52 hardware proxy is excluded under that condition. Without the define, the hardware-backed SPI output remains in use.

Changes: NRF52 SPI selection

Layer / File(s) Summary
Conditional SPI dispatch
src/platforms/arm/nrf52/spi_output_template.h, src/platforms/arm/nrf52/spi_device_proxy.h
When FASTLED_FORCE_SOFTWARE_SPI is defined, the output template includes the shared bit-bang implementation and the NRF52 proxy is excluded. Otherwise, fl::SPIOutput continues to use the hardware-backed output.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Low · up to 7ad82

The forced-software path has a bounded configuration risk: conflicting settings across source files can corrupt controller state. Keep the setting consistent throughout the application. With that constraint understood, the change is mergeable; automated forced-mode coverage would improve confidence.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 8, 2026
@github-actions github-actions Bot removed the sanitized Title, body and conversation screened; review text requires separate screening. label Nov 8, 2026
@zackees
zackees added this pull request to the merge queue Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Memory usage (this PR vs. its merge base)

Change in examples/Blink per target. The left number is this PR's image flash / attributed RAM in bytes; the colored delta is the change from the merge base (red ↑ is larger, green ↓ is smaller, 0 is unchanged).

Target FLASH [bytes] RAM [bytes]
nrf52840_dk 68,048 (0) 19,468 (0)

Merged via the queue into master with commit b905bf2 Nov 8, 2026
131 of 132 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Nov 8, 2026
@github-actions github-actions Bot added sanitized Title, body and conversation screened; review text requires separate screening. and removed security: unscreened-content labels Nov 8, 2026
@zackees
zackees deleted the fix/nrf52-force-software-spi-5120 branch November 17, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sanitized Title, body and conversation screened; review text requires separate screening.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(nrf52): P1 pins declared with local numbers get port 0 in nrf_pin(); FASTLED_FORCE_SOFTWARE_SPI fails to compile

1 participant