PyRPIO
A Python 3 addon which provides high-speed access to the Raspberry Pi GPIO interface, supporting regular GPIO as well as i²c, PWM, SPI, and MDIO.
This package is inspired by node-rpio which is a node.js addon.
Compatibility
- Raspberry Pi Models: A, B (revisions 1.0 and 2.0), A+, B+, 2, 3, 3+, 3 A+, 4, Compute Module 3, Zero.
- Python 3.7+
Install
Install the latest from PyPi:
pip install pyrpio
Supported Interfaces
- GPIO
- PWM
- I2C
- MDIO
- SPI
Examples
from pyrpio.i2c import I2C
from pyrpio.mdio import MDIO
from pyrpio.i2c_register_device import I2CRegisterDevice
### I2C Operations ###
i2c_bus = i2c.I2C('/dev/i2c-3')
i2c_bus.open()
i2c_bus.set_address(0x50)
i2c_bus.read_write(data=bytes([0x23]), length=1)
i2c_dev = I2CRegisterDevice(bus=i2c_bus, address=0x50, register_size=1, data_size=1)
# Read register
val = i2c_dev.read_register(register=0x23)
# Read sequential registers
vals = i2c_dev.read_register_sequential(register=0x23, length=4)
# Close up shop
i2c_bus.close()
### MDIO Operations ###
# Create bus using GPIO pins 23 and 24 (bit-bang)
mdio_bus = mdio.MDIO(clk_pin=23, data_pin=24, path='/dev/gpiochip0')
mdio_bus.open()
# Read register 0x10 from device 0x30 (CLAUSE-45)
mdio_bus.read_c45_register(0x30, 0x00, 0x10)
# Read register set from device 0x30 (CLAUSE-45)
mdio_bus.read_c45_registers(0x30, 0x00, [0,1,2,3,4])
# Close up shop
mdio_bus.close()
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Maintainers
Metadata
Release files for pyrpio 0.4.1
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 | |
|---|---|---|---|---|
| PyRPIO-0.4.1.tar.gz | 62.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| PyRPIO-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 132.5 kB
Release files / PyRPIO-0.4.1.tar.gz
| Download URL | PyRPIO-0.4.1.tar.gz |
|---|---|
| Size | 62.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
facc91832cf03f593fbfda6c096ed55bce0a8fa776fda8f8bfb83a12b086a3f9
|
|
BLAKE2b-256 checksum How to use checksums |
203424d78674b027a25a63d04d9e574fdebd47e59f27c6c0865dda611bdea760
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.12 Linux/5.4.92-flatcar
|
Release files / PyRPIO-0.4.1-py3-none-any.whl
| Download URL | PyRPIO-0.4.1-py3-none-any.whl |
|---|---|
| Size | 69.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8512cf22dcfb9445455504cbb6a7e488a3738af1abe57ca075c8084f48c0970
|
|
BLAKE2b-256 checksum How to use checksums |
37f9ec8dc3b772bb1b98993486267073eefc476a815dccf241e45e80a5c951a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.12 Linux/5.4.92-flatcar
|
Security for pyrpio 0.4.1
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.