Skip to content

Commit

Permalink
Merge pull request #681 from ithinuel/migrate-to-eh10rc
Browse files Browse the repository at this point in the history
migrate to eh1_0 rc 1
  • Loading branch information
ithinuel authored Sep 4, 2023
2 parents 8f3e8d0 + f62f19c commit 6756d35
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 21 deletions.
4 changes: 2 additions & 2 deletions rp2040-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ targets = ["thumbv6m-none-eabi"]
[dependencies]
cortex-m = "0.7.2"
embedded-hal = { version = "0.2.5", features = ["unproven"] }
eh1_0_alpha = { package = "embedded-hal", version = "=1.0.0-alpha.11", optional = true }
eh_nb_1_0_alpha = { package = "embedded-hal-nb", version = "=1.0.0-alpha.3", optional = true }
eh1_0_alpha = { package = "embedded-hal", version = "=1.0.0-rc.1", optional = true }
eh_nb_1_0_alpha = { package = "embedded-hal-nb", version = "=1.0.0-rc.1", optional = true }
embedded-dma = "0.2.0"
fugit = "0.3.6"
itertools = { version = "0.10.1", default-features = false }
Expand Down
6 changes: 2 additions & 4 deletions rp2040-hal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,14 @@ proposed features (and known issues).

We plan to support embedded-hal 1.0 soon after it is released.

For now, there is preliminary support for alpha versions of embedded-hal, which can
For now, there is preliminary support for alpha/rc versions of embedded-hal, which can
be enabled with the feature `eh1_0_alpha`. Please note that this support does not
provide any semver compatibility guarantees: With that feature activated, there
will be breaking changes even in minor versions of rp2040-hal.

Support for embedded-hal 1.0(-alpha) exists in parallel to support for
Support for embedded-hal 1.0(-alpha/rc) exists in parallel to support for
embedded-hal 0.2: Traits of both versions are implemented and can be used
at the same time.
The new blocking [SPI traits](https://docs.rs/embedded-hal/1.0.0-alpha.8/embedded_hal/spi/blocking/index.html)
are not yet implemented.

<!-- CONTRIBUTING -->
## Contributing
Expand Down
4 changes: 1 addition & 3 deletions rp2040-hal/src/uart/peripheral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ use crate::{
uart::*,
};

#[cfg(feature = "eh1_0_alpha")]
use eh1_0_alpha::serial as eh1;
#[cfg(feature = "eh1_0_alpha")]
use eh_nb_1_0_alpha::serial as eh1nb;

Expand Down Expand Up @@ -356,7 +354,7 @@ impl<D: UartDevice, P: ValidUartPinout<D>> Read<u8> for UartPeripheral<Enabled,
}

#[cfg(feature = "eh1_0_alpha")]
impl<D: UartDevice, P: ValidUartPinout<D>> eh1::ErrorType for UartPeripheral<Enabled, D, P> {
impl<D: UartDevice, P: ValidUartPinout<D>> eh1nb::ErrorType for UartPeripheral<Enabled, D, P> {
type Error = ReadErrorType;
}

Expand Down
16 changes: 7 additions & 9 deletions rp2040-hal/src/uart/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use crate::pac::uart0::RegisterBlock;
use embedded_hal::serial::Read;
use nb::Error::*;

#[cfg(feature = "eh1_0_alpha")]
use eh1_0_alpha::serial as eh1;
#[cfg(feature = "eh1_0_alpha")]
use eh_nb_1_0_alpha::serial as eh1nb;

Expand Down Expand Up @@ -42,13 +40,13 @@ pub enum ReadErrorType {
}

#[cfg(feature = "eh1_0_alpha")]
impl eh1_0_alpha::serial::Error for ReadErrorType {
fn kind(&self) -> eh1_0_alpha::serial::ErrorKind {
impl eh1nb::Error for ReadErrorType {
fn kind(&self) -> eh1nb::ErrorKind {
match self {
ReadErrorType::Overrun => eh1_0_alpha::serial::ErrorKind::Overrun,
ReadErrorType::Break => eh1_0_alpha::serial::ErrorKind::Other,
ReadErrorType::Parity => eh1_0_alpha::serial::ErrorKind::Parity,
ReadErrorType::Framing => eh1_0_alpha::serial::ErrorKind::FrameFormat,
ReadErrorType::Overrun => eh1nb::ErrorKind::Overrun,
ReadErrorType::Break => eh1nb::ErrorKind::Other,
ReadErrorType::Parity => eh1nb::ErrorKind::Parity,
ReadErrorType::Framing => eh1nb::ErrorKind::FrameFormat,
}
}
}
Expand Down Expand Up @@ -260,7 +258,7 @@ unsafe impl<D: UartDevice, P: ValidUartPinout<D>> ReadTarget for Reader<D, P> {
impl<D: UartDevice, P: ValidUartPinout<D>> EndlessReadTarget for Reader<D, P> {}

#[cfg(feature = "eh1_0_alpha")]
impl<D: UartDevice, P: ValidUartPinout<D>> eh1::ErrorType for Reader<D, P> {
impl<D: UartDevice, P: ValidUartPinout<D>> eh1nb::ErrorType for Reader<D, P> {
type Error = ReadErrorType;
}

Expand Down
4 changes: 1 addition & 3 deletions rp2040-hal/src/uart/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use crate::pac::uart0::RegisterBlock;
use core::fmt;
use core::{convert::Infallible, marker::PhantomData};
#[cfg(feature = "eh1_0_alpha")]
use eh1_0_alpha::serial as eh1;
#[cfg(feature = "eh1_0_alpha")]
use eh_nb_1_0_alpha::serial as eh1nb;
use embedded_hal::serial::Write;
use nb::Error::*;
Expand Down Expand Up @@ -205,7 +203,7 @@ unsafe impl<D: UartDevice, P: ValidUartPinout<D>> WriteTarget for Writer<D, P> {
impl<D: UartDevice, P: ValidUartPinout<D>> EndlessWriteTarget for Writer<D, P> {}

#[cfg(feature = "eh1_0_alpha")]
impl<D: UartDevice, P: ValidUartPinout<D>> eh1::ErrorType for Writer<D, P> {
impl<D: UartDevice, P: ValidUartPinout<D>> eh1nb::ErrorType for Writer<D, P> {
type Error = core::convert::Infallible;
}

Expand Down

0 comments on commit 6756d35

Please sign in to comment.