pub struct ADS111x<I2C> { /* private fields */ }Implementations§
Source§impl<I2C, E> ADS111x<I2C>where
I2C: I2c<Error = E>,
impl<I2C, E> ADS111x<I2C>where
I2C: I2c<Error = E>,
Sourcepub fn new(
i2c: I2C,
address: u8,
config: ADS111xConfig,
) -> Result<Self, ADSError>
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
Sourcepub fn write_config(&mut self, config: Option<ADS111xConfig>) -> Result<(), E>
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
pub fn read_config(&mut self) -> Result<ADS111xConfig, E>
Sourcepub fn read_single_voltage(
&mut self,
mux: Option<InputMultiplexer>,
) -> Result<f32, E>
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
pub fn check_cnversion_ready(&mut self) -> Result<bool, E>
Sourcepub fn read_voltage(&mut self) -> Result<f32, E>
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
pub fn set_low_treshold(&mut self, low_tresh: i16) -> Result<(), E>
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> 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