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

Provide functions to access watchdog scratch registers #685

Merged
merged 2 commits into from
Sep 10, 2023

Conversation

jannic
Copy link
Member

@jannic jannic commented Sep 5, 2023

No description provided.

@@ -93,6 +97,37 @@ impl Watchdog {
self.watchdog.ctrl.write(|w| w.enable().bit(bit))
}

/// Read a scratch register
pub fn read_scratch(&self, idx: u8) -> Result<u32, NoSuchRegister> {
Copy link
Member Author

@jannic jannic Sep 6, 2023

Choose a reason for hiding this comment

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

Request for feedback: Is the use of idx: u8 with the possibility of a NoSuchRegister error a good choice?
Or should the parameter be an enum listing the existing registers, so an error becomes impossible?

Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to expose them as a sized array? (May require a change in the PAC)

Copy link
Member Author

Choose a reason for hiding this comment

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

I considered that, but without a good use case I didn't want to do the PAC modification.
However I tried the enum variant and I think it's better than the idx: u8 one. I'll push the update as soon as I find the time to actually test it.

@jannic jannic merged commit 78f71ae into rp-rs:main Sep 10, 2023
8 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.

None yet

3 participants