Cleanup
This commit is contained in:
parent
ce7bc32755
commit
c9ceec8797
@ -22,7 +22,6 @@
|
||||
//! let i2c_dev2 = I2cBusDevice::new(i2c_bus);
|
||||
//! let mpu = Mpu6050::new(i2c_dev2);
|
||||
//! ```
|
||||
use core::fmt::Debug;
|
||||
use core::future::Future;
|
||||
|
||||
use embassy::blocking_mutex::raw::RawMutex;
|
||||
@ -42,17 +41,6 @@ impl<'a, M: RawMutex, BUS> I2cBusDevice<'a, M, 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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M: RawMutex, BUS> i2c::ErrorType for I2cBusDevice<'a, M, BUS>
|
||||
where
|
||||
BUS: i2c::ErrorType,
|
||||
|
@ -25,7 +25,6 @@
|
||||
//! let spi_dev2 = SpiBusDevice::new(spi_bus, cs_pin2);
|
||||
//! let display2 = ST7735::new(spi_dev2, dc2, rst2, Default::default(), 160, 128);
|
||||
//! ```
|
||||
use core::fmt::Debug;
|
||||
use core::future::Future;
|
||||
|
||||
use embassy::blocking_mutex::raw::RawMutex;
|
||||
@ -56,19 +55,6 @@ where
|
||||
type Error = SpiBusDeviceError<BUS::Error, CS::Error>;
|
||||
}
|
||||
|
||||
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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<M, BUS, CS> spi::SpiDevice for SpiBusDevice<'_, M, BUS, CS>
|
||||
where
|
||||
M: RawMutex + 'static,
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user