-
Notifications
You must be signed in to change notification settings - Fork 0
Move to using embassy tasks instead of a single async join in main #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the firmware to use Embassy's task-based architecture instead of manually joining async functions in main. The changes move from a monolithic main function using join4 to individual Embassy tasks that are spawned independently.
Key changes:
- Replace peripheral structs with "Claims" pattern for better ownership management
- Add Embassy tasks for USB, IMU, ACM echo, and CRC test functionality
- Introduce static buffer management using
static_cellfor USB operations - Add conditional compilation features for debug applications
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main.rs | Refactored from join-based concurrency to Embassy task spawning pattern |
| src/peripherals/usb_system.rs | Added USB task, static buffers, and renamed struct to UsbClaims |
| src/peripherals/acm.rs | Restructured ACM state management with static allocation |
| src/peripherals/spi.rs | Renamed SpiPeripherals to SpiClaims for consistency |
| src/drivers/imu/driver.rs | Added IMU task wrapper with error recovery |
| src/apps/*.rs | Converted applications to Embassy tasks with renamed structs |
| Cargo.toml | Updated Embassy timer configuration and added feature flags |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Moves to using Tasks as embassy intends.