.\" Copyright (c) 2018-2020 Robin Getz .\" Copyright (c) 2018-2020 Analog Devices Inc. .\" .\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, see .\" . .\" %%%LICENSE_END .\" .\" This file is autogenerated, and should not be edited .\" .if n .po 0 .TH INTRO 3LIBIIO "05 April 2024" "libiio-0.25" .SH NAME libiio-0.25 \- introduction to .IR libiio , a library for interacting with the Linux .SM IIO subsystem and devices .SH SYNOPSIS .B "#include " .sp cc file.c .B -liio .SH OPTIONS The define .B IIO_CHECK_REG will warn if return values are not checked. Most .B 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. .sp cc file.c .B -DIIO_CHECK_REG -liio .SH DESCRIPTION .I libiio is a library used to interface to the .I "Linux Industrial Input/Output (IIO)" Subsystem. The Linux .I 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 .I 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. .SH "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: .in +.5i .TP 18 .TP .B iio_scan_context The scanning context .TP .B iio_context_info The information related to a discovered context .TP .B iio_context Contains the representation of an IIO context .TP .B iio_device Represents a device in the IIO context .TP .B iio_channel Represents an input or output channel of a device .TP .B iio_buffer An input or output buffer, used to read or write samples .TP .B iio_data_format Contains the format of a data sample. .LP .in -.5i .SH "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). .sp Scan Functions for scanning available contexts .in +.5i .TP 33 .TP \fIFunction\fP \fIDescription\fP .TP .B iio_create_scan_context Create a scan context .TP .B iio_scan_context_destroy Destroy the given scan context .TP .B iio_scan_context_get_info_list Enumerate available contexts .TP .B iio_context_info_list_free Free a context info list .TP .B iio_context_info_get_description Get a description of a discovered context .TP .B iio_context_info_get_uri Get the URI of a discovered context .TP .B iio_create_scan_block Create a scan block .TP .B iio_scan_block_destroy Destroy the given scan block .TP .B iio_scan_block_scan Enumerate available contexts via scan block .TP .B iio_scan_block_get_info Get the iio_context_info for a particular context .LP .sp TopLevel Top-level functions .in +.5i .TP 33 .TP \fIFunction\fP \fIDescription\fP .TP .B iio_library_get_version Get the version of the libiio library .TP .B iio_strerror Get a string description of an error code .TP .B iio_has_backend Check if the specified backend is available .TP .B iio_get_backends_count Get the number of available backends .TP .B iio_get_backend Retrieve the name of a given backend .LP .sp Context Context .in +.5i .TP 33 .TP \fIFunction\fP \fIDescription\fP .TP .B iio_create_default_context Create a context from local or remote IIO devices .TP .B iio_create_local_context Create a context from local IIO devices (Linux only) .TP .B iio_create_xml_context Create a context from XML data in memory .TP .B iio_create_xml_context_mem Create a context from XML data in memory .TP .B iio_create_network_context Create a context from the network .TP .B iio_create_context_from_uri .TP .B iio_context_clone Duplicate a pre-existing IIO context .TP .B iio_context_destroy Destroy the given context .TP .B iio_context_get_version Get the version of the backend in use .TP .B iio_context_get_xml Obtain a XML representation of the given context .TP .B iio_context_get_name Get the name of the given context .TP .B iio_context_get_description Get a description of the given context .TP .B iio_context_get_attrs_count Get the number of context-specific attributes .TP .B iio_context_get_attr Retrieve the value of a context-specific attribute .TP .B iio_context_get_attr_value Retrieve the value of a context-specific attribute .TP .B iio_context_get_devices_count Enumerate the devices found in the given context .TP .B iio_context_get_device Get the device present at the given index .TP .B iio_context_find_device Try to find a device structure by its ID, label or name .TP .B iio_context_set_timeout Set a timeout for I/O operations .LP .sp Device Device .in +.5i .TP 38 .TP \fIFunction\fP \fIDescription\fP .TP .B iio_device_get_context Retrieve a pointer to the iio_context structure .TP .B iio_device_get_id Get whether or not the device is a hardware monitoring device .TP .B iio_device_get_name Retrieve the device name .TP .B iio_device_get_label Retrieve the device label .TP .B iio_device_get_channels_count Enumerate the channels of the given device .TP .B iio_device_get_attrs_count Enumerate the device-specific attributes of the given device .TP .B iio_device_get_buffer_attrs_count Enumerate the buffer-specific attributes of the given device .TP .B iio_device_get_channel Get the channel present at the given index .TP .B iio_device_get_attr Get the device-specific attribute present at the given index .TP .B iio_device_get_buffer_attr Get the buffer-specific attribute present at the given index .TP .B iio_device_find_channel Try to find a channel structure by its name of ID .TP .B iio_device_find_attr Try to find a device-specific attribute by its name .TP .B iio_device_find_buffer_attr Try to find a buffer-specific attribute by its name .TP .B iio_device_attr_read Read the content of the given device-specific attribute .TP .B iio_device_attr_read_all Read the content of all device-specific attributes .TP .B iio_device_attr_read_bool Read the content of the given device-specific attribute .TP .B iio_device_attr_read_longlong Read the content of the given device-specific attribute .TP .B iio_device_attr_read_double Read the content of the given device-specific attribute .TP .B iio_device_attr_write Set the value of the given device-specific attribute .TP .B iio_device_attr_write_raw Set the value of the given device-specific attribute .TP .B iio_device_attr_write_all Set the values of all device-specific attributes .TP .B iio_device_attr_write_bool Set the value of the given device-specific attribute .TP .B iio_device_attr_write_longlong Set the value of the given device-specific attribute .TP .B iio_device_attr_write_double Set the value of the given device-specific attribute .TP .B iio_device_buffer_attr_read Read the content of the given buffer-specific attribute .TP .B iio_device_buffer_attr_read_all Read the content of all buffer-specific attributes .TP .B iio_device_buffer_attr_read_bool Read the content of the given buffer-specific attribute .TP .B iio_device_buffer_attr_read_longlong Read the content of the given buffer-specific attribute .TP .B iio_device_buffer_attr_read_double Read the content of the given buffer-specific attribute .TP .B iio_device_buffer_attr_write Set the value of the given buffer-specific attribute .TP .B iio_device_buffer_attr_write_raw Set the value of the given buffer-specific attribute .TP .B iio_device_buffer_attr_write_all Set the values of all buffer-specific attributes .TP .B iio_device_buffer_attr_write_bool Set the value of the given buffer-specific attribute .TP .B iio_device_buffer_attr_write_longlong Set the value of the given buffer-specific attribute .TP .B iio_device_buffer_attr_write_double Set the value of the given buffer-specific attribute .TP .B iio_device_set_data Associate a pointer to an iio_device structure .TP .B iio_device_get_data Retrieve a previously associated pointer of an iio_device structure .TP .B iio_device_get_trigger Retrieve the trigger of a given device .TP .B iio_device_set_trigger Associate a trigger to a given device .TP .B iio_device_is_trigger Return True if the given device is a trigger .TP .B iio_device_set_kernel_buffers_count Configure the number of kernel buffers for a device .LP .sp Channel Channel .in +.5i .TP 38 .TP \fIFunction\fP \fIDescription\fP .TP .B iio_channel_get_device Retrieve a pointer to the iio_device structure .TP .B iio_channel_get_id Retrieve the channel ID .TP .B iio_channel_get_name Retrieve the channel name .TP .B iio_channel_is_output Return True if the given channel is an output channel .TP .B iio_channel_is_scan_element Return True if the given channel is a scan element .TP .B iio_channel_get_attrs_count Enumerate the channel-specific attributes of the given channel .TP .B iio_channel_get_attr Get the channel-specific attribute present at the given index .TP .B iio_channel_find_attr Try to find a channel-specific attribute by its name .TP .B iio_channel_attr_get_filename Retrieve the filename of an attribute .TP .B iio_channel_attr_read Read the content of the given channel-specific attribute .TP .B iio_channel_attr_read_all Read the content of all channel-specific attributes .TP .B iio_channel_attr_read_bool Read the content of the given channel-specific attribute .TP .B iio_channel_attr_read_longlong Read the content of the given channel-specific attribute .TP .B iio_channel_attr_read_double Read the content of the given channel-specific attribute .TP .B iio_channel_attr_write Set the value of the given channel-specific attribute .TP .B iio_channel_attr_write_raw Set the value of the given channel-specific attribute .TP .B iio_channel_attr_write_all Set the values of all channel-specific attributes .TP .B iio_channel_attr_write_bool Set the value of the given channel-specific attribute .TP .B iio_channel_attr_write_longlong Set the value of the given channel-specific attribute .TP .B iio_channel_attr_write_double Set the value of the given channel-specific attribute .TP .B iio_channel_enable Enable the given channel .TP .B iio_channel_disable Disable the given channel .TP .B iio_channel_is_enabled Returns True if the channel is enabled .TP .B iio_channel_read_raw Demultiplex the samples of a given channel .TP .B iio_channel_read Demultiplex and convert the samples of a given channel .TP .B iio_channel_write_raw Multiplex the samples of a given channel .TP .B iio_channel_write Convert and multiplex the samples of a given channel .TP .B iio_channel_set_data Associate a pointer to an iio_channel structure .TP .B iio_channel_get_data Get a pointer to a channel's data format structure .TP .B iio_channel_get_type Get the type of the given hwmon channel .TP .B iio_channel_get_modifier Get the modifier type of the given channel .LP .sp Buffer Buffer .in +.5i .TP 38 .TP \fIFunction\fP \fIDescription\fP .TP .B iio_buffer_get_device Retrieve a pointer to the iio_device structure .TP .B iio_device_create_buffer Create an input or output buffer associated to the given device .TP .B iio_buffer_destroy Destroy the given buffer .TP .B iio_buffer_get_poll_fd Get a pollable file descriptor .TP .B iio_buffer_set_blocking_mode Make iio_buffer_refill() and iio_buffer_push() blocking or not .TP .B iio_buffer_refill Cancel all buffer operations .TP .B iio_buffer_push Cancel all buffer operations .TP .B iio_buffer_push_partial Send a given number of samples to the hardware .TP .B iio_buffer_cancel Cancel all buffer operations .TP .B iio_buffer_start Get the start address of the buffer .TP .B iio_buffer_first Find the first sample of a channel in a buffer .TP .B iio_buffer_step Get the step size between two samples of one channel .TP .B iio_buffer_end Get the address that follows the last sample in a buffer .TP .B iio_buffer_foreach_sample Call the supplied callback for each sample found in a buffer .TP .B iio_buffer_set_data Associate a pointer to an iio_buffer structure .TP .B iio_buffer_get_data Retrieve a previously associated pointer of an iio_buffer structure .TP .B iio_device_get_sample_size Get the current sample size .TP .B iio_channel_get_index Get the index of the given channel .TP .B iio_channel_get_data_format Get a pointer to a channel's data format structure .TP .B iio_channel_convert Convert the sample from host format to hardware format .TP .B iio_channel_convert_inverse Convert the sample from host format to hardware format .TP .B iio_device_get_debug_attrs_count Enumerate the debug attributes of the given device .TP .B iio_device_get_debug_attr Get the debug attribute present at the given index .TP .B iio_device_find_debug_attr Try to find a debug attribute by its name .TP .B iio_device_debug_attr_read Read the content of the given debug attribute .TP .B iio_device_debug_attr_read_all Read the content of all debug attributes .TP .B iio_device_debug_attr_write Set the value of the given debug attribute .TP .B iio_device_debug_attr_write_raw Set the value of the given debug attribute .TP .B iio_device_debug_attr_write_all Set the values of all debug attributes .TP .B iio_device_debug_attr_read_bool Read the content of the given debug attribute .TP .B iio_device_debug_attr_read_longlong Read the content of the given debug attribute .TP .B iio_device_debug_attr_read_double Read the content of the given debug attribute .TP .B iio_device_debug_attr_write_bool Set the value of the given debug attribute .TP .B iio_device_debug_attr_write_longlong Set the value of the given debug attribute .TP .B iio_device_debug_attr_write_double Set the value of the given debug attribute .TP .B iio_device_identify_filename Identify the channel or debug attribute corresponding to a filename .TP .B iio_device_reg_write Set the value of a hardware register .TP .B iio_device_reg_read Get the value of a hardware register .LP .sp Hwmon Compatibility with hardware monitoring (hwmon) devices