Skip to content

pico2w: add bsp module for pin assignments and peripheral groups - #108

Merged
vbonduro merged 1 commit into
pico2w-cyw43-firmware-blobsfrom
pico2w-bsp
Oct 31, 2026
Merged

vbonduro merged 1 commit into
pico2w-cyw43-firmware-blobsfrom
pico2w-bsp

Conversation

@vbonduro

Copy link
Copy Markdown
Owner

Stacked on the firmware-blobs PR; merge that first, then retarget this to main.

Summary

  • New bsp module (ARM-only). Board::init() sets up the clock profile and HAL, and returns the peripherals grouped per subsystem: SdPeriphs, DisplayPeriphs, ButtonPeriphs, AudioPeriphs, WifiPeriphs. Pin numbers now live only in bsp.rs.
  • Moved out of main.rs: ClockProfile/CLOCK, Irqs/WifiIrqs, WifiPeriphs.
  • Drivers take their group by value, so double-claiming a peripheral is a compile error.
  • HwDisplay::new(&mut DisplayPeriphs) reborrows via Peri::reborrow, so GameDisplay::new_after_splash no longer needs unsafe / steal().
  • InputHandler::new(ButtonPeriphs), init_sd_card(SdPeriphs), new audio::init_i2s(AudioPeriphs, Irqs).
  • GP20 (SD power) is Board.sd_power, separate from SdPeriphs, since boot sequencing toggles it around display init before the card driver exists.

Testing

  • cargo build --release for the firmware succeeds with no new warnings.
  • Not flashed or run on hardware.
  • cargo test -p rustyboy-pico2w --lib --tests on the host fails to compile, but it fails identically on main (verified by stashing this change), so no host tests ran against this change.

🤖 Generated with Claude Code

Board::init() configures the clock profile and takes the HAL peripherals,
returning them grouped per subsystem (SD, display, buttons, audio, WiFi).
Drivers take their group by value, so each peripheral is claimed once and
the compiler enforces it.

- Move ClockProfile, Irqs/WifiIrqs and WifiPeriphs out of main.rs.
- HwDisplay::new borrows DisplayPeriphs via Peri::reborrow, so
  GameDisplay::new_after_splash no longer needs unsafe steal().
- InputHandler::new takes ButtonPeriphs; init_sd_card takes SdPeriphs.
- Add audio::init_i2s for the PIO0 I2S setup previously inline in main.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@vbonduro
vbonduro added this pull request to stack #109 October 31, 2026 10:00
@codecov

codecov Bot commented Oct 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.82%. Comparing base (557714f) to head (fd1e822).

Additional details and impacted files
@@                     Coverage Diff                      @@
##           pico2w-cyw43-firmware-blobs     #108   +/-   ##
============================================================
  Coverage                        92.82%   92.82%           
============================================================
  Files                               83       83           
  Lines                            14155    14155           
============================================================
  Hits                             13139    13139           
  Misses                            1016     1016           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vbonduro
vbonduro merged commit f723f15 into main Oct 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant