Implement partial embedded_can 0.4 compatibility (id conversions, transmit, receive)#56
Draft
projectgus wants to merge 3 commits intostm32-rs:masterfrom
Draft
Implement partial embedded_can 0.4 compatibility (id conversions, transmit, receive)#56projectgus wants to merge 3 commits intostm32-rs:masterfrom
projectgus wants to merge 3 commits intostm32-rs:masterfrom
Conversation
… types. Expand CI to build and test with and without the flag set.
- Implement Frame.into<TxFrameHeader> - Add transmit_frame() & transmit_preserve_frame() for transmitting frames.
Author
|
Marking as a draft because I haven't tested the receive functions yet. |
7aaf794 to
594b742
Compare
…::Frame. Classic CAN only, as no CAN-FD support in embedded_can yet.
594b742 to
d9632d6
Compare
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.
Relevant to #44. Was working with another third party crate that used embedded_can types and Id conversions in particular were a pain, so decided to jump in and try to add some support here.
In this PR:
FromandIntoembedded_can id types for fdcan id types. My initial approach was to actually type aliasembedded::can::{Id, StandardId, ExtendedId}to their fdcan equivalents if the feature flag was enabled (branch here). This works as the types are drop-in replacements for each other, but feels a little risky and I couldn't make the docs generate cleanly. In my project, swapping to this version meant adding someinto()s but didn't add any code size as the conversions are trivial and optimise away.transmit_frame()andtransmit_preserve_frame()functions which behave the same astransmit_frame()andtransmit_preserve()but accept anembedded_can::Frame.receive_frame(),receive0_frame()andreceive1_frame()functions which behave the same asreceive()but construct a newembedded_can::Frame-implementing type.Not in this PR:
embedded_candoesn't yet support it. See CAN FD support rust-embedded/embedded-hal#578.embedded_can::Error.