as5048a_async/
error.rs

1/// Error type for AS5048A operations
2#[derive(Debug, PartialEq, Eq)]
3#[cfg_attr(feature = "defmt", derive(defmt::Format))]
4pub enum Error<E> {
5    /// Communication error with the sensor
6    Communication(E),
7    /// Parity error in received data
8    ParityError,
9    /// Error flag set by the sensor (invalid command or parity error)
10    SensorError,
11}
12
13impl<E: Clone> Clone for Error<E> {
14    fn clone(&self) -> Self {
15        match self {
16            Error::Communication(e) => Error::Communication(e.clone()),
17            Error::ParityError => Error::ParityError,
18            Error::SensorError => Error::SensorError,
19        }
20    }
21}