no-OS
ad7193.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef __AD7193_H__
41 #define __AD7193_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 /******************************** AD7193 **************************************/
53 /******************************************************************************/
54 
55 /* SPI slave device ID */
56 #define AD7193_SLAVE_ID 1
57 
58 /* AD7193 Register Map */
59 #define AD7193_REG_COMM 0 // Communications Register (WO, 8-bit)
60 #define AD7193_REG_STAT 0 // Status Register (RO, 8-bit)
61 #define AD7193_REG_MODE 1 // Mode Register (RW, 24-bit
62 #define AD7193_REG_CONF 2 // Configuration Register (RW, 24-bit)
63 #define AD7193_REG_DATA 3 // Data Register (RO, 24/32-bit)
64 #define AD7193_REG_ID 4 // ID Register (RO, 8-bit)
65 #define AD7193_REG_GPOCON 5 // GPOCON Register (RW, 8-bit)
66 #define AD7193_REG_OFFSET 6 // Offset Register (RW, 24-bit
67 #define AD7193_REG_FULLSCALE 7 // Full-Scale Register (RW, 24-bit)
68 
69 /* Communications Register Bit Designations (AD7193_REG_COMM) */
70 #define AD7193_COMM_WEN (1 << 7) // Write Enable.
71 #define AD7193_COMM_WRITE (0 << 6) // Write Operation.
72 #define AD7193_COMM_READ (1 << 6) // Read Operation.
73 #define AD7193_COMM_ADDR(x) (((x) & 0x7) << 3) // Register Address.
74 #define AD7193_COMM_CREAD (1 << 2) // Continuous Read of Data Register.
75 
76 /* Status Register Bit Designations (AD7193_REG_STAT) */
77 #define AD7193_STAT_RDY (1 << 7) // Ready.
78 #define AD7193_STAT_ERR (1 << 6) // ADC error bit.
79 #define AD7193_STAT_NOREF (1 << 5) // Error no external reference.
80 #define AD7193_STAT_PARITY (1 << 4) // Parity check of the data register.
81 #define AD7193_STAT_CH3 (1 << 3) // Channel 3.
82 #define AD7193_STAT_CH2 (1 << 2) // Channel 2.
83 #define AD7193_STAT_CH1 (1 << 1) // Channel 1.
84 #define AD7193_STAT_CH0 (1 << 0) // Channel 0.
85 
86 /* Mode Register Bit Designations (AD7193_REG_MODE) */
87 #define AD7193_MODE_SEL(x) (((uint32_t)(x) & 0x7) << 21) // Operation Mode Select.
88 #define AD7193_MODE_DAT_STA ((uint32_t)1 << 20) // Status Register transmission.
89 #define AD7193_MODE_CLKSRC(x) (((uint32_t)(x) & 0x3) << 18) // Clock Source Select.
90 #define AD7193_MODE_AVG(x) (((uint32_t)(x) & 0x3) << 16) // Fast settling filter.
91 #define AD7193_MODE_SINC3 (1 << 15) // SINC3 Filter Select.
92 #define AD7193_MODE_ENPAR (1 << 13) // Parity Enable.
93 #define AD7193_MODE_CLKDIV (1 << 12) // Clock divide by 2 (AD7190/2 only).
94 #define AD7193_MODE_SCYCLE (1 << 11) // Single cycle conversion.
95 #define AD7193_MODE_REJ60 (1 << 10) // 50/60Hz notch filter.
96 #define AD7193_MODE_RATE(x) ((x) & 0x3FF) // Filter Update Rate Select.
97 
98 /* Mode Register: AD7193_MODE_AVG(x) options */
99 #define AD7193_AVG_NONE 0 // No averaging (fast settling mode disabled).
100 #define AD7193_AVG_BY_2 1 // Average by 2.
101 #define AD7193_AVG_BY_8 2 // Average by 8.
102 #define AD7193_AVG_BY_16 3 // Average by 16.
103 
104 /* Configuration Register Bit Designations (AD7193_REG_CONF) */
105 #define AD7193_CONF_CHOP ((uint32_t)1 << 23) // CHOP enable.
106 #define AD7193_CONF_REFSEL ((uint32_t)1 << 20) // REFIN1/REFIN2 Reference Select.
107 #define AD7193_CONF_PSEUDO ((uint32_t)1 << 18) // Pseudo differential analog inputs.
108 #define AD7193_CONF_CHAN(x) ((uint32_t)((x) & 0x3FF) << 8) // Channel select.
109 #define AD7193_CONF_BURN (1 << 7) // Burnout current enable.
110 #define AD7193_CONF_REFDET (1 << 6) // Reference detect enable.
111 #define AD7193_CONF_BUF (1 << 4) // Buffered Mode Enable.
112 #define AD7193_CONF_UNIPOLAR (1 << 3) // Unipolar/Bipolar Enable.
113 #define AD7193_CONF_GAIN(x) ((x) & 0x7) // Gain Select.
114 
115 /* Configuration Register: AD7193_CONF_CHAN(x) options */
116 // Pseudo Bit = 0 Pseudo Bit = 1
117 #define AD7193_CH_0 0 // AIN1(+) - AIN2(-); AIN1 - AINCOM
118 #define AD7193_CH_1 1 // AIN3(+) - AIN4(-); AIN2 - AINCOM
119 #define AD7193_CH_2 2 // AIN5(+) - AIN6(-); AIN3 - AINCOM
120 #define AD7193_CH_3 3 // AIN7(+) - AIN8(-); AIN4 - AINCOM
121 #define AD7193_CH_4 4 // AIN1(+) - AIN2(-); AIN5 - AINCOM
122 #define AD7193_CH_5 5 // AIN3(+) - AIN4(-); AIN6 - AINCOM
123 #define AD7193_CH_6 6 // AIN5(+) - AIN6(-); AIN7 - AINCOM
124 #define AD7193_CH_7 7 // AIN7(+) - AIN8(-); AIN8 - AINCOM
125 #define AD7193_CH_TEMP 8 // Temperature sensor
126 #define AD7193_CH_SHORT 9 // AIN2(+) - AIN2(-); AINCOM(+) - AINCOM(-)
127 
128 /* ID Register Bit Designations (AD7193_REG_ID) */
129 #define ID_AD7193 0x2
130 #define AD7193_ID_MASK 0x0F
131 
132 /* GPOCON Register Bit Designations (AD7193_REG_GPOCON) */
133 #define AD7193_GPOCON_BPDSW (1 << 6) // Bridge power-down switch enable
134 #define AD7193_GPOCON_GP32EN (1 << 5) // Digital Output P3 and P2 enable
135 #define AD7193_GPOCON_GP10EN (1 << 4) // Digital Output P1 and P0 enable
136 #define AD7193_GPOCON_P3DAT (1 << 3) // P3 state
137 #define AD7193_GPOCON_P2DAT (1 << 2) // P2 state
138 #define AD7193_GPOCON_P1DAT (1 << 1) // P1 state
139 #define AD7193_GPOCON_P0DAT (1 << 0) // P0 state
140 
141 /* Channel Mask */
142 #define AD7193_CH_MASK(x) BIT(x)
143 
144 /******************************************************************************/
145 /*************************** Types Declarations *******************************/
146 /******************************************************************************/
147 
149 // ADC Input Range (5 V Reference)
150  AD7193_ADC_2_5V = 0, // Gain 1 +-2.5 V
151  AD7193_ADC_312_5_mV = 3, // Gain 8 +-312.5 mV
152  AD7193_ADC_156_2_mV = 4, // Gain 16 +-156.2 mV
153  AD7193_ADC_78_125mV = 5, // Gain 32 +-78.125 mV
154  AD7193_ADC_39_06mV = 6, // Gain 64 +-39.06 mV
155  AD7193_ADC_19_53mV = 7 // Gain 128 +-19.53 mV
156 };
157 
159  // External crystal. The external crystal is connected from MCLK1 to MCLK2.
161  // External Clock applied to MCLK2
163  // Internal 4.92 MHz clock. Pin MCLK2 is tristated.
165  // Internal 4.92 MHz clock. The internal clock is available on MCLK2.
167 };
168 
170  // Continuous Conversion Mode
172  // Single Conversion Mode
174  // Idle Mode
176  // Power-Down Mode
178  // Internal Zero-Scale Calibration
180  // Internal Full-Scale Calibration4
182  // System Zero-Scale Calibration5
184  // System Full-Scale Calibration
186 };
187 
188 struct ad7193_dev {
189  /* SPI */
191  /* GPIO */
193  /* Device Settings */
197  uint16_t data_rate_code;
199  uint8_t input_mode;
200  uint8_t buffer;
201  uint8_t bpdsw_mode;
202 };
203 
205  /* SPI */
207  /* GPIO */
209  /* Device Settings */
213  uint16_t data_rate_code;
215  uint8_t input_mode;
216  uint8_t buffer;
217  uint8_t bpdsw_mode;
218 };
219 
220 /******************************************************************************/
221 /************************ Functions Declarations ******************************/
222 /******************************************************************************/
223 
225 int ad7193_init(struct ad7193_dev **device,
227 
229 int ad7193_remove(struct ad7193_dev *dev);
230 
232 int ad7193_set_register_value(struct ad7193_dev *dev, uint8_t reg_addr,
233  uint32_t reg_value, uint8_t bytes_number);
234 
236 int ad7193_get_register_value(struct ad7193_dev *dev, uint8_t reg_addr,
237  uint8_t bytes_number, uint32_t *reg_data);
238 
239 /* Write masked data into device register. */
241  uint8_t reg_addr, uint32_t mask, uint32_t data,
242  uint8_t bytes);
243 
245 int ad7193_reset(struct ad7193_dev *dev);
246 
248 int ad7193_set_operating_mode(struct ad7193_dev *dev,
249  enum ad7193_adc_modes opt_mode);
250 
252 int ad7193_wait_rdy_go_low(struct ad7193_dev *dev);
253 
255 int ad7193_channels_select(struct ad7193_dev *dev, uint16_t chn_mask);
256 
258 int ad7193_calibrate(struct ad7193_dev *dev,
259  uint8_t mode, uint8_t channel);
260 
262 int ad7193_config_input_mode(struct ad7193_dev *dev, uint8_t mode);
263 
265 int ad7193_buffer_select(struct ad7193_dev *dev, uint8_t buff_en);
266 
268 int ad7193_output_rate_select(struct ad7193_dev *dev,
269  uint16_t out_rate_code);
270 
272 int ad7193_clock_select(struct ad7193_dev *dev,
273  enum ad7193_adc_clock clk_select);
274 
276 int ad7193_set_bridge_switch(struct ad7193_dev *dev, uint8_t bpdsw_select);
277 
279 int ad7193_range_setup(struct ad7193_dev *dev,
280  uint8_t polarity, enum ad7193_adc_range range);
281 
283 int ad7193_single_conversion(struct ad7193_dev *dev, uint32_t *reg_data);
284 
286 int ad7193_continuous_read_avg(struct ad7193_dev *dev,
287  uint8_t sample_number, uint32_t *samples_avg);
288 
290 int ad7193_temperature_read(struct ad7193_dev *dev, float *temp);
291 
293 float ad7193_convert_to_volts(struct ad7193_dev *dev,
294  uint32_t raw_data, float v_ref);
295 
296 #endif /* __AD7193_H__ */
AD7193_ADC_2_5V
@ AD7193_ADC_2_5V
Definition: ad7193.h:150
ad7193_remove
int ad7193_remove(struct ad7193_dev *dev)
Free the resources allocated by ad7193_init().
Definition: ad7193.c:152
spi_remove
int32_t spi_remove(struct spi_desc *desc)
Free the resources allocated by spi_init().
Definition: spi.c:70
AD7193_MODE_CAL_SYS_FULL
@ AD7193_MODE_CAL_SYS_FULL
Definition: ad7193.h:185
ad7193_set_register_value
int ad7193_set_register_value(struct ad7193_dev *dev, uint8_t reg_addr, uint32_t reg_val, uint8_t bytes_number)
Writes data into a register.
Definition: ad7193.c:179
ad7193_single_conversion
int ad7193_single_conversion(struct ad7193_dev *dev, uint32_t *reg_data)
Returns the result of a single conversion.
Definition: ad7193.c:565
ad7193_temperature_read
int ad7193_temperature_read(struct ad7193_dev *dev, float *temp)
Read data from temperature sensor and converts it to Celsius degrees.
Definition: ad7193.c:637
ad7193_get_register_value
int ad7193_get_register_value(struct ad7193_dev *dev, uint8_t reg_addr, uint8_t bytes_number, uint32_t *reg_data)
Reads the value of a register.
Definition: ad7193.c:213
ad7193_set_bridge_switch
int ad7193_set_bridge_switch(struct ad7193_dev *dev, uint8_t bpdsw_select)
Opens or closes the bridge power-down switch of the ADC.
Definition: ad7193.c:510
spi_desc
Structure holding SPI descriptor.
Definition: spi.h:132
ad7193_init_param::clock_source
enum ad7193_adc_clock clock_source
Definition: ad7193.h:214
ad7193_set_register_value
int ad7193_set_register_value(struct ad7193_dev *dev, uint8_t reg_addr, uint32_t reg_value, uint8_t bytes_number)
Writes data into a register.
Definition: ad7193.c:179
ad7193_temperature_read
int ad7193_temperature_read(struct ad7193_dev *dev, float *temp)
Read data from temperature sensor and converts it to Celsius degrees.
Definition: ad7193.c:637
ad7193_range_setup
int ad7193_range_setup(struct ad7193_dev *dev, uint8_t polarity, enum ad7193_adc_range range)
Selects the polarity of the conversion and the ADC input range.
Definition: ad7193.c:538
ad7193_dev::operating_mode
enum ad7193_adc_modes operating_mode
Definition: ad7193.h:196
AD7193_CONF_GAIN
#define AD7193_CONF_GAIN(x)
Definition: ad7193.h:113
ad7193_remove
int ad7193_remove(struct ad7193_dev *dev)
Free the resources allocated by ad7193_init().
Definition: ad7193.c:152
AD7193_INT_CLK_4_92_MHZ
@ AD7193_INT_CLK_4_92_MHZ
Definition: ad7193.h:166
ad7193_init
int ad7193_init(struct ad7193_dev **device, struct ad7193_init_param init_param)
Initializes the communication peripheral and the initial Values for AD7193 Board and resets the devic...
Definition: ad7193.c:62
spi.h
Header file of SPI Interface.
AD7193_ADC_19_53mV
@ AD7193_ADC_19_53mV
Definition: ad7193.h:155
AD7193_REG_GPOCON
#define AD7193_REG_GPOCON
Definition: ad7193.h:65
spi_write_and_read
int32_t spi_write_and_read(struct spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: spi.c:82
AD7193_MODE_IDLE
@ AD7193_MODE_IDLE
Definition: ad7193.h:175
ad7193_get_register_value
int ad7193_get_register_value(struct ad7193_dev *dev, uint8_t reg_addr, uint8_t bytes_number, uint32_t *reg_data)
Reads the value of a register.
Definition: ad7193.c:213
AD7193_MODE_RATE
#define AD7193_MODE_RATE(x)
Definition: ad7193.h:96
ad7193_dev::bpdsw_mode
uint8_t bpdsw_mode
Definition: ad7193.h:201
AD7193_GPOCON_BPDSW
#define AD7193_GPOCON_BPDSW
Definition: ad7193.h:133
device
Definition: ad9361_util.h:75
ad7193_init_param
Definition: ad7193.h:204
ad7193_output_rate_select
int ad7193_output_rate_select(struct ad7193_dev *dev, uint16_t out_rate_code)
Selects the filter output data rate of the ADC.
Definition: ad7193.c:454
AD7193_MODE_SEL
#define AD7193_MODE_SEL(x)
Definition: ad7193.h:87
ad7193_range_setup
int ad7193_range_setup(struct ad7193_dev *dev, uint8_t polarity, enum ad7193_adc_range range)
Selects the polarity of the conversion and the ADC input range.
Definition: ad7193.c:538
ad7193_channels_select
int ad7193_channels_select(struct ad7193_dev *dev, uint16_t chn_mask)
Selects the channels to be enabled.
Definition: ad7193.c:355
AD7193_MODE_CAL_INT_FULL
@ AD7193_MODE_CAL_INT_FULL
Definition: ad7193.h:181
ad7193_config_input_mode
int ad7193_config_input_mode(struct ad7193_dev *dev, uint8_t mode)
Configures the input mode of the ADC.
Definition: ad7193.c:404
ad7193_convert_to_volts
float ad7193_convert_to_volts(struct ad7193_dev *dev, uint32_t raw_data, float v_ref)
Converts 24-bit raw data to milivolts.
Definition: ad7193.c:671
ad7193_init_param::bpdsw_mode
uint8_t bpdsw_mode
Definition: ad7193.h:217
ad7193_adc_range
ad7193_adc_range
Definition: ad7193.h:148
ad7193_clock_select
int ad7193_clock_select(struct ad7193_dev *dev, enum ad7193_adc_clock clk_select)
Selects the clock source of the ADC.
Definition: ad7193.c:483
AD7193_INT_CLK_4_92_MHZ_TRIST
@ AD7193_INT_CLK_4_92_MHZ_TRIST
Definition: ad7193.h:164
AD7193_REG_ID
#define AD7193_REG_ID
Definition: ad7193.h:64
ad7193_set_operating_mode
int ad7193_set_operating_mode(struct ad7193_dev *dev, enum ad7193_adc_modes opt_mode)
Sets device into the specified operating mode.
Definition: ad7193.c:305
gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: gpio.h:71
AD7193_ADC_156_2_mV
@ AD7193_ADC_156_2_mV
Definition: ad7193.h:152
ad7193_continuous_read_avg
int ad7193_continuous_read_avg(struct ad7193_dev *dev, uint8_t sample_number, uint32_t *samples_avg)
Returns the average of several conversion results.
Definition: ad7193.c:596
AD7193_REG_DATA
#define AD7193_REG_DATA
Definition: ad7193.h:63
ad7193_set_bridge_switch
int ad7193_set_bridge_switch(struct ad7193_dev *dev, uint8_t bpdsw_select)
Opens or closes the bridge power-down switch of the ADC.
Definition: ad7193.c:510
ad7193_continuous_read_avg
int ad7193_continuous_read_avg(struct ad7193_dev *dev, uint8_t sample_number, uint32_t *samples_avg)
Returns the average of several conversion results.
Definition: ad7193.c:596
ad7193_set_masked_register_value
int ad7193_set_masked_register_value(struct ad7193_dev *dev, uint8_t reg_addr, uint32_t mask, uint32_t reg_data, uint8_t bytes)
Write masked data into device register.
Definition: ad7193.c:248
ad7193_convert_to_volts
float ad7193_convert_to_volts(struct ad7193_dev *dev, uint32_t raw_data, float v_ref)
Converts 24-bit raw data to milivolts.
Definition: ad7193.c:671
ad7193_dev::spi_desc
spi_desc * spi_desc
Definition: ad7193.h:190
spi_init_param
Structure holding the parameters for SPI initialization.
Definition: spi.h:112
ad7193_init_param::gpio_miso
struct gpio_init_param gpio_miso
Definition: ad7193.h:208
AD7193_CH_TEMP
#define AD7193_CH_TEMP
Definition: ad7193.h:125
ad7193_init_param::current_polarity
uint8_t current_polarity
Definition: ad7193.h:210
ad7193_reset
int ad7193_reset(struct ad7193_dev *dev)
Resets the device.
Definition: ad7193.c:273
AD7193_CONF_PSEUDO
#define AD7193_CONF_PSEUDO
Definition: ad7193.h:107
ad7193_wait_rdy_go_low
int ad7193_wait_rdy_go_low(struct ad7193_dev *dev)
Waits for RDY pin to go low.
Definition: ad7193.c:327
ad7193_dev::current_polarity
uint8_t current_polarity
Definition: ad7193.h:194
error.h
Error codes definition.
AD7193_CONF_UNIPOLAR
#define AD7193_CONF_UNIPOLAR
Definition: ad7193.h:112
ad7193_output_rate_select
int ad7193_output_rate_select(struct ad7193_dev *dev, uint16_t out_rate_code)
Selects the filter output data rate of the ADC.
Definition: ad7193.c:454
AD7193_MODE_CONT
@ AD7193_MODE_CONT
Definition: ad7193.h:171
delay.h
Header file of Delay functions.
AD7193_ADC_312_5_mV
@ AD7193_ADC_312_5_mV
Definition: ad7193.h:151
AD7193_ID_MASK
#define AD7193_ID_MASK
Definition: ad7193.h:130
AD7193_MODE_PWRDN
@ AD7193_MODE_PWRDN
Definition: ad7193.h:177
gpio_desc
Structure holding the GPIO descriptor.
Definition: gpio.h:84
AD7193_COMM_WRITE
#define AD7193_COMM_WRITE
Definition: ad7193.h:71
ad7193_channels_select
int ad7193_channels_select(struct ad7193_dev *dev, uint16_t chn_mask)
Selects the channels to be enabled.
Definition: ad7193.c:355
AD7193_MODE_SINGLE
@ AD7193_MODE_SINGLE
Definition: ad7193.h:173
ad7193_init_param::operating_mode
enum ad7193_adc_modes operating_mode
Definition: ad7193.h:212
udelay
void udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: delay.c:117
gpio_direction_input
int32_t gpio_direction_input(struct gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: gpio.c:108
AD7193_EXT_CRYSTAL_MCLK1_MCLK2
@ AD7193_EXT_CRYSTAL_MCLK1_MCLK2
Definition: ad7193.h:160
ad7193_adc_clock
ad7193_adc_clock
Definition: ad7193.h:158
gpio_get
int32_t gpio_get(struct gpio_desc **desc, const struct gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: gpio.c:55
ad7193_buffer_select
int ad7193_buffer_select(struct ad7193_dev *dev, uint8_t buff_en)
Enables or disables the buffer on the ADC input channels.
Definition: ad7193.c:430
ad7193_calibrate
int ad7193_calibrate(struct ad7193_dev *dev, uint8_t mode, uint8_t channel)
Performs the given calibration to the specified channel.
Definition: ad7193.c:376
AD7193_EXT_CRYSTAL_MCLK2
@ AD7193_EXT_CRYSTAL_MCLK2
Definition: ad7193.h:162
ad7193.h
Header file of AD7193 Driver.
ad7193_dev::clock_source
enum ad7193_adc_clock clock_source
Definition: ad7193.h:198
AD7193_REG_MODE
#define AD7193_REG_MODE
Definition: ad7193.h:61
ad7193_set_masked_register_value
int ad7193_set_masked_register_value(struct ad7193_dev *dev, uint8_t reg_addr, uint32_t mask, uint32_t data, uint8_t bytes)
Write masked data into device register.
Definition: ad7193.c:248
ad7193_dev::data_rate_code
uint16_t data_rate_code
Definition: ad7193.h:197
AD7193_ADC_39_06mV
@ AD7193_ADC_39_06mV
Definition: ad7193.h:154
gpio.h
Header file of GPIO Interface.
ad7193_init_param::buffer
uint8_t buffer
Definition: ad7193.h:216
ad7193_init_param::current_gain
enum ad7193_adc_range current_gain
Definition: ad7193.h:211
AD7193_MODE_CAL_SYS_ZERO
@ AD7193_MODE_CAL_SYS_ZERO
Definition: ad7193.h:183
SUCCESS
#define SUCCESS
Definition: error.h:52
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
ad7193_dev::input_mode
uint8_t input_mode
Definition: ad7193.h:199
ad7193_init_param::input_mode
uint8_t input_mode
Definition: ad7193.h:215
ad7193_dev::current_gain
enum ad7193_adc_range current_gain
Definition: ad7193.h:195
AD7193_REG_CONF
#define AD7193_REG_CONF
Definition: ad7193.h:62
ad7193_config_input_mode
int ad7193_config_input_mode(struct ad7193_dev *dev, uint8_t mode)
Configures the input mode of the ADC.
Definition: ad7193.c:404
ad7193_buffer_select
int ad7193_buffer_select(struct ad7193_dev *dev, uint8_t buff_en)
Enables or disables the buffer on the ADC input channels.
Definition: ad7193.c:430
ad7193_calibrate
int ad7193_calibrate(struct ad7193_dev *dev, uint8_t mode, uint8_t channel)
Performs the given calibration to the specified channel.
Definition: ad7193.c:376
AD7193_CONF_CHAN
#define AD7193_CONF_CHAN(x)
Definition: ad7193.h:108
ad7193_clock_select
int ad7193_clock_select(struct ad7193_dev *dev, enum ad7193_adc_clock clk_select)
Selects the clock source of the ADC.
Definition: ad7193.c:483
AD7193_MODE_CLKSRC
#define AD7193_MODE_CLKSRC(x)
Definition: ad7193.h:89
ad7193_init_param::data_rate_code
uint16_t data_rate_code
Definition: ad7193.h:213
ad7193_init
int ad7193_init(struct ad7193_dev **device, struct ad7193_init_param init_param)
Initializes the communication peripheral and the initial Values for AD7193 Board and resets the devic...
Definition: ad7193.c:62
ad7193_set_operating_mode
int ad7193_set_operating_mode(struct ad7193_dev *dev, enum ad7193_adc_modes opt_mode)
Sets device into the specified operating mode.
Definition: ad7193.c:305
gpio_remove
int32_t gpio_remove(struct gpio_desc *desc)
Free the resources allocated by gpio_get().
Definition: gpio.c:95
spi_init
int32_t spi_init(struct spi_desc **desc, const struct spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: spi.c:51
gpio_get_value
int32_t gpio_get_value(struct gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: gpio.c:177
AD7193_MODE_CAL_INT_ZERO
@ AD7193_MODE_CAL_INT_ZERO
Definition: ad7193.h:179
ad7193_dev::buffer
uint8_t buffer
Definition: ad7193.h:200
AD7193_ADC_78_125mV
@ AD7193_ADC_78_125mV
Definition: ad7193.h:153
ad7193_dev
Definition: ad7193.h:188
AD7193_CH_MASK
#define AD7193_CH_MASK(x)
Definition: ad7193.h:142
ad7193_adc_modes
ad7193_adc_modes
Definition: ad7193.h:169
ad7193_init_param::spi_init
spi_init_param spi_init
Definition: ad7193.h:206
ad7193_single_conversion
int ad7193_single_conversion(struct ad7193_dev *dev, uint32_t *reg_data)
Returns the result of a single conversion.
Definition: ad7193.c:565
util.h
Implementation of utility functions.
AD7193_COMM_ADDR
#define AD7193_COMM_ADDR(x)
Definition: ad7193.h:73
FAILURE
#define FAILURE
Definition: error.h:56
ad7193_dev::gpio_miso
struct gpio_desc * gpio_miso
Definition: ad7193.h:192
ID_AD7193
#define ID_AD7193
Definition: ad7193.h:129
ad7193_reset
int ad7193_reset(struct ad7193_dev *dev)
Resets the device.
Definition: ad7193.c:273
AD7193_COMM_READ
#define AD7193_COMM_READ
Definition: ad7193.h:72
ad7193_wait_rdy_go_low
int ad7193_wait_rdy_go_low(struct ad7193_dev *dev)
Waits for RDY pin to go low.
Definition: ad7193.c:327
AD7193_CONF_BUF
#define AD7193_CONF_BUF
Definition: ad7193.h:111