1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#[cfg(feature = "micro-fmt")]
use ufmt::{uDebug, uWrite, Formatter};
#[derive(Copy, Clone, Debug)]
pub enum TransferError<SPIError, PinError> {
Spi(SPIError),
Pin(PinError),
CommunicationError(u8),
MaximumRetries,
}
#[cfg(feature = "micro-fmt")]
impl<SPIError, PinError> uDebug for TransferError<SPIError, PinError> {
fn fmt<W: ?Sized>(&self, f: &mut Formatter<'_, W>) -> core::result::Result<(), W::Error>
where
W: uWrite,
{
match *self {
Self::Spi(_) => f.write_str("SPI error"),
Self::Pin(_) => f.write_str("Pin error"),
Self::CommunicationError(_) => f.write_str("Communication error"),
Self::MaximumRetries => f.write_str("SPI error"),
}
}
}