Merge branch 'master' of https://github.com/embassy-rs/embassy into embassy-stm32/uart-flowcontrol

This commit is contained in:
Mathias 2022-09-29 12:58:38 +02:00
commit 38faae26e5
29 changed files with 94 additions and 99 deletions

View File

@ -18,8 +18,8 @@ nightly = ["embedded-hal-async", "embedded-storage-async"]
[dependencies] [dependencies]
embassy-sync = { version = "0.1.0", path = "../embassy-sync" } embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true } embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true }
embedded-storage = "0.3.0" embedded-storage = "0.3.0"
embedded-storage-async = { version = "0.3.0", optional = true } embedded-storage-async = { version = "0.3.0", optional = true }
nb = "1.0.0" nb = "1.0.0"

View File

@ -29,7 +29,7 @@ use core::future::Future;
use embassy_sync::blocking_mutex::raw::RawMutex; use embassy_sync::blocking_mutex::raw::RawMutex;
use embassy_sync::mutex::Mutex; use embassy_sync::mutex::Mutex;
use embedded_hal_1::digital::blocking::OutputPin; use embedded_hal_1::digital::OutputPin;
use embedded_hal_1::spi::ErrorType; use embedded_hal_1::spi::ErrorType;
use embedded_hal_async::spi; use embedded_hal_async::spi;
@ -57,7 +57,7 @@ where
type Error = SpiDeviceError<BUS::Error, CS::Error>; type Error = SpiDeviceError<BUS::Error, CS::Error>;
} }
impl<M, BUS, CS> spi::SpiDevice for SpiDevice<'_, M, BUS, CS> unsafe impl<M, BUS, CS> spi::SpiDevice for SpiDevice<'_, M, BUS, CS>
where where
M: RawMutex + 'static, M: RawMutex + 'static,
BUS: spi::SpiBusFlush + 'static, BUS: spi::SpiBusFlush + 'static,
@ -122,7 +122,7 @@ where
type Error = SpiDeviceError<BUS::Error, CS::Error>; type Error = SpiDeviceError<BUS::Error, CS::Error>;
} }
impl<M, BUS, CS> spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS> unsafe impl<M, BUS, CS> spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS>
where where
M: RawMutex + 'static, M: RawMutex + 'static,
BUS: spi::SpiBusFlush + SetConfig + 'static, BUS: spi::SpiBusFlush + SetConfig + 'static,

View File

@ -20,8 +20,7 @@ use core::cell::RefCell;
use embassy_sync::blocking_mutex::raw::RawMutex; use embassy_sync::blocking_mutex::raw::RawMutex;
use embassy_sync::blocking_mutex::Mutex; use embassy_sync::blocking_mutex::Mutex;
use embedded_hal_1::i2c::blocking::{I2c, Operation}; use embedded_hal_1::i2c::{ErrorType, I2c, Operation};
use embedded_hal_1::i2c::ErrorType;
use crate::shared_bus::I2cDeviceError; use crate::shared_bus::I2cDeviceError;
use crate::SetConfig; use crate::SetConfig;

View File

@ -22,9 +22,9 @@ use core::cell::RefCell;
use embassy_sync::blocking_mutex::raw::RawMutex; use embassy_sync::blocking_mutex::raw::RawMutex;
use embassy_sync::blocking_mutex::Mutex; use embassy_sync::blocking_mutex::Mutex;
use embedded_hal_1::digital::blocking::OutputPin; use embedded_hal_1::digital::OutputPin;
use embedded_hal_1::spi; use embedded_hal_1::spi;
use embedded_hal_1::spi::blocking::SpiBusFlush; use embedded_hal_1::spi::SpiBusFlush;
use crate::shared_bus::SpiDeviceError; use crate::shared_bus::SpiDeviceError;
use crate::SetConfig; use crate::SetConfig;
@ -50,7 +50,7 @@ where
type Error = SpiDeviceError<BUS::Error, CS::Error>; type Error = SpiDeviceError<BUS::Error, CS::Error>;
} }
impl<BUS, M, CS> embedded_hal_1::spi::blocking::SpiDevice for SpiDevice<'_, M, BUS, CS> impl<BUS, M, CS> embedded_hal_1::spi::SpiDevice for SpiDevice<'_, M, BUS, CS>
where where
M: RawMutex, M: RawMutex,
BUS: SpiBusFlush, BUS: SpiBusFlush,
@ -146,7 +146,7 @@ where
type Error = SpiDeviceError<BUS::Error, CS::Error>; type Error = SpiDeviceError<BUS::Error, CS::Error>;
} }
impl<BUS, M, CS> embedded_hal_1::spi::blocking::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS> impl<BUS, M, CS> embedded_hal_1::spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS>
where where
M: RawMutex, M: RawMutex,
BUS: SpiBusFlush + SetConfig, BUS: SpiBusFlush + SetConfig,

