Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
60 #define ADC10_REG_CONFIG_0 0x00
61 #define ADC10_REG_CONFIG_1 0x01
62 #define ADC10_REG_CONFIG_2 0x02
63 #define ADC10_REG_CONFIG_3 0x03
64 #define ADC10_REG_CONFIG_4 0x04
83 #define ADC10_SYNC_WORD 0x55
84 #define ADC10_CMD_RESET 0x06
85 #define ADC10_CMD_START 0x08
86 #define ADC10_CMD_POWERDOWN 0x03
87 #define ADC10_CMD_RDATA 0x10
88 #define ADC10_CMD_RREG 0x20
89 #define ADC10_CMD_WREG 0x40
96 #define ADC10_REG0_MUX_P0_N1 0x00
97 #define ADC10_REG0_MUX_P0_N2 0x01
98 #define ADC10_REG0_MUX_P0_N3 0x02
99 #define ADC10_REG0_MUX_P1_N0 0x03
100 #define ADC10_REG0_MUX_P1_N2 0x04
101 #define ADC10_REG0_MUX_P1_N3 0x05
102 #define ADC10_REG0_MUX_P2_N3 0x06
103 #define ADC10_REG0_MUX_P3_N2 0x07
104 #define ADC10_REG0_MUX_P0_NS 0x08
105 #define ADC10_REG0_MUX_P1_NS 0x09
106 #define ADC10_REG0_MUX_P2_NS 0x0A
107 #define ADC10_REG0_MUX_P3_NS 0x0B
108 #define ADC10_REG0_MUX_VREF 0x0C
109 #define ADC10_REG0_MUX_AVOLD_4 0x0D
110 #define ADC10_REG0_MUX_AVOLAVER 0x0E
111 #define ADC10_REG0_MUX_RESERVE 0x0F
118 #define ADC10_REG0_GAIN_1 0x00
119 #define ADC10_REG0_GAIN_2 0x01
120 #define ADC10_REG0_GAIN_4 0x02
121 #define ADC10_REG0_GAIN_8 0x03
122 #define ADC10_REG0_GAIN_16 0x04
123 #define ADC10_REG0_GAIN_32 0x05
124 #define ADC10_REG0_GAIN_64 0x06
125 #define ADC10_REG0_GAIN_128 0x07
132 #define ADC10_REG0_PGA_ENABLED 0x00
133 #define ADC10_REG0_PGA_DISABLED 0x01
140 #define ADC10_REG1_DR_NORMAL_20 0x00
141 #define ADC10_REG1_DR_NORMAL_45 0x01
142 #define ADC10_REG1_DR_NORMAL_90 0x02
143 #define ADC10_REG1_DR_NORMAL_175 0x03
144 #define ADC10_REG1_DR_NORMAL_330 0x04
145 #define ADC10_REG1_DR_NORMAL_600 0x05
146 #define ADC10_REG1_DR_NORMAL_1000 0x06
147 #define ADC10_REG1_DR_TURBO_40 0x00
148 #define ADC10_REG1_DR_TURBO_90 0x01
149 #define ADC10_REG1_DR_TURBO_180 0x02
150 #define ADC10_REG1_DR_TURBO_350 0x03
151 #define ADC10_REG1_DR_TURBO_660 0x04
152 #define ADC10_REG1_DR_TURBO_1200 0x05
153 #define ADC10_REG1_DR_TURBO_2000 0x06
160 #define ADC10_REG1_MODE_NORMAL 0x00
161 #define ADC10_REG1_MODE_TURBO 0x01
168 #define ADC10_REG1_CM_SINGAL_SHOT 0x00
169 #define ADC10_REG1_CM_CONTINUOUS 0x01
176 #define ADC10_REG1_VREF_INTERNAL_2048 0x00
177 #define ADC10_REG1_VREF_EXTERNAL_REF 0x01
178 #define ADC10_REG1_VREF_ANALOG_1 0x02
179 #define ADC10_REG1_VREF_ANALOG_2 0x03
186 #define ADC10_REG1_TS_DISABLED 0x00
187 #define ADC10_REG1_TS_ENABLED 0x01
194 #define ADC10_REG2_DRDY_NOT_READY 0x00
195 #define ADC10_REG2_DRDY_READY 0x01
202 #define ADC10_REG2_DCNT_DISABLED 0x00
203 #define ADC10_REG2_DCNT_ENABLED 0x01
210 #define ADC10_REG2_CRC_DISABLED 0x00
211 #define ADC10_REG2_CRC_INVERTED_ENABLED 0x01
212 #define ADC10_REG2_CRC_CRC16_ENABLED 0x02
213 #define ADC10_REG2_CRC_RESERVED 0x03
220 #define ADC10_REG2_BCS_CURRENT_SOURCE_OFF 0x00
221 #define ADC10_REG2_BCS_CURRENT_SOURCE_ON 0x01
228 #define ADC10_REG2_IDAC_CURRENT_OFF 0x00
229 #define ADC10_REG2_IDAC_CURRENT_10_uA 0x01
230 #define ADC10_REG2_IDAC_CURRENT_50_uA 0x02
231 #define ADC10_REG2_IDAC_CURRENT_100_uA 0x03
232 #define ADC10_REG2_IDAC_CURRENT_250_uA 0x04
233 #define ADC10_REG2_IDAC_CURRENT_500_uA 0x05
234 #define ADC10_REG2_IDAC_CURRENT_1000_uA 0x06
235 #define ADC10_REG2_IDAC_CURRENT_1500_uA 0x07
242 #define ADC10_REG3_L1MUX_DISABLED 0x00
243 #define ADC10_REG3_L1MUX_TO_AIN0 0x01
244 #define ADC10_REG3_L1MUX_TO_AIN1 0x02
245 #define ADC10_REG3_L1MUX_TO_AIN2 0x03
246 #define ADC10_REG3_L1MUX_TO_AIN3 0x04
247 #define ADC10_REG3_L1MUX_TO_REFP 0x05
248 #define ADC10_REG3_L1MUX_TO_REFN 0x06
249 #define ADC10_REG3_L1MUX_RESERVED 0x07
256 #define ADC10_REG3_L2MUX_DISABLED 0x00
257 #define ADC10_REG3_L2MUX_TO_AIN0 0x01
258 #define ADC10_REG3_L2MUX_TO_AIN1 0x02
259 #define ADC10_REG3_L2MUX_TO_AIN2 0x03
260 #define ADC10_REG3_L2MUX_TO_AIN3 0x04
261 #define ADC10_REG3_L2MUX_TO_REFP 0x05
262 #define ADC10_REG3_L2MUX_TO_REFN 0x06
269 #define ADC10_REG3_DATA_MODE_MANUAL 0x00
270 #define ADC10_REG3_DATA_MODE_AUTO 0x01
277 #define ADC10_REG4_GPIO2_DIR_INPUT 0x00
278 #define ADC10_REG4_GPIO2_DIR_OUTPUT 0x01
279 #define ADC10_REG4_GPIO1_DIR_INPUT 0x00
280 #define ADC10_REG4_GPIO1_DIR_OUTPUT 0x01
281 #define ADC10_REG4_GPIO0_DIR_INPUT 0x00
282 #define ADC10_REG4_GPIO0_DIR_OUTPUT 0x01
289 #define ADC10_REG4_GPIO2_SEL_DAT 0x00
290 #define ADC10_REG4_GPIO2_SEL_DRDY 0x01
297 #define ADC10_REG4_GPIO_LOW 0x00
298 #define ADC10_REG4_GPIO_HIGH 0x01
304 #define ADC10_ANALOG_INPUT_CH_0 0x00
305 #define ADC10_ANALOG_INPUT_CH_1 0x01
306 #define ADC10_ANALOG_INPUT_CH_2 0x02
307 #define ADC10_ANALOG_INPUT_CH_3 0x03
313 #define ADC10_NEW_DATA_IS_READY 0x00
314 #define ADC10_NEW_DATA_NOT_READY 0x01
320 #define ADC10_GAIN_1 1
321 #define ADC10_GAIN_2 2
322 #define ADC10_GAIN_4 4
323 #define ADC10_GAIN_8 8
324 #define ADC10_GAIN_16 16
325 #define ADC10_GAIN_32 32
326 #define ADC10_GAIN_64 64
327 #define ADC10_GAIN_128 128
333 #define ADC10_REG_BITS 0x0E
334 #define ADC10_ADC_RESOLUTION 0x007FFFFF
335 #define ADC10_VREF_INTERNAL 2048.0
336 #define ADC10_VREF_EXTERNAL_3300_mA 3300.0
337 #define ADC10_VREF_EXTERNAL_5000_mA 5000.0
345 #define DRV_BUFFER_SIZE 200
363 #define ADC10_MAP_MIKROBUS( cfg, mikrobus ) \
364 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
365 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
366 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
367 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
384 digital_in_t int_pin;
417 uart_data_bits_t data_bit;
418 uart_parity_t parity_bit;
419 uart_stop_bits_t stop_bit;
435 uint8_t data_integ_check;
436 uint8_t b_current_src;
437 uint8_t idac_current;
438 uint8_t idac1_routing;
439 uint8_t idac2_routing;
440 uint8_t adc_data_out_mode;
444 uint8_t gpio2_drdy_ctrl;
445 uint8_t gpio2_io_lvl;
446 uint8_t gpio1_io_lvl;
447 uint8_t gpio0_io_lvl;
float adc10_calc_voltage(adc10_t *ctx, int32_t adc_data, float vref, uint8_t gain)
ADC 10 Calculate the voltage function.
void adc10_set_config(adc10_t *ctx, adc10_settings_t cfg_data)
ADC 10 Set configuration function.
void adc10_shutdown(adc10_t *ctx)
ADC 10 Shutdown function.
int32_t adc10_get_ch_output(adc10_t *ctx, uint8_t sel_ch)
ADC 10 Get the channel output function.
void adc10_reset(adc10_t *ctx)
ADC 10 Software reset function.
void adc10_cfg_setup(adc10_cfg_t *cfg)
ADC 10 configuration object setup function.
void adc10_hw_reset(adc10_t *ctx)
ADC 10 Hardware reset function.
uint8_t adc10_read_reg(adc10_t *ctx, uint8_t reg)
ADC 10 Read register function.
void adc10_default_cfg(adc10_t *ctx)
ADC 10 default configuration function.
void adc10_start_sync(adc10_t *ctx)
ADC 10 Start the synchronization function.
err_t adc10_generic_read(adc10_t *ctx, char *data_buf, uint16_t max_len)
ADC 10 data reading function.
ADC 10 Click configuration object.
Definition: adc10.h:400
uint8_t adc10_check_drdy(adc10_t *ctx)
ADC 10 Check DRDY function.
void adc10_get_config(adc10_t *ctx, adc10_settings_t *cfg_data)
ADC 10 Get configuration function.
ADC 10 Click context object.
Definition: adc10.h:375
#define DRV_BUFFER_SIZE
ADC 10 driver buffer size.
Definition: adc10.h:344
void adc10_write_reg(adc10_t *ctx, uint8_t reg, uint8_t tx_data)
ADC 10 Write register function.
err_t adc10_generic_write(adc10_t *ctx, char *data_buf, uint16_t len)
ADC 10 data writing function.
err_t adc10_init(adc10_t *ctx, adc10_cfg_t *cfg)
ADC 10 initialization function.
void adc10_send_command(adc10_t *ctx, uint8_t cmd)
ADC 10 Send command function.