Package: libusbsio
Python wrapper for NXP libusbsio binary libraryTheNXP libusbsiois a binary library for Win/Linux/MacOS systems used to exercise SPI, I2C bus and GPIO pins over USBSIO interface of NXPLPCLink2andMCUlink Prodevices.This Python component provides a wrapper object which encapsulates the binary library
and exposes its API to Python applications.Author:michal.hanak@nxp.com(https://www.nxp.com)DependenciesThere are no dependencies to any external modules needed to use the LIBUSBSIO
module.The binary libraries use theHID_APIlibrary code and partially also its
newlibusb/hidapiversion to access
the USB HID interface on all supported OS platforms.Installationpypi.orgUse pip to download and install the packagepython -m pip install libusbsioLocalUse the followingpipcommand to install the libusbsio module from
the local NXP LIBUSBSIO installation package available atwww.nxp.com:python -m pip install dist/libusbsio-2.1.11-py3-none-any.whlRunning example codeRunning the example code is easy. You do not even need to install the package,
the example code will locate the module in the local directory (in ../libusbsio).Go toexamplesdirectory and see the demo scripts there.
Examine the script and the way how it creates theLIBUSBSIOobject.Without any constructor parameters, the USBSIO library is automatically
located. There are also options to load the library from a given path.from libusbsio import *
sio = LIBUSBSIO()Use theloglevelparameter to specify logging verbosity:import logging
from libusbsio import *

logging.basicConfig()
sio = LIBUSBSIO(loglevel=logging.INFO)Running test codeThe test code is located in thetestdirectory and it is ready to be used with theunittestorpytest.Note that most of the tests assume that the target MCU application
runs thesiotest1application test code which answers on SPI and I2C buses using a simple
command/response protocol.The source code of thesiotestapplication for
different target boards is available as an optional part of the NXP MCUXpresso SDK package.Run one of the following commands in the base 'python' directory. Note that some long
duration tests and known-issues tests are skipped by default.
See more intest/test_base.pymain test file.python -m unittest
.............s.......s...s...sssss.........s.
----------------------------------------------------------------------
Ran 45 tests in 11.034s

OK (skipped=9)or:pyttest

===================================== test session starts ======================================
platform win32 -- Python 3.8.7, pytest-6.2.3, py-1.10.0, pluggy-0.13.1
rootdir: d:\gitwork\libusbsio\python
collected 45 items

test\test_00_lib.py ..........                                                            [ 22%]
test\test_10_spi.py ...s....                                                              [ 40%]
test\test_20_i2c.py ...s...s...s...ssss                                                   [ 82%]
test\test_30_gpio.py ......s.                                                             [100%]

================================ 36 passed, 9 skipped in 11.38s ================================Historyv2.1.11 - February 2022Source code of the library made available under BSD-3-Clause license.macOS now use the libusb/hidapi version to use a new format of HID device path.v2.1.10 - February 2022Add GetDeviceInfo method to retrieve hid_api low-level information of the SIO portv2.1.8 - November 2021Add binaries for linux_armv7l and linux_aarch64v2.1.5 - August 2021Add binaries and support for arm64 macOSv2.1.4 - July 2021Extend by low-level HID_API access, fix read buffer length when reading data.Refactor "PIDVID" variables, arguments and tuples to a correctly ordered "VIDPID"Fix example code.v2.1.0 - April 2021The initial Python libusbsio library wrapper release supporting USBSIO library v2.1Copyright NXP 2021-2022