Struct ADS111x

Source
pub struct ADS111x<I2C> { /* private fields */ }

Implementations§

Source§

impl<I2C, E> ADS111x<I2C>
where I2C: I2c<Error = E>,

Source

pub fn new( i2c: I2C, address: u8, config: ADS111xConfig, ) -> Result<Self, ADSError>

Create a new ADS111x instance with the specified configuration Note: This only creates the instance, it doesn’t write the configuration to the chip

Source

pub fn destroy(self) -> I2C

Destroys driver instance and returns I²C bus instance.

Source

pub fn write_config(&mut self, config: Option<ADS111xConfig>) -> Result<(), E>

Writes self configuration to to the chip’s registers Config can be used to update configuration This step is necessary to apply the configuration

Source

pub fn read_config(&mut self) -> Result<ADS111xConfig, E>

Source

pub fn read_single_voltage( &mut self, mux: Option<InputMultiplexer>, ) -> Result<f32, E>

Perform single read when mode set to single ADC is in low power state until requested and will go back after conversion Will block until converstion is ready Mux can be used to reconfigure what ADC input to read

Source

pub fn check_cnversion_ready(&mut self) -> Result<bool, E>

Source

pub fn read_voltage(&mut self) -> Result<f32, E>

Reads conversion does not block to wait for conversion will return 0 when conversion was still ongoing You can use check_coversion_ready if needed only works when Mode is Continuous

Source

pub fn set_low_treshold(&mut self, low_tresh: i16) -> Result<(), E>

Source

pub fn set_high_treshold(&mut self, high_tresh: i16) -> Result<(), E>

Auto Trait Implementations§

§

impl<I2C> Freeze for ADS111x<I2C>
where I2C: Freeze,

§

impl<I2C> RefUnwindSafe for ADS111x<I2C>
where I2C: RefUnwindSafe,

§

impl<I2C> Send for ADS111x<I2C>
where I2C: Send,

§

impl<I2C> Sync for ADS111x<I2C>
where I2C: Sync,

§

impl<I2C> Unpin for ADS111x<I2C>
where I2C: Unpin,

§

impl<I2C> UnwindSafe for ADS111x<I2C>
where I2C: 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.