SELKIELogger  1.0.0
TI ADS1015: Interface functions
Collaboration diagram for TI ADS1015: Interface functions:

Classes

struct  i2c_ads1015_options
 

Macros

#define I2C_ADS1015_DEFAULTS   {.scale = 1.0, .offset=0.0, .min=-INFINITY, .max=INFINITY}
 

Functions

uint16_t i2c_ads1015_read_configuration (const int busHandle, const int devAddr)
 Read configuration from device. More...
 
float i2c_ads1015_read_mux (const int busHandle, const int devAddr, const uint16_t mux, const i2c_ads1015_options *opts)
 Generic ADS1015 read function. More...
 
float i2c_ads1015_pga_to_scale_factor (const uint16_t config)
 Get number of millivolts represented by LSB at a given PGA value. More...
 
float i2c_ads1015_read_ch0 (const int busHandle, const int devAddr, const void *opts)
 Get single-ended voltage measurement from channel 0. More...
 
float i2c_ads1015_read_ch1 (const int busHandle, const int devAddr, const void *opts)
 Get single-ended voltage measurement from channel 1. More...
 
float i2c_ads1015_read_ch2 (const int busHandle, const int devAddr, const void *opts)
 Get single-ended voltage measurement from channel 2. More...
 
float i2c_ads1015_read_ch3 (const int busHandle, const int devAddr, const void *opts)
 Get single-ended voltage measurement from channel 3. More...
 
float i2c_ads1015_read_diff_ch0_ch1 (const int busHandle, const int devAddr, const void *opts)
 Get differential voltage measurement between channels 0 and 1. More...
 
float i2c_ads1015_read_diff_ch0_ch3 (const int busHandle, const int devAddr, const void *opts)
 Get differential voltage measurement between channels 0 and 3. More...
 
float i2c_ads1015_read_diff_ch1_ch3 (const int busHandle, const int devAddr, const void *opts)
 Get differential voltage measurement between channels 1 and 3. More...
 
float i2c_ads1015_read_diff_ch2_ch3 (const int busHandle, const int devAddr, const void *opts)
 Get differential voltage measurement between channels 2 and 3. More...
 

Detailed Description

Function Documentation

◆ i2c_ads1015_pga_to_scale_factor()

float i2c_ads1015_pga_to_scale_factor ( const uint16_t  config)

Get number of millivolts represented by LSB at a given PGA value.

Convert PGA setting (or extract it from a 16bit configuration word) and return the value of the least significant bit in millivolts.

Parameters
[in]configConfiguration word or ADS1015_CONFIG_PGA_ constant
Returns
LSB value in millivolts

Definition at line 55 of file I2C-ADS1015.c.

◆ i2c_ads1015_read_ch0()

float i2c_ads1015_read_ch0 ( const int  busHandle,
const int  devAddr,
const void *  opts 
)

Get single-ended voltage measurement from channel 0.

Wrapper around i2c_ads1015_read_mux()

Parameters
[in]busHandleHandle from i2c_openConnection()
[in]devAddrI2C Address for an ADS1015 ADC
[in]optsPointer to i2c_ads1015_options structure
Returns
ADC voltage in millivolts, or NAN on error

Definition at line 163 of file I2C-ADS1015.c.

◆ i2c_ads1015_read_ch1()

float i2c_ads1015_read_ch1 ( const int  busHandle,
const int  devAddr,
const void *  opts 
)

Get single-ended voltage measurement from channel 1.

Wrapper around i2c_ads1015_read_mux()

Parameters
[in]busHandleHandle from i2c_openConnection()
[in]devAddrI2C Address for an ADS1015 ADC
[in]optsPointer to i2c_ads1015_options structure
Returns
ADC voltage in millivolts, or NAN on error

Definition at line 177 of file I2C-ADS1015.c.

◆ i2c_ads1015_read_ch2()

float i2c_ads1015_read_ch2 ( const int  busHandle,
const int  devAddr,
const void *  opts 
)

Get single-ended voltage measurement from channel 2.

Wrapper around i2c_ads1015_read_mux()

Parameters
[in]busHandleHandle from i2c_openConnection()
[in]devAddrI2C Address for an ADS1015 ADC
[in]optsPointer to i2c_ads1015_options structure
Returns
ADC voltage in millivolts, or NAN on error

