Accessing IIO data
You may have guessed, there are only two ways to access data with the IIO framework: one-shot capture through sysfs channels or continuous mode (triggered buffer) via an IIO character device.
Single-shot capture
Single-shot data capture is done through the sysfs interface. By reading the sysfs entry that corresponds to a channel, you'll capture only the data specific to that channel. Say we have a temperature sensor with two channels: one for the ambient temperature and the other for the thermocouple temperature:
# cd /sys/bus/iio/devices/iio:device0 # cat in_voltage3_raw 6646 # cat in_voltage_scale 0.305175781
The processed value is obtained by multiplying the scale by the raw value:
Voltage value: 6646 * 0.305175781 = 2028.19824053
The device datasheet says the process value is given in mV. In our case, it corresponds to 2.02819 V.
Accessing the data buffer
To get a triggered acquisition working, trigger support must have been implemented...