|
ENTS-tock
Environmental NeTworked Sensor firmware on Tock OS
|
Soil Power Sensor ADS12 library. More...
#include "ads1219.h"#include <libtock-sync/services/alarm.h>#include <libtock/peripherals/i2c_master.h>#include <libtock/tock.h>#include "../proto/sensor.h"Go to the source code of this file.
Data Structures | |
| union | ConfigReg |
Enumerations | |
| enum | ads1219_cmd_t { cmd_reset = 0x06 , cmd_start = 0x08 , cmd_powerdown = 0x02 , cmd_rdata = 0x10 , cmd_rreg = 0x20 , cmd_wreg = 0x40 } |
Functions | |
| void | power_on (void) |
| GPIO port for adc data ready line. | |
| void | power_off (void) |
| Turn off power to analog circuit. | |
| int | measure (uint32_t *meas) |
| Measure from the adc. | |
| int | configure (const ConfigReg reg_data) |
| This function reconfigures the ADS1219 based on the parameter reg_data. | |
| int | ads1219_reset (void) |
| This function starts up the ADS1219. | |
| int | ads1219_voltage_raw (uint32_t *voltage) |
| int | ads1219_voltage (double *voltage) |
| This function reads the current ADC voltage value. | |
| int | ads1219_current_raw (uint32_t *current) |
| int | ads1219_current (double *current) |
| This function reads the current ADC ampere value. | |
| 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) |
Soil Power Sensor ADS12 library.
This file provides a function to read from the ADS1219.
This file was copied and modified from the ENTS libraries.
TODO (jmadden173): Add support for data ready pin TODO (jmadden173): Improve lib with big bang for regs TODO (jmadden173): Add offset calibration at startup
Definition in file ads1219.c.
| enum ads1219_cmd_t |
| int configure | ( | const ConfigReg | reg_data | ) |
This function reconfigures the ADS1219 based on the parameter reg_data.
| reg_data |
Definition at line 142 of file ads1219.c.
References ADS1219_CONFIGURE, ADS1219_SUCCESS, cmd_wreg, and ConfigReg::value.
Referenced by ads1219_current_raw(), and ads1219_voltage_raw().
| int measure | ( | uint32_t * | meas | ) |
Measure from the adc.
| mwas | Raw measurement |
Definition at line 231 of file ads1219.c.
References ADS1219_CONVERSION, ADS1219_MEASURE, ADS1219_SUCCESS, cmd_rdata, cmd_start, power_off(), and power_on().
Referenced by ads1219_current_raw(), and ads1219_voltage_raw().
| void power_off | ( | void | ) |
| void power_on | ( | void | ) |
GPIO port for adc data ready line.
GPIO pin for adc data ready line
Turn on power to analog circuit
Has a blocking wait of 1 mS to account for the startup time of OpAmps. This should be an order of magnitude greater than the startup or turn-on time of the opamps used in the circuit.
MAX9944 - N/A INA296 - 20 uS THS4532 - 420 nS
Definition at line 219 of file ads1219.c.
Referenced by measure().