-
Notifications
You must be signed in to change notification settings - Fork 213
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
Shared type definitions (e.g. MHz, bps...) #59
Comments
For most physical types there are other crates, so as the
docs.rs/measurements crate that I manage.
I think frequency, bitrate and time should be in embedded-hal though as
most APIs will need them.
|
Not to derail the discussion after the first comment, but would it be possible to transition some of the time handling to use The advantage would be more interoperability with the rest of the ecosystem, and also many helpful functions to ensure no overflow etc. |
@thejpster Great stuff! I was actually looking for that, partially also for #32. |
Partially related discussion: #24 |
It would be very likely that it won't be optimized away unless the I was just thinking about whether a EDIT: Thinking about it a little more. As long as the |
True, but then again if you're counting clock cycles and just use a u32 counter, your countdowns aren't going to be very long. I think it'd be better if we just implemented the standard and if it really becomes a problem at some point check out how to address it. |
There are cases when long times don't make sense. I'd be against calling it |
To name a few alternatives to the |
Yeah, it's a somewhat odd choice to use f64 for a number of reasons, but especially without FPU it does hurt. I was actually going to look into what was required to change that, potentially using https://github.com/japaric/fpa . |
I am trying to implement a new device driver that should ideally only depend on For it to work, I need to wait up to a certain amount of microseconds for an input pin to change, check whether it has changed and wehther it is now in the desired state. This can be implemented for example using the MonoTimer of stm32f103xx-hal. Once the current 'time' / Instant is read a simple while loop could check whether the input changed, as long as the timeout has not reached yet (something like |
Hey, I wanted to revive this stalled issue. I’m writing a device driver that would really like a Has anything changed re: |
There is also https://crates.io/crates/bitrate |
@kellerkindt or @fionawhim did either of you ever come up with a solution? I'm also writing a driver and found that I have to depend on the |
Have you had a look at |
@eldruin OK, I submitted a PR for integrating embedded-time for the stm32f3xx-hal device crate. It was a pretty smooth integration for the most part except for the I want to see if there are some other devices crates that would be willing to accept a PR for this. |
I would love to see the same happen for https://github.com/stm32-rs/stm32l4xx-hal |
59: Note the change to the MSRV in the changelog r=ryankurte a=eldruin After merging rust-embedded#55 Co-authored-by: Diego Barrios Romero <eldruin@gmail.com>
I want to create this issue to discuss a shared place to store necessary hardware type definitions. These could be stored in the
embedded-hal
crate, but could also easily be in their own crate. I just think we should discuss a shared place to store these outside the processor specific crates.There are many type definitions that can be useful when working with low-level sensors. At the moment there are no shared place that such type can or are stored. A couple of very handy types are currently in
stm32f30x_hal::time
(and also replicated instm32f103xx_hal
) for dealing with time.An easy first step is to create a
type
module forembedded-hal
and extract the types defined instm32f30x_hal::time
and potentially add more later if necessary.I'm not sure if there are other definitions apart from time that should be abstracted out. I don't think this issue should be about physical types (e.g.
cm
orm/s
), but should focus on shared types that are necessary for interacting with hardware.The text was updated successfully, but these errors were encountered: