Skip to main content

DS4432

Struct DS4432 

Source
pub struct DS4432<I> { /* private fields */ }
Expand description

A DS4432 Digital To Analog (DAC) converter on the I2C bus I.

Implementations§

Source§

impl<I: I2c + ErrorType> DS4432<I>

Source

pub fn new(i2c: I) -> Self

Create a new DS4432 using the given I2C implementation.

Using this constructor doesn’t allow the driver to know the Rfs values so only raw DAC code are supported in the Status.

Source

pub fn with_rfs( i2c: I, rfs0_ohm: Option<u32>, rfs1_ohm: Option<u32>, ) -> Result<Self, I::Error>

Create a new DS4432 using the given I2C implementation and the optinal Rfs values.

If a Rfs value is given for an Output:

  • reading status will automatically convert to microamps value instead of giving the raw DAC code.
  • writing status will allow automatic convertion from microamps value to raw DAC code.

Note: if you want to only deal with raw DAC code, use new instead and use Status::current_ua() to do manual convertion into microamps.

Source

pub fn set_status( &mut self, output: Output, status: Status, ) -> Result<(), I::Error>

Set the current sink/source status and code of an output

Source

pub fn status(&mut self, output: Output) -> Result<Status, I::Error>

Get the current sink/source status and code of an output

Source

pub fn release(self) -> I

Return the underlying I2C device

Source

pub fn destroy(self) -> Self

Destroys this driver and releases the I2C bus I.

Auto Trait Implementations§

§

impl<I> Freeze for DS4432<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for DS4432<I>
where I: RefUnwindSafe,

§

impl<I> Send for DS4432<I>
where I: Send,

§

impl<I> Sync for DS4432<I>
where I: Sync,

§

impl<I> Unpin for DS4432<I>
where I: Unpin,

§

impl<I> UnsafeUnpin for DS4432<I>
where I: UnsafeUnpin,

§

impl<I> UnwindSafe for DS4432<I>
where I: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.