embedded_onewire/
error.rs

1#[allow(unused_imports)]
2use crate::OneWireSearch;
3
4/// One wire communication error type.
5#[derive(Debug)]
6pub enum OneWireError<E> {
7    /// Encapsulates the error type from the underlying hardware.
8    Other(E),
9    /// Indicates that no device is present on the bus.
10    NoDevicePresent,
11    /// Indicates that the bus is busy, which may happen if a device is already communicating.
12    BusInUse,
13    /// Indicates that the bus is not initialized, which may happen if the bus master has come out
14    /// of a reset, but the 1-Wire port has not been configured.
15    BusUninitialized,
16    /// Indicates that the current bus speed is invalid for the operation.
17    BusInvalidSpeed,
18    /// Indicates that a short circuit was detected on the bus.
19    ShortCircuit,
20    /// Indicates that the operation is not implemented, such as reading a triplet when not supported.
21    Unimplemented,
22    /// Computed CRC of the ROM is invalid.
23    InvalidCrc,
24    /// Invalid value
25    InvalidValue(&'static str),
26}
27
28impl<E> From<E> for OneWireError<E> {
29    fn from(other: E) -> Self {
30        Self::Other(other)
31    }
32}