diff --git a/embedded-hal-bus/src/spi/mod.rs b/embedded-hal-bus/src/spi/mod.rs index 65972628..c4b66250 100644 --- a/embedded-hal-bus/src/spi/mod.rs +++ b/embedded-hal-bus/src/spi/mod.rs @@ -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> for Infallible { + fn from(value: DeviceError) -> 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))]