Crate ads129xx

Source
Expand description

Driver crate for the Texas Instruments ADS1292 24-bit 2-channel low-power analog front end for ECG applications.

This initial version supports the ADS1292 (for the most part), but it’s a goal to support the ADS1291 and ADS1292R as well.

Usage:

// spi: spi interface
// ncs: not-Chip-Select pin
// timer: timer, 500kHz timeout.

let spi_device = SpiDevice::new(spi, ncs, timer)?;
let mut ads = Ads1292::init(spi_device)?;

// start conversions
ads.cmd(ads129xx::Command::START).unwrap();
ads.wait(200)?; // Wait a while in between sending commands
ads.cmd(ads129xx::Command::RDATAC).unwrap();
ads.wait(200)?;

let mut stream = ads.into_data_stream()?;

let mut buf = [[ChannelData::default(); 2]; 10];

// Opens stream, sends RDATAC command to ads
let data_stream = ads1292.into_data_stream()?;
ads.wait(200)?;

// A buffer to read data into
let mut buf = [[Ads1292Data::default(); 2]; 2000];

for i in buf.iter_mut() {
   // some way of finding out NDRDY has been low since last read (preferably by an interrupt-set flag)
   // data_stream always returns data (for now), so we can unwrap here
   *i = data_stream.next().unwrap()?;
}
// Don't forget to close; this will send the SDATAC command to the ads
data_stream.into_inner();

Modules§

ads1292
Ads1292-specific code
data
Data representation
spi
SPI interface

Structs§

ChannelSettings
Configuration for the register that configures the power mode, PGA gain, and multiplexer settings channels.
Conf1
Configuration for the register that configures each ADC channel sample rate.
Conf2
Configuration for the register that configures the test signal, clock, reference and LOFF buffer.
Loff
Configuration for the register that configures the lead-off detection operation.
LoffSense
Configuration for the register that selects the positive and negative side from each channel for lead-off detection.
RLDSenseSelection
Configuration for the register that controls the selection of the positive and negative signals from each channel for right leg drive derivation.
RespConf2
Configuration for the register that controls the respiration and calibration functionality.

Enums§

Ads129xxError
ChopFrequency
Command
SPI commands
GainSetting
InputSelection
LeadOffCurrentMagnitude
Register
Read / write-able registers
SampleRate

Traits§

Ads129xx
Represents any ADS129xx device

Type Aliases§

Result