View File

@ -28,8 +28,8 @@ log = { version = "0.4.14", optional = true }
embassy-time = { version = "0.1.0", path = "../embassy-time" } embassy-time = { version = "0.1.0", path = "../embassy-time" }
embassy-sync = { version = "0.1.0", path = "../embassy-sync" } embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true } embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
embedded-hal-async = { version = "0.1.0-alpha.1" } embedded-hal-async = { version = "=0.1.0-alpha.2" }
embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common", default-features = false } embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common", default-features = false }
futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] } futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] }
embedded-hal = { version = "0.2", features = ["unproven"] } embedded-hal = { version = "0.2", features = ["unproven"] }

View File

@ -73,8 +73,8 @@ embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" }
embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional=true } embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional=true }
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true} embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true}
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true} embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true}
embedded-io = { version = "0.3.0", features = ["async"], optional = true } embedded-io = { version = "0.3.0", features = ["async"], optional = true }
defmt = { version = "0.3", optional = true } defmt = { version = "0.3", optional = true }

View File

@ -574,7 +574,7 @@ mod eh1 {
type Error = Infallible; type Error = Infallible;
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::InputPin for Input<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> {
fn is_high(&self) -> Result<bool, Self::Error> { fn is_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_high()) Ok(self.is_high())
} }
@ -588,7 +588,7 @@ mod eh1 {
type Error = Infallible; type Error = Infallible;
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for Output<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> {
fn set_high(&mut self) -> Result<(), Self::Error> { fn set_high(&mut self) -> Result<(), Self::Error> {
Ok(self.set_high()) Ok(self.set_high())
} }
@ -598,7 +598,7 @@ mod eh1 {
} }
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for Output<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> {
fn is_set_high(&self) -> Result<bool, Self::Error> { fn is_set_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_set_high()) Ok(self.is_set_high())
} }
@ -615,7 +615,7 @@ mod eh1 {
/// Implement [`InputPin`] for [`Flex`]; /// Implement [`InputPin`] for [`Flex`];
/// ///
/// If the pin is not in input mode the result is unspecified. /// If the pin is not in input mode the result is unspecified.
impl<'d, T: Pin> embedded_hal_1::digital::blocking::InputPin for Flex<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> {
fn is_high(&self) -> Result<bool, Self::Error> { fn is_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_high()) Ok(self.is_high())
} }
@ -625,7 +625,7 @@ mod eh1 {
} }
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for Flex<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> {
fn set_high(&mut self) -> Result<(), Self::Error> { fn set_high(&mut self) -> Result<(), Self::Error> {
Ok(self.set_high()) Ok(self.set_high())
} }
@ -635,7 +635,7 @@ mod eh1 {
} }
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for Flex<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> {
fn is_set_high(&self) -> Result<bool, Self::Error> { fn is_set_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_set_high()) Ok(self.is_set_high())
} }

View File

