#include <libsimpleio/libadc.h> void ADC_get_name(int32_t chip, char *name, int32_t namesize, int32_t *error); void ADC_open(int32_t chip, int32_t channel, int32_t *fd, int32_t *error); void ADC_close(int32_t fd, int32_t *error); void ADC_read(int32_t fd, int32_t *sample, int32_t *error);Link with -lsimpleio.
ADC_get_name() fetches an information string for an A/D device. The chip number must be passed in chip. The destination buffer address must be passed in *name and the destination buffer size must be passed in namesize. The minimum size for the destination buffer is 16 bytes.
ADC_open() opens an A/D input channel device. The A/D chip number must be passed in the chip parameter and the A/D input channel number must be passed in the channel parameter. Upon success, a file descriptor for the A/D input channel device is returned in *fd.
ADC_close() closes a previously opened A/D input channel device.
ADC_read() reads a sample from an A/D input channel device. The file descriptor for an open A/D input channel device must be passed in the fd parameter. The analog sample data will be returned in the *sample parameter.
https://wiki.analog.com/software/linux/docs/iio/iio