no-OS
ad719x.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef __AD719X_H__
41 #define __AD719X_H__
42 
43 /******************************************************************************/
44 /***************************** Include Files **********************************/
45 /******************************************************************************/
46 #include <stdint.h>
47 #include "no_os_gpio.h"
48 #include "no_os_spi.h"
49 #include "no_os_util.h"
50 
51 /******************************************************************************/
52 /******************************** AD719X **************************************/
53 /******************************************************************************/
54 
55 /* SPI slave device ID */
56 #define AD719X_SLAVE_ID 1
57 
58 /* AD719X Register Map */
59 #define AD719X_REG_COMM 0 // Communications Register (WO, 8-bit)
60 #define AD719X_REG_STAT 0 // Status Register (RO, 8-bit)
61 #define AD719X_REG_MODE 1 // Mode Register (RW, 24-bit
62 #define AD719X_REG_CONF 2 // Configuration Register (RW, 24-bit)
63 #define AD719X_REG_DATA 3 // Data Register (RO, 24/32-bit)
64 #define AD719X_REG_ID 4 // ID Register (RO, 8-bit)
65 #define AD719X_REG_GPOCON 5 // GPOCON Register (RW, 8-bit)
66 #define AD719X_REG_OFFSET 6 // Offset Register (RW, 24-bit
67 #define AD719X_REG_FULLSCALE 7 // Full-Scale Register (RW, 24-bit)
68 
69 /* Communications Register Bit Designations (AD719X_REG_COMM) */
70 #define AD719X_COMM_WEN (1 << 7) // Write Enable.
71 #define AD719X_COMM_WRITE (0 << 6) // Write Operation.
72 #define AD719X_COMM_READ (1 << 6) // Read Operation.
73 #define AD719X_COMM_ADDR(x) (((x) & 0x7) << 3) // Register Address.
74 #define AD719X_COMM_CREAD (1 << 2) // Continuous Read of Data Register.
75 
76 /* Status Register Bit Designations (AD719X_REG_STAT) */
77 #define AD719X_STAT_RDY (1 << 7) // Ready.
78 #define AD719X_STAT_ERR (1 << 6) // ADC error bit.
79 #define AD719X_STAT_NOREF (1 << 5) // Error no external reference.
80 #define AD719X_STAT_PARITY (1 << 4) // Parity check of the data register.
81 #define AD719X_STAT_CH3 (1 << 3) // Channel 3.
82 #define AD719X_STAT_CH2 (1 << 2) // Channel 2.
83 #define AD719X_STAT_CH1 (1 << 1) // Channel 1.
84 #define AD719X_STAT_CH0 (1 << 0) // Channel 0.
85 
86 /* Mode Register Bit Designations (AD719X_REG_MODE) */
87 #define AD719X_MODE_SEL(x) (((uint32_t)(x) & 0x7) << 21) // Operation Mode Select.
88 #define AD719X_MODE_DAT_STA ((uint32_t)1 << 20) // Status Register transmission.
89 #define AD719X_MODE_CLKSRC(x) (((uint32_t)(x) & 0x3) << 18) // Clock Source Select.
90 #define AD719X_MODE_AVG(x) (((uint32_t)(x) & 0x3) << 16) // Fast settling filter.
91 #define AD719X_MODE_SINC3 (1 << 15) // SINC3 Filter Select.
92 #define AD719X_MODE_ENPAR (1 << 13) // Parity Enable.
93 #define AD719X_MODE_CLKDIV (1 << 12) // Clock divide by 2 (AD7190/2 only).
94 #define AD719X_MODE_SCYCLE (1 << 11) // Single cycle conversion.
95 #define AD719X_MODE_REJ60 (1 << 10) // 50/60Hz notch filter.
96 #define AD719X_MODE_RATE(x) ((x) & 0x3FF) // Filter Update Rate Select.
97 
98 /* Mode Register: AD719X_MODE_AVG(x) options */
99 #define AD719X_AVG_NONE 0 // No averaging (fast settling mode disabled).
100 #define AD719X_AVG_BY_2 1 // Average by 2.
101 #define AD719X_AVG_BY_8 2 // Average by 8.
102 #define AD719X_AVG_BY_16 3 // Average by 16.
103 
104 /* Configuration Register Bit Designations (AD719X_REG_CONF) */
105 #define AD719X_CONF_CHOP ((uint32_t)1 << 23) // CHOP enable.
106 #define AD719X_CONF_REFSEL ((uint32_t)1 << 20) // REFIN1/REFIN2 Reference Select.
107 #define AD719X_CONF_PSEUDO ((uint32_t)1 << 18) // Pseudo differential analog inputs.
108 #define AD719X_CONF_CHAN(x) ((uint32_t)((x) & 0x3FF) << 8) // Channel select.
109 #define AD719X_CONF_BURN (1 << 7) // Burnout current enable.
110 #define AD719X_CONF_REFDET (1 << 6) // Reference detect enable.
111 #define AD719X_CONF_BUF (1 << 4) // Buffered Mode Enable.
112 #define AD719X_CONF_UNIPOLAR (1 << 3) // Unipolar/Bipolar Enable.
113 #define AD719X_CONF_GAIN(x) ((x) & 0x7) // Gain Select.
114 
115 /* Channel Mask */
116 #define AD719X_CH_MASK(channel) NO_OS_BIT(channel)
117 
118 /* Configuration Register: AD719X_CONF_CHAN(x) options */
119 #define AD719X_CH_0 0
120 #define AD719X_CH_1 1
121 #define AD719X_CH_2 2
122 #define AD719X_CH_3 3
123 #define AD719X_CH_4 4
124 #define AD719X_CH_5 5
125 #define AD719X_CH_6 6
126 #define AD719X_CH_7 7
127 #define AD719X_CH_TEMP 8
128 #define AD719X_CH_SHORT 9
129 
130 /* ID Register Bit Designations (AD7193_REG_ID) */
131 #define AD7190_4_ID_MASK 0x0F
132 #define AD7195_ID_MASK 0xFF
133 
134 /* GPOCON Register Bit Designations (AD719X_REG_GPOCON) */
135 #define AD719X_GPOCON_BPDSW (1 << 6) // Bridge power-down switch enable
136 #define AD719X_GPOCON_GP32EN (1 << 5) // Digital Output P3 and P2 enable
137 #define AD719X_GPOCON_GP10EN (1 << 4) // Digital Output P1 and P0 enable
138 #define AD719X_GPOCON_P3DAT (1 << 3) // P3 state
139 #define AD719X_GPOCON_P2DAT (1 << 2) // P2 state
140 #define AD719X_GPOCON_P1DAT (1 << 1) // P1 state
141 #define AD719X_GPOCON_P0DAT (1 << 0) // P0 state
142 
143 /******************************************************************************/
144 /*************************** Types Declarations *******************************/
145 /******************************************************************************/
146 
148 // ADC Gain (CONF Reg)
149  AD719X_ADC_GAIN_1 = 0, // Gain 1
150  AD719X_ADC_GAIN_8 = 3, // Gain 8
151  AD719X_ADC_GAIN_16 = 4, // Gain 16
152  AD719X_ADC_GAIN_32 = 5, // Gain 32
153  AD719X_ADC_GAIN_64 = 6, // Gain 64
154  AD719X_ADC_GAIN_128 = 7 // Gain 128
155 };
156 
158  // External crystal. The external crystal is connected from MCLK1 to MCLK2.
160  // External Clock applied to MCLK2
162  // Internal 4.92 MHz clock. Pin MCLK2 is tristated.
164  // Internal 4.92 MHz clock. The internal clock is available on MCLK2.
166 };
167 
169  // Continuous Conversion Mode
171  // Single Conversion Mode
173  // Idle Mode
175  // Power-Down Mode
177  // Internal Zero-Scale Calibration
179  // Internal Full-Scale Calibration4
181  // System Zero-Scale Calibration5
183  // System Full-Scale Calibration
185 };
186 
188  AD7190 = 0x4,
189  AD7192 = 0x0,
190  AD7193 = 0x2,
191  AD7194 = 0x3,
192  AD7195 = 0xA6
193 };
194 
195 struct ad719x_dev {
196  /* SPI */
198  /* GPIO */
201  /* Device Settings */
205  uint16_t data_rate_code;
207  uint8_t input_mode;
208  uint8_t buffer;
209  uint8_t bpdsw_mode;
211 };
212 
214  /* SPI */
216  /* GPIO */
218  /* Optional GPIO pin - only for multiple devices */
220  /* Device Settings */
224  uint16_t data_rate_code;
226  uint8_t input_mode;
227  uint8_t buffer;
228  uint8_t bpdsw_mode;
230 };
231 
232 /******************************************************************************/
233 /************************ Functions Declarations ******************************/
234 /******************************************************************************/
235 
237 int ad719x_init(struct ad719x_dev **device,
239 
241 int ad719x_remove(struct ad719x_dev *dev);
242 
244 int ad719x_set_register_value(struct ad719x_dev *dev, uint8_t reg_addr,
245  uint32_t reg_value, uint8_t bytes_number);
246 
248 int ad719x_get_register_value(struct ad719x_dev *dev, uint8_t reg_addr,
249  uint8_t bytes_number, uint32_t *reg_data);
250 
251 /* Write masked data into device register. */
253  uint8_t reg_addr, uint32_t mask, uint32_t data,
254  uint8_t bytes);
255 
257 int ad719x_reset(struct ad719x_dev *dev);
258 
260 int ad719x_set_operating_mode(struct ad719x_dev *dev,
261  enum ad719x_adc_modes opt_mode);
262 
264 int ad719x_wait_rdy_go_low(struct ad719x_dev *dev);
265 
267 int ad719x_channels_select(struct ad719x_dev *dev, uint16_t chn_mask);
268 
270 int ad719x_calibrate(struct ad719x_dev *dev,
271  uint8_t mode, uint8_t channel);
272 
274 int ad719x_config_input_mode(struct ad719x_dev *dev, uint8_t mode);
275 
277 int ad719x_buffer_select(struct ad719x_dev *dev, uint8_t buff_en);
278 
280 int ad719x_output_rate_select(struct ad719x_dev *dev,
281  uint16_t out_rate_code);
282 
284 int ad719x_clock_select(struct ad719x_dev *dev,
285  enum ad719x_adc_clock clk_select);
286 
288 int ad719x_set_bridge_switch(struct ad719x_dev *dev, uint8_t bpdsw_select);
289 
291 int ad719x_range_setup(struct ad719x_dev *dev,
292  uint8_t polarity, enum ad719x_adc_gain range);
293 
295 int ad719x_single_conversion(struct ad719x_dev *dev, uint32_t *reg_data);
296 
298 int ad719x_continuous_read_avg(struct ad719x_dev *dev,
299  uint8_t sample_number, uint32_t *samples_avg);
300 
302 int ad719x_temperature_read(struct ad719x_dev *dev, float *temp);
303 
305 float ad719x_convert_to_volts(struct ad719x_dev *dev,
306  uint32_t raw_data, float v_ref);
307 
308 #endif /* __AD719X_H__ */
ad719x_clock_select
int ad719x_clock_select(struct ad719x_dev *dev, enum ad719x_adc_clock clk_select)
Selects the clock source of the ADC.
Definition: ad719x.c:545
AD719X_MODE_IDLE
@ AD719X_MODE_IDLE
Definition: ad719x.h:174
timeout
uint32_t timeout
Definition: ad413x.c:55
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
AD719X_MODE_SINGLE
@ AD719X_MODE_SINGLE
Definition: ad719x.h:172
ad719x_reset
int ad719x_reset(struct ad719x_dev *dev)
Resets the device.
Definition: ad719x.c:316
no_os_spi_write_and_read
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:165
ad719x_init_param::sync_pin
struct no_os_gpio_init_param * sync_pin
Definition: ad719x.h:219
no_os_spi.h
Header file of SPI Interface.
ad719x_reset
int ad719x_reset(struct ad719x_dev *dev)
Resets the device.
Definition: ad719x.c:316
ad719x_set_bridge_switch
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:572
no_os_gpio_get_value
int32_t no_os_gpio_get_value(struct no_os_gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: no_os_gpio.c:227
AD719X_MODE_CAL_INT_ZERO
@ AD719X_MODE_CAL_INT_ZERO
Definition: ad719x.h:178
ad719x_init_param::input_mode
uint8_t input_mode
Definition: ad719x.h:226
ad719x_get_register_value
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:256
AD719X_MODE_SEL
#define AD719X_MODE_SEL(x)
Definition: ad719x.h:87
ad719x_set_register_value
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:222
no_os_delay.h
Header file of Delay functions.
AD719X_CONF_GAIN
#define AD719X_CONF_GAIN(x)
Definition: ad719x.h:113
AD719X_MODE_CAL_SYS_ZERO
@ AD719X_MODE_CAL_SYS_ZERO
Definition: ad719x.h:182
AD719X_MODE_CLKSRC
#define AD719X_MODE_CLKSRC(x)
Definition: ad719x.h:89
ad719x_buffer_select
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:492
ad719x_wait_rdy_go_low
int ad719x_wait_rdy_go_low(struct ad719x_dev *dev)
Waits for RDY pin to go low.
Definition: ad719x.c:370
ad719x_init
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:64
ad719x_init_param::current_polarity
uint8_t current_polarity
Definition: ad719x.h:221
device
Definition: ad9361_util.h:75
AD719X_MODE_PWRDN
@ AD719X_MODE_PWRDN
Definition: ad719x.h:176
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:123
ad719x_channels_select
int ad719x_channels_select(struct ad719x_dev *dev, uint16_t chn_mask)
Selects the channels to be enabled.
Definition: ad719x.c:398
ad719x_calibrate
int ad719x_calibrate(struct ad719x_dev *dev, uint8_t mode, uint8_t channel)
Performs the given calibration to the specified channel.
Definition: ad719x.c:437
ad719x_temperature_read
int ad719x_temperature_read(struct ad719x_dev *dev, float *temp)
Read data from temperature sensor and converts it to Celsius degrees.
Definition: ad719x.c:703
no_os_gpio_direction_input
int32_t no_os_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: no_os_gpio.c:130
AD719X_ADC_GAIN_128
@ AD719X_ADC_GAIN_128
Definition: ad719x.h:154
AD719X_REG_CONF
#define AD719X_REG_CONF
Definition: ad719x.h:62
AD719X_MODE_CAL_SYS_FULL
@ AD719X_MODE_CAL_SYS_FULL
Definition: ad719x.h:184
AD719X_REG_GPOCON
#define AD719X_REG_GPOCON
Definition: ad719x.h:65
ad719x_dev::bpdsw_mode
uint8_t bpdsw_mode
Definition: ad719x.h:209
ad719x_temperature_read
int ad719x_temperature_read(struct ad719x_dev *dev, float *temp)
Read data from temperature sensor and converts it to Celsius degrees.
Definition: ad719x.c:703
AD719X_EXT_CRYSTAL_MCLK1_MCLK2
@ AD719X_EXT_CRYSTAL_MCLK1_MCLK2
Definition: ad719x.h:159
AD7190_4_ID_MASK
#define AD7190_4_ID_MASK
Definition: ad719x.h:131
AD719X_ADC_GAIN_64
@ AD719X_ADC_GAIN_64
Definition: ad719x.h:153
AD719X_COMM_ADDR
#define AD719X_COMM_ADDR(x)
Definition: ad719x.h:73
ad719x_set_register_value
int ad719x_set_register_value(struct ad719x_dev *dev, uint8_t reg_addr, uint32_t reg_val, uint8_t bytes_number)
Writes data into a register.
Definition: ad719x.c:222
ad719x_init_param::gpio_miso
struct no_os_gpio_init_param * gpio_miso
Definition: ad719x.h:217
ad719x_config_input_mode
int ad719x_config_input_mode(struct ad719x_dev *dev, uint8_t mode)
Configures the input mode of the ADC.
Definition: ad719x.c:465
no_os_error.h
Error codes definition.
ad719x_channels_select
int ad719x_channels_select(struct ad719x_dev *dev, uint16_t chn_mask)
Selects the channels to be enabled.
Definition: ad719x.c:398
AD719X_CH_MASK
#define AD719X_CH_MASK(channel)
Definition: ad719x.h:116
ad719x_dev::sync_pin
struct no_os_gpio_desc * sync_pin
Definition: ad719x.h:200
ad719x_init_param
Definition: ad719x.h:213
AD719X_ADC_GAIN_16
@ AD719X_ADC_GAIN_16
Definition: ad719x.h:151
AD719X_REG_DATA
#define AD719X_REG_DATA
Definition: ad719x.h:63
AD719X_CONF_BUF
#define AD719X_CONF_BUF
Definition: ad719x.h:111
ad719x_continuous_read_avg
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:662
AD719X_MODE_CAL_INT_FULL
@ AD719X_MODE_CAL_INT_FULL
Definition: ad719x.h:180
ad719x_init_param::bpdsw_mode
uint8_t bpdsw_mode
Definition: ad719x.h:228
ad719x_dev::gpio_miso
struct no_os_gpio_desc * gpio_miso
Definition: ad719x.h:199
ad719x_set_bridge_switch
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:572
ad719x_dev::current_polarity
uint8_t current_polarity
Definition: ad719x.h:202
ad719x_continuous_read_avg
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:662
ad719x_range_setup
int ad719x_range_setup(struct ad719x_dev *dev, uint8_t polarity, enum ad719x_adc_gain gain)
Selects the polarity of the conversion and the ADC input range.
Definition: ad719x.c:604
AD7190
@ AD7190
Definition: ad719x.h:188
AD719X_REG_ID
#define AD719X_REG_ID
Definition: ad719x.h:64
ad719x_clock_select
int ad719x_clock_select(struct ad719x_dev *dev, enum ad719x_adc_clock clk_select)
Selects the clock source of the ADC.
Definition: ad719x.c:545
ad719x_adc_gain
ad719x_adc_gain
Definition: ad719x.h:147
AD7195_ID_MASK
#define AD7195_ID_MASK
Definition: ad719x.h:132
ad719x_init_param::current_gain
enum ad719x_adc_gain current_gain
Definition: ad719x.h:222
ad719x_range_setup
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:604
ad719x_adc_clock
ad719x_adc_clock
Definition: ad719x.h:157
ad719x_dev::input_mode
uint8_t input_mode
Definition: ad719x.h:207
no_os_gpio_remove
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:110
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
ad719x_dev::data_rate_code
uint16_t data_rate_code
Definition: ad719x.h:205
ad719x_set_masked_register_value
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:291
AD719X_COMM_READ
#define AD719X_COMM_READ
Definition: ad719x.h:72
ad719x_adc_modes
ad719x_adc_modes
Definition: ad719x.h:168
AD7192
@ AD7192
Definition: ad719x.h:189
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
ad719x_remove
int ad719x_remove(struct ad719x_dev *dev)
Free the resources allocated by ad719x_init().
Definition: ad719x.c:195
ad719x_dev::buffer
uint8_t buffer
Definition: ad719x.h:208
AD719X_GPOCON_BPDSW
#define AD719X_GPOCON_BPDSW
Definition: ad719x.h:135
AD719X_CONF_PSEUDO
#define AD719X_CONF_PSEUDO
Definition: ad719x.h:107
AD719X_CH_2
#define AD719X_CH_2
Definition: ad719x.h:121
no_os_gpio_get
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:55
ad719x_dev::clock_source
enum ad719x_adc_clock clock_source
Definition: ad719x.h:206
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:49
ad719x_init_param::chip_id
enum ad719x_chip_id chip_id
Definition: ad719x.h:229
ad719x_remove
int ad719x_remove(struct ad719x_dev *dev)
Free the resources allocated by ad719x_init().
Definition: ad719x.c:195
ad719x_set_operating_mode
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:348
ad719x_single_conversion
int ad719x_single_conversion(struct ad719x_dev *dev, uint32_t *reg_data)
Returns the result of a single conversion.
Definition: ad719x.c:631
ad719x_chip_id
ad719x_chip_id
Definition: ad719x.h:187
AD719X_INT_CLK_4_92_MHZ_TRIST
@ AD719X_INT_CLK_4_92_MHZ_TRIST
Definition: ad719x.h:163
ad719x_get_register_value
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:256
AD7193
@ AD7193
Definition: ad719x.h:190
AD7194
@ AD7194
Definition: ad719x.h:191
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:75
ad719x_set_operating_mode
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:348
ad719x_wait_rdy_go_low
int ad719x_wait_rdy_go_low(struct ad719x_dev *dev)
Waits for RDY pin to go low.
Definition: ad719x.c:370
ad719x_init
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:64
ad719x_init_param::operating_mode
enum ad719x_adc_modes operating_mode
Definition: ad719x.h:223
AD719X_COMM_WRITE
#define AD719X_COMM_WRITE
Definition: ad719x.h:71
AD719X_MODE_RATE
#define AD719X_MODE_RATE(x)
Definition: ad719x.h:96
ad719x_init_param::spi_init
struct no_os_spi_init_param * spi_init
Definition: ad719x.h:215
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:120
ad719x_dev::current_gain
enum ad719x_adc_gain current_gain
Definition: ad719x.h:203
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:203
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
ad719x_calibrate
int ad719x_calibrate(struct ad719x_dev *dev, uint8_t mode, uint8_t channel)
Performs the given calibration to the specified channel.
Definition: ad719x.c:437
AD719X_MODE_CONT
@ AD719X_MODE_CONT
Definition: ad719x.h:170
ad719x_init_param::clock_source
enum ad719x_adc_clock clock_source
Definition: ad719x.h:225
ad719x_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad719x.h:197
ad719x_convert_to_volts
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:743
ad719x_single_conversion
int ad719x_single_conversion(struct ad719x_dev *dev, uint32_t *reg_data)
Returns the result of a single conversion.
Definition: ad719x.c:631
ad719x_init_param::data_rate_code
uint16_t data_rate_code
Definition: ad719x.h:224
ad719x_set_masked_register_value
int ad719x_set_masked_register_value(struct ad719x_dev *dev, uint8_t reg_addr, uint32_t mask, uint32_t reg_data, uint8_t bytes)
Write masked data into device register.
Definition: ad719x.c:291
AD719X_CH_TEMP
#define AD719X_CH_TEMP
Definition: ad719x.h:127
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:122
ad719x_dev::chip_id
enum ad719x_chip_id chip_id
Definition: ad719x.h:210
no_os_gpio.h
Header file of GPIO Interface.
ad719x_convert_to_volts
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:743
AD719X_INT_CLK_4_92_MHZ
@ AD719X_INT_CLK_4_92_MHZ
Definition: ad719x.h:165
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:58
ad719x_output_rate_select
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:516
ad719x_config_input_mode
int ad719x_config_input_mode(struct ad719x_dev *dev, uint8_t mode)
Configures the input mode of the ADC.
Definition: ad719x.c:465
AD7195
@ AD7195
Definition: ad719x.h:192
no_os_util.h
Header file of utility functions.
ad719x_buffer_select
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:492
AD719X_ADC_GAIN_32
@ AD719X_ADC_GAIN_32
Definition: ad719x.h:152
AD719X_EXT_CRYSTAL_MCLK2
@ AD719X_EXT_CRYSTAL_MCLK2
Definition: ad719x.h:161
ad719x_output_rate_select
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:516
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:153
AD719X_ADC_GAIN_8
@ AD719X_ADC_GAIN_8
Definition: ad719x.h:150
ad719x_dev::operating_mode
enum ad719x_adc_modes operating_mode
Definition: ad719x.h:204
ad719x_sync_control
int ad719x_sync_control(struct ad719x_dev *dev, uint8_t value)
Control SYNC pin for synchronization of multiple devices.
Definition: ad719x.c:769
ad719x.h
Header file of AD7190/2/3/4/5 Driver.
AD719X_CONF_CHAN
#define AD719X_CONF_CHAN(x)
Definition: ad719x.h:108
ad719x_init_param::buffer
uint8_t buffer
Definition: ad719x.h:227
AD719X_REG_MODE
#define AD719X_REG_MODE
Definition: ad719x.h:61
ad719x_dev
Definition: ad719x.h:195
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131
AD719X_CONF_UNIPOLAR
#define AD719X_CONF_UNIPOLAR
Definition: ad719x.h:112
AD719X_ADC_GAIN_1
@ AD719X_ADC_GAIN_1
Definition: ad719x.h:149
no_os_gpio_get_optional
int32_t no_os_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: no_os_gpio.c:81