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
void ads1220_read(struct Ads1220 *ads)
static void ads1220_send_config(struct Ads1220 *ads)
void ads1220_event(struct Ads1220 *ads)
void ads1220_configure(struct Ads1220 *ads)
void ads1220_init(struct Ads1220 *ads, struct spi_periph *spi_p, uint8_t slave_idx)
#define ADS1220_WREG(_reg, _nb)
Driver for the ADS1220 24-bits ADC from TI SPI communication.
enum Ads1220VRef vref
voltage ref
struct spi_transaction spi_trans
spi transaction
volatile uint8_t tx_buf[ADS1220_BUFFER_LEN]
transmit buffer
enum Ads1220Imux i1mux
IDAC routing 1.
enum Ads1220Idac idac
IDAC config.
enum Ads1220Imux i2mux
IDAC routing 2.
volatile bool data_available
data ready flag
enum Ads1220Gain gain
gain
enum Ads1220SampleRate rate
data output rate
enum Ads1220ConfStatus status
config status
struct Ads1220Config config
configuration
struct spi_periph * spi_p
spi peripheral
uint32_t data
raw ADC value
enum Ads1220ConvMode conv
conversion mode
volatile uint8_t rx_buf[ADS1220_BUFFER_LEN]
receive buffer
bool pga_bypass
bypass PGA (PGA enabled = 0)
enum Ads1220Mux mux
input multiplexer
enum SPIClockPolarity cpol
clock polarity control
enum SPIClockPhase cpha
clock phase control
enum SPISlaveSelect select
slave selection behavior
SPICallback before_cb
NULL or function called before the transaction.
SPICallback after_cb
NULL or function called after the transaction.
enum SPIDataSizeSelect dss
data transfer word size
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
uint16_t input_length
number of data words to read
enum SPIClockDiv cdiv
prescaler of main clock to use as SPI clock
volatile uint8_t * input_buf
pointer to receive buffer for DMA
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
enum SPIBitOrder bitorder
MSB/LSB order.
uint16_t output_length
number of data words to write
enum SPITransactionStatus status
bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit SPI transaction.
@ SPICpolIdleLow
CPOL = 0.
@ SPISelectUnselect
slave is selected before transaction and unselected after
SPI peripheral structure.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.