upm
0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
|
The ADS1013, ADS1014, and ADS1015 are precision analog-to-digital converters (ADCs) with 12 bits of resolution offered in an ultra-small, leadless QFN-10 package or an MSOP-10 package. The ADS1013/4/5 are designed with precision, power, and ease of implementation in mind. The ADS1013/4/5 feature an onboard reference and oscillator. Data is transferred via an I2C-compatible serial interface; four I2C slave addresses can be selected. The ADS1013/4/5 operate from a single power supply ranging from 2.0V to 5.5V. The ADS1013/4/5 can perform conversions at rates up to 3300 samples per second (SPS). An onboard PGA is available on the ADS1014 and ADS1015 that offers input ranges from the supply to as low as ±256mV, allowing both large and small signals to be measured with high resolution. The ADS1015 also features an input multiplexer (MUX) that provides two differential or four single-ended inputs. The ADS1013/4/5 operate either in continuous conversion mode or a single-shot mode that automatically powers down after a conversion and greatly reduces current consumption during idle periods. The ADS1013/4/5 are specified from –40°C to +125°C.
Tested with Adafriut ADS1015 board: https://www.adafruit.com/products/1083
Public Types | |
enum | ADSSAMPLERATE { SPS_128 = ADS1015_DR_128SPS, SPS_250 = ADS1015_DR_250SPS, SPS_490 = ADS1015_DR_490SPS, SPS_920 = ADS1015_DR_920SPS, SPS_1600 = ADS1015_DR_1600SPS, SPS_2400 = ADS1015_DR_2400SPS, SPS_3300 = ADS1015_DR_3300SPS } |
uint16_t enum containing values representing the sample rate of the device. | |
typedef enum upm::ADS1015::ADSSAMPLERATE | ADSSAMPLERATE |
Public Types inherited from ADS1X15 | |
enum | ADSGAIN { GAIN_TWOTHIRDS = ADS1X15_PGA_6_144V, GAIN_ONE = ADS1X15_PGA_4_096V, GAIN_TWO = ADS1X15_PGA_2_048V, GAIN_FOUR = ADS1X15_PGA_1_024V, GAIN_EIGHT = ADS1X15_PGA_0_512V, GAIN_SIXTEEN = ADS1X15_PGA_0_256V } |
uint16_t enum containing values for setting gain for ADS1X15 devices. | |
enum | ADSMUXMODE { DIFF_0_1 = ADS1X15_MUX_DIFF_0_1, DIFF_0_3 = ADS1X15_MUX_DIFF_0_3, DIFF_1_3 = ADS1X15_MUX_DIFF_1_3, DIFF_2_3 = ADS1X15_MUX_DIFF_2_3, SINGLE_0 = ADS1X15_MUX_SINGLE_0, SINGLE_1 = ADS1X15_MUX_SINGLE_1, SINGLE_2 = ADS1X15_MUX_SINGLE_2, SINGLE_3 = ADS1X15_MUX_SINGLE_3 } |
uint16_t enum containing values used for selecting ADS1X15 read operations. | |
enum | ADSCOMP { CQUE_1CONV = 0x0000, CQUE_2CONV = 0x0001, CQUE_4CONV = 0x0002, CQUE_NONE = 0x0003 } |
uint16_t enum containing values for setting ADS1X15 comparator queue modes. | |
enum | ADSTHRESH { THRESH_LOW = ADS1X15_REG_POINTER_LOWTHRESH, THRESH_HIGH = ADS1X15_REG_POINTER_HITHRESH, CONVERSION_RDY = 0x04, THRESH_DEFAULT = 0x05 } |
uint8_t enum containing register addresses used for setting HI and LOW threshold values as well as setting conversion ready and set to default. | |
enum | ADSSAMPLERATE { SPS_DEFAULT = 0x0080 } |
uint16_t enum containing values representing the sample rate of the device. Will be overridden in subclass | |
typedef enum upm::ADS1X15::ADSGAIN | ADSGAIN |
typedef enum upm::ADS1X15::ADSMUXMODE | ADSMUXMODE |
typedef enum upm::ADS1X15::ADSCOMP | ADSCOMP |
typedef enum upm::ADS1X15::ADSTHRESH | ADSTHRESH |
typedef enum upm::ADS1X15::ADSSAMPLERATE | ADSSAMPLERATE |
Public Member Functions | |
ADS1015 (int bus, uint8_t address=0x48) | |
~ADS1015 () | |
void | setSPS (ADSSAMPLERATE rate=SPS_1600) |
Public Member Functions inherited from ADS1X15 | |
ADS1X15 (int bus, uint8_t address) | |
virtual | ~ADS1X15 () |
std::string | name () |
float | getLastSample (int reg=ADS1X15_REG_POINTER_CONVERT) |
float | getSample (ADSMUXMODE mode=ADS1X15::DIFF_0_1) |
ADSGAIN | getGain () |
void | setGain (ADSGAIN gain=ADS1X15::GAIN_TWO) |
ADSSAMPLERATE | getSPS (void) |
virtual void | setSPS (ADSSAMPLERATE rate) |
bool | getCompMode (void) |
void | setCompMode (bool mode=false) |
bool | getCompPol (void) |
void | setCompPol (bool mode=false) |
bool | getCompLatch (void) |
void | setCompLatch (bool mode=false) |
ADSCOMP | getCompQue (void) |
void | setCompQue (ADSCOMP mode=ADS1X15::CQUE_NONE) |
bool | getContinuous (void) |
void | setContinuous (bool mode=false) |
float | getThresh (ADSTHRESH reg=THRESH_LOW) |
void | setThresh (ADSTHRESH reg=THRESH_DEFAULT, float value=0.0) |
Protected Member Functions | |
float | getMultiplier (void) |
void | setDelay (void) |
Protected Member Functions inherited from ADS1X15 | |
void | getCurrentConfig () |
void | updateConfigRegister (uint16_t update, bool read=false) |
uint16_t | swapWord (uint16_t value) |
Additional Inherited Members | |
Protected Attributes inherited from ADS1X15 | |
std::string | m_name |
float | m_conversionDelay |
uint8_t | m_bitShift |
uint16_t | m_config_reg |
mraa::I2c * | i2c |
ADS1015 | ( | int | bus, |
uint8_t | address = 0x48 |
||
) |
ADS1X15 constructor
bus | i2c bus the sensor is attached to. |
address. | Device address. Default is 0x48. |
void setSPS | ( | ADSSAMPLERATE | rate = SPS_1600 | ) |