Upgraded embedded-hal alpha dependency to 1.0.0-alpha.9

For now, disabled non-blocking implementations.
This commit is contained in:
Jan Niehusmann 2022-09-28 21:41:38 +00:00
parent 8d9b4538c9
commit e4deaabb51
8 changed files with 28 additions and 17 deletions

View file

@ -13,7 +13,7 @@ license = "MIT OR Apache-2.0"
cortex-m = "0.7.2"
cortex-m-rt = ">=0.6.15,<0.8"
embedded-hal = { version = "0.2.5", features = ["unproven"] }
eh1_0_alpha = { package = "embedded-hal", version = "=1.0.0-alpha.8", optional = true }
eh1_0_alpha = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true }
fugit = "0.3.6"
itertools = { version = "0.10.1", default-features = false }
nb = "1.0"

View file

@ -556,7 +556,7 @@ impl eh1::ErrorType for DynPin {
}
#[cfg(feature = "eh1_0_alpha")]
impl eh1::blocking::OutputPin for DynPin {
impl eh1::OutputPin for DynPin {
#[inline]
fn set_high(&mut self) -> Result<(), Self::Error> {
self._set_high()
@ -568,7 +568,7 @@ impl eh1::blocking::OutputPin for DynPin {
}
#[cfg(feature = "eh1_0_alpha")]
impl eh1::blocking::InputPin for DynPin {
impl eh1::InputPin for DynPin {
#[inline]
fn is_high(&self) -> Result<bool, Self::Error> {
self._is_high()
@ -580,7 +580,7 @@ impl eh1::blocking::InputPin for DynPin {
}
#[cfg(feature = "eh1_0_alpha")]
impl eh1::blocking::ToggleableOutputPin for DynPin {
impl eh1::ToggleableOutputPin for DynPin {
#[inline]
fn toggle(&mut self) -> Result<(), Self::Error> {
self._toggle()
@ -588,7 +588,7 @@ impl eh1::blocking::ToggleableOutputPin for DynPin {
}
#[cfg(feature = "eh1_0_alpha")]
impl eh1::blocking::StatefulOutputPin for DynPin {
impl eh1::StatefulOutputPin for DynPin {
#[inline]
fn is_set_high(&self) -> Result<bool, Self::Error> {
self._is_set_high()

View file

@ -881,7 +881,7 @@ where
}
#[cfg(feature = "eh1_0_alpha")]
impl<I, C> eh1::blocking::OutputPin for Pin<I, Output<C>>
impl<I, C> eh1::OutputPin for Pin<I, Output<C>>
where
I: PinId,
C: OutputConfig,
@ -899,7 +899,7 @@ where
}
#[cfg(feature = "eh1_0_alpha")]
impl<I> eh1::blocking::InputPin for Pin<I, ReadableOutput>
impl<I> eh1::InputPin for Pin<I, ReadableOutput>
where
I: PinId,
{
@ -923,7 +923,7 @@ where
}
#[cfg(feature = "eh1_0_alpha")]
impl<I, C> eh1::blocking::InputPin for Pin<I, Input<C>>
impl<I, C> eh1::InputPin for Pin<I, Input<C>>
where
I: PinId,
C: InputConfig,
@ -939,7 +939,7 @@ where
}
#[cfg(feature = "eh1_0_alpha")]
impl<I, C> eh1::blocking::ToggleableOutputPin for Pin<I, Output<C>>
impl<I, C> eh1::ToggleableOutputPin for Pin<I, Output<C>>
where
I: PinId,
C: OutputConfig,
@ -952,7 +952,7 @@ where
}
#[cfg(feature = "eh1_0_alpha")]
impl<I, C> eh1::blocking::StatefulOutputPin for Pin<I, Output<C>>
impl<I, C> eh1::StatefulOutputPin for Pin<I, Output<C>>
where
I: PinId,
C: OutputConfig,

View file

@ -279,7 +279,7 @@ impl<T: Deref<Target = Block>, PINS> eh1::ErrorType for I2C<T, PINS, Controller>
}
#[cfg(feature = "eh1_0_alpha")]
impl<T: Deref<Target = Block>, PINS> eh1::blocking::I2c for I2C<T, PINS, Controller> {
impl<T: Deref<Target = Block>, PINS> eh1::I2c for I2C<T, PINS, Controller> {
fn write(&mut self, addr: u8, bytes: &[u8]) -> Result<(), Self::Error> {
Write::write(self, addr, bytes)
}
@ -330,15 +330,15 @@ impl<T: Deref<Target = Block>, PINS> eh1::blocking::I2c for I2C<T, PINS, Control
fn transaction<'a>(
&mut self,
address: u8,
operations: &mut [eh1::blocking::Operation<'a>],
operations: &mut [eh1::Operation<'a>],
) -> Result<(), Self::Error> {
let addr: u16 = address.into();
self.setup(addr);
for i in 0..operations.len() {
let last = i == operations.len() - 1;
match &mut operations[i] {
eh1::blocking::Operation::Read(buf) => self.read_internal(buf, false, last)?,
eh1::blocking::Operation::Write(buf) => self.write_internal(buf, last)?,
eh1::Operation::Read(buf) => self.read_internal(buf, false, last)?,
eh1::Operation::Write(buf) => self.write_internal(buf, last)?,
}
}
Ok(())
@ -346,7 +346,7 @@ impl<T: Deref<Target = Block>, PINS> eh1::blocking::I2c for I2C<T, PINS, Control
fn transaction_iter<'a, O>(&mut self, address: u8, operations: O) -> Result<(), Self::Error>
where
O: IntoIterator<Item = eh1::blocking::Operation<'a>>,
O: IntoIterator<Item = eh1::Operation<'a>>,
{
let addr: u16 = address.into();
self.setup(addr);
@ -354,8 +354,8 @@ impl<T: Deref<Target = Block>, PINS> eh1::blocking::I2c for I2C<T, PINS, Control
while let Some(operation) = peekable.next() {
let last = peekable.peek().is_none();
match operation {
eh1::blocking::Operation::Read(buf) => self.read_internal(buf, false, last)?,
eh1::blocking::Operation::Write(buf) => self.write_internal(buf, last)?,
eh1::Operation::Read(buf) => self.read_internal(buf, false, last)?,
eh1::Operation::Write(buf) => self.write_internal(buf, last)?,
}
}
Ok(())

View file

@ -253,6 +253,7 @@ macro_rules! impl_write {
type Error = SpiInfallible;
}
/* disabled for now - nb was migrated to separate crate
#[cfg(feature = "eh1_0_alpha")]
impl<D: SpiDevice> eh1::nb::FullDuplex<$type> for Spi<Enabled, D, $nr> {
fn read(&mut self) -> Result<$type, nb::Error<SpiInfallible>> {
@ -276,6 +277,7 @@ macro_rules! impl_write {
Ok(())
}
}
*/
)+

View file

@ -357,6 +357,7 @@ impl<D: UartDevice, P: ValidUartPinout<D>> eh1::ErrorType for UartPeripheral<Ena
type Error = ReadErrorType;
}
/* disabled for now - nb was migrated to separate crate
#[cfg(feature = "eh1_0_alpha")]
impl<D: UartDevice, P: ValidUartPinout<D>> eh1::nb::Read<u8> for UartPeripheral<Enabled, D, P> {
fn read(&mut self) -> nb::Result<u8, Self::Error> {
@ -371,6 +372,8 @@ impl<D: UartDevice, P: ValidUartPinout<D>> eh1::nb::Read<u8> for UartPeripheral<
}
}
}
*/
impl<D: UartDevice, P: ValidUartPinout<D>> Write<u8> for UartPeripheral<Enabled, D, P> {
type Error = Infallible;
@ -387,6 +390,7 @@ impl<D: UartDevice, P: ValidUartPinout<D>> Write<u8> for UartPeripheral<Enabled,
}
}
/* disabled for now - nb was migrated to separate crate
#[cfg(feature = "eh1_0_alpha")]
impl<D: UartDevice, P: ValidUartPinout<D>> eh1::nb::Write<u8> for UartPeripheral<Enabled, D, P> {
fn write(&mut self, word: u8) -> nb::Result<(), Self::Error> {
@ -404,6 +408,7 @@ impl<D: UartDevice, P: ValidUartPinout<D>> eh1::nb::Write<u8> for UartPeripheral
})
}
}
*/
impl<D: UartDevice, P: ValidUartPinout<D>> fmt::Write for UartPeripheral<Enabled, D, P> {
fn write_str(&mut self, s: &str) -> fmt::Result {

View file

@ -239,6 +239,7 @@ impl<D: UartDevice, P: ValidUartPinout<D>> eh1::ErrorType for Reader<D, P> {
type Error = ReadErrorType;
}
/* disabled for now - nb was migrated to separate crate
#[cfg(feature = "eh1_0_alpha")]
impl<D: UartDevice, P: ValidUartPinout<D>> eh1::nb::Read<u8> for Reader<D, P> {
fn read(&mut self) -> nb::Result<u8, Self::Error> {
@ -253,3 +254,4 @@ impl<D: UartDevice, P: ValidUartPinout<D>> eh1::nb::Read<u8> for Reader<D, P> {
}
}
}
*/

View file

@ -187,6 +187,7 @@ impl<D: UartDevice, P: ValidUartPinout<D>> eh1::ErrorType for Writer<D, P> {
type Error = super::utils::SerialInfallible;
}
/* disabled for now - nb was migrated to separate crate
#[cfg(feature = "eh1_0_alpha")]
impl<D: UartDevice, P: ValidUartPinout<D>> eh1::nb::Write<u8> for Writer<D, P> {
fn write(&mut self, word: u8) -> nb::Result<(), Self::Error> {
@ -204,6 +205,7 @@ impl<D: UartDevice, P: ValidUartPinout<D>> eh1::nb::Write<u8> for Writer<D, P> {
})
}
}
*/
impl<D: UartDevice, P: ValidUartPinout<D>> fmt::Write for Writer<D, P> {
fn write_str(&mut self, s: &str) -> fmt::Result {