ADS129xx
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.
Contributions welcome!
Usage example
// spi: spi interface
// ncs: not-Chip-Select pin
// timer: timer, 500kHz timeout.
let spi_device = new?;
let mut ads = init?;
// start conversions
ads.cmd.unwrap;
ads.wait?; // Wait a while in between sending commands
ads.cmd.unwrap;
ads.wait?;
let mut stream = ads.into_data_stream?;
let mut buf = ;
// Opens stream, sends RDATAC command to ads
let data_stream = ads1292.into_data_stream?;
ads.wait?;
// A buffer to read data into
let mut buf = ;
for i in buf.iter_mut
// Don't forget to close; this will send the SDATAC command to the ads
data_stream.into_inner;
Functionality
- Send commands:
ads1292.cmd?;
- Write to registers
ads1292.write_register?;
- Read from registers
let lead_off_status = ads1292.read_register?;
- Read data
let data = ads1292.read_data?;
- Read data continuously
// Opens stream, sends RDATAC command to ads
let data_stream = ads1292.into_data_stream?;
let mut buf = ;
for i in buf.iter_mut
// Don't forget to close; this will send the SDATAC command to the ads
data_stream.into_inner;
TODO's
- Support ADS1292R
- Support ADS1291
- Non-blockingly wait after sending SPI commands
- Documentation
- Separate device-specific and universal code