no-OS
ad4110.h
Go to the documentation of this file.
1 /***************************************************************************/
36 #ifndef AD4110_H_
37 #define AD4110_H_
38 
39 /******************************************************************************/
40 /***************************** Include Files **********************************/
41 /******************************************************************************/
42 #include <stdint.h>
43 #include <stdbool.h>
44 #include "no_os_delay.h"
45 #include "no_os_gpio.h"
46 #include "no_os_spi.h"
47 #include "no_os_irq.h"
48 
49 /******************************************************************************/
50 /********************** Macros and Constants Definitions **********************/
51 /******************************************************************************/
52 #define AD4110_CMD_WR_COM_REG(x) (0x00 | ((x) & 0xF)) // Write to Register x
53 #define AD4110_CMD_READ_COM_REG(x) (0x40 | ((x) & 0xF)) // Read from Register x
54 #define AD4110_DEV_ADDR_MASK (0x30) // Device address mask
55 
56 /* Register map */
57 #define A4110_ADC 0x00
58 #define A4110_AFE 0x01
59 
60 /****************************** AFE Register Map ******************************/
61 #define AD4110_REG_AFE_TOP_STATUS 0x0
62 #define AD4110_REG_AFE_CNTRL1 0x1
63 #define AD4110_REG_AFE_CLK_CTRL 0x3
64 #define AD4110_REG_AFE_CNTRL2 0x4
65 #define AD4110_REG_PGA_RTD_CTRL 0x5
66 #define AD4110_REG_AFE_ERR_DISABLE 0x6
67 #define AD4110_REG_AFE_DETAIL_STATUS 0x7
68 #define AD4110_REG_AFE_CAL_DATA 0xC
69 #define AD4110_REG_AFE_RSENSE_DATA 0xD
70 #define AD4110_REG_AFE_NO_PWR_DEFAULT_SEL 0xE
71 #define AD4110_REG_AFE_NO_PWR_DEFAULT_STATUS 0xF
72 
73 /***************************** ADC Register Map *******************************/
74 #define AD4110_REG_ADC_STATUS 0x0
75 #define AD4110_REG_ADC_MODE 0x1
76 #define AD4110_REG_ADC_INTERFACE 0x2
77 #define AD4110_REG_ADC_CONFIG 0x3
78 #define AD4110_REG_DATA 0x4
79 #define AD4110_REG_FILTER 0x5
80 #define AD4110_REG_ADC_GPIO_CONFIG 0x6
81 #define AD4110_REG_ID 0x7
82 #define AD4110_ADC_OFFSET0 0x8
83 #define AD4110_ADC_OFFSET1 0x9
84 #define AD4110_ADC_OFFSET2 0xA
85 #define AD4110_ADC_OFFSET3 0xB
86 #define AD4110_ADC_GAIN0 0xC
87 #define AD4110_ADC_GAIN1 0xD
88 #define AD4110_ADC_GAIN2 0xE
89 #define AD4110_ADC_GAIN3 0xF
90 
91 /* AFE_CNTRL1 Register */
92 #define AD4110_REG_AFE_CNTRL1_CRC_EN (1 << 14)
93 #define AD4110_REG_AFE_CNTRL1_DISRTD (1 << 9)
94 
95 /* AFE_CLK_CTRL Register */
96 #define AD4110_REG_AFE_CLK_CTRL_CFG(x) (((x) & 0x3) << 3)
97 
98 /* AFE_CNTRL2 Register */
99 #define AD4110_REG_AFE_CNTRL2_IMODE_MSK (1 << 1)
100 #define AD4110_REG_AFE_CNTRL2_EXT_R_SEL_MSK (1 << 2)
101 #define AD4110_REG_AFE_CNTRL2_EN_FLD_PWR_MSK (1 << 3)
102 #define AD4110_AFE_VBIAS(x) (((x) & 0x3) << 6)
103 #define AD4110_AFE_VBIAS_ON 0x1
104 #define AD4110_AFE_VBIAS_DEFAULT_OFF 0x2
105 #define AD4110_AFE_VBIAS_OFF 0x3
106 #define AD4110_REG_AFE_CNTRL2_AINP_UP1 (1 << 8)
107 #define AD4110_REG_AFE_CNTRL2_AINP_UP100 (1 << 9)
108 #define AD4110_REG_AFE_CNTRL2_AINP_DN1 (1 << 10)
109 #define AD4110_REG_AFE_CNTRL2_AINP_DN100 (1 << 11)
110 #define AD4110_REG_AFE_CNTRL2_AINN_UP1 (1 << 12)
111 #define AD4110_REG_AFE_CNTRL2_AINN_UP100 (1 << 13)
112 #define AD4110_REG_AFE_CNTRL2_AINN_DN1 (1 << 14)
113 #define AD4110_REG_AFE_CNTRL2_AINN_DN100 (1 << 15)
114 
115 /* PGA_RTD_CTRL Register */
116 #define AD4110_REG_PGA_RTD_CTRL_23W_EN_MSK (1 << 15)
117 #define AD4110_REG_PGA_RTD_CTRL_I_COM_SEL(x) (((x) & 0x7) << 12)
118 #define AD4110_REG_PGA_RTD_CTRL_I_EXC_SEL(x) (((x) & 0x7) << 9)
119 #define AD4110_REG_PGA_RTD_CTRL_EXT_RTD (1 << 8)
120 #define AD4110_REG_PGA_RTD_CTRL_GAIN_CH(x) (((x) & 0xF) << 4)
121 #define AD4110_REG_PGA_RTD_CTRL_GAIN_CH_MSK 0xF0
122 
123 /* AFE_ERR_DISABLE Register */
124 #define AD4110_REG_AFE_ERR_DIS_AIN_OC (1 << 1)
125 #define AD4110_REG_AFE_ERR_DIS_FLD_PWR_OC (1 << 2)
126 #define AD4110_REG_AFE_ERR_DIS_I_COM (1 << 6)
127 #define AD4110_REG_AFE_ERR_DIS_I_EXC (1 << 7)
128 #define AD4110_REG_AFE_ERR_DIS_AINP_OV (1 << 8)
129 #define AD4110_REG_AFE_ERR_DIS_AINN_OV (1 << 9)
130 #define AD4110_REG_AFE_ERR_DIS_AINP_UV (1 << 10)
131 #define AD4110_REG_AFE_ERR_DIS_AINN_UV (1 << 11)
132 
133 /* NO_PWR_DEFAULT_SEL Register */
134 #define AD4110_REG_NO_PWR_DEFAULT_SEL_MSK 0xFF
135 
136 /* ADC status register */
137 #define AD4110_REG_ADC_STATUS_RDY (1 << 7)
138 
139 /* ADC_MODE Register */
140 #define AD4110_REG_ADC_MODE_MSK 0x70
141 #define AD4110_ADC_MODE(x) (((x) & 0x7) << 4)
142 #define AD4110_REG_ADC_MODE_REF_EN (1 << 15)
143 #define AD4110_REG_ADC_DELAY(x) (((x) & 0x7) << 8)
144 #define AD4110_REG_ADC_CLK_SEL(x) (((x) & 0x3) << 2)
145 
146 /* ADC_INTERFACE Register */
147 #define AD4110_REG_ADC_INTERFACE_CRC_EN_MSK 0x0C
148 #define AD4110_ADC_CRC_EN(x) (((x) & 0x3) << 2)
149 #define AD4110_REG_ADC_INTERFACE_WL16_MSK 0x01
150 #define AD4110_REG_ADC_INTERFACE_DS_MSK 0x40
151 #define AD4110_DATA_STAT_EN (1 << 6)
152 
153 /* ADC_CONFIG Register */
154 #define AD4110_REG_ADC_CONFIG_CHAN_EN_MSK 0xF
155 #define AD4110_REG_ADC_CONFIG_CHAN_EN_0 (1 << 0)
156 #define AD4110_REG_ADC_CONFIG_CHAN_EN_1 (1 << 1)
157 #define AD4110_REG_ADC_CONFIG_CHAN_EN_2 (1 << 2)
158 #define AD4110_REG_ADC_CONFIG_CHAN_EN_3 (1 << 3)
159 #define AD4110_REG_ADC_CONFIG_REF_SEL(x) (((x) & 0x3) << 4)
160 #define AD4110_REG_ADC_CONFIG_BIT_6 (1 << 6)
161 #define AD4110_REG_ADC_CONFIG_AIN_BUFF(x) ((((x) & 0x3) << 8))
162 #define AD4110_REG_ADC_CONFIG_BI_UNIPOLAR (1 << 12)
163 
164 /* ADC_FILTER Register */
165 #define AD4110_REG_ADC_FILTER_ODR(x) (((x) & 0x1F) << 0)
166 #define AD4110_REG_ADC_FILTER_ORDER(x) (((x) & 0x3) << 5)
167 #define AD4110_REG_ADC_FILTER_SEL_ENH(x) (((x) & 0x7) << 8)
168 #define AD4110_REG_ADC_FILTER_EN_ENH (1 << 11)
169 
170 /* ADC_GPIO_CONFIG Register */
171 #define AD4110_REG_GPIO_CONFIG_ERR_EN(x) (((x) & 0x3) << 9)
172 #define AD4110_REG_GPIO_CONFIG_SYNC_EN(x) (((x) & 0x1) << 11)
173 
174 /* 8-bits wide checksum generated using the polynomial */
175 #define AD4110_CRC8_POLY 0x07 // x^8 + x^2 + x^1 + x^0
176 
177 /* ADC conversion timeout */
178 #define AD4110_ADC_CONV_TIMEOUT 10000
179 
180 /******************************************************************************/
181 /*************************** Types Declarations *******************************/
182 /******************************************************************************/
183 /* If AD4110_AFE_ADC_CLOCKED selected, select AD4110_ADC_INT_CLK_CLKIO */
188 };
189 
193 };
194 
198 };
199 
204 };
205 
209 };
210 
214 };
215 
223 };
224 
234 };
235 
238  AD4110_ADC_XOR_CRC, // 8-bit XOR checksum on reads, 8-bit CRC on writes
239  AD4110_ADC_CRC_CRC // 8-bit CRC on reads and writes.
240 };
241 
244  AD4110_AFE_CRC // 8-bit CRC on reads and writes.
245 };
246 
264 };
265 
271 };
272 
295 };
296 
298  sinc5_sinc1 = 0x0,
299  sinc3 = 0x3
300 };
301 
302 struct ad4110_dev {
303  /* SPI */
305  /* Device Settings */
316  uint8_t addr;
317  bool bipolar;
321  /* GPIO - used only for continuous mode */
323  uint32_t nready_pin;
324 };
325 
327  /* SPI */
329  /* Device Settings */
340  uint8_t addr;
341  bool bipolar;
345  /* GPIO - used only for continuous mode */
347  uint32_t nready_pin;
348 };
349 
351  struct ad4110_dev *dev;
352  uint32_t *buffer;
353  uint32_t buffer_size;
354 };
355 
356 /******************************************************************************/
357 /************************ Functions Declarations ******************************/
358 /******************************************************************************/
359 /* Compute CRC8 checksum. */
360 uint8_t ad4110_compute_crc8(uint8_t *data,
361  uint8_t data_size);
362 /* Compute XOR checksum. */
363 uint8_t ad4110_compute_xor(uint8_t *data,
364  uint8_t data_size);
365 
366 /* SPI write to device using a mask. */
367 int32_t ad4110_spi_int_reg_write_msk(struct ad4110_dev *dev,
368  uint8_t reg_map,
369  uint8_t reg_addr,
370  uint32_t data,
371  uint16_t mask);
372 /* Set the mode of the ADC. */
373 int32_t ad4110_set_adc_mode(struct ad4110_dev *dev, enum ad4110_adc_mode mode);
374 
375 /* Set the gain. */
376 int32_t ad4110_set_gain(struct ad4110_dev *dev, enum ad4110_gain gain);
377 
378 /* Set ADC clock mode. */
379 int32_t ad4110_set_adc_clk(struct ad4110_dev *dev, enum ad4110_adc_clk_sel clk);
380 
381 /* Set AFE clock mode. */
382 int32_t ad4110_set_afe_clk(struct ad4110_dev *dev, enum ad4110_afe_clk_cfg clk);
383 
384 /* Set voltage reference. */
385 int32_t ad4110_set_reference(struct ad4110_dev *dev,
386  enum ad4110_voltage_reference ref);
387 
388 /* Set the operation mode. */
389 int32_t ad4110_set_op_mode(struct ad4110_dev *dev, enum ad4110_op_mode mode);
390 
391 /* Do a SPI software reset. */
392 int32_t ad4110_spi_do_soft_reset(struct ad4110_dev *dev);
393 
394 /* Get the data size of a specified register. */
395 uint8_t ad4110_get_data_size(struct ad4110_dev *dev,
396  uint8_t reg_map,
397  uint8_t reg_addr);
398 
399 /* SPI internal register write to device. */
400 int32_t ad4110_spi_int_reg_write(struct ad4110_dev *dev,
401  uint8_t reg_map,
402  uint8_t reg_addr,
403  uint32_t reg_data);
404 
405 /* SPI internal register read from device. */
406 int32_t ad4110_spi_int_reg_read(struct ad4110_dev *dev,
407  uint8_t reg_map,
408  uint8_t reg_addr,
409  uint32_t *reg_data);
410 
411 /* Fills buffer with buffer_size number of samples using irq */
412 int32_t ad4110_continuous_read(struct ad4110_dev *dev, uint32_t *buffer,
413  uint32_t buffer_size);
414 
415 /* SPI internal DATA register read from device. */
416 int32_t ad4110_spi_int_data_reg_read(struct ad4110_dev *dev,
417  uint32_t *reg_data);
418 
419 /* Initialize the device. */
420 int32_t ad4110_setup(struct ad4110_dev **device,
422 
423 /* Enable/Disable channel */
424 int ad4110_set_channel_status(struct ad4110_dev *dev, uint8_t chan_id,
425  bool status);
426 
427 /* Set analog input buffer */
429  enum ad4110_ain_buffer buffer);
430 
431 /* Set polarity */
432 int ad4110_set_bipolar(struct ad4110_dev *dev, bool bipolar);
433 
434 /* Set ODR */
435 int ad4110_set_odr(struct ad4110_dev *dev, enum ad4110_odr odr);
436 
437 /* Set filter order */
438 int ad4110_set_order(struct ad4110_dev *dev, enum ad4110_order order);
439 
440 /* Fills the buffer with a single sample */
441 int ad4110_do_single_read(struct ad4110_dev *dev, uint32_t *buffer);
442 
443 /* Wait for conversion completion */
444 int ad4110_wait_for_rdy_low(struct ad4110_dev *dev, uint32_t timeout);
445 
446 #endif // AD4110_H_
AD4110_GAIN_0_75
@ AD4110_GAIN_0_75
Definition: ad4110.h:253
ad4110_dev::bipolar
bool bipolar
Definition: ad4110.h:317
AD4110_REG_AFE_CNTRL2
#define AD4110_REG_AFE_CNTRL2
Definition: ad4110.h:64
KSPS_62P5_B
@ KSPS_62P5_B
Definition: ad4110.h:277
AD4110_SYNC_DIS
@ AD4110_SYNC_DIS
Definition: ad4110.h:196
ad4110_set_gain
int32_t ad4110_set_gain(struct ad4110_dev *dev, enum ad4110_gain gain)
Definition: ad4110.c:186
timeout
uint32_t timeout
Definition: ad413x.c:49
no_os_alloc.h
ad4110_data_word_length
ad4110_data_word_length
Definition: ad4110.h:211
AD4110_REG_AFE_CNTRL1_CRC_EN
#define AD4110_REG_AFE_CNTRL1_CRC_EN
Definition: ad4110.h:92
AD4110_CONTINOUS_CONV_MODE
@ AD4110_CONTINOUS_CONV_MODE
Definition: ad4110.h:217
AD4110_AFE_VBIAS_ON
#define AD4110_AFE_VBIAS_ON
Definition: ad4110.h:103
ad4110_init_param::spi_init
struct no_os_spi_init_param spi_init
Definition: ad4110.h:328
AD4110_SYNC_EN
@ AD4110_SYNC_EN
Definition: ad4110.h:197
AD4110_AFE_ADC_CLOCKED
@ AD4110_AFE_ADC_CLOCKED
Definition: ad4110.h:192
ad4110_dev
Definition: ad4110.h:302
ad4110_init_param::afe_clk
enum ad4110_afe_clk_cfg afe_clk
Definition: ad4110.h:338
SPS_50
@ SPS_50
Definition: ad4110.h:290
SPS_400P6
@ SPS_400P6
Definition: ad4110.h:286
ad4110_set_gain
int32_t ad4110_set_gain(struct ad4110_dev *dev, enum ad4110_gain gain)
Definition: ad4110.c:186
ad4110_callback_ctx
Definition: ad4110.h:350
AD4110_REG_AFE_CNTRL1
#define AD4110_REG_AFE_CNTRL1
Definition: ad4110.h:62
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:159
ad4110_init_param::gain
enum ad4110_gain gain
Definition: ad4110.h:336
KSPS_2P5
@ KSPS_2P5
Definition: ad4110.h:283
ad4110_callback_ctx::buffer_size
uint32_t buffer_size
Definition: ad4110.h:353
no_os_callback_desc
Structure describing a callback to be registered.
Definition: no_os_irq.h:142
ad4110_continuous_read
int32_t ad4110_continuous_read(struct ad4110_dev *dev, uint32_t *buffer, uint32_t buffer_size)
Definition: ad4110.c:1040
ad4110_callback_ctx::dev
struct ad4110_dev * dev
Definition: ad4110.h:351
AD4110_REG_ADC_MODE_MSK
#define AD4110_REG_ADC_MODE_MSK
Definition: ad4110.h:140
AD4110_ADC_CRC_EN
#define AD4110_ADC_CRC_EN(x)
Definition: ad4110.h:148
no_os_spi.h
Header file of SPI Interface.
no_os_irq.h
Header file of IRQ interface.
no_os_irq_register_callback
int32_t no_os_irq_register_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *callback_desc)
Register a callback to handle the irq events.
Definition: no_os_irq.c:92
ad4110_compute_xor
uint8_t ad4110_compute_xor(uint8_t *data, uint8_t data_size)
Definition: ad4110.c:88
DISABLE_AIN_BUFFER
@ DISABLE_AIN_BUFFER
Definition: ad4110.h:267
ad4110_set_adc_clk
int32_t ad4110_set_adc_clk(struct ad4110_dev *dev, enum ad4110_adc_clk_sel clk)
Definition: ad4110.c:206
AD4110_REG_PGA_RTD_CTRL_I_EXC_SEL
#define AD4110_REG_PGA_RTD_CTRL_I_EXC_SEL(x)
Definition: ad4110.h:118
AD4110_GAIN_0_25
@ AD4110_GAIN_0_25
Definition: ad4110.h:249
ad4110_compute_crc8
uint8_t ad4110_compute_crc8(uint8_t *data, uint8_t data_size)
Definition: ad4110.c:60
ad4110_set_reference
int32_t ad4110_set_reference(struct ad4110_dev *dev, enum ad4110_voltage_reference ref)
Definition: ad4110.c:245
SPS_100P2
@ SPS_100P2
Definition: ad4110.h:288
AD4110_FLD_POWER_MODE
@ AD4110_FLD_POWER_MODE
Definition: ad4110.h:230
ad4110_dev::irq_desc
struct no_os_irq_ctrl_desc * irq_desc
Definition: ad4110.h:322
NO_OS_IRQ_LEVEL_LOW
@ NO_OS_IRQ_LEVEL_LOW
Definition: no_os_irq.h:77
ad4110_init_param::adc_crc_en
enum ad4110_adc_crc_mode adc_crc_en
Definition: ad4110.h:334
pr_err
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:88
ad4110_set_odr
int ad4110_set_odr(struct ad4110_dev *dev, enum ad4110_odr odr)
Set Output Data Rate.
Definition: ad4110.c:796
AD4110_REG_DATA
#define AD4110_REG_DATA
Definition: ad4110.h:78
ad4110_init_param::addr
uint8_t addr
Definition: ad4110.h:340
SPS_60
@ SPS_60
Definition: ad4110.h:289
AD4110_AFE_VBIAS
#define AD4110_AFE_VBIAS(x)
Definition: ad4110.h:102
ad4110_set_adc_mode
int32_t ad4110_set_adc_mode(struct ad4110_dev *dev, enum ad4110_adc_mode mode)
Definition: ad4110.c:148
no_os_delay.h
Header file of Delay functions.
ad4110_gain
ad4110_gain
Definition: ad4110.h:247
AD4110_ENABLE
@ AD4110_ENABLE
Definition: ad4110.h:208
pr_info
#define pr_info(fmt, args...)
Definition: no_os_print_log.h:115
ad4110_set_odr
int ad4110_set_odr(struct ad4110_dev *dev, enum ad4110_odr odr)
Set Output Data Rate.
Definition: ad4110.c:796
AD4110_ADC_CRC_DISABLE
@ AD4110_ADC_CRC_DISABLE
Definition: ad4110.h:237
ad4110_init_param::order
enum ad4110_order order
Definition: ad4110.h:344
AD4110_DATA_WL24
@ AD4110_DATA_WL24
Definition: ad4110.h:212
AD4110_GAIN_24
@ AD4110_GAIN_24
Definition: ad4110.h:263
ad4110_adc_crc_mode
ad4110_adc_crc_mode
Definition: ad4110.h:236
sinc5_sinc1
@ sinc5_sinc1
Definition: ad4110.h:298
ad4110_init_param::bipolar
bool bipolar
Definition: ad4110.h:341
ad4110_set_order
int ad4110_set_order(struct ad4110_dev *dev, enum ad4110_order order)
Set Order of Filter.
Definition: ad4110.c:818
ENABLE_NEG_BUFFER
@ ENABLE_NEG_BUFFER
Definition: ad4110.h:268
device
Definition: ad9361_util.h:69
AD4110_REG_ADC_INTERFACE
#define AD4110_REG_ADC_INTERFACE
Definition: ad4110.h:76
AD4110_EXT_REF
@ AD4110_EXT_REF
Definition: ad4110.h:201
ad4110_setup
int32_t ad4110_setup(struct ad4110_dev **device, struct ad4110_init_param init_param)
Definition: ad4110.c:890
AD4110_AVDD5_REF
@ AD4110_AVDD5_REF
Definition: ad4110.h:203
ad4110_ain_buffer
ad4110_ain_buffer
Definition: ad4110.h:266
ad4110_spi_int_data_reg_read
int32_t ad4110_spi_int_data_reg_read(struct ad4110_dev *dev, uint32_t *reg_data)
Definition: ad4110.c:549
no_os_print_log.h
Print messages helpers.
ad4110_set_adc_mode
int32_t ad4110_set_adc_mode(struct ad4110_dev *dev, enum ad4110_adc_mode mode)
Definition: ad4110.c:148
AD4110_REG_ADC_INTERFACE_DS_MSK
#define AD4110_REG_ADC_INTERFACE_DS_MSK
Definition: ad4110.h:150
AD4110_GAIN_4
@ AD4110_GAIN_4
Definition: ad4110.h:258
ad4110_odr
ad4110_odr
Definition: ad4110.h:273
ad4110_set_afe_clk
int32_t ad4110_set_afe_clk(struct ad4110_dev *dev, enum ad4110_afe_clk_cfg clk)
Definition: ad4110.c:225
ad4110_spi_do_soft_reset
int32_t ad4110_spi_do_soft_reset(struct ad4110_dev *dev)
Definition: ad4110.c:443
AD4110_GAIN_1_5
@ AD4110_GAIN_1_5
Definition: ad4110.h:255
ad4110_dev::afe_clk
enum ad4110_afe_clk_cfg afe_clk
Definition: ad4110.h:314
AD4110_AFE_CRC_DISABLE
@ AD4110_AFE_CRC_DISABLE
Definition: ad4110.h:243
ad4110_dev::data_length
enum ad4110_data_word_length data_length
Definition: ad4110.h:308
AD4110_REG_AFE_CNTRL2_EXT_R_SEL_MSK
#define AD4110_REG_AFE_CNTRL2_EXT_R_SEL_MSK
Definition: ad4110.h:100
AD4110_REG_AFE_CLK_CTRL_CFG
#define AD4110_REG_AFE_CLK_CTRL_CFG(x)
Definition: ad4110.h:96
AD4110_PW_DOWN_MODE
@ AD4110_PW_DOWN_MODE
Definition: ad4110.h:220
AD4110_AFE_CRC
@ AD4110_AFE_CRC
Definition: ad4110.h:244
KSPS_1
@ KSPS_1
Definition: ad4110.h:284
AD4110_AFE_INT_CLOCK
@ AD4110_AFE_INT_CLOCK
Definition: ad4110.h:191
AD4110_DISABLE
@ AD4110_DISABLE
Definition: ad4110.h:207
SPS_200
@ SPS_200
Definition: ad4110.h:287
ad4110_init_param::odr
enum ad4110_odr odr
Definition: ad4110.h:343
sinc3
@ sinc3
Definition: ad4110.h:299
AD4110_REG_ADC_INTERFACE_WL16_MSK
#define AD4110_REG_ADC_INTERFACE_WL16_MSK
Definition: ad4110.h:149
KSPS_15P625
@ KSPS_15P625
Definition: ad4110.h:280
AD4110_REG_AFE_CNTRL2_AINN_DN100
#define AD4110_REG_AFE_CNTRL2_AINN_DN100
Definition: ad4110.h:113
ad4110_op_mode
ad4110_op_mode
Definition: ad4110.h:225
KSPS_10P417
@ KSPS_10P417
Definition: ad4110.h:281
ad4110_get_data_size
uint8_t ad4110_get_data_size(struct ad4110_dev *dev, uint8_t reg_map, uint8_t reg_addr)
Definition: ad4110.c:464
ad4110_afe_clk_cfg
ad4110_afe_clk_cfg
Definition: ad4110.h:190
ENABLE_FULL_BUFFER
@ ENABLE_FULL_BUFFER
Definition: ad4110.h:270
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
ad4110_state
ad4110_state
Definition: ad4110.h:206
ad4110_init_param::data_stat
enum ad4110_state data_stat
Definition: ad4110.h:331
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
ad4110_setup
int32_t ad4110_setup(struct ad4110_dev **device, struct ad4110_init_param init_param)
Definition: ad4110.c:890
ad4110_spi_int_reg_write
int32_t ad4110_spi_int_reg_write(struct ad4110_dev *dev, uint8_t reg_map, uint8_t reg_addr, uint32_t reg_data)
Definition: ad4110.c:499
ad4110_set_op_mode
int32_t ad4110_set_op_mode(struct ad4110_dev *dev, enum ad4110_op_mode mode)
Definition: ad4110.c:290
AD4110_REG_ADC_MODE_REF_EN
#define AD4110_REG_ADC_MODE_REF_EN
Definition: ad4110.h:142
AD4110_ADC_OFFSET0
#define AD4110_ADC_OFFSET0
Definition: ad4110.h:82
no_os_error.h
Error codes definition.
AD4110_GAIN_0_375
@ AD4110_GAIN_0_375
Definition: ad4110.h:251
ad4110_voltage_reference
ad4110_voltage_reference
Definition: ad4110.h:200
ad4110_spi_int_data_reg_read
int32_t ad4110_spi_int_data_reg_read(struct ad4110_dev *dev, uint32_t *reg_data)
Definition: ad4110.c:549
AD4110_RTD_3W_MODE
@ AD4110_RTD_3W_MODE
Definition: ad4110.h:232
SPS_500
@ SPS_500
Definition: ad4110.h:285
ad4110_adc_mode
ad4110_adc_mode
Definition: ad4110.h:216
AD4110_ADC_CRC_CRC
@ AD4110_ADC_CRC_CRC
Definition: ad4110.h:239
AD4110_REG_PGA_RTD_CTRL_23W_EN_MSK
#define AD4110_REG_PGA_RTD_CTRL_23W_EN_MSK
Definition: ad4110.h:116
ad4110_afe_crc_mode
ad4110_afe_crc_mode
Definition: ad4110.h:242
ad4110_spi_int_reg_read
int32_t ad4110_spi_int_reg_read(struct ad4110_dev *dev, uint8_t reg_map, uint8_t reg_addr, uint32_t *reg_data)
Definition: ad4110.c:628
ad4110_dev::afe_crc_en
enum ad4110_afe_crc_mode afe_crc_en
Definition: ad4110.h:310
AD4110_DATA_STAT_EN
#define AD4110_DATA_STAT_EN
Definition: ad4110.h:151
ad4110_dev::addr
uint8_t addr
Definition: ad4110.h:316
AD4110_REG_ADC_INTERFACE_CRC_EN_MSK
#define AD4110_REG_ADC_INTERFACE_CRC_EN_MSK
Definition: ad4110.h:147
ad4110_set_order
int ad4110_set_order(struct ad4110_dev *dev, enum ad4110_order order)
Set Order of Filter.
Definition: ad4110.c:818
AD4110_GAIN_3
@ AD4110_GAIN_3
Definition: ad4110.h:257
no_os_callback_desc::ctx
void * ctx
Definition: no_os_irq.h:146
AD4110_GAIN_0_3
@ AD4110_GAIN_0_3
Definition: ad4110.h:250
ad4110_dev::sync
enum ad4110_sync_en sync
Definition: ad4110.h:313
AD4110_GAIN_8
@ AD4110_GAIN_8
Definition: ad4110.h:260
AD4110_REG_ADC_GPIO_CONFIG
#define AD4110_REG_ADC_GPIO_CONFIG
Definition: ad4110.h:80
KSPS_125_A
@ KSPS_125_A
Definition: ad4110.h:274
KSPS_31P25
@ KSPS_31P25
Definition: ad4110.h:278
AD4110_GAIN_1
@ AD4110_GAIN_1
Definition: ad4110.h:254
AD4110_REG_PGA_RTD_CTRL_GAIN_CH
#define AD4110_REG_PGA_RTD_CTRL_GAIN_CH(x)
Definition: ad4110.h:120
ad4110_set_analog_input_buffer
int ad4110_set_analog_input_buffer(struct ad4110_dev *dev, enum ad4110_ain_buffer buffer)
Assign analog input buffer.
Definition: ad4110.c:743
KSPS_5
@ KSPS_5
Definition: ad4110.h:282
AD4110_REG_ADC_CONFIG_AIN_BUFF
#define AD4110_REG_ADC_CONFIG_AIN_BUFF(x)
Definition: ad4110.h:161
ad4110_init_param::nready_pin
uint32_t nready_pin
Definition: ad4110.h:347
AD4110_SYS_GAIN_CAL
@ AD4110_SYS_GAIN_CAL
Definition: ad4110.h:222
AD4110_REG_AFE_CLK_CTRL
#define AD4110_REG_AFE_CLK_CTRL
Definition: ad4110.h:63
ad4110_compute_xor
uint8_t ad4110_compute_xor(uint8_t *data, uint8_t data_size)
Definition: ad4110.c:88
AD4110_THERMOCOUPLE
@ AD4110_THERMOCOUPLE
Definition: ad4110.h:229
AD4110_REG_ADC_FILTER_ORDER
#define AD4110_REG_ADC_FILTER_ORDER(x)
Definition: ad4110.h:166
SPS_20
@ SPS_20
Definition: ad4110.h:291
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
ad4110_get_data_size
uint8_t ad4110_get_data_size(struct ad4110_dev *dev, uint8_t reg_map, uint8_t reg_addr)
Definition: ad4110.c:464
ad4110_dev::gain
enum ad4110_gain gain
Definition: ad4110.h:312
ad4110_adc_clk_sel
ad4110_adc_clk_sel
Definition: ad4110.h:184
AD4110_REG_AFE_CNTRL2_EN_FLD_PWR_MSK
#define AD4110_REG_AFE_CNTRL2_EN_FLD_PWR_MSK
Definition: ad4110.h:101
no_os_callback_desc::callback
void(* callback)(void *context)
Definition: no_os_irq.h:144
AD4110_GAIN_0_5
@ AD4110_GAIN_0_5
Definition: ad4110.h:252
ad4110_dev::analog_input_buff
enum ad4110_ain_buffer analog_input_buff
Definition: ad4110.h:318
AD4110_GAIN_2
@ AD4110_GAIN_2
Definition: ad4110.h:256
ad4110_spi_do_soft_reset
int32_t ad4110_spi_do_soft_reset(struct ad4110_dev *dev)
Definition: ad4110.c:443
AD4110_AFE_VBIAS_OFF
#define AD4110_AFE_VBIAS_OFF
Definition: ad4110.h:105
KSPS_62P5_A
@ KSPS_62P5_A
Definition: ad4110.h:276
AD4110_INT_2_5V_REF
@ AD4110_INT_2_5V_REF
Definition: ad4110.h:202
ad4110_set_analog_input_buffer
int ad4110_set_analog_input_buffer(struct ad4110_dev *dev, enum ad4110_ain_buffer buffer)
Assign analog input buffer.
Definition: ad4110.c:743
ad4110_remove
int32_t ad4110_remove(struct ad4110_dev *dev)
Free the resources allocated by ad4110_setup().
Definition: ad4110.c:1087
ad4110_init_param::analog_input_buff
enum ad4110_ain_buffer analog_input_buff
Definition: ad4110.h:342
ad4110_set_reference
int32_t ad4110_set_reference(struct ad4110_dev *dev, enum ad4110_voltage_reference ref)
Definition: ad4110.c:245
AD4110_CRC8_POLY
#define AD4110_CRC8_POLY
Definition: ad4110.h:175
A4110_AFE
#define A4110_AFE
Definition: ad4110.h:58
ad4110_init_param
Definition: ad4110.h:326
ad4110_dev::spi_dev
struct no_os_spi_desc * spi_dev
Definition: ad4110.h:304
ad4110_dev::adc_clk
enum ad4110_adc_clk_sel adc_clk
Definition: ad4110.h:315
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
AD4110_REG_PGA_RTD_CTRL
#define AD4110_REG_PGA_RTD_CTRL
Definition: ad4110.h:65
AD4110_DEV_ADDR_MASK
#define AD4110_DEV_ADDR_MASK
Definition: ad4110.h:54
ad4110_spi_int_reg_read
int32_t ad4110_spi_int_reg_read(struct ad4110_dev *dev, uint8_t reg_map, uint8_t reg_addr, uint32_t *reg_data)
Definition: ad4110.c:628
ad4110_dev::volt_ref
enum ad4110_voltage_reference volt_ref
Definition: ad4110.h:306
AD4110_GAIN_16
@ AD4110_GAIN_16
Definition: ad4110.h:262
AD4110_STANDBY_MODE
@ AD4110_STANDBY_MODE
Definition: ad4110.h:219
ad4110_set_op_mode
int32_t ad4110_set_op_mode(struct ad4110_dev *dev, enum ad4110_op_mode mode)
Definition: ad4110.c:290
SPS_10
@ SPS_10
Definition: ad4110.h:293
ad4110.h
Header file of AD4110 Driver.
ENABLE_POS_BUFFER
@ ENABLE_POS_BUFFER
Definition: ad4110.h:269
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:69
ad4110_set_bipolar
int ad4110_set_bipolar(struct ad4110_dev *dev, bool bipolar)
Set polarity.
Definition: ad4110.c:766
ad4110_set_adc_clk
int32_t ad4110_set_adc_clk(struct ad4110_dev *dev, enum ad4110_adc_clk_sel clk)
Definition: ad4110.c:206
AD4110_RTD_4W_MODE
@ AD4110_RTD_4W_MODE
Definition: ad4110.h:233
AD4110_REG_ADC_MODE
#define AD4110_REG_ADC_MODE
Definition: ad4110.h:75
ad4110_dev::odr
enum ad4110_odr odr
Definition: ad4110.h:319
AD4110_REG_AFE_CNTRL2_IMODE_MSK
#define AD4110_REG_AFE_CNTRL2_IMODE_MSK
Definition: ad4110.h:99
AD4110_REG_ADC_CONFIG
#define AD4110_REG_ADC_CONFIG
Definition: ad4110.h:77
ad4110_wait_for_rdy_low
int ad4110_wait_for_rdy_low(struct ad4110_dev *dev, uint32_t timeout)
Wait for RDY bit to go low indicating conversion completion.
Definition: ad4110.c:840
AD4110_REG_ADC_STATUS
#define AD4110_REG_ADC_STATUS
Definition: ad4110.h:74
AD4110_ADC_INT_CLK_CLKIO
@ AD4110_ADC_INT_CLK_CLKIO
Definition: ad4110.h:186
AD4110_ADC_INT_CLK
@ AD4110_ADC_INT_CLK
Definition: ad4110.h:185
ad4110_dev::nready_pin
uint32_t nready_pin
Definition: ad4110.h:323
AD4110_VOLTAGE_MODE
@ AD4110_VOLTAGE_MODE
Definition: ad4110.h:226
ad4110_dev::adc_crc_en
enum ad4110_adc_crc_mode adc_crc_en
Definition: ad4110.h:309
AD4110_GAIN_12
@ AD4110_GAIN_12
Definition: ad4110.h:261
ad4110_spi_int_reg_write_msk
int32_t ad4110_spi_int_reg_write_msk(struct ad4110_dev *dev, uint8_t reg_map, uint8_t reg_addr, uint32_t data, uint16_t mask)
Definition: ad4110.c:117
ad4110_dev::data_stat
enum ad4110_state data_stat
Definition: ad4110.h:307
ad4110_compute_crc8
uint8_t ad4110_compute_crc8(uint8_t *data, uint8_t data_size)
Definition: ad4110.c:60
ad4110_dev::op_mode
enum ad4110_op_mode op_mode
Definition: ad4110.h:311
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
AD4110_RTD_2W_MODE
@ AD4110_RTD_2W_MODE
Definition: ad4110.h:231
SPS_16P7
@ SPS_16P7
Definition: ad4110.h:292
ad4110_init_param::data_length
enum ad4110_data_word_length data_length
Definition: ad4110.h:332
bipolar
@ bipolar
Definition: ad5446.h:71
ad4110_set_channel_status
int ad4110_set_channel_status(struct ad4110_dev *dev, uint8_t chan_id, bool status)
Enable/Disable channel.
Definition: ad4110.c:723
AD4110_GAIN_0_2
@ AD4110_GAIN_0_2
Definition: ad4110.h:248
AD4110_CMD_READ_COM_REG
#define AD4110_CMD_READ_COM_REG(x)
Definition: ad4110.h:53
KSPS_125_B
@ KSPS_125_B
Definition: ad4110.h:275
SPS_5
@ SPS_5
Definition: ad4110.h:294
AD4110_REG_ADC_CONFIG_BI_UNIPOLAR
#define AD4110_REG_ADC_CONFIG_BI_UNIPOLAR
Definition: ad4110.h:162
AD4110_ADC_MODE
#define AD4110_ADC_MODE(x)
Definition: ad4110.h:141
ad4110_init_param::volt_ref
enum ad4110_voltage_reference volt_ref
Definition: ad4110.h:330
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:116
AD4110_ADC_EXT_CLK
@ AD4110_ADC_EXT_CLK
Definition: ad4110.h:187
no_os_irq_enable
int32_t no_os_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Enable specific interrupt.
Definition: no_os_irq.c:181
ad4110_do_single_read
int ad4110_do_single_read(struct ad4110_dev *dev, uint32_t *buffer)
ADC data read in single conversion mode.
Definition: ad4110.c:863
no_os_gpio.h
Header file of GPIO Interface.
AD4110_ADC_XOR_CRC
@ AD4110_ADC_XOR_CRC
Definition: ad4110.h:238
ad4110_set_afe_clk
int32_t ad4110_set_afe_clk(struct ad4110_dev *dev, enum ad4110_afe_clk_cfg clk)
Definition: ad4110.c:225
AD4110_GAIN_6
@ AD4110_GAIN_6
Definition: ad4110.h:259
AD4110_REG_ADC_CLK_SEL
#define AD4110_REG_ADC_CLK_SEL(x)
Definition: ad4110.h:144
AD4110_REG_ADC_FILTER_ODR
#define AD4110_REG_ADC_FILTER_ODR(x)
Definition: ad4110.h:165
ad4110_dev::order
enum ad4110_order order
Definition: ad4110.h:320
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:52
AD4110_DATA_WL16
@ AD4110_DATA_WL16
Definition: ad4110.h:213
ad4110_spi_int_reg_write_msk
int32_t ad4110_spi_int_reg_write_msk(struct ad4110_dev *dev, uint8_t reg_map, uint8_t reg_addr, uint32_t data, uint16_t mask)
Definition: ad4110.c:117
no_os_util.h
Header file of utility functions.
AD4110_REG_ADC_CONFIG_REF_SEL
#define AD4110_REG_ADC_CONFIG_REF_SEL(x)
Definition: ad4110.h:159
AD4110_ADC_CONV_TIMEOUT
#define AD4110_ADC_CONV_TIMEOUT
Definition: ad4110.h:178
ad4110_init_param::adc_clk
enum ad4110_adc_clk_sel adc_clk
Definition: ad4110.h:339
AD4110_CMD_WR_COM_REG
#define AD4110_CMD_WR_COM_REG(x)
Definition: ad4110.h:52
ad4110_callback_ctx::buffer
uint32_t * buffer
Definition: ad4110.h:352
AD4110_CURRENT_MODE
@ AD4110_CURRENT_MODE
Definition: ad4110.h:227
AD4110_REG_FILTER
#define AD4110_REG_FILTER
Definition: ad4110.h:79
no_os_irq_trigger_level_set
int32_t no_os_irq_trigger_level_set(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, enum no_os_irq_trig_level trig)
Set interrupt trigger level.
Definition: no_os_irq.c:162
no_os_irq_disable
int32_t no_os_irq_disable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Disable specific interrupt.
Definition: no_os_irq.c:198
ad4110_set_bipolar
int ad4110_set_bipolar(struct ad4110_dev *dev, bool bipolar)
Set polarity.
Definition: ad4110.c:766
no_os_irq_ctrl_desc
Definition: no_os_irq.h:123
AD4110_REG_GPIO_CONFIG_SYNC_EN
#define AD4110_REG_GPIO_CONFIG_SYNC_EN(x)
Definition: ad4110.h:172
ad4110_init_param::op_mode
enum ad4110_op_mode op_mode
Definition: ad4110.h:335
AD4110_SYS_OFFSET_CAL
@ AD4110_SYS_OFFSET_CAL
Definition: ad4110.h:221
ad4110_wait_for_rdy_low
int ad4110_wait_for_rdy_low(struct ad4110_dev *dev, uint32_t timeout)
Wait for RDY bit to go low indicating conversion completion.
Definition: ad4110.c:840
ad4110_set_channel_status
int ad4110_set_channel_status(struct ad4110_dev *dev, uint8_t chan_id, bool status)
Enable/Disable channel.
Definition: ad4110.c:723
ad4110_sync_en
ad4110_sync_en
Definition: ad4110.h:195
ad4110_spi_int_reg_write
int32_t ad4110_spi_int_reg_write(struct ad4110_dev *dev, uint8_t reg_map, uint8_t reg_addr, uint32_t reg_data)
Definition: ad4110.c:499
ad4110_init_param::afe_crc_en
enum ad4110_afe_crc_mode afe_crc_en
Definition: ad4110.h:333
ad4110_continuous_read
int32_t ad4110_continuous_read(struct ad4110_dev *dev, uint32_t *buffer, uint32_t buffer_size)
Definition: ad4110.c:1040
AD4110_CURRENT_MODE_EXT_R_SEL
@ AD4110_CURRENT_MODE_EXT_R_SEL
Definition: ad4110.h:228
ad4110_order
ad4110_order
Definition: ad4110.h:297
ad4110_init_param::irq_desc
struct no_os_irq_ctrl_desc * irq_desc
Definition: ad4110.h:346
ad4110_do_single_read
int ad4110_do_single_read(struct ad4110_dev *dev, uint32_t *buffer)
ADC data read in single conversion mode.
Definition: ad4110.c:863
ad4110_init_param::sync
enum ad4110_sync_en sync
Definition: ad4110.h:337
AD4110_REG_ADC_STATUS_RDY
#define AD4110_REG_ADC_STATUS_RDY
Definition: ad4110.h:137
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
AD4110_SINGLE_CONV_MODE
@ AD4110_SINGLE_CONV_MODE
Definition: ad4110.h:218
KSPS_25
@ KSPS_25
Definition: ad4110.h:279
A4110_ADC
#define A4110_ADC
Definition: ad4110.h:57