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

Remove Started/Stopped type state from Rtc #252

Merged
merged 2 commits into from
Oct 26, 2020

Conversation

timokroeger
Copy link
Contributor

The type states make it difficult to enable and disable the RTC on demand with RTIC.
Started/Stopped types were only used to restrict the usage of set_prescaler() to a disabled RTC.
Pass the prescaler as argument to the costructor instead.

This made it really difficult to enable and disable the RTC on demand with RTIC.
Pass the prescaler as argument to the costructor.
Copy link
Contributor

@jonas-schievink jonas-schievink left a comment

Choose a reason for hiding this comment

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

Thanks, this looks reasonable!

This does mean that you can't change the prescaler after creating the RTC though. I don't think that's a common thing to do, so it should be fine, but we might want to add a fn free(self) -> RTC to enable that use case again.

@jonas-schievink
Copy link
Contributor

Oh, it already has a release function that does exactly that.

@jonas-schievink jonas-schievink merged commit 63cba63 into nrf-rs:master Oct 26, 2020
@timokroeger timokroeger deleted the no-rtc-typestate branch October 27, 2020 10:52
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.

2 participants