Definition at line 191 of file I2C-ADS1015.c.

◆ i2c_ads1015_read_ch3()

float i2c_ads1015_read_ch3 ( const int  busHandle,
const int  devAddr,
const void *  opts 
)

Get single-ended voltage measurement from channel 3.

Wrapper around i2c_ads1015_read_mux()

Parameters
[in]busHandleHandle from i2c_openConnection()
[in]devAddrI2C Address for an ADS1015 ADC
[in]optsPointer to i2c_ads1015_options structure
Returns
ADC voltage in millivolts, or NAN on error

Definition at line 206 of file I2C-ADS1015.c.

◆ i2c_ads1015_read_configuration()

uint16_t i2c_ads1015_read_configuration ( const int  busHandle,
const int  devAddr 
)

Read configuration from device.

Connect to specified device address and read configuration

Parameters
[in]busHandleHandle from i2c_openConnection()
[in]devAddrI2C Address for an ADS1015 sensor
Returns
configuration word

Definition at line 40 of file I2C-ADS1015.c.

◆ i2c_ads1015_read_diff_ch0_ch1()

float i2c_ads1015_read_diff_ch0_ch1 ( const int  busHandle,
const int  devAddr,
const void *  opts 
)

Get differential voltage measurement between channels 0 and 1.

Wrapper around i2c_ads1015_read_mux()

Parameters
[in]busHandleHandle from i2c_openConnection()
[in]devAddrI2C Address for an ADS1015 ADC
[in]optsPointer to i2c_ads1015_options structure
Returns
ADC voltage in millivolts, or NAN on error

Definition at line 220 of file I2C-ADS1015.c.

◆ i2c_ads1015_read_diff_ch0_ch3()

float i2c_ads1015_read_diff_ch0_ch3 ( const int  busHandle,
const int  devAddr,
const void *  opts 
)

Get differential voltage measurement between channels 0 and 3.

Wrapper around i2c_ads1015_read_mux()

Parameters
[in]busHandleHandle from i2c_openConnection()
[in]devAddrI2C Address for an ADS1015 ADC
[in]optsPointer to i2c_ads1015_options structure
Returns
ADC voltage in millivolts, or NAN on error

Definition at line 234 of file I2C-ADS1015.c.

◆ i2c_ads1015_read_diff_ch1_ch3()

float i2c_ads1015_read_diff_ch1_ch3 ( const int  busHandle,
const int  devAddr,
const void *  opts 
)

Get differential voltage measurement between channels 1 and 3.

Wrapper around i2c_ads1015_read_mux()

Parameters
[in]busHandleHandle from i2c_openConnection()
[in]devAddrI2C Address for an ADS1015 ADC
[in]optsPointer to i2c_ads1015_options structure
Returns
ADC voltage in millivolts, or NAN on error

Definition at line 248 of file I2C-ADS1015.c.

◆ i2c_ads1015_read_diff_ch2_ch3()

float i2c_ads1015_read_diff_ch2_ch3 ( const int  busHandle,
const int  devAddr,
const void *  opts 
)

Get differential voltage measurement between channels 2 and 3.

Wrapper around i2c_ads1015_read_mux()

Parameters
[in]busHandleHandle from i2c_openConnection()
[in]devAddrI2C Address for an ADS1015 ADC
[in]optsPointer to i2c_ads1015_options structure
Returns
ADC voltage in millivolts, or NAN on error

Definition at line 262 of file I2C-ADS1015.c.

◆ i2c_ads1015_read_mux()

float i2c_ads1015_read_mux ( const int  busHandle,
const int  devAddr,
const uint16_t  mux,
const i2c_ads1015_options opts 
)

Generic ADS1015 read function.

Perform a single shot conversion on an ADS1015 device using provided mux and pga values.

mux and pga parameters will be masked before use.

Parameters
[in]busHandleHandle from i2c_openConnection()
[in]devAddrI2C Address for an ADS1015 sensor
[in]muxADS1015_CONFIG_MUX_ constant to select measurement to be performed
[in]optsPointer to i2c_ads1015_options structure
Returns
MUX voltage value

Definition at line 91 of file I2C-ADS1015.c.