Implement embedded-hal 1.0 traits#431
Merged
qwandor merged 10 commits intonrf-rs:masterfrom Mar 6, 2024
qwandor:embedded-hal
Merged
Implement embedded-hal 1.0 traits#431qwandor merged 10 commits intonrf-rs:masterfrom qwandor:embedded-hal
qwandor merged 10 commits intonrf-rs:masterfrom
qwandor:embedded-hal
Conversation
This was referenced Jan 18, 2024
Member
Author
|
Hi, could I get a review of this soon? It's blocking me from updating some other things to embedded-hal 1.0. |
Contributor
mattheww
reviewed
Feb 5, 2024
| const MAX_RVR: u32 = 0x00FF_FFFF; | ||
|
|
||
| let mut total_rvr = us * (HFCLK_FREQ / 1_000_000); | ||
| let mut total_rvr = ns * (HFCLK_FREQ / 1_000_000_000); |
There was a problem hiding this comment.
HFCLK_FREQ is 64_000_000, so isn't this always going to come out as zero?
Member
Author
There was a problem hiding this comment.
Whoops, good point. Fixed.
There was a problem hiding this comment.
That fix looks correct to me, and I can verify that the SYST-based DelayNs implementation works given the fix, when it didn't before.
But I'm not a maintainer of this repository, and I haven't read through this whole PR.
Member
|
I'll try these out with some of my stuff over the weekend and let you know if I see anything. I have only reviewed a couple of these so far — will get to the rest shortly. |
Also removed unused error variants.
Use u64 for intermediate value to avoid overflow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now that
embedded-hal1.0 is released, this PR adds implementations of most of its relevant traits. For now I've added them alongside the existingembedded-hal0.2 trait implementations, so that users can still use drivers based on the old traits. We can remove the old traits in a later release.I haven't implemented the
embedded-hal-nbandembedded-hal-asynctraits yet, and the I2C traits are also missing as the design has changed and implementing it correctly is non-trivial.