Run rustfmt.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
use core::future::Future;
|
||||
use embedded_hal_02::blocking;
|
||||
use embedded_hal_02::serial;
|
||||
|
||||
use embedded_hal_02::{blocking, serial};
|
||||
|
||||
/// BlockingAsync is a wrapper that implements async traits using blocking peripherals. This allows
|
||||
/// driver writers to depend on the async traits while still supporting embedded-hal peripheral implementations.
|
||||
@ -25,9 +25,7 @@ impl<T> BlockingAsync<T> {
|
||||
impl<T, E> embedded_hal_1::i2c::ErrorType for BlockingAsync<T>
|
||||
where
|
||||
E: embedded_hal_1::i2c::Error + 'static,
|
||||
T: blocking::i2c::WriteRead<Error = E>
|
||||
+ blocking::i2c::Read<Error = E>
|
||||
+ blocking::i2c::Write<Error = E>,
|
||||
T: blocking::i2c::WriteRead<Error = E> + blocking::i2c::Read<Error = E> + blocking::i2c::Write<Error = E>,
|
||||
{
|
||||
type Error = E;
|
||||
}
|
||||
@ -35,9 +33,7 @@ where
|
||||
impl<T, E> embedded_hal_async::i2c::I2c for BlockingAsync<T>
|
||||
where
|
||||
E: embedded_hal_1::i2c::Error + 'static,
|
||||
T: blocking::i2c::WriteRead<Error = E>
|
||||
+ blocking::i2c::Read<Error = E>
|
||||
+ blocking::i2c::Write<Error = E>,
|
||||
T: blocking::i2c::WriteRead<Error = E> + blocking::i2c::Read<Error = E> + blocking::i2c::Write<Error = E>,
|
||||
{
|
||||
type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
|
||||
type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
|
||||
@ -51,12 +47,7 @@ where
|
||||
async move { self.wrapped.write(address, bytes) }
|
||||
}
|
||||
|
||||
fn write_read<'a>(
|
||||
&'a mut self,
|
||||
address: u8,
|
||||
bytes: &'a [u8],
|
||||
buffer: &'a mut [u8],
|
||||
) -> Self::WriteReadFuture<'a> {
|
||||
fn write_read<'a>(&'a mut self, address: u8, bytes: &'a [u8], buffer: &'a mut [u8]) -> Self::WriteReadFuture<'a> {
|
||||
async move { self.wrapped.write_read(address, bytes, buffer) }
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,9 @@
|
||||
//! let i2c_dev2 = I2cBusDevice::new(i2c_bus);
|
||||
//! let mpu = Mpu6050::new(i2c_dev2);
|
||||
//! ```
|
||||
use core::{fmt::Debug, future::Future};
|
||||
use core::fmt::Debug;
|
||||
use core::future::Future;
|
||||
|
||||
use embassy::blocking_mutex::raw::RawMutex;
|
||||
use embassy::mutex::Mutex;
|
||||
use embedded_hal_async::i2c;
|
||||
@ -70,9 +72,7 @@ where
|
||||
fn read<'a>(&'a mut self, address: u8, buffer: &'a mut [u8]) -> Self::ReadFuture<'a> {
|
||||
async move {
|
||||
let mut bus = self.bus.lock().await;
|
||||
bus.read(address, buffer)
|
||||
.await
|
||||
.map_err(I2cBusDeviceError::I2c)?;
|
||||
bus.read(address, buffer).await.map_err(I2cBusDeviceError::I2c)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@ -82,9 +82,7 @@ where
|
||||
fn write<'a>(&'a mut self, address: u8, bytes: &'a [u8]) -> Self::WriteFuture<'a> {
|
||||
async move {
|
||||
let mut bus = self.bus.lock().await;
|
||||
bus.write(address, bytes)
|
||||
.await
|
||||
.map_err(I2cBusDeviceError::I2c)?;
|
||||
bus.write(address, bytes).await.map_err(I2cBusDeviceError::I2c)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -25,10 +25,11 @@
|
||||
//! 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, future::Future};
|
||||
use core::fmt::Debug;
|
||||
use core::future::Future;
|
||||
|
||||
use embassy::blocking_mutex::raw::RawMutex;
|
||||
use embassy::mutex::Mutex;
|
||||
|
||||
use embedded_hal_1::digital::blocking::OutputPin;
|
||||
use embedded_hal_1::spi::ErrorType;
|
||||
use embedded_hal_async::spi;
|
||||
|
Reference in New Issue
Block a user