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

Add trait bounds for Error enums #23

Open
HusseinAbdelhamid opened this issue Sep 11, 2024 · 0 comments
Open

Add trait bounds for Error enums #23

HusseinAbdelhamid opened this issue Sep 11, 2024 · 0 comments
Assignees

Comments

@HusseinAbdelhamid
Copy link
Contributor

The enum errors here should have Transfer and OutputPin as trait bounds for the generic arguments

rt-mcp2517/src/can.rs

Lines 27 to 63 in 206ce3d

#[derive(Debug, PartialEq)]
pub enum BusError<B, CS> {
/// Failed setting state of CS pin
CSError(CS),
/// SPI transfer failed
TransferError(B),
}
/// Configuration errors
#[derive(Debug, PartialEq)]
pub enum ConfigError<B, CS> {
/// Low level bus communication error
BusError(BusError<B, CS>),
/// Internal clock error
ClockError,
/// No configuration mode within timeout of 2 ms
ConfigurationModeTimeout,
/// Device did not enter given request mode within timeout of 2 ms
RequestModeTimeout,
}
/// Possible errors transmitting CAN message
#[derive(Debug, PartialEq)]
pub enum Error<B, CS> {
/// Configuration error
ConfigErr(ConfigError<B, CS>),
/// SPI bus transfer error
BusErr(BusError<B, CS>),
/// Invalid payload bytes length error
InvalidPayloadLength(usize),
/// Invalid Ram Address region error
InvalidRamAddress(u16),
}

@HusseinAbdelhamid HusseinAbdelhamid self-assigned this Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant