Cleanup
This commit is contained in:
@ -1,4 +1,8 @@
|
||||
//! Shared bus implementations
|
||||
use core::fmt::Debug;
|
||||
|
||||
use embedded_hal_1::{i2c, spi};
|
||||
|
||||
#[cfg(feature = "nightly")]
|
||||
pub mod asynch;
|
||||
|
||||
@ -9,8 +13,32 @@ pub enum I2cBusDeviceError<BUS> {
|
||||
I2c(BUS),
|
||||
}
|
||||
|
||||
impl<BUS> i2c::Error for I2cBusDeviceError<BUS>
|
||||
where
|
||||
BUS: i2c::Error + Debug,
|
||||
{
|
||||
fn kind(&self) -> i2c::ErrorKind {
|
||||
match self {
|
||||
Self::I2c(e) => e.kind(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum SpiBusDeviceError<BUS, CS> {
|
||||
Spi(BUS),
|
||||
Cs(CS),
|
||||
}
|
||||
|
||||
impl<BUS, CS> spi::Error for SpiBusDeviceError<BUS, CS>
|
||||
where
|
||||
BUS: spi::Error + Debug,
|
||||
CS: Debug,
|
||||
{
|
||||
fn kind(&self) -> spi::ErrorKind {
|
||||
match self {
|
||||
Self::Spi(e) => e.kind(),
|
||||
Self::Cs(_) => spi::ErrorKind::Other,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user