pub struct Ads1x1x<DI, IC, CONV, MODE> { /* private fields */ }
Expand description
ADS1x1x ADC driver
Implementations§
source§impl<DI, IC, CONV, E> Ads1x1x<DI, IC, CONV, OneShot>where
DI: WriteData<Error = E> + ReadData<Error = E>,
CONV: ConvertMeasurement,
impl<DI, IC, CONV, E> Ads1x1x<DI, IC, CONV, OneShot>where
DI: WriteData<Error = E> + ReadData<Error = E>,
CONV: ConvertMeasurement,
sourcepub fn into_continuous(
self
) -> Result<Ads1x1x<DI, IC, CONV, Continuous>, Error<E>>
pub fn into_continuous(
self
) -> Result<Ads1x1x<DI, IC, CONV, Continuous>, Error<E>>
Change operating mode to Continuous
source§impl<DI, IC, CONV, E> Ads1x1x<DI, IC, CONV, Continuous>where
DI: ReadData<Error = E> + WriteData<Error = E>,
CONV: ConvertMeasurement,
impl<DI, IC, CONV, E> Ads1x1x<DI, IC, CONV, Continuous>where
DI: ReadData<Error = E> + WriteData<Error = E>,
CONV: ConvertMeasurement,
source§impl<DI, IC, CONV, E> Ads1x1x<DI, IC, CONV, Continuous>where
DI: ReadData<Error = E> + WriteData<Error = E>,
CONV: ConvertMeasurement,
impl<DI, IC, CONV, E> Ads1x1x<DI, IC, CONV, Continuous>where
DI: ReadData<Error = E> + WriteData<Error = E>,
CONV: ConvertMeasurement,
source§impl<DI, IC, MODE, E> Ads1x1x<DI, IC, Resolution12Bit, MODE>where
DI: WriteData<Error = E>,
impl<DI, IC, MODE, E> Ads1x1x<DI, IC, Resolution12Bit, MODE>where
DI: WriteData<Error = E>,
sourcepub fn set_data_rate(&mut self, rate: DataRate12Bit) -> Result<(), Error<E>>
pub fn set_data_rate(&mut self, rate: DataRate12Bit) -> Result<(), Error<E>>
Set data rate
source§impl<DI, IC, MODE, E> Ads1x1x<DI, IC, Resolution16Bit, MODE>where
DI: WriteData<Error = E>,
impl<DI, IC, MODE, E> Ads1x1x<DI, IC, Resolution16Bit, MODE>where
DI: WriteData<Error = E>,
sourcepub fn set_data_rate(&mut self, rate: DataRate16Bit) -> Result<(), Error<E>>
pub fn set_data_rate(&mut self, rate: DataRate16Bit) -> Result<(), Error<E>>
Set data rate
source§impl<DI, IC, CONV, MODE, E> Ads1x1x<DI, IC, CONV, MODE>where
DI: WriteData<Error = E>,
IC: Tier2Features,
CONV: ConvertThreshold<E>,
impl<DI, IC, CONV, MODE, E> Ads1x1x<DI, IC, CONV, MODE>where
DI: WriteData<Error = E>,
IC: Tier2Features,
CONV: ConvertThreshold<E>,
sourcepub fn set_full_scale_range(
&mut self,
range: FullScaleRange
) -> Result<(), Error<E>>
pub fn set_full_scale_range(
&mut self,
range: FullScaleRange
) -> Result<(), Error<E>>
Set the input voltage measurable range
This configures the programmable gain amplifier and determines the measurable input voltage range.
sourcepub fn set_low_threshold_raw(&mut self, value: i16) -> Result<(), Error<E>>
pub fn set_low_threshold_raw(&mut self, value: i16) -> Result<(), Error<E>>
Set raw comparator lower threshold
The input value must be within [2047..-2048]
for 12-bit devices (ADS101x
)
and within [32767..-32768]
for 16-bit devices (ADS111x
). The voltage that
these values correspond to must be calculated using the full-scale range
selected. See FullScaleRange
.
sourcepub fn set_high_threshold_raw(&mut self, value: i16) -> Result<(), Error<E>>
pub fn set_high_threshold_raw(&mut self, value: i16) -> Result<(), Error<E>>
Set raw comparator upper threshold
The input value must be within [2047..-2048]
for 12-bit devices (ADS101x
)
and within [32767..-32768]
for 16-bit devices (ADS111x
). The voltage that
these values correspond to must be calculated using the full-scale range
selected. See FullScaleRange
.
sourcepub fn set_comparator_mode(
&mut self,
mode: ComparatorMode
) -> Result<(), Error<E>>
pub fn set_comparator_mode(
&mut self,
mode: ComparatorMode
) -> Result<(), Error<E>>
Set comparator mode
sourcepub fn set_comparator_polarity(
&mut self,
polarity: ComparatorPolarity
) -> Result<(), Error<E>>
pub fn set_comparator_polarity(
&mut self,
polarity: ComparatorPolarity
) -> Result<(), Error<E>>
Set comparator polarity
sourcepub fn set_comparator_latching(
&mut self,
latching: ComparatorLatching
) -> Result<(), Error<E>>
pub fn set_comparator_latching(
&mut self,
latching: ComparatorLatching
) -> Result<(), Error<E>>
Set comparator latching
sourcepub fn set_comparator_queue(
&mut self,
queue: ComparatorQueue
) -> Result<(), Error<E>>
pub fn set_comparator_queue(
&mut self,
queue: ComparatorQueue
) -> Result<(), Error<E>>
Activate comparator and set the alert queue
The comparator can be disabled with disable_comparator()
sourcepub fn disable_comparator(&mut self) -> Result<(), Error<E>>
pub fn disable_comparator(&mut self) -> Result<(), Error<E>>
Disable comparator (default)
This will set the ALERT/RDY pin to high-impedance.
The comparator can be enabled by setting the comparator queue.
See set_comparator_queue()
sourcepub fn use_alert_rdy_pin_as_ready(&mut self) -> Result<(), Error<E>>
pub fn use_alert_rdy_pin_as_ready(&mut self) -> Result<(), Error<E>>
Use the ALERT/RDY pin as conversion-ready pin.
This the ALERT/RDY pin outputs the OS bit when in OneShot mode, and provides a continuous-conversion ready pulse when in continuous-conversion mode.
When calling this the comparator will be disabled and the thresholds will be cleared.
source§impl<DI, IC, CONV, MODE, E> Ads1x1x<DI, IC, CONV, MODE>where
DI: WriteData<Error = E> + ReadData<Error = E>,
impl<DI, IC, CONV, MODE, E> Ads1x1x<DI, IC, CONV, MODE>where
DI: WriteData<Error = E> + ReadData<Error = E>,
sourcepub fn is_measurement_in_progress(&mut self) -> Result<bool, Error<E>>
pub fn is_measurement_in_progress(&mut self) -> Result<bool, Error<E>>
Read whether a measurement is currently in progress.
sourcepub fn reset_internal_driver_state(&mut self)
pub fn reset_internal_driver_state(&mut self)
Reset the internal state of this driver to the default values.
Note: This does not alter the state or configuration of the device.
This resets the cached configuration register value in this driver to the power-up (reset) configuration of the device.
This needs to be called after performing a reset on the device, for example through an I2C general-call Reset command, which was not done through this driver to ensure that the configurations in the device and in the driver match.
source§impl<I2C, E> Ads1x1x<I2cInterface<I2C>, Ads1013, Resolution12Bit, OneShot>where
I2C: Write<Error = E> + WriteRead<Error = E>,
impl<I2C, E> Ads1x1x<I2cInterface<I2C>, Ads1013, Resolution12Bit, OneShot>where
I2C: Write<Error = E> + WriteRead<Error = E>,
sourcepub fn new_ads1013(i2c: I2C, address: SlaveAddr) -> Self
pub fn new_ads1013(i2c: I2C, address: SlaveAddr) -> Self
Create a new instance of the device in OneShot mode.
source§impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, Ads1013, CONV, MODE>
impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, Ads1013, CONV, MODE>
sourcepub fn destroy_ads1013(self) -> I2C
pub fn destroy_ads1013(self) -> I2C
Destroy driver instance, return I²C bus instance.
source§impl<I2C, E> Ads1x1x<I2cInterface<I2C>, Ads1113, Resolution16Bit, OneShot>where
I2C: Write<Error = E> + WriteRead<Error = E>,
impl<I2C, E> Ads1x1x<I2cInterface<I2C>, Ads1113, Resolution16Bit, OneShot>where
I2C: Write<Error = E> + WriteRead<Error = E>,
sourcepub fn new_ads1113(i2c: I2C, address: SlaveAddr) -> Self
pub fn new_ads1113(i2c: I2C, address: SlaveAddr) -> Self
Create a new instance of the device in OneShot mode.
source§impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, Ads1113, CONV, MODE>
impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, Ads1113, CONV, MODE>
sourcepub fn destroy_ads1113(self) -> I2C
pub fn destroy_ads1113(self) -> I2C
Destroy driver instance, return I²C bus instance.
source§impl<I2C, E> Ads1x1x<I2cInterface<I2C>, Ads1014, Resolution12Bit, OneShot>where
I2C: Write<Error = E> + WriteRead<Error = E>,
impl<I2C, E> Ads1x1x<I2cInterface<I2C>, Ads1014, Resolution12Bit, OneShot>where
I2C: Write<Error = E> + WriteRead<Error = E>,
sourcepub fn new_ads1014(i2c: I2C, address: SlaveAddr) -> Self
pub fn new_ads1014(i2c: I2C, address: SlaveAddr) -> Self
Create a new instance of the device in OneShot mode.
source§impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, Ads1014, CONV, MODE>
impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, Ads1014, CONV, MODE>
sourcepub fn destroy_ads1014(self) -> I2C
pub fn destroy_ads1014(self) -> I2C
Destroy driver instance, return I²C bus instance.
source§impl<I2C, E> Ads1x1x<I2cInterface<I2C>, Ads1114, Resolution16Bit, OneShot>where
I2C: Write<Error = E> + WriteRead<Error = E>,
impl<I2C, E> Ads1x1x<I2cInterface<I2C>, Ads1114, Resolution16Bit, OneShot>where
I2C: Write<Error = E> + WriteRead<Error = E>,
sourcepub fn new_ads1114(i2c: I2C, address: SlaveAddr) -> Self
pub fn new_ads1114(i2c: I2C, address: SlaveAddr) -> Self
Create a new instance of the device in OneShot mode.
source§impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, Ads1114, CONV, MODE>
impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, Ads1114, CONV, MODE>
sourcepub fn destroy_ads1114(self) -> I2C
pub fn destroy_ads1114(self) -> I2C
Destroy driver instance, return I²C bus instance.
source§impl<I2C, E> Ads1x1x<I2cInterface<I2C>, Ads1015, Resolution12Bit, OneShot>where
I2C: Write<Error = E> + WriteRead<Error = E>,
impl<I2C, E> Ads1x1x<I2cInterface<I2C>, Ads1015, Resolution12Bit, OneShot>where
I2C: Write<Error = E> + WriteRead<Error = E>,
sourcepub fn new_ads1015(i2c: I2C, address: SlaveAddr) -> Self
pub fn new_ads1015(i2c: I2C, address: SlaveAddr) -> Self
Create a new instance of the device in OneShot mode.
source§impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, Ads1015, CONV, MODE>
impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, Ads1015, CONV, MODE>
sourcepub fn destroy_ads1015(self) -> I2C
pub fn destroy_ads1015(self) -> I2C
Destroy driver instance, return I²C bus instance.
source§impl<I2C, E> Ads1x1x<I2cInterface<I2C>, Ads1115, Resolution16Bit, OneShot>where
I2C: Write<Error = E> + WriteRead<Error = E>,
impl<I2C, E> Ads1x1x<I2cInterface<I2C>, Ads1115, Resolution16Bit, OneShot>where
I2C: Write<Error = E> + WriteRead<Error = E>,
sourcepub fn new_ads1115(i2c: I2C, address: SlaveAddr) -> Self
pub fn new_ads1115(i2c: I2C, address: SlaveAddr) -> Self
Create a new instance of the device in OneShot mode.
source§impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, Ads1115, CONV, MODE>
impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, Ads1115, CONV, MODE>
sourcepub fn destroy_ads1115(self) -> I2C
pub fn destroy_ads1115(self) -> I2C
Destroy driver instance, return I²C bus instance.
Trait Implementations§
source§impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1013, CONV, MODE>> for DifferentialA0A1
impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1013, CONV, MODE>> for DifferentialA0A1
source§impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1014, CONV, MODE>> for DifferentialA0A1
impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1014, CONV, MODE>> for DifferentialA0A1
source§impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1015, CONV, MODE>> for DifferentialA0A1
impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1015, CONV, MODE>> for DifferentialA0A1
source§impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1015, CONV, MODE>> for DifferentialA0A3
impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1015, CONV, MODE>> for DifferentialA0A3
source§impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1015, CONV, MODE>> for DifferentialA1A3
impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1015, CONV, MODE>> for DifferentialA1A3
source§impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1015, CONV, MODE>> for DifferentialA2A3
impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1015, CONV, MODE>> for DifferentialA2A3
source§impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1113, CONV, MODE>> for DifferentialA0A1
impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1113, CONV, MODE>> for DifferentialA0A1
source§impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1114, CONV, MODE>> for DifferentialA0A1
impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1114, CONV, MODE>> for DifferentialA0A1
source§impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1115, CONV, MODE>> for DifferentialA0A1
impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1115, CONV, MODE>> for DifferentialA0A1
source§impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1115, CONV, MODE>> for DifferentialA0A3
impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1115, CONV, MODE>> for DifferentialA0A3
source§impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1115, CONV, MODE>> for DifferentialA1A3
impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1115, CONV, MODE>> for DifferentialA1A3
source§impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1115, CONV, MODE>> for DifferentialA2A3
impl<DI, CONV, MODE> Channel<Ads1x1x<DI, Ads1115, CONV, MODE>> for DifferentialA2A3
source§impl<DI: Default, IC: Default, CONV: Default, MODE: Default> Default for Ads1x1x<DI, IC, CONV, MODE>
impl<DI: Default, IC: Default, CONV: Default, MODE: Default> Default for Ads1x1x<DI, IC, CONV, MODE>
source§impl<DI, IC, CONV, E, CH> OneShot<Ads1x1x<DI, IC, CONV, OneShot>, i16, CH> for Ads1x1x<DI, IC, CONV, OneShot>where
DI: ReadData<Error = E> + WriteData<Error = E>,
CONV: ConvertMeasurement,
CH: Channel<Ads1x1x<DI, IC, CONV, OneShot>, ID = ChannelSelection>,
impl<DI, IC, CONV, E, CH> OneShot<Ads1x1x<DI, IC, CONV, OneShot>, i16, CH> for Ads1x1x<DI, IC, CONV, OneShot>where
DI: ReadData<Error = E> + WriteData<Error = E>,
CONV: ConvertMeasurement,
CH: Channel<Ads1x1x<DI, IC, CONV, OneShot>, ID = ChannelSelection>,
source§fn read(&mut self, _channel: &mut CH) -> Result<i16, Self::Error>
fn read(&mut self, _channel: &mut CH) -> Result<i16, Self::Error>
Request that the ADC begin a conversion on the specified channel.
The output value will be within [2047..-2048]
for 12-bit devices
(ADS101x
) and within [32767..-32768]
for 16-bit devices (ADS111x
).
The voltage that these values correspond to must be calculated using
the full-scale range selected.
See FullScaleRange
.
Returns nb::Error::WouldBlock
while a measurement is in progress.
In case a measurement was requested and after is it is finished a measurement on a different channel is requested, a new measurement on using the new channel selection is triggered.