no-OS
ad7124.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef __AD7124_H__
41 #define __AD7124_H__
42 
43 /******************************************************************************/
44 /***************************** Include Files **********************************/
45 /******************************************************************************/
46 #include <stdint.h>
47 #include <stdbool.h>
48 #include "no_os_spi.h"
49 #include "no_os_delay.h"
50 #include "no_os_util.h"
51 
52 /******************************************************************************/
53 /********************** Macros and Constants Definitions **********************/
54 /******************************************************************************/
55 #define AD7124_RW 1 /* Read and Write */
56 #define AD7124_R 2 /* Read only */
57 #define AD7124_W 3 /* Write only */
58 
59 /* Total Number of Setups */
60 #define AD7124_MAX_SETUPS 8
61 /* Maximum number of channels */
62 #define AD7124_MAX_CHANNELS 16
63 
64 /* AD7124-4 Standard Device ID */
65 #define AD7124_4_STD_ID 0x04
66 /* AD7124-4 B Grade Device ID */
67 #define AD7124_4_B_GRADE_ID 0x06
68 /* Device ID for the re-designed die in the AD7124-4 standard part and B-grade */
69 #define AD7124_4_NEW_ID 0x07
70 
71 /* AD7124-8 Standard Device ID */
72 #define AD7124_8_STD_ID 0x14
73 /* AD7124-8 B and W Grade Device ID */
74 #define AD7124_8_B_W_GRADE_ID 0x16
75 /* Device ID for the re-designed die in the AD7124-8 standard part, B-grade and W-grade */
76 #define AD7124_8_NEW_ID 0x17
77 
78 /* AD7124 Register Map */
79 #define AD7124_COMM_REG 0x00
80 #define AD7124_STATUS_REG 0x00
81 #define AD7124_ADC_CTRL_REG 0x01
82 #define AD7124_DATA_REG 0x02
83 #define AD7124_IO_CTRL1_REG 0x03
84 #define AD7124_IO_CTRL2_REG 0x04
85 #define AD7124_ID_REG 0x05
86 #define AD7124_ERR_REG 0x06
87 #define AD7124_ERREN_REG 0x07
88 #define AD7124_CH0_MAP_REG 0x09
89 #define AD7124_CH1_MAP_REG 0x0A
90 #define AD7124_CH2_MAP_REG 0x0B
91 #define AD7124_CH3_MAP_REG 0x0C
92 #define AD7124_CH4_MAP_REG 0x0D
93 #define AD7124_CH5_MAP_REG 0x0E
94 #define AD7124_CH6_MAP_REG 0x0F
95 #define AD7124_CH7_MAP_REG 0x10
96 #define AD7124_CH8_MAP_REG 0x11
97 #define AD7124_CH9_MAP_REG 0x12
98 #define AD7124_CH10_MAP_REG 0x13
99 #define AD7124_CH11_MAP_REG 0x14
100 #define AD7124_CH12_MAP_REG 0x15
101 #define AD7124_CH13_MAP_REG 0x16
102 #define AD7124_CH14_MAP_REG 0x17
103 #define AD7124_CH15_MAP_REG 0x18
104 #define AD7124_CFG0_REG 0x19
105 #define AD7124_CFG1_REG 0x1A
106 #define AD7124_CFG2_REG 0x1B
107 #define AD7124_CFG3_REG 0x1C
108 #define AD7124_CFG4_REG 0x1D
109 #define AD7124_CFG5_REG 0x1E
110 #define AD7124_CFG6_REG 0x1F
111 #define AD7124_CFG7_REG 0x20
112 #define AD7124_FILT0_REG 0x21
113 #define AD7124_FILT1_REG 0x22
114 #define AD7124_FILT2_REG 0x23
115 #define AD7124_FILT3_REG 0x24
116 #define AD7124_FILT4_REG 0x25
117 #define AD7124_FILT5_REG 0x26
118 #define AD7124_FILT6_REG 0x27
119 #define AD7124_FILT7_REG 0x28
120 #define AD7124_OFFS0_REG 0x29
121 #define AD7124_OFFS1_REG 0x2A
122 #define AD7124_OFFS2_REG 0x2B
123 #define AD7124_OFFS3_REG 0x2C
124 #define AD7124_OFFS4_REG 0x2D
125 #define AD7124_OFFS5_REG 0x2E
126 #define AD7124_OFFS6_REG 0x2F
127 #define AD7124_OFFS7_REG 0x30
128 #define AD7124_GAIN0_REG 0x31
129 #define AD7124_GAIN1_REG 0x32
130 #define AD7124_GAIN2_REG 0x33
131 #define AD7124_GAIN3_REG 0x34
132 #define AD7124_GAIN4_REG 0x35
133 #define AD7124_GAIN5_REG 0x36
134 #define AD7124_GAIN6_REG 0x37
135 #define AD7124_GAIN7_REG 0x38
136 
137 /* Communication Register bits */
138 #define AD7124_COMM_REG_WEN (0 << 7)
139 #define AD7124_COMM_REG_WR (0 << 6)
140 #define AD7124_COMM_REG_RD (1 << 6)
141 #define AD7124_COMM_REG_RA(x) ((x) & 0x3F)
142 
143 /* Status Register bits */
144 #define AD7124_STATUS_REG_RDY (1 << 7)
145 #define AD7124_STATUS_REG_ERROR_FLAG (1 << 6)
146 #define AD7124_STATUS_REG_POR_FLAG (1 << 4)
147 #define AD7124_STATUS_REG_CH_ACTIVE(x) ((x) & 0xF)
148 
149 /* ADC_Control Register bits */
150 #define AD7124_ADC_CTRL_REG_DOUT_RDY_DEL (1 << 12)
151 #define AD7124_ADC_CTRL_REG_CONT_READ (1 << 11)
152 #define AD7124_ADC_CTRL_REG_DATA_STATUS (1 << 10)
153 #define AD7124_ADC_CTRL_REG_CS_EN (1 << 9)
154 #define AD7124_ADC_CTRL_REG_REF_EN (1 << 8)
155 #define AD7124_ADC_CTRL_REG_POWER_MODE(x) (((x) & 0x3) << 6)
156 #define AD7124_ADC_CTRL_REG_MODE(x) (((x) & 0xF) << 2)
157 #define AD7124_ADC_CTRL_REG_CLK_SEL(x) (((x) & 0x3) << 0)
158 
159 /* IO_Control_1 Register bits */
160 #define AD7124_IO_CTRL1_REG_GPIO_DAT2 (1 << 23)
161 #define AD7124_IO_CTRL1_REG_GPIO_DAT1 (1 << 22)
162 #define AD7124_IO_CTRL1_REG_GPIO_CTRL2 (1 << 19)
163 #define AD7124_IO_CTRL1_REG_GPIO_CTRL1 (1 << 18)
164 #define AD7124_IO_CTRL1_REG_PDSW (1 << 15)
165 #define AD7124_IO_CTRL1_REG_IOUT1(x) (((x) & 0x7) << 11)
166 #define AD7124_IO_CTRL1_REG_IOUT0(x) (((x) & 0x7) << 8)
167 #define AD7124_IO_CTRL1_REG_IOUT_CH1(x) (((x) & 0xF) << 4)
168 #define AD7124_IO_CTRL1_REG_IOUT_CH0(x) (((x) & 0xF) << 0)
169 
170 /* IO_Control_1 AD7124-8 specific bits */
171 #define AD7124_8_IO_CTRL1_REG_GPIO_DAT4 (1 << 23)
172 #define AD7124_8_IO_CTRL1_REG_GPIO_DAT3 (1 << 22)
173 #define AD7124_8_IO_CTRL1_REG_GPIO_DAT2 (1 << 21)
174 #define AD7124_8_IO_CTRL1_REG_GPIO_DAT1 (1 << 20)
175 #define AD7124_8_IO_CTRL1_REG_GPIO_CTRL4 (1 << 19)
176 #define AD7124_8_IO_CTRL1_REG_GPIO_CTRL3 (1 << 18)
177 #define AD7124_8_IO_CTRL1_REG_GPIO_CTRL2 (1 << 17)
178 #define AD7124_8_IO_CTRL1_REG_GPIO_CTRL1 (1 << 16)
179 
180 /* IO_Control_2 Register bits */
181 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS7 (1 << 15)
182 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS6 (1 << 14)
183 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS5 (1 << 11)
184 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS4 (1 << 10)
185 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS3 (1 << 5)
186 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS2 (1 << 4)
187 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS1 (1 << 1)
188 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS0 (1 << 0)
189 
190 /* IO_Control_2 AD7124-8 specific bits */
191 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS15 (1 << 15)
192 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS14 (1 << 14)
193 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS13 (1 << 13)
194 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS12 (1 << 12)
195 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS11 (1 << 11)
196 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS10 (1 << 10)
197 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS9 (1 << 9)
198 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS8 (1 << 8)
199 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS7 (1 << 7)
200 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS6 (1 << 6)
201 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS5 (1 << 5)
202 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS4 (1 << 4)
203 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS3 (1 << 3)
204 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS2 (1 << 2)
205 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS1 (1 << 1)
206 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS0 (1 << 0)
207 
208 /* ID Register bits */
209 #define AD7124_ID_REG_DEVICE_ID(x) (((x) & 0xF) << 4)
210 #define AD7124_ID_REG_SILICON_REV(x) (((x) & 0xF) << 0)
211 
212 /* Error Register bits */
213 #define AD7124_ERR_REG_LDO_CAP_ERR (1 << 19)
214 #define AD7124_ERR_REG_ADC_CAL_ERR (1 << 18)
215 #define AD7124_ERR_REG_ADC_CONV_ERR (1 << 17)
216 #define AD7124_ERR_REG_ADC_SAT_ERR (1 << 16)
217 #define AD7124_ERR_REG_AINP_OV_ERR (1 << 15)
218 #define AD7124_ERR_REG_AINP_UV_ERR (1 << 14)
219 #define AD7124_ERR_REG_AINM_OV_ERR (1 << 13)
220 #define AD7124_ERR_REG_AINM_UV_ERR (1 << 12)
221 #define AD7124_ERR_REG_REF_DET_ERR (1 << 11)
222 #define AD7124_ERR_REG_DLDO_PSM_ERR (1 << 9)
223 #define AD7124_ERR_REG_ALDO_PSM_ERR (1 << 7)
224 #define AD7124_ERR_REG_SPI_IGNORE_ERR (1 << 6)
225 #define AD7124_ERR_REG_SPI_SLCK_CNT_ERR (1 << 5)
226 #define AD7124_ERR_REG_SPI_READ_ERR (1 << 4)
227 #define AD7124_ERR_REG_SPI_WRITE_ERR (1 << 3)
228 #define AD7124_ERR_REG_SPI_CRC_ERR (1 << 2)
229 #define AD7124_ERR_REG_MM_CRC_ERR (1 << 1)
230 #define AD7124_ERR_REG_ROM_CRC_ERR (1 << 0)
231 
232 /* Error_En Register bits */
233 #define AD7124_ERREN_REG_MCLK_CNT_EN (1 << 22)
234 #define AD7124_ERREN_REG_LDO_CAP_CHK_TEST_EN (1 << 21)
235 #define AD7124_ERREN_REG_LDO_CAP_CHK(x) (((x) & 0x3) << 19)
236 #define AD7124_ERREN_REG_ADC_CAL_ERR_EN (1 << 18)
237 #define AD7124_ERREN_REG_ADC_CONV_ERR_EN (1 << 17)
238 #define AD7124_ERREN_REG_ADC_SAT_ERR_EN (1 << 16)
239 #define AD7124_ERREN_REG_AINP_OV_ERR_EN (1 << 15)
240 #define AD7124_ERREN_REG_AINP_UV_ERR_EN (1 << 14)
241 #define AD7124_ERREN_REG_AINM_OV_ERR_EN (1 << 13)
242 #define AD7124_ERREN_REG_AINM_UV_ERR_EN (1 << 12)
243 #define AD7124_ERREN_REG_REF_DET_ERR_EN (1 << 11)
244 #define AD7124_ERREN_REG_DLDO_PSM_TRIP_TEST_EN (1 << 10)
245 #define AD7124_ERREN_REG_DLDO_PSM_ERR_ERR (1 << 9)
246 #define AD7124_ERREN_REG_ALDO_PSM_TRIP_TEST_EN (1 << 8)
247 #define AD7124_ERREN_REG_ALDO_PSM_ERR_EN (1 << 7)
248 #define AD7124_ERREN_REG_SPI_IGNORE_ERR_EN (1 << 6)
249 #define AD7124_ERREN_REG_SPI_SCLK_CNT_ERR_EN (1 << 5)
250 #define AD7124_ERREN_REG_SPI_READ_ERR_EN (1 << 4)
251 #define AD7124_ERREN_REG_SPI_WRITE_ERR_EN (1 << 3)
252 #define AD7124_ERREN_REG_SPI_CRC_ERR_EN (1 << 2)
253 #define AD7124_ERREN_REG_MM_CRC_ERR_EN (1 << 1)
254 #define AD7124_ERREN_REG_ROM_CRC_ERR_EN (1 << 0)
255 
256 /* Channel Registers 0-15 bits */
257 #define AD7124_CH_MAP_REG_CH_ENABLE (1 << 15)
258 #define AD7124_CH_MAP_REG_SETUP(x) (((x) & 0x7) << 12)
259 #define AD7124_CH_MAP_REG_AINP(x) (((x) & 0x1F) << 5)
260 #define AD7124_CH_MAP_REG_AINM(x) (((x) & 0x1F) << 0)
261 
262 /* Configuration Registers 0-7 bits */
263 #define AD7124_CFG_REG_BIPOLAR (1 << 11)
264 #define AD7124_CFG_REG_BURNOUT(x) (((x) & 0x3) << 9)
265 #define AD7124_CFG_REG_REF_BUFP (1 << 8)
266 #define AD7124_CFG_REG_REF_BUFM (1 << 7)
267 #define AD7124_CFG_REG_AIN_BUFP (1 << 6)
268 #define AD7124_CFG_REG_AINN_BUFM (1 << 5)
269 #define AD7124_CFG_REG_REF_SEL(x) ((x) & 0x3) << 3
270 #define AD7124_CFG_REG_PGA(x) (((x) & 0x7) << 0)
271 
272 /* Filter Register 0-7 bits */
273 #define AD7124_FILT_REG_FILTER(x) (((x) & 0x7) << 21)
274 #define AD7124_FILT_REG_REJ60 (1 << 20)
275 #define AD7124_FILT_REG_POST_FILTER(x) (((x) & 0x7) << 17)
276 #define AD7124_FILT_REG_SINGLE_CYCLE (1 << 16)
277 #define AD7124_FILT_REG_FS(x) (((x) & 0x7FF) << 0)
278 
279 #define AD7124_CRC8_POLYNOMIAL_REPRESENTATION 0x07 /* x8 + x2 + x + 1 */
280 #define AD7124_DISABLE_CRC 0
281 #define AD7124_USE_CRC 1
282 #define AD7124_CHMAP_REG_SETUP_SEL_MSK NO_OS_GENMASK(14,12)
283 #define AD7124_CHMAP_REG_AINPOS_MSK NO_OS_GENMASK(9,5)
284 #define AD7124_CHMAP_REG_AINNEG_MSK NO_OS_GENMASK(4,0)
285 #define AD7124_ADC_CTRL_REG_MODE_MSK NO_OS_GENMASK(5,2)
286 #define AD7124_SETUP_CONF_REG_REF_SEL_MSK NO_OS_GENMASK(4,3)
287 #define AD7124_REF_BUF_MSK NO_OS_GENMASK(8,7)
288 #define AD7124_AIN_BUF_MSK NO_OS_GENMASK(6,5)
289 #define AD7124_POWER_MODE_MSK NO_OS_GENMASK(7,6)
290 
291 /******************************************************************************/
292 /*************************** Types Declarations *******************************/
293 /******************************************************************************/
301 };
302 
318 };
319 
355 };
356 
364 };
365 
372  uint8_t setup_sel;
374 };
375 
381  /* External Reference REFIN1+/-*/
383  /* External Reference REFIN2+/-*/
385  /* Internal 2.5V Reference */
387  /* AVDD - AVSS */
389  /* Maximum Reference Sources */
391 };
392 
399  bool ref_buff;
400  bool ain_buff;
402 };
403 
412 };
413 
414 /* Device register info */
416  int32_t addr;
417  int32_t value;
418  int32_t size;
419  int32_t rw;
420 };
421 
422 /* AD7124 registers list */
482 };
483 
488 struct ad7124_dev {
489  /* SPI */
491  /* Device Settings */
493  int16_t use_crc;
494  int16_t check_ready;
497  /* Active Device */
499  /* Reference enable */
500  bool ref_en;
501  /* Power modes */
503  /* Setups */
505  /* Channel Mapping*/
507 };
508 
510  /* SPI */
512  /* Device Settings */
514  int16_t use_crc;
515  int16_t check_ready;
518  /* Active Device */
520  /* Reference enable */
521  bool ref_en;
522  /* Power modes */
524  /* Setups */
526  /* Channel Mapping*/
528 };
529 
530 /******************************************************************************/
531 /************************ Functions Declarations ******************************/
532 /******************************************************************************/
533 /* Reads the value of the specified register without a device state check. */
534 int32_t ad7124_no_check_read_register(struct ad7124_dev *dev,
535  struct ad7124_st_reg* p_reg);
536 
537 /* Writes the value of the specified register without a device state check. */
538 int32_t ad7124_no_check_write_register(struct ad7124_dev *dev,
539  struct ad7124_st_reg reg);
540 
541 /* Reads the value of the specified register. */
542 int32_t ad7124_read_register(struct ad7124_dev *dev,
543  struct ad7124_st_reg* p_reg);
544 
545 /* Wrap the read register function to give it a modern signature. */
546 int32_t ad7124_read_register2(struct ad7124_dev *dev,
547  uint32_t reg,
548  uint32_t *readval);
549 
550 /* Writes the value of the specified register. */
551 int32_t ad7124_write_register(struct ad7124_dev *dev,
552  struct ad7124_st_reg reg);
553 
554 /* Wrap the write register function to give it a modern signature. */
555 int32_t ad7124_write_register2(struct ad7124_dev *dev,
556  uint32_t reg,
557  uint32_t writeval);
558 
559 /* Resets the device. */
560 int32_t ad7124_reset(struct ad7124_dev *dev);
561 
562 /* Waits until the device can accept read and write user actions. */
563 int32_t ad7124_wait_for_spi_ready(struct ad7124_dev *dev,
564  uint32_t timeout);
565 
566 /* Waits until the device finishes the power-on reset operation. */
567 int32_t ad7124_wait_to_power_on(struct ad7124_dev *dev,
568  uint32_t timeout);
569 
570 /* Waits until a new conversion result is available. */
571 int32_t ad7124_wait_for_conv_ready(struct ad7124_dev *dev,
572  uint32_t timeout);
573 
574 /* Reads the conversion result from the device. */
575 int32_t ad7124_read_data(struct ad7124_dev *dev,
576  int32_t* p_data);
577 
578 /* Get the ID of the channel of the latest conversion. */
579 int32_t ad7124_get_read_chan_id(struct ad7124_dev *dev, uint32_t *status);
580 
581 /* Computes the CRC checksum for a data buffer. */
582 uint8_t ad7124_compute_crc8(uint8_t* p_buf,
583  uint8_t buf_size);
584 
585 /* Computes the XOR checksum for a data buffer. */
586 uint8_t AD7124_ComputeXOR8(uint8_t * p_buf,
587  uint8_t buf_size);
588 
589 /* Updates the CRC settings. */
590 void ad7124_update_crcsetting(struct ad7124_dev *dev);
591 
592 /* Updates the device SPI interface settings. */
594 
595 /* Get the AD7124 reference clock. */
596 int32_t ad7124_fclk_get(struct ad7124_dev *dev, float *f_clk);
597 
598 /* Get the filter coefficient for the sample rate. */
599 int32_t ad7124_fltcoff_get(struct ad7124_dev *dev,
600  int16_t chn_no,
601  uint16_t *flt_coff);
602 
603 /* Calculate ODR of the device. */
604 float ad7124_get_odr(struct ad7124_dev *dev, int16_t ch_no);
605 
606 /* Set ODR of the device. */
607 int32_t ad7124_set_odr(struct ad7124_dev *dev,
608  float odr,
609  int16_t chn_no);
610 
611 /* SPI write to device using a mask. */
612 int ad7124_reg_write_msk(struct ad7124_dev *dev,
613  uint32_t reg_addr,
614  uint32_t data,
615  uint32_t mask);
616 
617 /* Set ADC Mode */
618 int ad7124_set_adc_mode(struct ad7124_dev *device, enum ad7124_mode mode);
619 
620 /* Enable/Disable Channels */
622  uint8_t chn_no,
623  bool channel_status);
624 
625 /* Configure Analog inputs to channel */
627  uint8_t chn_no,
628  struct ad7124_analog_inputs analog_input);
629 
630 /* Assign setup to channel */
632  uint8_t ch_no,
633  uint8_t setup);
634 
635 /* Assign polarity to setup */
637  bool bipolar,
638  uint8_t setup_id);
639 
640 /* Assign reference source to setup */
642  enum ad7124_reference_source ref_source,
643  uint8_t setup_id,
644  bool ref_en);
645 
646 /* Enable/Disable input and reference buffers to setup */
648  bool ain_buff,
649  bool ref_buff,
650  uint8_t setup_id);
651 
652 /* Select the power mode */
654  enum ad7124_power_mode mode);
655 
656 /* Initializes the AD7124 */
657 int32_t ad7124_setup(struct ad7124_dev **device,
658  struct ad7124_init_param *init_param);
659 
660 /* Free the resources allocated by ad7124_setup(). */
661 int32_t ad7124_remove(struct ad7124_dev *dev);
662 
663 #endif /* __AD7124_H__ */
664 
ad7124_dev::active_device
enum ad7124_device_type active_device
Definition: ad7124.h:498
AD7124_AIN9
@ AD7124_AIN9
Definition: ad7124.h:334
ad7124_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad7124.h:490
ad7124_dev::use_crc
int16_t use_crc
Definition: ad7124.h:493
AD7124_ADC_Control
@ AD7124_ADC_Control
Definition: ad7124.h:425
ADC_MAX_MODES
@ ADC_MAX_MODES
Definition: ad7124.h:317
AD7124_REF_BUF_MSK
#define AD7124_REF_BUF_MSK
Definition: ad7124.h:287
AD7124_Config_6
@ AD7124_Config_6
Definition: ad7124.h:455
timeout
uint32_t timeout
Definition: ad413x.c:55
no_os_alloc.h
ad7124_st_reg::value
int32_t value
Definition: ad7124.h:417
AD7124_8_NEW_ID
#define AD7124_8_NEW_ID
Definition: ad7124.h:76
AD7124_8_B_W_GRADE_ID
#define AD7124_8_B_W_GRADE_ID
Definition: ad7124.h:74
ad7124_analog_inputs::ainp
enum ad7124_analog_input ainp
Definition: ad7124.h:362
iio_trigger.h
Header file for iio_trigger.
ad7124_reset
int32_t ad7124_reset(struct ad7124_dev *dev)
Resets the device.
Definition: ad7124.c:265
AD7124_Config_1
@ AD7124_Config_1
Definition: ad7124.h:450
AD7124_IN_FULL_SCALE_GAIN
@ AD7124_IN_FULL_SCALE_GAIN
Definition: ad7124.h:314
AD7124_Filter_6
@ AD7124_Filter_6
Definition: ad7124.h:463
ad7124_init_param::setups
struct ad7124_channel_setup setups[AD7124_MAX_SETUPS]
Definition: ad7124.h:525
ad7124_init_param::use_crc
int16_t use_crc
Definition: ad7124.h:514
AD7124_IDLE
@ AD7124_IDLE
Definition: ad7124.h:312
ad7124_remove
int32_t ad7124_remove(struct ad7124_dev *dev)
Free the resources allocated by ad7124_setup().
Definition: ad7124.c:1133
AD7124_IOCon2
@ AD7124_IOCon2
Definition: ad7124.h:428
AD7124_DLDO_DGND_P
@ AD7124_DLDO_DGND_P
Definition: ad7124.h:351
ad7124_analog_inputs::ainm
enum ad7124_analog_input ainm
Definition: ad7124.h:363
AD7124_4_NEW_ID
#define AD7124_4_NEW_ID
Definition: ad7124.h:69
ad7124_reg_write_msk
int ad7124_reg_write_msk(struct ad7124_dev *dev, uint32_t reg_addr, uint32_t data, uint32_t mask)
SPI internal register write to device using a mask.
Definition: ad7124.c:701
AD7124_STATUS_REG_POR_FLAG
#define AD7124_STATUS_REG_POR_FLAG
Definition: ad7124.h:146
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
AD7124_COMM_REG_WEN
#define AD7124_COMM_REG_WEN
Definition: ad7124.h:138
AD7124_FILT_REG_FS
#define AD7124_FILT_REG_FS(x)
Definition: ad7124.h:277
ad7124_dev
Device Structure.
Definition: ad7124.h:488
AD7124_ALDO_AVSS_M
@ AD7124_ALDO_AVSS_M
Definition: ad7124.h:350
ad7124_wait_to_power_on
int32_t ad7124_wait_to_power_on(struct ad7124_dev *dev, uint32_t timeout)
Waits until the device finishes the power-on reset operation.
Definition: ad7124.c:333
iio_ad7091r8.h
Header file of IIO AD7091R8 driver header file.
ad7124_channel_setup
Channel setup.
Definition: ad7124.h:397
AD7124_MAX_CHANNELS
#define AD7124_MAX_CHANNELS
Definition: ad7124.h:62
ad7124_set_reference_source
int ad7124_set_reference_source(struct ad7124_dev *device, enum ad7124_reference_source ref_source, uint8_t setup_id, bool ref_en)
Definition: ad7124.c:877
no_os_spi.h
Header file of SPI Interface.
AD7124_IOVDD_DGND_P
@ AD7124_IOVDD_DGND_P
Definition: ad7124.h:347
AD7124_MAX_SETUPS
#define AD7124_MAX_SETUPS
Definition: ad7124.h:60
AD7124_AIN7
@ AD7124_AIN7
Definition: ad7124.h:332
ad7124_dev::check_ready
int16_t check_ready
Definition: ad7124.h:494
ad7124_write_register
int32_t ad7124_write_register(struct ad7124_dev *dev, struct ad7124_st_reg reg)
Writes the value of the specified register only when the device is ready to accept user requests....
Definition: ad7124.c:228
ad7124_reg_write_msk
int ad7124_reg_write_msk(struct ad7124_dev *dev, uint32_t reg_addr, uint32_t data, uint32_t mask)
SPI internal register write to device using a mask.
Definition: ad7124.c:701
AD7124_FILT_REG_POST_FILTER
#define AD7124_FILT_REG_POST_FILTER(x)
Definition: ad7124.h:275
AD7124_ERR_REG
#define AD7124_ERR_REG
Definition: ad7124.h:86
AD7124_Gain_0
@ AD7124_Gain_0
Definition: ad7124.h:473
ad7124_wait_for_conv_ready
int32_t ad7124_wait_for_conv_ready(struct ad7124_dev *dev, uint32_t timeout)
Waits until a new conversion result is available.
Definition: ad7124.c:369
AD7124_STATUS_REG_CH_ACTIVE
#define AD7124_STATUS_REG_CH_ACTIVE(x)
Definition: ad7124.h:147
AD7124_Offset_0
@ AD7124_Offset_0
Definition: ad7124.h:465
EXTERNAL_REFIN1
@ EXTERNAL_REFIN1
Definition: ad7124.h:382
AD7124_IOVDD_DGND_M
@ AD7124_IOVDD_DGND_M
Definition: ad7124.h:348
ad7124_dev::chan_map
struct ad7124_channel_map chan_map[AD7124_MAX_CHANNELS]
Definition: ad7124.h:506
AD7124_CFG_REG_AINN_BUFM
#define AD7124_CFG_REG_AINN_BUFM
Definition: ad7124.h:268
iio_trig_disable
int iio_trig_disable(void *trig)
Disable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:133
ad7124_assign_setup
int ad7124_assign_setup(struct ad7124_dev *device, uint8_t ch_no, uint8_t setup)
Assign Setup to Channel.
Definition: ad7124.c:819
AD7124_AIN15
@ AD7124_AIN15
Definition: ad7124.h:340
no_os_delay.h
Header file of Delay functions.
AD7124_Channel_12
@ AD7124_Channel_12
Definition: ad7124.h:445
AD7124_COMM_REG_WR
#define AD7124_COMM_REG_WR
Definition: ad7124.h:139
ad7124_connect_analog_input
int ad7124_connect_analog_input(struct ad7124_dev *device, uint8_t chn_no, struct ad7124_analog_inputs analog_input)
Set Analog Inputs to channel.
Definition: ad7124.c:782
AD7124_STANDBY
@ AD7124_STANDBY
Definition: ad7124.h:310
ad7124_update_dev_spi_settings
void ad7124_update_dev_spi_settings(struct ad7124_dev *dev)
Updates the device SPI interface settings.
Definition: ad7124.c:499
AD7124_CFG_REG_BIPOLAR
#define AD7124_CFG_REG_BIPOLAR
Definition: ad7124.h:263
AD7124_ALDO_AVSS_P
@ AD7124_ALDO_AVSS_P
Definition: ad7124.h:349
ad7124_analog_input
ad7124_analog_input
ADC input sources for each channel.
Definition: ad7124.h:324
AD7124_CH0_MAP_REG
#define AD7124_CH0_MAP_REG
Definition: ad7124.h:88
AD7124_Mclk_Count
@ AD7124_Mclk_Count
Definition: ad7124.h:432
device
Definition: ad9361_util.h:75
AD7124_AIN13
@ AD7124_AIN13
Definition: ad7124.h:338
AD7124_Channel_8
@ AD7124_Channel_8
Definition: ad7124.h:441
AD7124_Gain_1
@ AD7124_Gain_1
Definition: ad7124.h:474
AD7124_Data
@ AD7124_Data
Definition: ad7124.h:426
ad7124_registers
ad7124_registers
Definition: ad7124.h:423
AD7124_Offset_5
@ AD7124_Offset_5
Definition: ad7124.h:470
ad7124_update_crcsetting
void ad7124_update_crcsetting(struct ad7124_dev *dev)
Updates the CRC settings.
Definition: ad7124.c:478
AD7124_USE_CRC
#define AD7124_USE_CRC
Definition: ad7124.h:281
ad7124_no_check_write_register
int32_t ad7124_no_check_write_register(struct ad7124_dev *dev, struct ad7124_st_reg reg)
Writes the value of the specified register without checking if the device is ready to accept user req...
Definition: ad7124.c:136
AD7124_AVDD_AVSS_P
@ AD7124_AVDD_AVSS_P
Definition: ad7124.h:345
AD7124_AIN12
@ AD7124_AIN12
Definition: ad7124.h:337
AD7124_Filter_5
@ AD7124_Filter_5
Definition: ad7124.h:462
AD7124_Filter_3
@ AD7124_Filter_3
Definition: ad7124.h:460
ad7124_reference_source
ad7124_reference_source
Type of ADC Reference.
Definition: ad7124.h:380
AD7124_POWER_DOWN
@ AD7124_POWER_DOWN
Definition: ad7124.h:311
ad7124_channel_setup::bi_unipolar
bool bi_unipolar
Definition: ad7124.h:398
AD7124_AIN6
@ AD7124_AIN6
Definition: ad7124.h:331
ad7616_init_param::mode
enum ad7616_mode mode
Definition: ad7616.h:232
AD7124_Filter_1
@ AD7124_Filter_1
Definition: ad7124.h:458
ad7124_channel_map::ain
struct ad7124_analog_inputs ain
Definition: ad7124.h:373
AD7124_Gain_3
@ AD7124_Gain_3
Definition: ad7124.h:476
ad7124_read_data
int32_t ad7124_read_data(struct ad7124_dev *dev, int32_t *p_data)
Reads the conversion result from the device.
Definition: ad7124.c:403
AD7124_MID_POWER
@ AD7124_MID_POWER
Definition: ad7124.h:410
AD7124_CHMAP_REG_AINNEG_MSK
#define AD7124_CHMAP_REG_AINNEG_MSK
Definition: ad7124.h:284
ad7124_update_crcsetting
void ad7124_update_crcsetting(struct ad7124_dev *dev)
Updates the CRC settings.
Definition: ad7124.c:478
AD7124_Offset_3
@ AD7124_Offset_3
Definition: ad7124.h:468
ad7124_init_param::ref_en
bool ref_en
Definition: ad7124.h:521
AD7124_CFG0_REG
#define AD7124_CFG0_REG
Definition: ad7124.h:104
ad7124_no_check_write_register
int32_t ad7124_no_check_write_register(struct ad7124_dev *dev, struct ad7124_st_reg reg)
Writes the value of the specified register without checking if the device is ready to accept user req...
Definition: ad7124.c:136
AD7124_ADC_CTRL_REG
#define AD7124_ADC_CTRL_REG
Definition: ad7124.h:81
AD7124_Error_En
@ AD7124_Error_En
Definition: ad7124.h:431
AD7124_AIN1
@ AD7124_AIN1
Definition: ad7124.h:326
ad7124_channel_setup::ref_source
enum ad7124_reference_source ref_source
Definition: ad7124.h:401
AD7124_Channel_11
@ AD7124_Channel_11
Definition: ad7124.h:444
ad7124_init_param::active_device
enum ad7124_device_type active_device
Definition: ad7124.h:519
AD7124_Channel_4
@ AD7124_Channel_4
Definition: ad7124.h:437
AD7124_Channel_0
@ AD7124_Channel_0
Definition: ad7124.h:433
ad7124_wait_for_spi_ready
int32_t ad7124_wait_for_spi_ready(struct ad7124_dev *dev, uint32_t timeout)
Waits until the device can accept read and write user actions.
Definition: ad7124.c:297
AD7124_SINGLE
@ AD7124_SINGLE
Definition: ad7124.h:309
AD7124_AIN5
@ AD7124_AIN5
Definition: ad7124.h:330
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:132
AD7124_CFG_REG_REF_BUFP
#define AD7124_CFG_REG_REF_BUFP
Definition: ad7124.h:265
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
ad7124_dev::mode
enum ad7124_mode mode
Definition: ad7124.h:496
ad7124_read_register
int32_t ad7124_read_register(struct ad7124_dev *dev, struct ad7124_st_reg *p_reg)
Reads the value of the specified register only when the device is ready to accept user requests....
Definition: ad7124.c:181
ad7124_init_param::mode
enum ad7124_mode mode
Definition: ad7124.h:517
AD7124_8_STD_ID
#define AD7124_8_STD_ID
Definition: ad7124.h:72
AD7124_ERREN_REG_SPI_CRC_ERR_EN
#define AD7124_ERREN_REG_SPI_CRC_ERR_EN
Definition: ad7124.h:252
ad7124_st_reg::addr
int32_t addr
Definition: ad7124.h:416
iio.h
Header file of iio.
AD7124_V_20MV_P
@ AD7124_V_20MV_P
Definition: ad7124.h:353
no_os_error.h
Error codes definition.
ad7091r8_iio_timer_trig_desc
struct iio_trigger ad7091r8_iio_timer_trig_desc
Definition: iio_ad7091r8_trig.c:54
AD7124_Config_7
@ AD7124_Config_7
Definition: ad7124.h:456
ad7124_fltcoff_get
int32_t ad7124_fltcoff_get(struct ad7124_dev *dev, int16_t chn_num, uint16_t *flt_coff)
Get the filter coefficient for the sample rate.
Definition: ad7124.c:557
AD7124_LOW_POWER
@ AD7124_LOW_POWER
Definition: ad7124.h:409
ad7124_init_param::chan_map
struct ad7124_channel_map chan_map[AD7124_MAX_CHANNELS]
Definition: ad7124.h:527
AD7124_FILT_REG_FILTER
#define AD7124_FILT_REG_FILTER(x)
Definition: ad7124.h:273
AD7124_ADC_CTRL_REG_REF_EN
#define AD7124_ADC_CTRL_REG_REF_EN
Definition: ad7124.h:154
AD7124_Gain_2
@ AD7124_Gain_2
Definition: ad7124.h:475
AD7124_Offset_6
@ AD7124_Offset_6
Definition: ad7124.h:471
ad7124_dev::power_mode
enum ad7124_power_mode power_mode
Definition: ad7124.h:502
ad7124_init_param::power_mode
enum ad7124_power_mode power_mode
Definition: ad7124.h:523
AD7124_AVSS
@ AD7124_AVSS
Definition: ad7124.h:341
AD7124_AIN0
@ AD7124_AIN0
Definition: ad7124.h:325
ad7124_write_register2
int32_t ad7124_write_register2(struct ad7124_dev *dev, uint32_t reg, uint32_t writeval)
Wrap the write register function to give it a modern signature.
Definition: ad7124.c:251
ad7124_fltcoff_get
int32_t ad7124_fltcoff_get(struct ad7124_dev *dev, int16_t chn_no, uint16_t *flt_coff)
Get the filter coefficient for the sample rate.
Definition: ad7124.c:557
ad7124_no_check_read_register
int32_t ad7124_no_check_read_register(struct ad7124_dev *dev, struct ad7124_st_reg *p_reg)
Reads the value of the specified register without checking if the device is ready to accept user requ...
Definition: ad7124.c:67
iio_trig_enable
int iio_trig_enable(void *trig)
Enable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:116
ad7124_channel_map
Channel mapping.
Definition: ad7124.h:370
AD7124_Channel_10
@ AD7124_Channel_10
Definition: ad7124.h:443
ad7124_set_channel_status
int ad7124_set_channel_status(struct ad7124_dev *device, uint8_t chn_num, bool channel_status)
Definition: ad7124.c:751
AD7124_Config_0
@ AD7124_Config_0
Definition: ad7124.h:449
AD7124_SETUP_CONF_REG_REF_SEL_MSK
#define AD7124_SETUP_CONF_REG_REF_SEL_MSK
Definition: ad7124.h:286
ad7124_set_adc_mode
int ad7124_set_adc_mode(struct ad7124_dev *device, enum ad7124_mode adc_mode)
Set ADC Mode.
Definition: ad7124.c:725
ad7124_mode
ad7124_mode
ADC Modes of Operation.
Definition: ad7124.h:307
ad7124_set_power_mode
int ad7124_set_power_mode(struct ad7124_dev *device, enum ad7124_power_mode mode)
Select the Power Mode.
Definition: ad7124.c:973
ad7124_init_param::spi_rdy_poll_cnt
int16_t spi_rdy_poll_cnt
Definition: ad7124.h:516
AD7124_COMM_REG_RD
#define AD7124_COMM_REG_RD
Definition: ad7124.h:140
ID_AD7124_4
@ ID_AD7124_4
Definition: ad7124.h:299
ad7124_init_param::spi_init
struct no_os_spi_init_param * spi_init
Definition: ad7124.h:511
AD7124_STATUS_REG_RDY
#define AD7124_STATUS_REG_RDY
Definition: ad7124.h:144
ID_AD7124_8
@ ID_AD7124_8
Definition: ad7124.h:300
AD7124_Filter_4
@ AD7124_Filter_4
Definition: ad7124.h:461
AD7124_CH_MAP_REG_CH_ENABLE
#define AD7124_CH_MAP_REG_CH_ENABLE
Definition: ad7124.h:257
ad7124_setup
int32_t ad7124_setup(struct ad7124_dev **device, struct ad7124_init_param *init_param)
Initializes the AD7124.
Definition: ad7124.c:997
AD7124_DLDO_DGND_M
@ AD7124_DLDO_DGND_M
Definition: ad7124.h:352
AD7124_Channel_2
@ AD7124_Channel_2
Definition: ad7124.h:435
ad7124_update_dev_spi_settings
void ad7124_update_dev_spi_settings(struct ad7124_dev *dev)
Updates the device SPI interface settings.
Definition: ad7124.c:499
ad7124_set_adc_mode
int ad7124_set_adc_mode(struct ad7124_dev *device, enum ad7124_mode mode)
Set ADC Mode.
Definition: ad7124.c:725
AD7124_Filter_2
@ AD7124_Filter_2
Definition: ad7124.h:459
AD7124_ID
@ AD7124_ID
Definition: ad7124.h:429
ad7124_reset
int32_t ad7124_reset(struct ad7124_dev *dev)
Resets the device.
Definition: ad7124.c:265
AD7124_HIGH_POWER
@ AD7124_HIGH_POWER
Definition: ad7124.h:411
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
ad7124_fclk_get
int32_t ad7124_fclk_get(struct ad7124_dev *dev, float *f_clk)
Get the AD7124 reference clock.
Definition: ad7124.c:520
ad7124_channel_setup::ref_buff
bool ref_buff
Definition: ad7124.h:399
ad7124_dev::ref_en
bool ref_en
Definition: ad7124.h:500
ad7124_set_power_mode
int ad7124_set_power_mode(struct ad7124_dev *device, enum ad7124_power_mode mode)
Select the Power Mode.
Definition: ad7124.c:973
AD7124_Config_2
@ AD7124_Config_2
Definition: ad7124.h:451
AD7124_Offset_7
@ AD7124_Offset_7
Definition: ad7124.h:472
ad7124_init_param::check_ready
int16_t check_ready
Definition: ad7124.h:515
AD7124_IN_REF
@ AD7124_IN_REF
Definition: ad7124.h:343
ad7124_connect_analog_input
int ad7124_connect_analog_input(struct ad7124_dev *device, uint8_t chn_num, struct ad7124_analog_inputs analog_input)
Set Analog Inputs to channel.
Definition: ad7124.c:782
AD7124_4_B_GRADE_ID
#define AD7124_4_B_GRADE_ID
Definition: ad7124.h:67
ad7124_remove
int32_t ad7124_remove(struct ad7124_dev *dev)
Free the resources allocated by ad7124_setup().
Definition: ad7124.c:1133
AD7124_ADC_CTRL_REG_MODE_MSK
#define AD7124_ADC_CTRL_REG_MODE_MSK
Definition: ad7124.h:285
AD7124_CFG_REG_REF_BUFM
#define AD7124_CFG_REG_REF_BUFM
Definition: ad7124.h:266
AD7124_Offset_4
@ AD7124_Offset_4
Definition: ad7124.h:469
ad7124_init_param
Definition: ad7124.h:509
AD7124_ComputeXOR8
uint8_t AD7124_ComputeXOR8(uint8_t *p_buf, uint8_t buf_size)
AD7124_Channel_5
@ AD7124_Channel_5
Definition: ad7124.h:438
AD7124_AIN11
@ AD7124_AIN11
Definition: ad7124.h:336
AD7124_AIN_BUF_MSK
#define AD7124_AIN_BUF_MSK
Definition: ad7124.h:288
AD7124_DGND
@ AD7124_DGND
Definition: ad7124.h:344
AD7124_Filter_7
@ AD7124_Filter_7
Definition: ad7124.h:464
AD7124_FILT_REG_SINGLE_CYCLE
#define AD7124_FILT_REG_SINGLE_CYCLE
Definition: ad7124.h:276
AD7124_SYS_ZERO_SCALE_GAIN
@ AD7124_SYS_ZERO_SCALE_GAIN
Definition: ad7124.h:316
ad7124_set_reference_source
int ad7124_set_reference_source(struct ad7124_dev *device, enum ad7124_reference_source ref_source, uint8_t setup_id, bool ref_en)
Definition: ad7124.c:877
ad7124_init_param::regs
struct ad7124_st_reg * regs
Definition: ad7124.h:513
AD7124_4_STD_ID
#define AD7124_4_STD_ID
Definition: ad7124.h:65
AD7124_CHMAP_REG_AINPOS_MSK
#define AD7124_CHMAP_REG_AINPOS_MSK
Definition: ad7124.h:283
AD7124_ERREN_REG_SPI_IGNORE_ERR_EN
#define AD7124_ERREN_REG_SPI_IGNORE_ERR_EN
Definition: ad7124.h:248
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:49
ad7124_wait_for_conv_ready
int32_t ad7124_wait_for_conv_ready(struct ad7124_dev *dev, uint32_t timeout)
Waits until a new conversion result is available.
Definition: ad7124.c:369
AD7124_DATA_REG
#define AD7124_DATA_REG
Definition: ad7124.h:82
INTERNAL_REF
@ INTERNAL_REF
Definition: ad7124.h:386
AD7124_Channel_7
@ AD7124_Channel_7
Definition: ad7124.h:440
ad7124_setup
int32_t ad7124_setup(struct ad7124_dev **device, struct ad7124_init_param *init_param)
Initializes the AD7124.
Definition: ad7124.c:997
AD7124_Error
@ AD7124_Error
Definition: ad7124.h:430
ad7124_channel_setup::ain_buff
bool ain_buff
Definition: ad7124.h:400
AD7124_Channel_6
@ AD7124_Channel_6
Definition: ad7124.h:439
AD7124_REG_NO
@ AD7124_REG_NO
Definition: ad7124.h:481
AD7124_Gain_7
@ AD7124_Gain_7
Definition: ad7124.h:480
AD7124_Gain_4
@ AD7124_Gain_4
Definition: ad7124.h:477
AD7124_Channel_1
@ AD7124_Channel_1
Definition: ad7124.h:434
ad7124_compute_crc8
uint8_t ad7124_compute_crc8(uint8_t *p_buf, uint8_t buf_size)
Computes the CRC checksum for a data buffer.
Definition: ad7124.c:449
AD7124_V_20MV_M
@ AD7124_V_20MV_M
Definition: ad7124.h:354
AD7124_SYS_ZERO_SCALE_OFF
@ AD7124_SYS_ZERO_SCALE_OFF
Definition: ad7124.h:315
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
ad7124_enable_buffers
int ad7124_enable_buffers(struct ad7124_dev *device, bool ain_buff, bool ref_buff, uint8_t setup_id)
Enable Input Buffer.
Definition: ad7124.c:925
AD7124_Channel_3
@ AD7124_Channel_3
Definition: ad7124.h:436
AD7124_CONTINUOUS
@ AD7124_CONTINUOUS
Definition: ad7124.h:308
AD7124_IOCon1
@ AD7124_IOCon1
Definition: ad7124.h:427
AD7124_DISABLE_CRC
#define AD7124_DISABLE_CRC
Definition: ad7124.h:280
iio_trigger
Definition: iio_types.h:236
AD7124_TEMP_SENSOR
@ AD7124_TEMP_SENSOR
Definition: ad7124.h:342
ad7124_analog_inputs
Positive and negative analog inputs.
Definition: ad7124.h:361
ad7124_channel_map::setup_sel
uint8_t setup_sel
Definition: ad7124.h:372
EXTERNAL_REFIN2
@ EXTERNAL_REFIN2
Definition: ad7124.h:384
ad7124_set_odr
int32_t ad7124_set_odr(struct ad7124_dev *dev, float odr, int16_t chn_num)
Set ODR of the device.
Definition: ad7124.c:658
AD7124_Offset_1
@ AD7124_Offset_1
Definition: ad7124.h:466
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
ad7124_get_odr
float ad7124_get_odr(struct ad7124_dev *dev, int16_t ch_no)
Calculate ODR of the device.
Definition: ad7124.c:609
AD7124_Offset_2
@ AD7124_Offset_2
Definition: ad7124.h:467
ad7124_dev::setups
struct ad7124_channel_setup setups[AD7124_MAX_SETUPS]
Definition: ad7124.h:504
AD7124_Config_4
@ AD7124_Config_4
Definition: ad7124.h:453
ad7124_read_register2
int32_t ad7124_read_register2(struct ad7124_dev *dev, uint32_t reg, uint32_t *readval)
Wrap the read register function to give it a modern signature.
Definition: ad7124.c:204
AD7124_POWER_MODE_MSK
#define AD7124_POWER_MODE_MSK
Definition: ad7124.h:289
bipolar
@ bipolar
Definition: ad5446.h:79
ad7124_st_reg
Definition: ad7124.h:415
ad7124_enable_buffers
int ad7124_enable_buffers(struct ad7124_dev *device, bool inbuf_en, bool refbuf_en, uint8_t setup_id)
Enable Input Buffer.
Definition: ad7124.c:925
AD7124_Gain_6
@ AD7124_Gain_6
Definition: ad7124.h:479
ad7124_read_data
int32_t ad7124_read_data(struct ad7124_dev *dev, int32_t *p_data)
Reads the conversion result from the device.
Definition: ad7124.c:403
ad7124_set_polarity
int ad7124_set_polarity(struct ad7124_dev *device, bool bipolar, uint8_t setup_id)
Set Polarity.
Definition: ad7124.c:846
AD7124_AIN8
@ AD7124_AIN8
Definition: ad7124.h:333
MAX_REF_SOURCES
@ MAX_REF_SOURCES
Definition: ad7124.h:390
ad7124_channel_map::channel_enable
bool channel_enable
Definition: ad7124.h:371
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
ad7124_compute_crc8
uint8_t ad7124_compute_crc8(uint8_t *p_buf, uint8_t buf_size)
Computes the CRC checksum for a data buffer.
Definition: ad7124.c:449
ad7124.h
AD7124 header file. Devices: AD7124-4, AD7124-8.
ad7124_assign_setup
int ad7124_assign_setup(struct ad7124_dev *device, uint8_t chn_num, uint8_t setup)
Assign Setup to Channel.
Definition: ad7124.c:819
AD7124_COMM_REG_RA
#define AD7124_COMM_REG_RA(x)
Definition: ad7124.h:141
ad7124_get_read_chan_id
int32_t ad7124_get_read_chan_id(struct ad7124_dev *dev, uint32_t *status)
Get the ID of the channel of the latest conversion.
Definition: ad7124.c:429
AD7124_CHMAP_REG_SETUP_SEL_MSK
#define AD7124_CHMAP_REG_SETUP_SEL_MSK
Definition: ad7124.h:282
ad7124_power_mode
ad7124_power_mode
Power modes.
Definition: ad7124.h:408
ad7124_wait_for_spi_ready
int32_t ad7124_wait_for_spi_ready(struct ad7124_dev *dev, uint32_t timeout)
Waits until the device can accept read and write user actions.
Definition: ad7124.c:297
AD7124_AIN3
@ AD7124_AIN3
Definition: ad7124.h:328
AD7124_POST_RESET_DELAY
#define AD7124_POST_RESET_DELAY
Definition: ad7124.c:56
ad7124_read_register
int32_t ad7124_read_register(struct ad7124_dev *dev, struct ad7124_st_reg *p_reg)
Reads the value of the specified register only when the device is ready to accept user requests....
Definition: ad7124.c:181
ad7124_get_odr
float ad7124_get_odr(struct ad7124_dev *dev, int16_t chn_num)
Calculate ODR of the device.
Definition: ad7124.c:609
AD7124_Channel_13
@ AD7124_Channel_13
Definition: ad7124.h:446
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
ad7124_fclk_get
int32_t ad7124_fclk_get(struct ad7124_dev *dev, float *f_clk)
Get the AD7124 reference clock.
Definition: ad7124.c:520
AD7124_ERR_REG_SPI_IGNORE_ERR
#define AD7124_ERR_REG_SPI_IGNORE_ERR
Definition: ad7124.h:224
AD7124_Channel_15
@ AD7124_Channel_15
Definition: ad7124.h:448
AD7124_AIN14
@ AD7124_AIN14
Definition: ad7124.h:339
iio_trigger::is_synchronous
bool is_synchronous
Definition: iio_types.h:239
ad7124_st_reg::rw
int32_t rw
Definition: ad7124.h:419
ad7124_device_type
ad7124_device_type
Definition: ad7124.h:298
AD7124_CFG_REG_AIN_BUFP
#define AD7124_CFG_REG_AIN_BUFP
Definition: ad7124.h:267
AD7124_Channel_9
@ AD7124_Channel_9
Definition: ad7124.h:442
no_os_util.h
Header file of utility functions.
ad7124_write_register
int32_t ad7124_write_register(struct ad7124_dev *dev, struct ad7124_st_reg p_reg)
Writes the value of the specified register only when the device is ready to accept user requests....
Definition: ad7124.c:228
AD7124_AVDD_AVSS_M
@ AD7124_AVDD_AVSS_M
Definition: ad7124.h:346
AD7124_ID_REG
#define AD7124_ID_REG
Definition: ad7124.h:85
AD7124_AIN4
@ AD7124_AIN4
Definition: ad7124.h:329
AD7124_AIN10
@ AD7124_AIN10
Definition: ad7124.h:335
ad7124_st_reg::size
int32_t size
Definition: ad7124.h:418
ad7124_read_register2
int32_t ad7124_read_register2(struct ad7124_dev *dev, uint32_t reg, uint32_t *readval)
Wrap the read register function to give it a modern signature.
Definition: ad7124.c:204
ad7124_set_channel_status
int ad7124_set_channel_status(struct ad7124_dev *device, uint8_t chn_no, bool channel_status)
Definition: ad7124.c:751
AD7124_Gain_5
@ AD7124_Gain_5
Definition: ad7124.h:478
AD7124_Channel_14
@ AD7124_Channel_14
Definition: ad7124.h:447
ad7124_dev::regs
struct ad7124_st_reg * regs
Definition: ad7124.h:492
AD7124_Status
@ AD7124_Status
Definition: ad7124.h:424
ad7124_dev::spi_rdy_poll_cnt
int16_t spi_rdy_poll_cnt
Definition: ad7124.h:495
AD7124_CRC8_POLYNOMIAL_REPRESENTATION
#define AD7124_CRC8_POLYNOMIAL_REPRESENTATION
Definition: ad7124.h:279
AD7124_STATUS_REG
#define AD7124_STATUS_REG
Definition: ad7124.h:80
AD7124_Filter_0
@ AD7124_Filter_0
Definition: ad7124.h:457
ad7124_set_polarity
int ad7124_set_polarity(struct ad7124_dev *device, bool bipolar, uint8_t setup_id)
Set Polarity.
Definition: ad7124.c:846
AD7124_ADC_CTRL_REG_DATA_STATUS
#define AD7124_ADC_CTRL_REG_DATA_STATUS
Definition: ad7124.h:152
ad7124_no_check_read_register
int32_t ad7124_no_check_read_register(struct ad7124_dev *dev, struct ad7124_st_reg *p_reg)
Reads the value of the specified register without checking if the device is ready to accept user requ...
Definition: ad7124.c:67
ad7124_write_register2
int32_t ad7124_write_register2(struct ad7124_dev *dev, uint32_t reg, uint32_t writeval)
Wrap the write register function to give it a modern signature.
Definition: ad7124.c:251
AD7124_Config_3
@ AD7124_Config_3
Definition: ad7124.h:452
ad7124_wait_to_power_on
int32_t ad7124_wait_to_power_on(struct ad7124_dev *dev, uint32_t timeout)
Waits until the device finishes the power-on reset operation.
Definition: ad7124.c:333
ad7124_get_read_chan_id
int32_t ad7124_get_read_chan_id(struct ad7124_dev *dev, uint32_t *status)
Get the ID of the channel of the latest conversion.
Definition: ad7124.c:429
AD7124_AIN2
@ AD7124_AIN2
Definition: ad7124.h:327
AD7124_Config_5
@ AD7124_Config_5
Definition: ad7124.h:454
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131
ad7124_set_odr
int32_t ad7124_set_odr(struct ad7124_dev *dev, float odr, int16_t chn_no)
Set ODR of the device.
Definition: ad7124.c:658
AVDD_AVSS
@ AVDD_AVSS
Definition: ad7124.h:388
AD7124_IN_ZERO_SCALE_OFF
@ AD7124_IN_ZERO_SCALE_OFF
Definition: ad7124.h:313