Skip to content

fix(esp32): make FastPin toggle per-bit atomic - #3930

Merged
zackees merged 1 commit into
masterfrom
fix/1040-esp32-atomic-toggle
Aug 20, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/1040-esp32-atomic-toggle

Conversation

@zackees

@zackees zackees commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

Summary

  • replace ESP32 FastPin whole-register XOR with per-bit W1TS/W1TC writes
  • preserve software-SPI clock toggling without overwriting concurrent GPIO changes
  • add a regression contract for the atomic toggle implementation

Validation

  • PYTEST_ADDOPTS='-k esp32_fastpin_atomic_toggle' bash test --py
  • bash compile esp32dev --examples Apa102 --defines FASTLED_FORCE_SOFTWARE_SPI
  • bash lint
  • clud-review: clean

Closes #1040

Summary by CodeRabbit

  • Bug Fixes

    • Improved ESP32 pin toggling to use atomic set/clear operations.
    • Prevented unintended whole-port updates during pin state changes.
  • Tests

    • Added regression coverage to verify safe, atomic pin toggling behavior.

@zackees
zackees merged commit adb6e8c into master Aug 20, 2026
9 of 17 checks passed
@zackees
zackees deleted the fix/1040-esp32-atomic-toggle branch August 20, 2026 14:24
@coderabbitai

coderabbitai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 74f04de0-ee9b-4942-8f4c-cf77de31cb6e

📥 Commits

Reviewing files that changed from the base of the PR and between 5e2d5a7 and 0eda214.

📒 Files selected for processing (2)
  • ci/tests/test_esp32_fastpin_atomic_toggle.py
  • src/platforms/esp/32/core/fastpin_esp32.h

📝 Walkthrough

Walkthrough

Changes

ESP32 atomic toggle

Layer / File(s) Summary
Atomic toggle behavior and regression coverage
src/platforms/esp/32/core/fastpin_esp32.h, ci/tests/test_esp32_fastpin_atomic_toggle.py
toggle() uses isset() with atomic lo() and hi() operations instead of a whole-port XOR write. The regression test verifies this implementation pattern.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1040-esp32-atomic-toggle

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

Comment @coderabbitai help to get the list of available commands.

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Aug 20, 2026
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ESP32 pin mask template breaking some SPI devices

1 participant