ENTS-tock
Environmental NeTworked Sensor firmware on Tock OS
Loading...
Searching...
No Matches
ADS1219

Library for interfacing with the ADS1219 ADC. More...

Enumerations

enum  ads1219_status {
  ADS1219_SUCCESS , ADS1219_ERROR = -1 , ADS1219_CONFIGURE = -2 , ADS1219_MEASURE = -3 ,
  ADS1219_CONVERSION = -4
}
 

Functions

int ads1219_reset (void)
 This function starts up the ADS1219.
 
int ads1219_voltage (double *voltage)
 This function reads the current ADC voltage value.
 
int ads1219_voltage_raw (uint32_t *voltage)
 
int ads1219_current (double *current)
 This function reads the current ADC ampere value.
 
int ads1219_current_raw (uint32_t *current)
 
uint8_t ads1219_sensor_voltage (uint8_t *data, Metadata meta, uint32_t idx)
 Sensor measure functions.
 
uint8_t ads1219_sensor_current (uint8_t *data, Metadata meta, uint32_t idx)
 

Detailed Description

Library for interfacing with the ADS1219 ADC.

This library is designed to read measurements from the ADS1219 ADC. When not actively taking measurements, the analog frontend is power down to reduce parasitic current.

Library expected I2C and GPIO to be initialized before use.

Example: example_adc.c

Datasheet: https://www.ti.com/product/ADS1219

Enumeration Type Documentation

◆ ads1219_status

Enumerator
ADS1219_SUCCESS 
ADS1219_ERROR 
ADS1219_CONFIGURE 
ADS1219_MEASURE 
ADS1219_CONVERSION 

Definition at line 44 of file ads1219.h.

Function Documentation

◆ ads1219_current()

int ads1219_current ( double *  current)

This function reads the current ADC ampere value.

This function is a wrapper for the STM32 HAl I2C library. The ADS1219 uses I2C the I2C communication protocol. This version simply chops the noisy bits.

Parameters
currentPointer to store measurement.
Returns
Return code.

Definition at line 209 of file ads1219.c.

References ads1219_current_raw(), and ADS1219_SUCCESS.

Referenced by ads1219_sensor_current(), and main().

◆ ads1219_current_raw()

int ads1219_current_raw ( uint32_t *  current)

Definition at line 186 of file ads1219.c.

References ADS1219_SUCCESS, ConfigReg::bits, configure(), measure(), ConfigReg::mux, and ConfigReg::vref.

Referenced by ads1219_current().

◆ ads1219_reset()

int ads1219_reset ( void  )

This function starts up the ADS1219.

This function is a wrapper for the STM32 HAl I2C library. The ADS1219 uses I2C the I2C communication protocol. This function configures then ADS1219 for single read mode. Note: the ADS1219 requires a minimum of 500us when it is powered on.

Returns
Return code.

Definition at line 126 of file ads1219.c.

References ADS1219_ERROR, ADS1219_SUCCESS, and cmd_reset.

Referenced by main(), and main().

◆ ads1219_sensor_current()

uint8_t ads1219_sensor_current ( uint8_t *  data,
Metadata  meta,
uint32_t  idx 
)

Definition at line 300 of file ads1219.c.

References ads1219_current(), data, data_len, EncodeDoubleMeasurement(), and SENSOR_OK.

Referenced by main().

◆ ads1219_sensor_voltage()

uint8_t ads1219_sensor_voltage ( uint8_t *  data,
Metadata  meta,
uint32_t  idx 
)

Sensor measure functions.

See also
SensorsPrototypeMeasure

Definition at line 279 of file ads1219.c.

References ads1219_voltage(), data, data_len, EncodeDoubleMeasurement(), and SENSOR_OK.

Referenced by main().

◆ ads1219_voltage()

int ads1219_voltage ( double *  voltage)

This function reads the current ADC voltage value.

This function is a wrapper for the STM32 HAl I2C library. The ADS1219 uses I2C the I2C communication protocol. This version simply chops the noisy bits.

Parameters
currentPointer to store measurement.
Returns
Return code.

Definition at line 174 of file ads1219.c.

References ADS1219_SUCCESS, and ads1219_voltage_raw().

Referenced by ads1219_sensor_voltage(), and main().

◆ ads1219_voltage_raw()

int ads1219_voltage_raw ( uint32_t *  voltage)

Definition at line 153 of file ads1219.c.

References ADS1219_SUCCESS, ConfigReg::bits, configure(), measure(), and ConfigReg::vref.

Referenced by ads1219_voltage().