@ -457,7 +457,7 @@ mod eh1 {
type Error = Infallible; type Error = Infallible;
} }
impl<'d, C: Channel, T: GpioPin> embedded_hal_1::digital::blocking::InputPin for InputChannel<'d, C, T> { impl<'d, C: Channel, T: GpioPin> embedded_hal_1::digital::InputPin for InputChannel<'d, C, T> {
fn is_high(&self) -> Result<bool, Self::Error> { fn is_high(&self) -> Result<bool, Self::Error> {
Ok(self.pin.is_high()) Ok(self.pin.is_high())
} }

View File

@ -446,25 +446,25 @@ mod eh1 {
type Error = Error; type Error = Error;
} }
impl<'d, T: Instance> embedded_hal_1::spi::blocking::SpiBusFlush for Spim<'d, T> { impl<'d, T: Instance> embedded_hal_1::spi::SpiBusFlush for Spim<'d, T> {
fn flush(&mut self) -> Result<(), Self::Error> { fn flush(&mut self) -> Result<(), Self::Error> {
Ok(()) Ok(())
} }
} }
impl<'d, T: Instance> embedded_hal_1::spi::blocking::SpiBusRead<u8> for Spim<'d, T> { impl<'d, T: Instance> embedded_hal_1::spi::SpiBusRead<u8> for Spim<'d, T> {
fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> { fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> {
self.blocking_transfer(words, &[]) self.blocking_transfer(words, &[])
} }
} }
impl<'d, T: Instance> embedded_hal_1::spi::blocking::SpiBusWrite<u8> for Spim<'d, T> { impl<'d, T: Instance> embedded_hal_1::spi::SpiBusWrite<u8> for Spim<'d, T> {
fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
self.blocking_write(words) self.blocking_write(words)
} }
} }
impl<'d, T: Instance> embedded_hal_1::spi::blocking::SpiBus<u8> for Spim<'d, T> { impl<'d, T: Instance> embedded_hal_1::spi::SpiBus<u8> for Spim<'d, T> {
fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> { fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> {
self.blocking_transfer(read, write) self.blocking_transfer(read, write)
} }

View File

@ -793,7 +793,7 @@ mod eh1 {
type Error = Error; type Error = Error;
} }
impl<'d, T: Instance> embedded_hal_1::i2c::blocking::I2c for Twim<'d, T> { impl<'d, T: Instance> embedded_hal_1::i2c::I2c for Twim<'d, T> {
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> { fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
self.blocking_read(address, buffer) self.blocking_read(address, buffer)
} }
@ -823,14 +823,14 @@ mod eh1 {
fn transaction<'a>( fn transaction<'a>(
&mut self, &mut self,
_address: u8, _address: u8,
_operations: &mut [embedded_hal_1::i2c::blocking::Operation<'a>], _operations: &mut [embedded_hal_1::i2c::Operation<'a>],
) -> Result<(), Self::Error> { ) -> Result<(), Self::Error> {
todo!(); todo!();
} }
fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error> fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error>
where where
O: IntoIterator<Item = embedded_hal_1::i2c::blocking::Operation<'a>>, O: IntoIterator<Item = embedded_hal_1::i2c::Operation<'a>>,
{ {
todo!(); todo!();
} }

View File

@ -1040,7 +1040,7 @@ mod eh1 {
type Error = Error; type Error = Error;
} }
impl<'d, T: Instance> embedded_hal_1::serial::blocking::Write for Uarte<'d, T> { impl<'d, T: Instance> embedded_hal_1::serial::Write for Uarte<'d, T> {
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> { fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
self.blocking_write(buffer) self.blocking_write(buffer)
} }
@ -1054,7 +1054,7 @@ mod eh1 {
type Error = Error; type Error = Error;
} }
impl<'d, T: Instance> embedded_hal_1::serial::blocking::Write for UarteTx<'d, T> { impl<'d, T: Instance> embedded_hal_1::serial::Write for UarteTx<'d, T> {
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> { fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
self.blocking_write(buffer) self.blocking_write(buffer)
} }

View File

@ -31,7 +31,7 @@ nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "
# Implement embedded-hal 1.0 alpha traits. # Implement embedded-hal 1.0 alpha traits.
# Implement embedded-hal-async traits if `nightly` is set as well. # Implement embedded-hal-async traits if `nightly` is set as well.
unstable-traits = ["embedded-hal-1"] unstable-traits = ["embedded-hal-1", "embedded-hal-nb"]
[dependencies] [dependencies]
embassy-sync = { version = "0.1.0", path = "../embassy-sync" } embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
@ -58,5 +58,6 @@ rp2040-pac2 = { git = "https://github.com/embassy-rs/rp2040-pac2", rev="017e3c90
#rp2040-pac2 = { path = "../../rp2040-pac2", features = ["rt"] } #rp2040-pac2 = { path = "../../rp2040-pac2", features = ["rt"] }
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true} embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true}
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true} embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true}
embedded-hal-nb = { version = "=1.0.0-alpha.1", optional = true}

