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.