Skip to content
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

Fix PeripheralRef #3017

Merged
merged 1 commit into from
Jan 24, 2025
Merged

Fix PeripheralRef #3017

merged 1 commit into from
Jan 24, 2025

Conversation

bugadani
Copy link
Contributor

This PR applies the soundness fixes from embassy-hal-internal to our copy-pasted implementation, and modifies code where necessary to allow that change.

There are three noteworthy items:

  • I've removed Peripheral: Sealed, as it is just in the way. Preventing the users from implementing the trait (e.g. like we do for Flex) doesn't give us much, I believe.
  • I've removed a few InterruptConfigurable implementations from timers. I don't think we should implement that trait for peripheral singletons, we should keep it for peripheral drivers only.
  • I've changed all methods on peripheral singletons to use &self. These are supposed to be singletons, and they shouldn't really have user-facing APIs anyway. &mut self wasn't really preventing anything anyway (e.g. we can race on GPIO configuration), but it was in the way of this PR.

Closes #2661 as we now have an identical implementation to embassy, except for a few custom additions where we abuse the pattern a bit.

@bugadani bugadani added the skip-changelog No changelog modification needed label Jan 22, 2025
@bugadani bugadani marked this pull request as ready for review January 23, 2025 14:49
Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Copy link
Member

@SergioGasquez SergioGasquez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks

@bugadani bugadani enabled auto-merge January 24, 2025 08:57
@bugadani bugadani added this pull request to the merge queue Jan 24, 2025
Merged via the queue into esp-rs:main with commit 24f8458 Jan 24, 2025
28 checks passed
@bugadani bugadani deleted the deref branch January 24, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog No changelog modification needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evaluate the Peripheral and Peripheral ref module
3 participants