[][src]Struct mcp4725::MCP4725

pub struct MCP4725<I2C> where
    I2C: Read + Write
{ /* fields omitted */ }

MCP4725 DAC driver. Wraps an I2C port to send commands to an MCP4725

Implementations

impl<I2C, E> MCP4725<I2C> where
    I2C: Read<Error = E> + Write<Error = E>, 
[src]

pub fn new(i2c: I2C, user_address: u8) -> Self[src]

Construct a new MCP4725 driver instance. i2c is the initialized i2c driver port to use, user_address is the three bit user-part of the i2c address where the MCP4725 can be reached

  • The least significant bit of this address can be set externally by pulling the A0 leg of the chip low (0) or high (1) The two most significant bits are set in the factory. There are four variants of the chip with different addresses.

pub fn set_dac(&mut self, power: PowerDown, data: u16) -> Result<(), E>[src]

Set the dac register

pub fn set_dac_and_eeprom(
    &mut self,
    power: PowerDown,
    data: u16
) -> Result<(), E>
[src]

Set the dac and eeprom registers

pub fn set_dac_fast(&mut self, power: PowerDown, data: u16) -> Result<(), E>[src]

Use the two byte fast command to set the dac register

pub fn read(&mut self) -> Result<DacStatus, E>[src]

Send read command and return the dac status

pub fn wake_up(&mut self) -> Result<(), E>[src]

Send a wake-up command over the I2C bus. WARNING: This is a general call command and can wake-up other devices on the bus as well.

pub fn reset(&mut self) -> Result<(), E>[src]

Send a reset command on the I2C bus. WARNING: This is a general call command and can reset other devices on the bus as well.

pub fn destroy(self) -> I2C[src]

Destroy the MCP4725 driver, return the wrapped I2C

Trait Implementations

impl<I2C: Debug> Debug for MCP4725<I2C> where
    I2C: Read + Write
[src]

Auto Trait Implementations

impl<I2C> Send for MCP4725<I2C> where
    I2C: Send

impl<I2C> Sync for MCP4725<I2C> where
    I2C: Sync

impl<I2C> Unpin for MCP4725<I2C> where
    I2C: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.