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

Create newtypes for all PAC peripherals, mark unstable peripheral singletons #2957

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

bugadani
Copy link
Contributor

@bugadani bugadani commented Jan 15, 2025

Trying to break up #2956 into more manageable pieces :)

This change wraps all PAC types we use as peripherals in a newtype. This is a step toward removing the Deref implementation, and we'll no longer have to guess which of the peripheral::STUFF is a PAC peripheral, and which one is our newtype.

The PR also lets us hide some of the useless peripheral singletons - so far, only behind the unstable flag, but we should go one step further and introduce a private category for things like FE, or NRX.

@bugadani bugadani added the skip-changelog No changelog modification needed label Jan 15, 2025
@bugadani bugadani marked this pull request as ready for review January 15, 2025 09:36
@bugadani bugadani force-pushed the newtype branch 2 times, most recently from 75d3958 to 4a9ea47 Compare January 16, 2025 09:29
@bjoernQ
Copy link
Contributor

bjoernQ commented Jan 17, 2025

Maybe we could improve the docs a bit more

Stability here looks a bit weird

image

I see it's unstable - but I understood it the first time, already
image

@bugadani
Copy link
Contributor Author

This is a consequence of using instability::unstable together with a public reexport - I don't plan on keeping the public reexports, so I hope this issue will go away.

@bugadani
Copy link
Contributor Author

And indeed in the next PR the output looks like this:

image

Copy link
Member

@MabezDev MabezDev 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!

@@ -274,6 +274,7 @@ pub mod dma {
}

/// A DMA capable AES instance.
#[instability::unstable]
Copy link
Member

Choose a reason for hiding this comment

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

Is marking the the top level module unstable not enough? Just for future me's understanding :)

Copy link
Contributor Author

@bugadani bugadani Jan 17, 2025

Choose a reason for hiding this comment

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

Something in the traits ends up not compiling because of some public reexport somewhere, it's a bit of a mess that I'm trying to untangle. (Specifically, without these we have Private type in public interface errors)

@MabezDev MabezDev added this pull request to the merge queue Jan 17, 2025
Merged via the queue into esp-rs:main with commit 40d552f Jan 17, 2025
28 checks passed
@bugadani bugadani deleted the newtype branch January 17, 2025 15:39
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.

3 participants