pub struct MCP4725<I: I2c<SevenBitAddress>> { /* private fields */ }
Expand description
The MCP4725 device
Implementations§
Source§impl<I: I2c<SevenBitAddress>> MCP4725<I>
impl<I: I2c<SevenBitAddress>> MCP4725<I>
Sourcepub fn new(i2c: I, address: SevenBitAddress) -> Self
pub fn new(i2c: I, address: SevenBitAddress) -> Self
Create a new device from an I2C peripheral and address.
Sourcepub async fn set_voltage(
&mut self,
dac: u16,
write_eeprom: bool,
) -> Result<(), I::Error>
pub async fn set_voltage( &mut self, dac: u16, write_eeprom: bool, ) -> Result<(), I::Error>
Convenience function to just set the output voltage. Only the lower 12 bits of the DAC value
are used. If write_eeprom
is true, the DAC value will also be written to the EEPROM and
the EEPROM power down mode will be set to Normal
.
Sourcepub async fn read(&mut self) -> Result<(RegisterStatus, EEPROMStatus), I::Error>
pub async fn read(&mut self) -> Result<(RegisterStatus, EEPROMStatus), I::Error>
Perform a read command. This will return the value in the DAC register and the EEPROM data.
Sourcepub async fn fast_write(
&mut self,
power_down_mode: PowerDownMode,
dac: u16,
) -> Result<(), I::Error>
pub async fn fast_write( &mut self, power_down_mode: PowerDownMode, dac: u16, ) -> Result<(), I::Error>
Perform a fast write. This can set the power down mode and the DAC value. This only changes the DAC register and does not affect the EEPROM. Only the lower 12 bits of the DAC value are used.
Auto Trait Implementations§
impl<I> Freeze for MCP4725<I>where
I: Freeze,
impl<I> RefUnwindSafe for MCP4725<I>where
I: RefUnwindSafe,
impl<I> Send for MCP4725<I>where
I: Send,
impl<I> Sync for MCP4725<I>where
I: Sync,
impl<I> Unpin for MCP4725<I>where
I: Unpin,
impl<I> UnwindSafe for MCP4725<I>where
I: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more