Nol.A SDK Library 26.11.2
For IoT System Software Development
Loading...
Searching...
No Matches
Adafruit_ADS1X15 Class Reference

Sensor driver for the Adafruit ADS1X15 ADC breakouts. More...

#include <Adafruit_ADS1X15.hpp>

Inheritance diagram for Adafruit_ADS1X15:
Adafruit_ADS1015 Adafruit_ADS1115

Public Member Functions

 Adafruit_ADS1X15 (TwoWire &w, uint8_t i2c_addr=ADS1X15_ADDRESS)
 Bind the I2C bus and address. Use an ADS1015/ADS1115 subclass to set resolution defaults.
bool begin ()
 Initialize I2C and probe the configured address; return true on acknowledgement.
int16_t readADC_SingleEnded (uint8_t channel)
 Block for a single-ended raw ADC conversion.
int16_t readADC_Differential_0_1 ()
 Block for raw signed ADC counts from AIN0 minus AIN1.
int16_t readADC_Differential_0_3 ()
 Block for raw signed ADC counts from AIN0 minus AIN3.
int16_t readADC_Differential_1_3 ()
 Block for raw signed ADC counts from AIN1 minus AIN3.
int16_t readADC_Differential_2_3 ()
 Block for raw signed ADC counts from AIN2 minus AIN3.
void startComparator_SingleEnded (uint8_t channel, int16_t threshold)
 Start continuous comparator operation for channel 0 through 3.
int16_t getLastConversionResults ()
 Read the conversion register and return signed counts at the device resolution.
float computeVolts (int16_t counts)
 Convert counts to volts using the configured gain and ADC resolution.
void setGain (adsGain_t gain)
 Cache the PGA gain used by subsequent conversions and computeVolts().
adsGain_t getGain ()
 Return the cached PGA gain.
void setDataRate (uint16_t rate)
 Cache a device-specific RATE_ADS1015_* or RATE_ADS1115_* register setting.
uint16_t getDataRate ()
 Return the cached data-rate register setting, not a numeric samples/second value.
void startADCReading (uint16_t mux, bool continuous)
 Start a conversion without waiting.
bool conversionComplete ()
 Return the configuration OS bit; used to poll single-shot completion.

Protected Attributes

TwoWire & wire
 I2C bus device.
uint8_t i2c_addr
uint8_t m_bitShift
 bit shift amount
adsGain_t m_gain
 ADC gain.
uint16_t m_dataRate
 Data rate.

Detailed Description

Sensor driver for the Adafruit ADS1X15 ADC breakouts.

Member Function Documentation

◆ readADC_SingleEnded()

int16_t Adafruit_ADS1X15::readADC_SingleEnded ( uint8_t channel)

Block for a single-ended raw ADC conversion.

Parameters
channelInput channel 0 through 3.
Returns
ADC counts, or zero for an invalid channel. No conversion timeout is enforced.

◆ startADCReading()

void Adafruit_ADS1X15::startADCReading ( uint16_t mux,
bool continuous )

Start a conversion without waiting.

Parameters
muxADS1X15_REG_CONFIG_MUX_* channel selection.
continuousTrue selects continuous conversion; false selects single-shot. Poll conversionComplete() for single-shot completion, then read the result.

◆ startComparator_SingleEnded()

void Adafruit_ADS1X15::startComparator_SingleEnded ( uint8_t channel,
int16_t threshold )

Start continuous comparator operation for channel 0 through 3.

Parameters
channelSingle-ended input.
thresholdComparator threshold in ADC counts.

The documentation for this class was generated from the following file: