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

Leverage embedded-time #185

Closed
Sh3Rm4n opened this issue Dec 18, 2020 · 4 comments
Closed

Leverage embedded-time #185

Sh3Rm4n opened this issue Dec 18, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@Sh3Rm4n
Copy link
Member

Sh3Rm4n commented Dec 18, 2020

We have some extension traits, which define times and frequencies in src/time.rs.

This module is mostly a 1:1 copy, which can be found in almost every stm32f*-hal.
It mostly used internally, but gets also exposed, to configured clocks and timers.

Wouldn't it be nicer to use embedded-time to replace the current time module?

Maybe we can leverage some more features of this crate.

@wbuck
Copy link
Contributor

wbuck commented Jan 10, 2021

So I forked the project, removed the custom time module and replaced it with embedded-time. It was almost a drop-in replacement. I altered the serial constructor to take a Baud type instead of the original Bps.

I only built it for the stm32f303xc but it did build with no issues.
I'm fairly new to Rust so I'm unsure what the expectation is regarding re-exporting a third party crate.
So to minimize changes I added the following to lib.rs

pub use embedded_time as time;

@David-OConnor
Copy link
Contributor

Please make a PR.

@strom-und-spiele
Copy link
Collaborator

@Sh3Rm4n thanks for proposing this. And thanks to @wbuck for giving a nice example on how to "leverage some more features of this crate" in #191.
Reading about its fixed-point arithmetic under the hood made me like this purpose even more 👍

@Sh3Rm4n
Copy link
Member Author

Sh3Rm4n commented Mar 12, 2021

Closed by #192

@Sh3Rm4n Sh3Rm4n closed this as completed Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants