Error

Enum Error 

Source
pub enum Error<InnerError> {
    ValueOutOfBounds(u16),
    WriteSizeExceeded,
    StartingChannelMismatch,
    I2CError(InnerError),
}
Expand description

Error type for the crate, which can represent either an error from this driver or an inner error that comes from the I2C type.

Variants§

§

ValueOutOfBounds(u16)

A value was larger than the DAC supports.

The MCP4728 is a 12-bit DAC, so values that it writes must be smaller than 2^12.

§

WriteSizeExceeded

MCP4728::multi_write can write an arbitrary number of updates, so it is impossible to statically allocate a buffer to write using the embedded_hal::i2c::I2c trait. To work around this, we will use a buffer large enough to contain four writes at a time and return Error::WriteSizeExceeded if more writes are requested. This is unlikely to be a limitation given that there are four channels.

§

StartingChannelMismatch

A sequential write command was issued with a list of updates that didn’t match the associated starting channel.

For example, a sequential write command that starts with channel B must contain 3 updates: for channels B, C, and D.

§

I2CError(InnerError)

Error representing an error that came from the inner I2C driver.

Trait Implementations§

Source§

impl<InnerError: Debug> Debug for Error<InnerError>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<InnerError> From<InnerError> for Error<InnerError>

Source§

fn from(inner: InnerError) -> Self

Converts to this type from the input type.
Source§

impl<InnerError: PartialEq> PartialEq for Error<InnerError>

Source§

fn eq(&self, other: &Error<InnerError>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<InnerError: Eq> Eq for Error<InnerError>

Source§

impl<InnerError> StructuralPartialEq for Error<InnerError>

Auto Trait Implementations§

§

impl<InnerError> Freeze for Error<InnerError>
where InnerError: Freeze,

§

impl<InnerError> RefUnwindSafe for Error<InnerError>
where InnerError: RefUnwindSafe,

§

impl<InnerError> Send for Error<InnerError>
where InnerError: Send,

§

impl<InnerError> Sync for Error<InnerError>
where InnerError: Sync,

§

impl<InnerError> Unpin for Error<InnerError>
where InnerError: Unpin,

§

impl<InnerError> UnwindSafe for Error<InnerError>
where InnerError: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<!> for T

§

fn from(t: !) -> T

Converts to this type from the input type.
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.