43#define AD719X_SLAVE_ID 1
46#define AD719X_REG_COMM 0
47#define AD719X_REG_STAT 0
48#define AD719X_REG_MODE 1
49#define AD719X_REG_CONF 2
50#define AD719X_REG_DATA 3
51#define AD719X_REG_ID 4
52#define AD719X_REG_GPOCON 5
53#define AD719X_REG_OFFSET 6
54#define AD719X_REG_FULLSCALE 7
57#define AD719X_COMM_WEN (1 << 7)
58#define AD719X_COMM_WRITE (0 << 6)
59#define AD719X_COMM_READ (1 << 6)
60#define AD719X_COMM_ADDR(x) (((x) & 0x7) << 3)
61#define AD719X_COMM_CREAD (1 << 2)
64#define AD719X_STAT_RDY (1 << 7)
65#define AD719X_STAT_ERR (1 << 6)
66#define AD719X_STAT_NOREF (1 << 5)
67#define AD719X_STAT_PARITY (1 << 4)
68#define AD719X_STAT_CH3 (1 << 3)
69#define AD719X_STAT_CH2 (1 << 2)
70#define AD719X_STAT_CH1 (1 << 1)
71#define AD719X_STAT_CH0 (1 << 0)
74#define AD719X_MODE_SEL(x) (((uint32_t)(x) & 0x7) << 21)
75#define AD719X_MODE_DAT_STA ((uint32_t)1 << 20)
76#define AD719X_MODE_CLKSRC(x) (((uint32_t)(x) & 0x3) << 18)
77#define AD719X_MODE_AVG(x) (((uint32_t)(x) & 0x3) << 16)
78#define AD719X_MODE_SINC3 (1 << 15)
79#define AD719X_MODE_ENPAR (1 << 13)
80#define AD719X_MODE_CLKDIV (1 << 12)
81#define AD719X_MODE_SCYCLE (1 << 11)
82#define AD719X_MODE_REJ60 (1 << 10)
83#define AD719X_MODE_RATE(x) ((x) & 0x3FF)
86#define AD719X_AVG_NONE 0
87#define AD719X_AVG_BY_2 1
88#define AD719X_AVG_BY_8 2
89#define AD719X_AVG_BY_16 3
92#define AD719X_CONF_CHOP ((uint32_t)1 << 23)
93#define AD719X_CONF_REFSEL ((uint32_t)1 << 20)
94#define AD719X_CONF_PSEUDO ((uint32_t)1 << 18)
95#define AD719X_CONF_CHAN(x) ((uint32_t)((x) & 0x3FF) << 8)
96#define AD719X_CONF_BURN (1 << 7)
97#define AD719X_CONF_REFDET (1 << 6)
98#define AD719X_CONF_BUF (1 << 4)
99#define AD719X_CONF_UNIPOLAR (1 << 3)
100#define AD719X_CONF_GAIN(x) ((x) & 0x7)
103#define AD719X_CH_MASK(channel) NO_OS_BIT(channel)
114#define AD719X_CH_TEMP 8
115#define AD719X_CH_SHORT 9
118#define AD7190_4_ID_MASK 0x0F
119#define AD7195_ID_MASK 0xFF
122#define AD719X_GPOCON_BPDSW (1 << 6)
123#define AD719X_GPOCON_GP32EN (1 << 5)
124#define AD719X_GPOCON_GP10EN (1 << 4)
125#define AD719X_GPOCON_P3DAT (1 << 3)
126#define AD719X_GPOCON_P2DAT (1 << 2)
127#define AD719X_GPOCON_P1DAT (1 << 1)
128#define AD719X_GPOCON_P0DAT (1 << 0)
224 uint32_t reg_value, uint8_t bytes_number);
228 uint8_t bytes_number, uint32_t *reg_data);
232 uint8_t reg_addr, uint32_t mask, uint32_t data,
250 uint8_t mode, uint8_t channel);
260 uint16_t out_rate_code);
278 uint8_t sample_number, uint32_t *samples_avg);
285 uint32_t raw_data,
float v_ref);
int ad719x_reset(struct ad719x_dev *dev)
Resets the device.
Definition ad719x.c:303
int ad719x_config_input_mode(struct ad719x_dev *dev, uint8_t mode)
Configures the input mode of the ADC.
Definition ad719x.c:452
int ad719x_clock_select(struct ad719x_dev *dev, enum ad719x_adc_clock clk_select)
Selects the clock source of the ADC.
Definition ad719x.c:532
int ad719x_channels_select(struct ad719x_dev *dev, uint16_t chn_mask)
Selects the channels to be enabled.
Definition ad719x.c:385
int ad719x_remove(struct ad719x_dev *dev)
Free the resources allocated by ad719x_init().
Definition ad719x.c:182
float ad719x_convert_to_volts(struct ad719x_dev *dev, uint32_t raw_data, float v_ref)
Converts 24-bit raw data to milivolts.
Definition ad719x.c:731
int ad719x_temperature_read(struct ad719x_dev *dev, float *temp)
Read data from temperature sensor and converts it to Celsius degrees.
Definition ad719x.c:690
ad719x_adc_modes
Definition ad719x.h:151
@ AD719X_MODE_CAL_INT_ZERO
Definition ad719x.h:161
@ AD719X_MODE_PWRDN
Definition ad719x.h:159
@ AD719X_MODE_IDLE
Definition ad719x.h:157
@ AD719X_MODE_CONT
Definition ad719x.h:153
@ AD719X_MODE_SINGLE
Definition ad719x.h:155
@ AD719X_MODE_CAL_SYS_ZERO
Definition ad719x.h:165
@ AD719X_MODE_CAL_SYS_FULL
Definition ad719x.h:167
@ AD719X_MODE_CAL_INT_FULL
Definition ad719x.h:163
int ad719x_set_bridge_switch(struct ad719x_dev *dev, uint8_t bpdsw_select)
Opens or closes the bridge power-down switch of the ADC.
Definition ad719x.c:559
int ad719x_buffer_select(struct ad719x_dev *dev, uint8_t buff_en)
Enables or disables the buffer on the ADC input channels.
Definition ad719x.c:479
int ad719x_set_operating_mode(struct ad719x_dev *dev, enum ad719x_adc_modes opt_mode)
Sets device into the specified operating mode.
Definition ad719x.c:335
int ad719x_single_conversion(struct ad719x_dev *dev, uint32_t *reg_data)
Returns the result of a single conversion.
Definition ad719x.c:618
int ad719x_calibrate(struct ad719x_dev *dev, uint8_t mode, uint8_t channel)
Performs the given calibration to the specified channel.
Definition ad719x.c:424
int ad719x_get_register_value(struct ad719x_dev *dev, uint8_t reg_addr, uint8_t bytes_number, uint32_t *reg_data)
Reads the value of a register.
Definition ad719x.c:243
int ad719x_wait_rdy_go_low(struct ad719x_dev *dev)
Waits for RDY pin to go low.
Definition ad719x.c:357
int ad719x_init(struct ad719x_dev **device, struct ad719x_init_param init_param)
Initializes the communication peripheral and the initial Values for AD719X Board and resets the devic...
Definition ad719x.c:51
ad719x_adc_clock
Definition ad719x.h:140
@ AD719X_EXT_CRYSTAL_MCLK1_MCLK2
Definition ad719x.h:142
@ AD719X_INT_CLK_4_92_MHZ_TRIST
Definition ad719x.h:146
@ AD719X_EXT_CRYSTAL_MCLK2
Definition ad719x.h:144
@ AD719X_INT_CLK_4_92_MHZ
Definition ad719x.h:148
int ad719x_set_register_value(struct ad719x_dev *dev, uint8_t reg_addr, uint32_t reg_value, uint8_t bytes_number)
Writes data into a register.
Definition ad719x.c:209
int ad719x_output_rate_select(struct ad719x_dev *dev, uint16_t out_rate_code)
Selects the filter output data rate of the ADC.
Definition ad719x.c:503
int ad719x_continuous_read_avg(struct ad719x_dev *dev, uint8_t sample_number, uint32_t *samples_avg)
Returns the average of several conversion results.
Definition ad719x.c:649
int ad719x_range_setup(struct ad719x_dev *dev, uint8_t polarity, enum ad719x_adc_gain range)
Selects the polarity of the conversion and the ADC input range.
Definition ad719x.c:591
int ad719x_set_masked_register_value(struct ad719x_dev *dev, uint8_t reg_addr, uint32_t mask, uint32_t data, uint8_t bytes)
Write masked data into device register.
Definition ad719x.c:278
ad719x_chip_id
Definition ad719x.h:170
@ AD7192
Definition ad719x.h:172
@ AD7190
Definition ad719x.h:171
@ AD7195
Definition ad719x.h:175
@ AD7193
Definition ad719x.h:173
@ AD7194
Definition ad719x.h:174
ad719x_adc_gain
Definition ad719x.h:130
@ AD719X_ADC_GAIN_128
Definition ad719x.h:137
@ AD719X_ADC_GAIN_1
Definition ad719x.h:132
@ AD719X_ADC_GAIN_8
Definition ad719x.h:133
@ AD719X_ADC_GAIN_16
Definition ad719x.h:134
@ AD719X_ADC_GAIN_32
Definition ad719x.h:135
@ AD719X_ADC_GAIN_64
Definition ad719x.h:136
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
Header file of GPIO Interface.
Header file of SPI Interface.
Header file of utility functions.
uint16_t data_rate_code
Definition ad719x.h:188
struct no_os_gpio_desc * sync_pin
Definition ad719x.h:183
uint8_t buffer
Definition ad719x.h:191
enum ad719x_chip_id chip_id
Definition ad719x.h:193
struct no_os_gpio_desc * gpio_miso
Definition ad719x.h:182
uint8_t bpdsw_mode
Definition ad719x.h:192
enum ad719x_adc_clock clock_source
Definition ad719x.h:189
uint8_t input_mode
Definition ad719x.h:190
enum ad719x_adc_gain current_gain
Definition ad719x.h:186
enum ad719x_adc_modes operating_mode
Definition ad719x.h:187
uint8_t current_polarity
Definition ad719x.h:185
struct no_os_spi_desc * spi_desc
Definition ad719x.h:180
uint8_t current_polarity
Definition ad719x.h:204
struct no_os_spi_init_param * spi_init
Definition ad719x.h:198
enum ad719x_adc_modes operating_mode
Definition ad719x.h:206
uint8_t bpdsw_mode
Definition ad719x.h:211
struct no_os_gpio_init_param * sync_pin
Definition ad719x.h:202
enum ad719x_chip_id chip_id
Definition ad719x.h:212
enum ad719x_adc_clock clock_source
Definition ad719x.h:208
uint8_t input_mode
Definition ad719x.h:209
uint8_t buffer
Definition ad719x.h:210
struct no_os_gpio_init_param * gpio_miso
Definition ad719x.h:200
enum ad719x_adc_gain current_gain
Definition ad719x.h:205
uint16_t data_rate_code
Definition ad719x.h:207
Definition ad9361_util.h:63
Structure holding the GPIO descriptor.
Definition no_os_gpio.h:84
Structure holding the parameters for GPIO initialization.
Definition no_os_gpio.h:67
Structure holding SPI descriptor.
Definition no_os_spi.h:180
Structure holding the parameters for SPI initialization.
Definition no_os_spi.h:128