View File

@ -867,7 +867,7 @@ mod eh1 {
type Error = Infallible; type Error = Infallible;
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::InputPin for Input<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> {
fn is_high(&self) -> Result<bool, Self::Error> { fn is_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_high()) Ok(self.is_high())
} }
@ -881,7 +881,7 @@ mod eh1 {
type Error = Infallible; type Error = Infallible;
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for Output<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> {
fn set_high(&mut self) -> Result<(), Self::Error> { fn set_high(&mut self) -> Result<(), Self::Error> {
Ok(self.set_high()) Ok(self.set_high())
} }
@ -891,7 +891,7 @@ mod eh1 {
} }
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for Output<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> {
fn is_set_high(&self) -> Result<bool, Self::Error> { fn is_set_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_set_high()) Ok(self.is_set_high())
} }
@ -901,7 +901,7 @@ mod eh1 {
} }
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::ToggleableOutputPin for Output<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for Output<'d, T> {
fn toggle(&mut self) -> Result<(), Self::Error> { fn toggle(&mut self) -> Result<(), Self::Error> {
Ok(self.toggle()) Ok(self.toggle())
} }
@ -911,7 +911,7 @@ mod eh1 {
type Error = Infallible; type Error = Infallible;
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for OutputOpenDrain<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d, T> {
fn set_high(&mut self) -> Result<(), Self::Error> { fn set_high(&mut self) -> Result<(), Self::Error> {
Ok(self.set_high()) Ok(self.set_high())
} }
@ -921,7 +921,7 @@ mod eh1 {
} }
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for OutputOpenDrain<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d, T> {
fn is_set_high(&self) -> Result<bool, Self::Error> { fn is_set_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_set_high()) Ok(self.is_set_high())
} }
@ -931,7 +931,7 @@ mod eh1 {
} }
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::ToggleableOutputPin for OutputOpenDrain<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for OutputOpenDrain<'d, T> {
fn toggle(&mut self) -> Result<(), Self::Error> { fn toggle(&mut self) -> Result<(), Self::Error> {
Ok(self.toggle()) Ok(self.toggle())
} }
@ -941,7 +941,7 @@ mod eh1 {
type Error = Infallible; type Error = Infallible;
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::InputPin for Flex<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> {
fn is_high(&self) -> Result<bool, Self::Error> { fn is_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_high()) Ok(self.is_high())
} }
@ -951,7 +951,7 @@ mod eh1 {
} }
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for Flex<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> {
fn set_high(&mut self) -> Result<(), Self::Error> { fn set_high(&mut self) -> Result<(), Self::Error> {
Ok(self.set_high()) Ok(self.set_high())
} }
@ -961,7 +961,7 @@ mod eh1 {
} }
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for Flex<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> {
fn is_set_high(&self) -> Result<bool, Self::Error> { fn is_set_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_set_high()) Ok(self.is_set_high())
} }
@ -971,7 +971,7 @@ mod eh1 {
} }
} }
impl<'d, T: Pin> embedded_hal_1::digital::blocking::ToggleableOutputPin for Flex<'d, T> { impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for Flex<'d, T> {
fn toggle(&mut self) -> Result<(), Self::Error> { fn toggle(&mut self) -> Result<(), Self::Error> {
Ok(self.toggle()) Ok(self.toggle())
} }

View File

@ -379,7 +379,7 @@ mod eh1 {
type Error = Error; type Error = Error;
} }
impl<'d, T: Instance, M: Mode> embedded_hal_1::i2c::blocking::I2c for I2c<'d, T, M> { impl<'d, T: Instance, M: Mode> embedded_hal_1::i2c::I2c for I2c<'d, T, M> {
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> { fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
self.blocking_read(address, buffer) self.blocking_read(address, buffer)
} }
@ -421,16 +421,14 @@ mod eh1 {
fn transaction<'a>( fn transaction<'a>(
&mut self, &mut self,
address: u8, address: u8,
operations: &mut [embedded_hal_1::i2c::blocking::Operation<'a>], operations: &mut [embedded_hal_1::i2c::Operation<'a>],
) -> Result<(), Self::Error> { ) -> Result<(), Self::Error> {
Self::setup(address.into())?; Self::setup(address.into())?;
for i in 0..operations.len() { for i in 0..operations.len() {
let last = i == operations.len() - 1; let last = i == operations.len() - 1;
match &mut operations[i] { match &mut operations[i] {
embedded_hal_1::i2c::blocking::Operation::Read(buf) => { embedded_hal_1::i2c::Operation::Read(buf) => self.read_blocking_internal(buf, false, last)?,
self.read_blocking_internal(buf, false, last)? embedded_hal_1::i2c::Operation::Write(buf) => self.write_blocking_internal(buf, last)?,
}
embedded_hal_1::i2c::blocking::Operation::Write(buf) => self.write_blocking_internal(buf, last)?,
} }
} }
Ok(()) Ok(())
@ -438,17 +436,15 @@ mod eh1 {
fn transaction_iter<'a, O>(&mut self, address: u8, operations: O) -> Result<(), Self::Error> fn transaction_iter<'a, O>(&mut self, address: u8, operations: O) -> Result<(), Self::Error>
where where
O: IntoIterator<Item = embedded_hal_1::i2c::blocking::Operation<'a>>, O: IntoIterator<Item = embedded_hal_1::i2c::Operation<'a>>,
{ {
Self::setup(address.into())?; Self::setup(address.into())?;
let mut peekable = operations.into_iter().peekable(); let mut peekable = operations.into_iter().peekable();
while let Some(operation) = peekable.next() { while let Some(operation) = peekable.next() {
let last = peekable.peek().is_none(); let last = peekable.peek().is_none();
match operation { match operation {
embedded_hal_1::i2c::blocking::Operation::Read(buf) => { embedded_hal_1::i2c::Operation::Read(buf) => self.read_blocking_internal(buf, false, last)?,
self.read_blocking_internal(buf, false, last)? embedded_hal_1::i2c::Operation::Write(buf) => self.write_blocking_internal(buf, last)?,
}
embedded_hal_1::i2c::blocking::Operation::Write(buf) => self.write_blocking_internal(buf, last)?,
} }
} }
Ok(()) Ok(())

View File

@ -523,25 +523,25 @@ mod eh1 {
type Error = Error; type Error = Error;
} }
impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::blocking::SpiBusFlush for Spi<'d, T, M> { impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBusFlush for Spi<'d, T, M> {
fn flush(&mut self) -> Result<(), Self::Error> { fn flush(&mut self) -> Result<(), Self::Error> {
Ok(()) Ok(())
} }
} }
impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::blocking::SpiBusRead<u8> for Spi<'d, T, M> { impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBusRead<u8> for Spi<'d, T, M> {
fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> { fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> {
self.blocking_transfer(words, &[]) self.blocking_transfer(words, &[])
} }
} }
impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::blocking::SpiBusWrite<u8> for Spi<'d, T, M> { impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBusWrite<u8> for Spi<'d, T, M> {
fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
self.blocking_write(words) self.blocking_write(words)
} }
} }
impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::blocking::SpiBus<u8> for Spi<'d, T, M> { impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBus<u8> for Spi<'d, T, M> {
fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> { fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> {
self.blocking_transfer(read, write) self.blocking_transfer(read, write)
} }

View File

@ -486,7 +486,7 @@ mod eh1 {
type Error = Error; type Error = Error;
} }
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::nb::Read for UartRx<'d, T, M> { impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Read for UartRx<'d, T, M> {
fn read(&mut self) -> nb::Result<u8, Self::Error> { fn read(&mut self) -> nb::Result<u8, Self::Error> {
let r = T::regs(); let r = T::regs();
unsafe { unsafe {
@ -509,7 +509,7 @@ mod eh1 {
} }
} }
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::blocking::Write for UartTx<'d, T, M> { impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::Write for UartTx<'d, T, M> {
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> { fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
self.blocking_write(buffer) self.blocking_write(buffer)
} }
@ -519,7 +519,7 @@ mod eh1 {
} }
} }
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::nb::Write for UartTx<'d, T, M> { impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Write for UartTx<'d, T, M> {
fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> { fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> {
self.blocking_write(&[char]).map_err(nb::Error::Other) self.blocking_write(&[char]).map_err(nb::Error::Other)
} }
@ -529,13 +529,13 @@ mod eh1 {
} }
} }
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::nb::Read for Uart<'d, T, M> { impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Read for Uart<'d, T, M> {
fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> { fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> {
embedded_hal_02::serial::Read::read(&mut self.rx) embedded_hal_02::serial::Read::read(&mut self.rx)
} }
} }
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::blocking::Write for Uart<'d, T, M> { impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::Write for Uart<'d, T, M> {
fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> { fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
self.blocking_write(buffer) self.blocking_write(buffer)
} }
@ -545,7 +545,7 @@ mod eh1 {
} }
} }
impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::nb::Write for Uart<'d, T, M> { impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Write for Uart<'d, T, M> {
fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> { fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> {
self.blocking_write(&[char]).map_err(nb::Error::Other) self.blocking_write(&[char]).map_err(nb::Error::Other)
} }

View File

@ -42,8 +42,8 @@ embassy-net = { version = "0.1.0", path = "../embassy-net", optional = true }
embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional = true } embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional = true }
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true} embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true}
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true} embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true}
embedded-storage = "0.3.0" embedded-storage = "0.3.0"
embedded-storage-async = { version = "0.3.0", optional = true } embedded-storage-async = { version = "0.3.0", optional = true }

