mirror of
https://github.com/esp-rs/esp-idf-hal.git
synced 2025-09-27 12:21:02 +00:00

* Upgrade to e-hal 1.0-rc1 * e-hal is no longer alpha * Fix for ESP IDF < 5 * Unite all delay impls in a single module * Model delays between transactions * SPI: Make queueing it a bit more readable * SPI: Plug delays * Shorten the threshold for the Delay provider * Clippy * Fix the examples * SPI: Detect last transaction in the presence of delays * SPI: Introduce CsPin * SPI: Introduce CsPin * SPI: Mark delays with TODO * Clippy * SPI: Rename CsPin to CsCtl * Transfer_transaction not necessary
32 lines
592 B
Rust
32 lines
592 B
Rust
//! Error types
|
|
|
|
use core::fmt::{self, Display, Formatter};
|
|
|
|
use embedded_io::{Error, ErrorKind};
|
|
|
|
use crate::sys::EspError;
|
|
|
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
|
pub struct EspIOError(pub EspError);
|
|
|
|
impl Error for EspIOError {
|
|
fn kind(&self) -> ErrorKind {
|
|
ErrorKind::Other
|
|
}
|
|
}
|
|
|
|
impl From<EspError> for EspIOError {
|
|
fn from(e: EspError) -> Self {
|
|
EspIOError(e)
|
|
}
|
|
}
|
|
|
|
impl Display for EspIOError {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
|
self.0.fmt(f)
|
|
}
|
|
}
|
|
|
|
#[cfg(feature = "std")]
|
|
impl std::error::Error for EspIOError {}
|