Skyward boardcore
|
Driver for ADS131M08 8 simultaneous channels adc. More...
#include <ADS131M08.h>
Classes | |
struct | Config |
Public Member Functions | |
ADS131M08 (SPIBusInterface &bus, miosix::GpioPin cs, SPIBusConfig spiConfig, const Config &config) | |
bool | init () override |
Initialize the sensor. | |
bool | reset () |
void | applyConfig (Config config) |
Overwrites the sensor settings. | |
void | calibrateOffset (ADS131M08Defs::Channel channel) |
Samples each channel, averages the samples and applies offset compensation in the device. | |
bool | selfTest () override |
The self test samples internally connects each channel to known test signals and verifies if the sampled values are in an expected range. | |
![]() | |
Sensor () | |
Sensor (Sensor &&other) | |
virtual | ~Sensor () |
void | sample () override |
Sample the sensor. | |
virtual ADS131M08Data | getLastSample () |
![]() | |
virtual | ~AbstractSensor () |
SensorErrors | getLastError () |
Get last error for debugging purposes. Avoid silent fails. | |
Protected Member Functions | |
ADS131M08Data | sampleImpl () override |
Read a data sample from the sensor. In case of errors, the method should return the last available correct sample. | |
Additional Inherited Members | |
![]() | |
using | DataType |
![]() | |
DataType | lastSample |
miosix::FastMutex | mutex |
![]() | |
SensorErrors | lastError = SensorErrors::NO_ERRORS |
Driver for ADS131M08 8 simultaneous channels adc.
The ADS131M08 is an eight-channel, simultaneously-sampling, 24-bit, delta-sigma (ΔΣ), analog-to-digital converter (ADC). The individual ADC channels can be independently configured depending on the sensor input. A low-noise, programmable gain amplifier (PGA) provides gains ranging from 1 to 128 to amplify low-level signals.
Each channel on the ADS131M08 contains a digital decimation filter that demodulates the output of the ΔΣ modulators. Offset and gain calibration registers can be programmed to automatically adjust output samples for measured offset and gain errors.
The device features a "global-chop mode" to reduce offset error and offset drift inherent to the device due to mismatch in the internal circuitry to very low levels. When global-chop mode is enabled by setting the GC_EN bit in the GLOBAL_CHOP_CFG register, the device uses the conversion results from two consecutive internal conversions taken with opposite input polarity to cancel the device offset voltage.
Each channel has a dedicated input multiplexer that controls which signals are routed to the ADC channels:
Each channel also feature an integrated programmable gain amplifier (PGA) that provides gains of 1 to 128. Each channel has an independent PGA.
The device communicates via SPI, the maximum allowed frequency is 25MHz.
The ADC can work on 3 different power configurations depending on the clock frequency:
Definition at line 75 of file ADS131M08.h.
Boardcore::ADS131M08::ADS131M08 | ( | SPIBusInterface & | bus, |
miosix::GpioPin | cs, | ||
SPIBusConfig | spiConfig, | ||
const Config & | config ) |
Definition at line 35 of file ADS131M08.cpp.
void Boardcore::ADS131M08::applyConfig | ( | Config | config | ) |
Overwrites the sensor settings.
Writes a certain config to the sensor registers. This method is automatically called in ADS131M08::init() using as parameter the configuration given in the constructor.
config | The configuration to be applied. |
Definition at line 76 of file ADS131M08.cpp.
void Boardcore::ADS131M08::calibrateOffset | ( | ADS131M08Defs::Channel | channel | ) |
Samples each channel, averages the samples and applies offset compensation in the device.
Definition at line 91 of file ADS131M08.cpp.
|
overridevirtual |
Initialize the sensor.
Implements Boardcore::AbstractSensor.
Definition at line 43 of file ADS131M08.cpp.
bool Boardcore::ADS131M08::reset | ( | ) |
Definition at line 50 of file ADS131M08.cpp.
|
overrideprotectedvirtual |
Read a data sample from the sensor. In case of errors, the method should return the last available correct sample.
Implements Boardcore::Sensor< ADS131M08Data >.
Definition at line 293 of file ADS131M08.cpp.
|
overridevirtual |
The self test samples internally connects each channel to known test signals and verifies if the sampled values are in an expected range.
Implements Boardcore::AbstractSensor.
Definition at line 151 of file ADS131M08.cpp.