View File

@ -155,7 +155,7 @@ mod eh1 {
type Error = Infallible; type Error = Infallible;
} }
impl<'d, T: GpioPin> embedded_hal_1::digital::blocking::InputPin for ExtiInput<'d, T> { impl<'d, T: GpioPin> embedded_hal_1::digital::InputPin for ExtiInput<'d, T> {
fn is_high(&self) -> Result<bool, Self::Error> { fn is_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_high()) Ok(self.is_high())
} }

View File

@ -848,8 +848,7 @@ mod eh02 {
#[cfg(feature = "unstable-traits")] #[cfg(feature = "unstable-traits")]
mod eh1 { mod eh1 {
use embedded_hal_1::digital::blocking::{InputPin, OutputPin, StatefulOutputPin, ToggleableOutputPin}; use embedded_hal_1::digital::{ErrorType, InputPin, OutputPin, StatefulOutputPin, ToggleableOutputPin};
use embedded_hal_1::digital::ErrorType;
use super::*; use super::*;

View File

@ -334,7 +334,7 @@ mod eh1 {
type Error = Error; type Error = Error;
} }
impl<'d, T: Instance> embedded_hal_1::i2c::blocking::I2c for I2c<'d, T> { impl<'d, T: Instance> embedded_hal_1::i2c::I2c for I2c<'d, T> {
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> { fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
self.blocking_read(address, buffer) self.blocking_read(address, buffer)
} }
@ -364,14 +364,14 @@ mod eh1 {
fn transaction<'a>( fn transaction<'a>(
&mut self, &mut self,
_address: u8, _address: u8,
_operations: &mut [embedded_hal_1::i2c::blocking::Operation<'a>], _operations: &mut [embedded_hal_1::i2c::Operation<'a>],
) -> Result<(), Self::Error> { ) -> Result<(), Self::Error> {
todo!(); todo!();
} }
fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error> fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error>
where where
O: IntoIterator<Item = embedded_hal_1::i2c::blocking::Operation<'a>>, O: IntoIterator<Item = embedded_hal_1::i2c::Operation<'a>>,
{ {
todo!(); todo!();
} }

View File

@ -883,7 +883,7 @@ mod eh1 {
type Error = Error; type Error = Error;
} }
impl<'d, T: Instance> embedded_hal_1::i2c::blocking::I2c for I2c<'d, T, NoDma, NoDma> { impl<'d, T: Instance> embedded_hal_1::i2c::I2c for I2c<'d, T, NoDma, NoDma> {
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> { fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
self.blocking_read(address, buffer) self.blocking_read(address, buffer)
} }
@ -913,14 +913,14 @@ mod eh1 {
fn transaction<'a>( fn transaction<'a>(
&mut self, &mut self,
_address: u8, _address: u8,
_operations: &mut [embedded_hal_1::i2c::blocking::Operation<'a>], _operations: &mut [embedded_hal_1::i2c::Operation<'a>],
) -> Result<(), Self::Error> { ) -> Result<(), Self::Error> {
todo!(); todo!();
} }
fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error> fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error>
where where
O: IntoIterator<Item = embedded_hal_1::i2c::blocking::Operation<'a>>, O: IntoIterator<Item = embedded_hal_1::i2c::Operation<'a>>,
{ {
todo!(); todo!();
} }

View File

@ -843,25 +843,25 @@ mod eh1 {
type Error = Error; type Error = Error;
} }
impl<'d, T: Instance, Tx, Rx> embedded_hal_1::spi::blocking::SpiBusFlush for Spi<'d, T, Tx, Rx> { impl<'d, T: Instance, Tx, Rx> embedded_hal_1::spi::SpiBusFlush for Spi<'d, T, Tx, Rx> {
fn flush(&mut self) -> Result<(), Self::Error> { fn flush(&mut self) -> Result<(), Self::Error> {
Ok(()) Ok(())
} }
} }
impl<'d, T: Instance, W: Word> embedded_hal_1::spi::blocking::SpiBusRead<W> for Spi<'d, T, NoDma, NoDma> { impl<'d, T: Instance, W: Word> embedded_hal_1::spi::SpiBusRead<W> for Spi<'d, T, NoDma, NoDma> {
fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error> { fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error> {
self.blocking_read(words) self.blocking_read(words)
} }
} }
impl<'d, T: Instance, W: Word> embedded_hal_1::spi::blocking::SpiBusWrite<W> for Spi<'d, T, NoDma, NoDma> { impl<'d, T: Instance, W: Word> embedded_hal_1::spi::SpiBusWrite<W> for Spi<'d, T, NoDma, NoDma> {
fn write(&mut self, words: &[W]) -> Result<(), Self::Error> { fn write(&mut self, words: &[W]) -> Result<(), Self::Error> {
self.blocking_write(words) self.blocking_write(words)
} }
} }
impl<'d, T: Instance, W: Word> embedded_hal_1::spi::blocking::SpiBus<W> for Spi<'d, T, NoDma, NoDma> { impl<'d, T: Instance, W: Word> embedded_hal_1::spi::SpiBus<W> for Spi<'d, T, NoDma, NoDma> {
fn transfer(&mut self, read: &mut [W], write: &[W]) -> Result<(), Self::Error> { fn transfer(&mut self, read: &mut [W], write: &[W]) -> Result<(), Self::Error> {
self.blocking_transfer(read, write) self.blocking_transfer(read, write)
} }

View File

@ -105,8 +105,8 @@ defmt = { version = "0.3", optional = true }
log = { version = "0.4.14", optional = true } log = { version = "0.4.14", optional = true }
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" } embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true} embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true}
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true} embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true}
futures-util = { version = "0.3.17", default-features = false } futures-util = { version = "0.3.17", default-features = false }
embassy-macros = { version = "0.1.0", path = "../embassy-macros"} embassy-macros = { version = "0.1.0", path = "../embassy-macros"}

View File

@ -18,7 +18,7 @@ pub struct Delay;
mod eh1 { mod eh1 {
use super::*; use super::*;
impl embedded_hal_1::delay::blocking::DelayUs for Delay { impl embedded_hal_1::delay::DelayUs for Delay {
type Error = core::convert::Infallible; type Error = core::convert::Infallible;
fn delay_us(&mut self, us: u32) -> Result<(), Self::Error> { fn delay_us(&mut self, us: u32) -> Result<(), Self::Error> {

View File

@ -108,9 +108,9 @@ mod shared_spi {
use core::cell::RefCell; use core::cell::RefCell;
use core::fmt::Debug; use core::fmt::Debug;
use embedded_hal_1::digital::blocking::OutputPin; use embedded_hal_1::digital::OutputPin;
use embedded_hal_1::spi; use embedded_hal_1::spi;
use embedded_hal_1::spi::blocking::SpiDevice; use embedded_hal_1::spi::SpiDevice;
#[derive(Copy, Clone, Eq, PartialEq, Debug)] #[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum SpiDeviceWithCsError<BUS, CS> { pub enum SpiDeviceWithCsError<BUS, CS> {
@ -153,7 +153,7 @@ mod shared_spi {
impl<'a, BUS, CS> SpiDevice for SpiDeviceWithCs<'a, BUS, CS> impl<'a, BUS, CS> SpiDevice for SpiDeviceWithCs<'a, BUS, CS>
where where
BUS: spi::blocking::SpiBusFlush, BUS: spi::SpiBusFlush,
CS: OutputPin, CS: OutputPin,
{ {
type Bus = BUS; type Bus = BUS;
@ -182,7 +182,7 @@ mod shared_spi {
/// Driver for the XPT2046 resistive touchscreen sensor /// Driver for the XPT2046 resistive touchscreen sensor
mod touch { mod touch {
use embedded_hal_1::spi::blocking::{SpiBus, SpiBusRead, SpiBusWrite, SpiDevice}; use embedded_hal_1::spi::{SpiBus, SpiBusRead, SpiBusWrite, SpiDevice};
struct Calibration { struct Calibration {
x1: i32, x1: i32,
@ -246,8 +246,8 @@ mod touch {
mod my_display_interface { mod my_display_interface {
use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand}; use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand};
use embedded_hal_1::digital::blocking::OutputPin; use embedded_hal_1::digital::OutputPin;
use embedded_hal_1::spi::blocking::{SpiBusWrite, SpiDevice}; use embedded_hal_1::spi::{SpiBusWrite, SpiDevice};
/// SPI display interface. /// SPI display interface.
/// ///

View File

@ -17,8 +17,8 @@ defmt-rtt = "0.3"
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.0" cortex-m-rt = "0.7.0"
embedded-hal = "0.2.6" embedded-hal = "0.2.6"
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
embedded-hal-async = { version = "0.1.0-alpha.1" } embedded-hal-async = { version = "=0.1.0-alpha.2" }
embedded-nal-async = "0.2.0" embedded-nal-async = "0.2.0"
panic-probe = { version = "0.3", features = ["print-defmt"] } panic-probe = { version = "0.3", features = ["print-defmt"] }
futures = { version = "0.3.17", default-features = false, features = ["async-await"] } futures = { version = "0.3.17", default-features = false, features = ["async-await"] }

View File

@ -18,8 +18,8 @@ defmt-rtt = "0.3"
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.0" cortex-m-rt = "0.7.0"
embedded-hal = "0.2.6" embedded-hal = "0.2.6"
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
embedded-hal-async = { version = "0.1.0-alpha.1" } embedded-hal-async = { version = "=0.1.0-alpha.2" }
panic-probe = { version = "0.3", features = ["print-defmt"] } panic-probe = { version = "0.3", features = ["print-defmt"] }
futures = { version = "0.3.17", default-features = false, features = ["async-await"] } futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
heapless = { version = "0.7.5", default-features = false } heapless = { version = "0.7.5", default-features = false }

View File

@ -16,8 +16,8 @@ defmt-rtt = "0.3.0"
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.0" cortex-m-rt = "0.7.0"
embedded-hal = "0.2.6" embedded-hal = "0.2.6"
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
embedded-hal-async = { version = "0.1.0-alpha.1" } embedded-hal-async = { version = "=0.1.0-alpha.2" }
panic-probe = { version = "0.3.0", features = ["print-defmt"] } panic-probe = { version = "0.3.0", features = ["print-defmt"] }
futures = { version = "0.3.17", default-features = false, features = ["async-await"] } futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
embedded-io = { version = "0.3.0", features = ["async"] } embedded-io = { version = "0.3.0", features = ["async"] }

View File

@ -24,8 +24,8 @@ defmt-rtt = "0.3.0"
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.0" cortex-m-rt = "0.7.0"
embedded-hal = "0.2.6" embedded-hal = "0.2.6"
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
embedded-hal-async = { version = "0.1.0-alpha.1" } embedded-hal-async = { version = "=0.1.0-alpha.2" }
panic-probe = { version = "0.3.0", features = ["print-defmt"] } panic-probe = { version = "0.3.0", features = ["print-defmt"] }
[profile.dev] [profile.dev]