-
Notifications
You must be signed in to change notification settings - Fork 68
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
Clocks can no longer be specified in MHz #136
Comments
I agree with your conclusion that taking a I'd definitely merge a PR making the change from |
While #137 was merged and resolves the issue with
Would be nice if they could be resolved as well. This is more informative thatn a request ;) So don't feel pushed. |
I don't have the time to spare right now, but I'd be happy to review/merge any pull requests that address is, so feel free to look into it! |
Before the migration to
embedded-time
it was possible to writeHSEClock::new(216.mhz(), HSEClockMode::Oscillator)
. This isn't possible anymore, becauseInto<Hertz>
isn't implemented forembedded-time
sMegahertz
.The way the conversion is implemented in
embedded-time
makes more sense, because it prevents possible integer overflows. But the use ofInto<Hertz>
in e.g.HSEClock::new
suggests that values with any frequency unit could be used. I didn't expect this behavior while porting to the new version and had to look into why this didn't work anymore.Would it be better to change the API to take
Hertz
values instead ofimpl Into<Hertz>
values? This way the types should make the user aware that they need to convert the value into hertz first if they want to use another unit (e.g.216.MHz().try_into().unwrap()
).Another option would be to change the type bounds from
Into<Hertz>
toTryInto<Hertz>
, but this would mean that all functions that take a frequency would need to return aResult
. I don't think this would be a good idea.The text was updated successfully, but these errors were encountered: