pysub20
pysub20 is a LGPL licensed, simple pure Python binding for sub20 library: a software that allows PCs to work with a SUB-20 device. SUB-20 is a versatile and efficient bridge device providing simple interconnect between PC (USB host) and different HW devices and systems via popular interfaces such as I2C, SPI, MDIO, RS232, RS485, SMBus, ModBus, IR and others. You could find more information about the SUB-20 device on the official site: http://www.xdimax.com/sub20/sub20.html
The main goal of the project is that: to make the use of the SUB-20 library more convenient and pythonic. It’s possible to use SUB-20 dll/so directly but it’s a bit inconvenient, because every time you have to wrap the C library functions with Python c_type signatures.
Requirements
You MUST have a sub20 library installed in your system. To proceed with the installation take a look at the SUB-20 documentation: http://www.xdimax.com/sub20/sub20.html.
Usage
Low-level API: The low-level API is the raw Python functions converted from the SUB-20 C library functions. You can use them ‘as is’ with regard to the SUB-20 and Python c_types documentation.
>>> from sub20.ctypeslib.libsub import SIGNATURES, sub_version >>> from sub20.ctypeslib.utils import load_ctypes_library >>> libname = "sub20.dll" if sys.platform == "win32" else "libsub.so" >>> libsub = load_ctypes_library(libname, SIGNATURES) >>> sub_errno = c_int.in_dll(libsub, "sub_errno") ... your code with SUB-20 functions >>> libsub.sub_open(None) >>> libsub.close()
High-level API: A high level API tries to hide routine operations under the hood and make the SUB-20 library more pythonic and simple. The core of the high-level API is SUBDevice class. You don’t have to load libraries explicitly because it’s happening during the class instantiation.
>>> from sub20 import SUBDevice >>> subdev = sub20.SUBDevice() >>> subdev.open()
Then you can use the implemented functions in your code. To properly use them it’s strongly recommended to read the SUB-20 documentation first: http://www.xdimax.com/sub20/doc/sub20-man.pdf
NB: If you don’t have a sub20 library in your system and you try to create a SUBDevice instance then you’ll get an ImportError exception.
List of implemented functions:
sub_get_serial_number, sub_get_product_id, sub_get_version, sub_get_version_dict, sub_reset, sub_eep_read, sub_eep_write, sub_i2c_freq, sub_i2c_config, sub_i2c_start, sub_i2c_stop, sub_i2c_scan, sub_i2c_read, sub_i2c_write, sub_i2c_transfer, sub_gpio_config, sub_gpio_read, sub_gpio_write, sub_gpiob_config, sub_gpiob_read, sub_gpiob_write, sub_rs_set_config, sub_rs_get_config, sub_rs_timing, sub_rs_xfer, sub_fifo_config, sub_fifo_read, strerror
Examples
Under construction
Metadata
Release files for pysub20 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pysub20-0.0.2.tar.gz | 17.4 kB | Without provenance | Details for pysub20-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pysub20-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for pysub20-0.0.2-py3-none-any.whl |
Total release size: 35.8 kB
Release files / pysub20-0.0.2.tar.gz
| Download URL | pysub20-0.0.2.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5268c0f485b93b5dd1aea9cda0252497cbe66b273140d27280ae6997edba358c
|
|
BLAKE2b-256 checksum How to use checksums |
294a16a237d7ca52476577a8774e8b4f8dd0a09f6b02037f233efb571b1bf17c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Release files / pysub20-0.0.2-py3-none-any.whl
| Download URL | pysub20-0.0.2-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e346da4e4857693ed9c1eefd63b4d9473927631b99bc83b012146c87602faa7
|
|
BLAKE2b-256 checksum How to use checksums |
df5664bc3c30c7c9c103bf8f89085a58c0cfc22d2dcdd653a99e164888fdd2db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Security for pysub20 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.