mirror of
https://github.com/rust-embedded/embedded-hal.git
synced 2026-03-19 05:40:32 +00:00
Merge pull request #718 from t-wallet/spi-device-error-into-infallible
Implement Into<Infallible> when spi::DeviceError is infallible
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
//! `SpiDevice` implementations.
|
||||
|
||||
use core::convert::Infallible;
|
||||
use core::fmt::{self, Debug, Display, Formatter};
|
||||
use embedded_hal::spi::{Error, ErrorKind};
|
||||
|
||||
@@ -63,6 +64,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl From<DeviceError<Infallible, Infallible>> for Infallible {
|
||||
fn from(value: DeviceError<Infallible, Infallible>) -> Self {
|
||||
match value {
|
||||
DeviceError::Spi(e) => e,
|
||||
DeviceError::Cs(e) => e,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Dummy [`DelayNs`](embedded_hal::delay::DelayNs) implementation that panics on use.
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
|
||||
|
||||
Reference in New Issue
Block a user