This is an old revision of the document!
To simplify the use of different devices a python package was created interface with the different IIO drivers. The module pyadi-iio, provides device-specific APIs built on top of the current libIIO python bindings. These interfaces try to match the driver naming as much as possible without the need to understand the complexities of libIIO and IIO. In general, if you are familiar with python this is a great starting point for using different ADI parts and can even run on some ADI development systems as well.
First, make sure you have libIIO installed with the associated python bindings, and that they are on your python path. Next you can install the module. This can be done from the source code itself:
tcollins@jeeves:~$ git clone https://github.com/analogdevicesinc/pyadi-iio.git tcollins@jeeves:~$ cd pyadi-iio tcollins@jeeves:~$ (sudo) python setup.py install
Or through pip:
tcollins@jeeves:~$ (sudo) pip install pyadi-iio
pyadi-iio requires libiio, the libiio python bindings, and numpy. To check if you have the necessary libiio bindings installed run the following:
dave@hal:~$ python3 Python 3.6.8 (default, Jan 14 2019, 11:02:34) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import iio >>> iio.version (0, 18, 'eec5616')
If you have installed the libiio bindings already and you get an import error, it may not be on path. One way to do this is to add the default install path within python itself
import sys try: import iio except: # By default the iio python bindings are not in path sys.path.append('/usr/lib/python2.7/site-packages/') import iio
Linux needs to built from source to get the necessary bindings. Note that since v0.19 libiio requires cmake flags to enable the python bindings during installation.
Post this commit, Windows installers will include the necessary bindings. Otherwise, downloading the latest Appveyor artifacts include the python installers.
Like Linux, libiio on macOS can be built from source to get the necessary bindings. Note that since v0.19 libiio requires cmake flags to enable the python bindings during installation. The bindings are included with the recent pkg's.
Devices specific examples are available in the source repo, and the sphinx doc, but here is the basic idea
# Import library import adi # Create radio object sdr = adi.Pluto() # Configure properties sdr.rx_rf_bandwidth = 4000000 # Get data data = sdr.rx()
All documentation is available on GitHub.
See repo readme for supported hardware.
Please direct support question or enhancement requests to the Linux Forums on EngineerZone