diff options
Diffstat (limited to 'embassy-mcxa')
| -rw-r--r-- | embassy-mcxa/Cargo.toml | 4 | ||||
| -rw-r--r-- | embassy-mcxa/src/lpuart/mod.rs | 21 |
2 files changed, 23 insertions, 2 deletions
diff --git a/embassy-mcxa/Cargo.toml b/embassy-mcxa/Cargo.toml index 76ce59f5a..0d9663879 100644 --- a/embassy-mcxa/Cargo.toml +++ b/embassy-mcxa/Cargo.toml | |||
| @@ -36,8 +36,8 @@ embedded-hal-1 = { package = "embedded-hal", version = "1.0" } | |||
| 36 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } | 36 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } |
| 37 | embedded-hal-async = { version = "1.0" } | 37 | embedded-hal-async = { version = "1.0" } |
| 38 | embedded-hal-nb = { version = "1.0" } | 38 | embedded-hal-nb = { version = "1.0" } |
| 39 | embedded-io = "0.6" | 39 | embedded-io = "0.7" |
| 40 | embedded-io-async = { version = "0.6.1" } | 40 | embedded-io-async = { version = "0.7.0" } |
| 41 | heapless = "0.8" | 41 | heapless = "0.8" |
| 42 | mcxa-pac = { version = "0.1.0", features = ["rt", "critical-section"] } | 42 | mcxa-pac = { version = "0.1.0", features = ["rt", "critical-section"] } |
| 43 | nb = "1.1.0" | 43 | nb = "1.1.0" |
diff --git a/embassy-mcxa/src/lpuart/mod.rs b/embassy-mcxa/src/lpuart/mod.rs index bce3986b5..ae511e8d3 100644 --- a/embassy-mcxa/src/lpuart/mod.rs +++ b/embassy-mcxa/src/lpuart/mod.rs | |||
| @@ -568,6 +568,27 @@ pub enum Error { | |||
| 568 | ClockSetup(ClockError), | 568 | ClockSetup(ClockError), |
| 569 | } | 569 | } |
| 570 | 570 | ||
| 571 | impl core::fmt::Display for Error { | ||
| 572 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | ||
| 573 | match self { | ||
| 574 | Error::Read => write!(f, "Read error"), | ||
| 575 | Error::Overrun => write!(f, "Buffer overflow"), | ||
| 576 | Error::Noise => write!(f, "Noise error"), | ||
| 577 | Error::Framing => write!(f, "Framing error"), | ||
| 578 | Error::Parity => write!(f, "Parity error"), | ||
| 579 | Error::Fail => write!(f, "Failure"), | ||
| 580 | Error::InvalidArgument => write!(f, "Invalid argument"), | ||
| 581 | Error::UnsupportedBaudrate => write!(f, "Unsupported baud rate"), | ||
| 582 | Error::RxFifoEmpty => write!(f, "RX FIFO empty"), | ||
| 583 | Error::TxFifoFull => write!(f, "TX FIFO full"), | ||
| 584 | Error::TxBusy => write!(f, "TX busy"), | ||
| 585 | Error::ClockSetup(e) => write!(f, "Clock setup error: {:?}", e), | ||
| 586 | } | ||
| 587 | } | ||
| 588 | } | ||
| 589 | |||
| 590 | impl core::error::Error for Error {} | ||
| 591 | |||
| 571 | /// A specialized Result type for LPUART operations | 592 | /// A specialized Result type for LPUART operations |
| 572 | pub type Result<T> = core::result::Result<T, Error>; | 593 | pub type Result<T> = core::result::Result<T, Error>; |
| 573 | 594 | ||
