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:
Scott Mabin
2025-12-04 12:16:16 +00:00
committed by GitHub

View File

@@ -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))]