15 #ifndef TI_ADS1113_ADS1115_H 16 #define TI_ADS1113_ADS1115_H 33 TI_ADS_MUX_ApA0_AnA1 = 0,
34 TI_ADS_MUX_ApA0_AnA3 = 1,
35 TI_ADS_MUX_ApA1_AnA3 = 2,
36 TI_ADS_MUX_ApA2_AnA3 = 3,
37 TI_ADS_MUX_ApA0_AnGND = 4,
38 TI_ADS_MUX_ApA1_AnGND = 5,
39 TI_ADS_MUX_ApA2_AnGND = 6,
40 TI_ADS_MUX_ApA3_AnGND = 7
47 TI_ADS_PGA_FS_6_144V = 0,
48 TI_ADS_PGA_FS_4_096V = 1,
49 TI_ADS_PGA_FS_2_048V = 2,
50 TI_ADS_PGA_FS_1_024V = 3,
51 TI_ADS_PGA_FS_0_512V = 4,
52 TI_ADS_PGA_FS_0_256V = 5,
53 TI_ADS_PGA_FS_0_256V_2 = 6,
54 TI_ADS_PGA_FS_0_256V_3 = 7,
61 TI_ADS_MODE_CONTINUOUS = 0,
62 TI_ADS_MODE_SINGLE_SHOT = 1,
69 TI_ADS_DATARATE_8SPS = 0,
70 TI_ADS_DATARATE_16SPS = 1,
71 TI_ADS_DATARATE_32SPS = 2,
72 TI_ADS_DATARATE_64SPS = 3,
73 TI_ADS_DATARATE_128SPS = 4,
74 TI_ADS_DATARATE_250SPS = 5,
75 TI_ADS_DATARATE_475SPS = 6,
76 TI_ADS_DATARATE_860SPS = 7,
77 } ti_ads_adc_data_rate;
84 #define TI_ADS_COMP_MODE_HYSTERESIS (0 << 4) 85 #define TI_ADS_COMP_MODE_WINDOW (1 << 4) 86 #define TI_ADS_COMP_POL_ACTIVE_LOW (0 << 3) 87 #define TI_ADS_COMP_POL_ACTIVE_HIGH (1 << 3) 88 #define TI_ADS_COMP_LAT_NON_LATCHING (0 << 2) 89 #define TI_ADS_COMP_LAT_LATCHING (1 << 2) 90 #define TI_ADS_COMP_QUE_DISABLE_COMP (3 << 0) 91 #define TI_ADS_COMP_QUE_AFTER_4 (2 << 0) 92 #define TI_ADS_COMP_QUE_AFTER_2 (1 << 0) 93 #define TI_ADS_COMP_QUE_AFTER_1 (0 << 0) 103 #define TI_ADS_ADC_GET_CONVERSION (I2C_DEV_IO_CONTROL + 0) 104 #define TI_ADS_ADC_SET_MUX (I2C_DEV_IO_CONTROL + 1) 105 #define TI_ADS_ADC_SET_PGA (I2C_DEV_IO_CONTROL + 2) 106 #define TI_ADS_ADC_SET_MODE (I2C_DEV_IO_CONTROL + 3) 107 #define TI_ADS_ADC_SET_DATA_RATE (I2C_DEV_IO_CONTROL + 4) 108 #define TI_ADS_ADC_SET_COMP (I2C_DEV_IO_CONTROL + 5) 109 #define TI_ADS_ADC_SET_LO_THRESH (I2C_DEV_IO_CONTROL + 6) 110 #define TI_ADS_ADC_SET_HI_THRESH (I2C_DEV_IO_CONTROL + 7) 111 #define TI_ADS_ADC_SET_CONV_WAIT (I2C_DEV_IO_CONTROL + 8) 116 int i2c_dev_register_ti_ads_adc(
const char* bus_path,
117 const char* dev_path,
126 ti_ads_adc_convert(
int fd, uint16_t* sample)
128 return ioctl(fd, TI_ADS_ADC_GET_CONVERSION, sample);
135 ti_ads_adc_set_mux(
int fd, ti_ads_adc_mux mux)
137 return ioctl(fd, TI_ADS_ADC_SET_MUX, (
void *)(uintptr_t) mux);
144 ti_ads_adc_set_pga(
int fd, ti_ads_adc_pga pga)
146 return ioctl(fd, TI_ADS_ADC_SET_PGA, (
void *)(uintptr_t) pga);
153 ti_ads_adc_set_mode(
int fd, ti_ads_adc_mode mode)
155 return ioctl(fd, TI_ADS_ADC_SET_MODE, (
void *)(uintptr_t) mode);
162 ti_ads_adc_set_data_rate(
int fd, ti_ads_adc_data_rate rate)
164 return ioctl(fd, TI_ADS_ADC_SET_DATA_RATE, (
void *)(uintptr_t) rate);
171 ti_ads_adc_set_comparator(
int fd, uint16_t comp)
173 return ioctl(fd, TI_ADS_ADC_SET_COMP, (
void *)(uintptr_t) comp);
180 ti_ads_adc_set_low_threshold(
int fd, uint16_t level)
182 return ioctl(fd, TI_ADS_ADC_SET_LO_THRESH, (
void *)(uintptr_t) level);
189 ti_ads_adc_set_high_threshold(
int fd, uint16_t level)
191 return ioctl(fd, TI_ADS_ADC_SET_HI_THRESH, (
void *)(uintptr_t) level);
198 ti_ads_adc_set_conversion_poll_wait(
int fd, uint32_t micro_seconds)
200 return ioctl(fd, TI_ADS_ADC_SET_CONV_WAIT, (
void *)(uintptr_t) micro_seconds);
Definition: rtemscompat1.h:15
Inter-Integrated Circuit (I2C) Driver API.