|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
#include <STAR_ADS126X.h>
Classes | |
| struct | ADCReading |
Public Member Functions | |
| void | bypassPGA () |
| void | setInputMux (uint8_t pos, uint8_t neg) |
| void | setOutputTDACP (uint8_t on) |
| void | setOutputTDACN (uint8_t on) |
| void | setOutputmagnitudeTDACP (uint8_t mag) |
| void | setOutputmagnitudeTDACN (uint8_t mag) |
| IDAC functionality. | |
| void | setReference (uint8_t neg, uint8_t pos) |
| TDAC Registers. | |
| ads126x_reading | readADC1 () |
| void | setIDAC1Mag (uint8_t mag) |
| void | setIDAC2Mag (uint8_t mag) |
| void | setBiasADC (uint8_t adc) |
| void | setBiasPolarity (uint8_t pol) |
| void | setBiasMagnitude (uint8_t mag) |
| MODE2 register. | |
| void | stopADC1 () |
| void | startADC1 () |
| ADS126X (void) | |
| < Initial ADC Setup | |
| void | begin (uint8_t chip_select) |
| void | begin (uint8_t chip_select, SPIClass *spi) |
| Regular ADC Commands. | |
| void | begin (void) |
| void | setStartPin (uint8_t pin) |
| void | noOperation (void) |
| void | reset (void) |
| void | startADC1 (void) |
| void | stopADC1 (void) |
| void | startADC2 (void) |
| void | stopADC2 (void) |
| void | setInputMux (uint8_t pos_pin, uint8_t neg_pin) |
| void | setADC2Mux (uint8_t pos_pin, uint8_t neg_pin) |
| ADCReading | readADC1 () |
| ADCReading | readADC1 (uint8_t pos_pin, uint8_t neg_pin) |
| ADCReading | readADC2 () |
| ADCReading | readADC2 (uint8_t pos_pin, uint8_t neg_pin) |
| SPI Communication Commands. | |
| void | calibrateSysOffsetADC1 (uint8_t shorted1, uint8_t shorted2) |
| void | calibrateGainADC1 (uint8_t vcc_pin, uint8_t gnd_pin) |
| void | calibrateSelfOffsetADC1 (void) |
| void | calibrateSysOffsetADC2 (uint8_t shorted1, uint8_t shorted2) |
| void | calibrateGainADC2 (uint8_t vcc_pin, uint8_t gnd_pin) |
| void | calibrateSelfOffsetADC2 (void) |
| void | setIDAC1Pin (uint8_t pin) |
| void | setIDAC2Pin (uint8_t pin) |
| void | setIDAC1Mag (uint8_t magnitude) |
| void | setIDAC2Mag (uint8_t magnitude) |
| bool | checkResetBit (void) |
| void | clearResetBit (void) |
| void | enableLevelShift (void) |
| void | disableLevelShift (void) |
| void | enableInternalReference (void) |
| void | disableInternalReference (void) |
| void | disableCheck (void) |
| void | setChecksumMode (void) |
| void | setCRCMode (void) |
| bool | lastChecksum (void) |
| void | enableStatus (void) |
| void | disableStatus (void) |
| uint8_t | lastStatus (void) |
| bool | lastADC2Status (void) |
| bool | lastADC1Status (void) |
| bool | lastClockSource (void) |
| bool | lastADC1LowReferenceAlarm (void) |
| bool | lastADC1PGAOutputLowAlarm (void) |
| bool | lastADC1PGAOutputHighAlarm (void) |
| bool | lastADC1PGADifferentialOutputAlarm (void) |
| bool | lastReset (void) |
| void | setContinuousMode (void) |
| void | setPulseMode (void) |
| void | setChopMode (uint8_t mode) |
| void | setDelay (uint8_t del) |
| MODE1 register. | |
| void | setFilter (uint8_t filter) |
| void | setBiasADC (uint8_t adc_choice) |
| void | setBiasPolarity (uint8_t polarity) |
| void | setBiasMagnitude (uint8_t mag) |
| void | enablePGA (void) |
| void | bypassPGA (void) |
| void | setGain (uint8_t gain) |
| void | setRate (uint8_t rate) |
| void | setReference (uint8_t negativeReference, uint8_t positiveReference) |
| void | setOutputTDACP (bool enable) |
| void | setReservedTDACP () |
| void | setOutputmagnitudeTDACP (uint8_t mag) |
| void | setOutputTDACN (bool enable) |
| void | setReservedTDACN () |
| void | setOutputmagnitudeTDACN (uint8_t mag) |
| void | sendCommand (uint8_t command) |
| void | readRegisters (uint8_t start_reg, uint8_t num) |
| void | writeRegisters (uint8_t start_reg, uint8_t num) |
| uint8_t | readRegister (uint8_t reg) |
| SPI Communication Commands. | |
| void | readAllRegisters () |
| void | writeRegister (uint8_t reg) |
| void | spi_rw (uint8_t buff[], uint8_t len) |
| bool | check_checksum (uint32_t val, uint8_t byt) |
| bool | check_crc (uint32_t val, uint8_t byt) |
| uint8_t | msb_pos (uint64_t val) |
| MODE0 register. | |
Public Attributes | |
| ADS126X_REGISTER_Type | REGISTER |
| __IO unsigned char * | REGISTER_ARRAY = (uint8_t *)®ISTER.ID.reg |
| bool | cs_used = false |
| uint8_t | cs_pin |
| bool | start_used = false |
| uint8_t | start_pin |
| SPIClass * | _spi |
| ADS126X_STATUS_Type | STATUS |
| bool | CHECKSUM |
Definition at line 25 of file STAR_ADS126X.h.
| ADS126X::ADS126X | ( | void | ) |
< Initial ADC Setup
Definition at line 7 of file STAR_ADS126X.cpp.
| void ADS126X::begin | ( | uint8_t | chip_select | ) |
Definition at line 10 of file STAR_ADS126X.cpp.
References begin().
| void ADS126X::begin | ( | uint8_t | chip_select, |
| SPIClass * | spi ) |
Regular ADC Commands.
Definition at line 14 of file STAR_ADS126X.cpp.
References _spi, cs_pin, cs_used, digitalWrite(), HIGH, OUTPUT, pinMode(), readAllRegisters(), and reset().
| void ADS126X::begin | ( | void | ) |
Referenced by begin().
|
inline |
Definition at line 27 of file STAR_ADS126X.h.
| void ADS126X::bypassPGA | ( | void | ) |
| void ADS126X::calibrateGainADC1 | ( | uint8_t | vcc_pin, |
| uint8_t | gnd_pin ) |
| void ADS126X::calibrateGainADC2 | ( | uint8_t | vcc_pin, |
| uint8_t | gnd_pin ) |
| void ADS126X::calibrateSelfOffsetADC1 | ( | void | ) |
| void ADS126X::calibrateSelfOffsetADC2 | ( | void | ) |
| void ADS126X::calibrateSysOffsetADC1 | ( | uint8_t | shorted1, |
| uint8_t | shorted2 ) |
| void ADS126X::calibrateSysOffsetADC2 | ( | uint8_t | shorted1, |
| uint8_t | shorted2 ) |
| bool ADS126X::check_checksum | ( | uint32_t | val, |
| uint8_t | byt ) |
Definition at line 335 of file STAR_ADS126X.cpp.
References ADS126X_CHECK_BYTE, and diff().
Referenced by readADC2().
| bool ADS126X::check_crc | ( | uint32_t | val, |
| uint8_t | byt ) |
Definition at line 351 of file STAR_ADS126X.cpp.
References ADS126X_CRC_BYTE, CRC, and msb_pos().
Referenced by readADC2().
| bool ADS126X::checkResetBit | ( | void | ) |
| void ADS126X::clearResetBit | ( | void | ) |
| void ADS126X::disableCheck | ( | void | ) |
| void ADS126X::disableInternalReference | ( | void | ) |
| void ADS126X::disableLevelShift | ( | void | ) |
| void ADS126X::disableStatus | ( | void | ) |
| void ADS126X::enableInternalReference | ( | void | ) |
| void ADS126X::enableLevelShift | ( | void | ) |
| void ADS126X::enablePGA | ( | void | ) |
Definition at line 425 of file STAR_ADS126X.cpp.
References ADS126X_MODE2, ADS126X_PGA_ENABLE, REGISTER, and writeRegister().
| void ADS126X::enableStatus | ( | void | ) |
| bool ADS126X::lastADC1LowReferenceAlarm | ( | void | ) |
| bool ADS126X::lastADC1PGADifferentialOutputAlarm | ( | void | ) |
| bool ADS126X::lastADC1PGAOutputHighAlarm | ( | void | ) |
| bool ADS126X::lastADC1PGAOutputLowAlarm | ( | void | ) |
| bool ADS126X::lastADC1Status | ( | void | ) |
| bool ADS126X::lastADC2Status | ( | void | ) |
| bool ADS126X::lastChecksum | ( | void | ) |
| bool ADS126X::lastClockSource | ( | void | ) |
| bool ADS126X::lastReset | ( | void | ) |
| uint8_t ADS126X::lastStatus | ( | void | ) |
| uint8_t ADS126X::msb_pos | ( | uint64_t | val | ) |
| void ADS126X::noOperation | ( | void | ) |
Definition at line 29 of file STAR_ADS126X.cpp.
References ADS126X_NOP, and sendCommand().
|
inline |
Definition at line 42 of file STAR_ADS126X.h.
References g_mock_adc_checksum, and g_mock_adc_value.
Referenced by readADC1().
| ADCReading ADS126X::readADC1 | ( | ) |
References neg_pin.
| ADS126X::ADCReading ADS126X::readADC1 | ( | uint8_t | pos_pin, |
| uint8_t | neg_pin ) |
Definition at line 188 of file STAR_ADS126X.cpp.
References neg_pin, readADC1(), and setInputMux().
| ADS126X::ADCReading ADS126X::readADC2 | ( | ) |
Definition at line 193 of file STAR_ADS126X.cpp.
References ADS126X_CHECK_CRC, ADS126X_CHECKSUM, ADS126X_RDATA2, check_checksum(), check_crc(), CHECKSUM, cs_pin, digitalWrite(), HIGH, LOW, reg, REGISTER, result, spi_rw(), and STATUS.
Referenced by readADC2().
| ADS126X::ADCReading ADS126X::readADC2 | ( | uint8_t | pos_pin, |
| uint8_t | neg_pin ) |
SPI Communication Commands.
Definition at line 253 of file STAR_ADS126X.cpp.
References neg_pin, readADC2(), and setADC2Mux().
| void ADS126X::readAllRegisters | ( | ) |
Definition at line 322 of file STAR_ADS126X.cpp.
References ADS126X_REG_NUM, and readRegisters().
Referenced by begin().
| uint8_t ADS126X::readRegister | ( | uint8_t | reg | ) |
SPI Communication Commands.
Definition at line 327 of file STAR_ADS126X.cpp.
References readRegisters(), reg, and REGISTER_ARRAY.
| void ADS126X::readRegisters | ( | uint8_t | start_reg, |
| uint8_t | num ) |
Definition at line 295 of file STAR_ADS126X.cpp.
References ADS126X_RREG, cs_pin, digitalWrite(), HIGH, LOW, REGISTER_ARRAY, and spi_rw().
Referenced by readAllRegisters(), and readRegister().
| void ADS126X::reset | ( | void | ) |
Definition at line 33 of file STAR_ADS126X.cpp.
References ADS126X_RESET, and sendCommand().
Referenced by begin().
| void ADS126X::sendCommand | ( | uint8_t | command | ) |
Definition at line 260 of file STAR_ADS126X.cpp.
References cs_pin, digitalWrite(), HIGH, LOW, and spi_rw().
Referenced by noOperation(), reset(), startADC2(), and stopADC2().
| void ADS126X::setADC2Mux | ( | uint8_t | pos_pin, |
| uint8_t | neg_pin ) |
Definition at line 123 of file STAR_ADS126X.cpp.
References ADS126X_ADC2MUX, neg_pin, REGISTER, and writeRegister().
Referenced by readADC2().
|
inline |
Definition at line 50 of file STAR_ADS126X.h.
References adc().
| void ADS126X::setBiasADC | ( | uint8_t | adc_choice | ) |
|
inline |
MODE2 register.
Definition at line 54 of file STAR_ADS126X.h.
| void ADS126X::setBiasMagnitude | ( | uint8_t | mag | ) |
|
inline |
Definition at line 52 of file STAR_ADS126X.h.
| void ADS126X::setBiasPolarity | ( | uint8_t | polarity | ) |
| void ADS126X::setChecksumMode | ( | void | ) |
| void ADS126X::setChopMode | ( | uint8_t | mode | ) |
Definition at line 387 of file STAR_ADS126X.cpp.
References ADS126X_MODE0, REGISTER, and writeRegister().
| void ADS126X::setContinuousMode | ( | void | ) |
Definition at line 377 of file STAR_ADS126X.cpp.
References ADS126X_CONV_CONT, ADS126X_MODE0, REGISTER, and writeRegister().
| void ADS126X::setCRCMode | ( | void | ) |
| void ADS126X::setDelay | ( | uint8_t | del | ) |
MODE1 register.
Definition at line 392 of file STAR_ADS126X.cpp.
References ADS126X_MODE0, REGISTER, and writeRegister().
| void ADS126X::setFilter | ( | uint8_t | filter | ) |
Definition at line 401 of file STAR_ADS126X.cpp.
References ADS126X_MODE1, REGISTER, and writeRegister().
| void ADS126X::setGain | ( | uint8_t | gain | ) |
Definition at line 435 of file STAR_ADS126X.cpp.
References ADS126X_MODE2, REGISTER, and writeRegister().
|
inline |
Definition at line 46 of file STAR_ADS126X.h.
| void ADS126X::setIDAC1Mag | ( | uint8_t | magnitude | ) |
| void ADS126X::setIDAC1Pin | ( | uint8_t | pin | ) |
Definition at line 501 of file STAR_ADS126X.cpp.
References ADS126X_IDACMUX, REGISTER, and writeRegister().
|
inline |
Definition at line 48 of file STAR_ADS126X.h.
| void ADS126X::setIDAC2Mag | ( | uint8_t | magnitude | ) |
| void ADS126X::setIDAC2Pin | ( | uint8_t | pin | ) |
Definition at line 509 of file STAR_ADS126X.cpp.
References ADS126X_IDACMUX, REGISTER, and writeRegister().
|
inline |
Definition at line 29 of file STAR_ADS126X.h.
Referenced by readADC1().
| void ADS126X::setInputMux | ( | uint8_t | pos_pin, |
| uint8_t | neg_pin ) |
References neg_pin.
|
inline |
IDAC functionality.
Definition at line 37 of file STAR_ADS126X.h.
| void ADS126X::setOutputmagnitudeTDACN | ( | uint8_t | mag | ) |
|
inline |
Definition at line 35 of file STAR_ADS126X.h.
| void ADS126X::setOutputmagnitudeTDACP | ( | uint8_t | mag | ) |
References enable().
| void ADS126X::setOutputTDACN | ( | bool | enable | ) |
Definition at line 480 of file STAR_ADS126X.cpp.
References ADS126X_TDACN, enable(), REGISTER, and writeRegister().
|
inline |
Definition at line 33 of file STAR_ADS126X.h.
| void ADS126X::setOutputTDACP | ( | bool | enable | ) |
Definition at line 458 of file STAR_ADS126X.cpp.
References ADS126X_TDACP, enable(), REGISTER, and writeRegister().
|
inline |
Definition at line 31 of file STAR_ADS126X.h.
| void ADS126X::setPulseMode | ( | void | ) |
Definition at line 382 of file STAR_ADS126X.cpp.
References ADS126X_CONV_PULSE, ADS126X_MODE0, REGISTER, and writeRegister().
| void ADS126X::setRate | ( | uint8_t | rate | ) |
Definition at line 440 of file STAR_ADS126X.cpp.
References ADS126X_MODE2, REGISTER, and writeRegister().
|
inline |
TDAC Registers.
Definition at line 39 of file STAR_ADS126X.h.
| void ADS126X::setReference | ( | uint8_t | negativeReference, |
| uint8_t | positiveReference ) |
References enable().
| void ADS126X::setReservedTDACN | ( | ) |
| void ADS126X::setReservedTDACP | ( | ) |
| void ADS126X::setStartPin | ( | uint8_t | pin | ) |
| void ADS126X::spi_rw | ( | uint8_t | buff[], |
| uint8_t | len ) |
Definition at line 529 of file STAR_ADS126X.cpp.
References _spi, and SPI_MODE1.
Referenced by readADC2(), readRegisters(), sendCommand(), and writeRegisters().
|
inline |
Definition at line 58 of file STAR_ADS126X.h.
| void ADS126X::startADC1 | ( | void | ) |
| void ADS126X::startADC2 | ( | void | ) |
Definition at line 45 of file STAR_ADS126X.cpp.
References ADS126X_START2, and sendCommand().
|
inline |
Definition at line 56 of file STAR_ADS126X.h.
| void ADS126X::stopADC1 | ( | void | ) |
| void ADS126X::stopADC2 | ( | void | ) |
Definition at line 49 of file STAR_ADS126X.cpp.
References ADS126X_STOP2, and sendCommand().
| void ADS126X::writeRegister | ( | uint8_t | reg | ) |
Definition at line 317 of file STAR_ADS126X.cpp.
References reg, and writeRegisters().
Referenced by enablePGA(), setADC2Mux(), setChopMode(), setContinuousMode(), setDelay(), setFilter(), setGain(), setIDAC1Pin(), setIDAC2Pin(), setOutputTDACN(), setOutputTDACP(), setPulseMode(), and setRate().
| void ADS126X::writeRegisters | ( | uint8_t | start_reg, |
| uint8_t | num ) |
Definition at line 271 of file STAR_ADS126X.cpp.
References ADS126X_WREG, cs_pin, digitalWrite(), HIGH, LOW, REGISTER_ARRAY, and spi_rw().
Referenced by writeRegister().
| SPIClass* ADS126X::_spi |
Definition at line 130 of file STAR_ADS126X.h.
| bool ADS126X::CHECKSUM |
Definition at line 133 of file STAR_ADS126X.h.
Referenced by readADC2().
| uint8_t ADS126X::cs_pin |
Definition at line 126 of file STAR_ADS126X.h.
Referenced by begin(), readADC2(), readRegisters(), sendCommand(), and writeRegisters().
| bool ADS126X::cs_used = false |
Definition at line 125 of file STAR_ADS126X.h.
Referenced by begin().
| ADS126X_REGISTER_Type ADS126X::REGISTER |
Definition at line 119 of file STAR_ADS126X.h.
Referenced by enablePGA(), readADC2(), setADC2Mux(), setChopMode(), setContinuousMode(), setDelay(), setFilter(), setGain(), setIDAC1Pin(), setIDAC2Pin(), setOutputTDACN(), setOutputTDACP(), setPulseMode(), and setRate().
| __IO unsigned char* ADS126X::REGISTER_ARRAY = (uint8_t *)®ISTER.ID.reg |
Definition at line 123 of file STAR_ADS126X.h.
Referenced by readRegister(), readRegisters(), and writeRegisters().
| uint8_t ADS126X::start_pin |
Definition at line 128 of file STAR_ADS126X.h.
| bool ADS126X::start_used = false |
Definition at line 127 of file STAR_ADS126X.h.
| ADS126X_STATUS_Type ADS126X::STATUS |
Definition at line 132 of file STAR_ADS126X.h.
Referenced by readADC2().