libiio - Man Page
introduction to libiio, a library for interacting with the Linux IIO subsystem and devices
Synopsis
#include <iio.h>
cc file.c -liio
Options
The define IIO_CHECK_REG will warn if return values are not checked. Most libiio functions, if/when a failure occurs will return a negative error number. this warning will ensure these error numbers are looked at. There is nothing more frustraining than calling a function, debugging some hardware, and then eventually realizing there was a typo in an attribute name. This option will force libraries users to at least capture the return value.
cc file.c -DIIO_CHECK_REG -liio
Description
libiio is a library used to interface to the Linux Industrial Input/Output (IIO) Subsystem. The Linux IIO subsystem is intended to provide support for devices that in some sense are analog to digital or digital to analog converters (ADCs, DACs). This includes, but is not limited to ADCs, Accelerometers, Gyros, IMUs, Capacitance to Digital Converters (CDCs), Pressure Sensors, Color, Light and Proximity Sensors, Temperature Sensors, Magnetometers, DACs, DDS (Direct Digital Synthesis), PLLs (Phase Locked Loops), Variable/Programmable Gain Amplifiers (VGA, PGA), and RF transceivers. You can use libiio natively on an embedded Linux target (local mode), or use libiio to communicate remotely to that same target from a host Linux, Windows or MAC over USB, Ethernet or Serial.
Data Types
The library makes use of C structures and typedefs to promote portability, and is known to run on various GNU/Linux distributions, macOS, Windows, and mbed (via tiny-iiod). The main C structures are:
- iio_context_params
IIO context creation information
- iio_attr
Structure holding meta-data for an attribute
- iio_scan
Structure holding scanning information
- iio_context
Contains the representation of an IIO context
- iio_device
Represents a device in the IIO context
- iio_channel
Represents an input or output channel of a device
- iio_buffer
An input or output buffer, used to read or write samples
- iio_buffer_stream
An opened buffer ready for data streaming
- iio_block
A block of memory containing data samples
- iio_stream
A helper object to simplify reading/writing to a iio_buffer
- iio_event
Represents a IIO event.
- iio_data_format
Contains the format of a data sample.
List of Routines
The following routines are part of the library. Consult the Doxygen pages for details on their operation (in the SEE ALSO section).
ErrorHandling Functions for handling pointer-encoded errors