34 #define ADS1220_WREG(_reg, _nb) ((1<<6)|(_reg<<2)|(_nb-1))
35 #define ADS1220_RREG(_reg, _nb) ((1<<5)|(_reg<<2)|(_nb-1))
36 #define ADS1220_RESET 0x06
37 #define ADS1220_START_SYNC 0x08
38 #define ADS1220_POWERDOWN 0x02
39 #define ADS1220_RDATA 0x10
42 #define ADS1220_CONF0 0x0
43 #define ADS1220_CONF1 0x1
44 #define ADS1220_CONF2 0x2
45 #define ADS1220_CONF3 0x3
enum SPIClockPolarity cpol
clock polarity control
enum Ads1220ConvMode conv
conversion mode
enum SPIClockDiv cdiv
prescaler of main clock to use as SPI clock
uint16_t output_length
number of data words to write
void ads1220_event(struct Ads1220 *ads)
enum Ads1220Imux i2mux
IDAC routing 2.
volatile bool data_available
data ready flag
enum Ads1220Mux mux
input multiplexer
void ads1220_configure(struct Ads1220 *ads)
bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit SPI transaction.
volatile uint8_t rx_buf[ADS1220_BUFFER_LEN]
receive buffer
enum SPIBitOrder bitorder
MSB/LSB order.
struct spi_transaction spi_trans
spi transaction
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
struct spi_periph * spi_p
spi peripheral
struct Ads1220Config config
configuration
enum SPISlaveSelect select
slave selection behavior
enum SPIClockPhase cpha
clock phase control
Driver for the ADS1220 24-bits ADC from TI SPI communication.
SPI peripheral structure.
enum Ads1220Gain gain
gain
static void ads1220_send_config(struct Ads1220 *ads)
bool pga_bypass
bypass PGA (PGA enabled = 0)
enum Ads1220VRef vref
voltage ref
SPICallback after_cb
NULL or function called after the transaction.
uint16_t input_length
number of data words to read
void ads1220_read(struct Ads1220 *ads)
enum Ads1220SampleRate rate
data output rate
enum Ads1220ConfStatus status
config status
uint32_t data
raw ADC value
slave is selected before transaction and unselected after
enum Ads1220Idac idac
IDAC config.
void ads1220_init(struct Ads1220 *ads, struct spi_periph *spi_p, uint8_t slave_idx)
enum SPIDataSizeSelect dss
data transfer word size
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
#define ADS1220_WREG(_reg, _nb)
volatile uint8_t * input_buf
pointer to receive buffer for DMA
SPICallback before_cb
NULL or function called before the transaction.
enum Ads1220Imux i1mux
IDAC routing 1.
enum SPITransactionStatus status
volatile uint8_t tx_buf[ADS1220_BUFFER_LEN]
transmit buffer