-
Notifications
You must be signed in to change notification settings - Fork 1
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
MLC - CAN IO implementation #63
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done, nearly there just a few things here and there to be fixed/added
Err(embassy_stm32::can::enums::TryReadError::BusError(e)) => Err(match e { | ||
embassy_stm32::can::enums::BusError::Stuff => CanError::Stuff, | ||
embassy_stm32::can::enums::BusError::Form => CanError::Form, | ||
embassy_stm32::can::enums::BusError::Acknowledge => CanError::Acknowledge, | ||
embassy_stm32::can::enums::BusError::BitRecessive => CanError::BitRecessive, | ||
embassy_stm32::can::enums::BusError::BitDominant => CanError::BitDominant, | ||
embassy_stm32::can::enums::BusError::Crc => CanError::Crc, | ||
embassy_stm32::can::enums::BusError::Software => CanError::Software, | ||
embassy_stm32::can::enums::BusError::BusOff => CanError::BusOff, | ||
embassy_stm32::can::enums::BusError::BusPassive => CanError::BusPassive, | ||
embassy_stm32::can::enums::BusError::BusWarning => CanError::BusWarning, | ||
}), | ||
Err(embassy_stm32::can::enums::TryReadError::Empty) => Err(CanError::Empty), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one thing you could do here, is impl From<BusError> for CanError
where CanError
is defined, then you can just return e.into()
here. that might be overkill tho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i tried doing that - however i needed to add embassy-stm32
to the Cargo.toml file, which can't be done as it would make it board specific
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok, does that also happen if you don't enable a board in the features?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if i fully understood the question, but basically the moment you write impl From<CanError> for embassy_stm32::can::BusError
for example, I get failed to resolve: use of undeclared crate or module embassy_stm32 use of undeclared crate or module embassy_stm32
so i would have to import it in that case, but not sure if that's what you were asking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can clarify a couple of things here:
- Reason why we can't use
From
here is because the embassy typeBusError
and our typeHypedCanError
are both defined in other crates and rust doesn't let you do that. - The options then become adding the
From
stuff to the crate whereHypedCanError
is defined, which would require importingembassy_stm32
(but we can't importembassy_stm32
without enabling exactly one board feature), or moving theHypedCanError
enum to the code inhyped_can_derive
which I don't think is possible because that would create separate versions for each board's IO where the macro is used
…ches when converting from embassy's frame to HypedCanFrame and vice versa
No description provided.