Python RPI interface to low-level ICs
Project description
PyRPIIC
A [Py]thon 3 addon for [R]aspberry [Pi] that enables [i]nterfacing w/ a variety of low-level board [IC]s.
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 pyrpiic
Modules
Clocks
- LMK612
- SI570
EEPROMs
- Generic
- M24C02
I2C-GPIO Expanders
- TCA6416A
Sensors
- LDC1412
- LDC1414
- LDC1612
- LDC1614
Examples
Clocks (Programmable Oscillators)
from pyrpio.i2c import I2C
from pyrpiic.clock.lmk61e2 import LMK61E2
# Create and open I2C-3 bus
i2c3 = I2C('/dev/i2c-3')
i2c3.open()
# Create clock
clock = LMK61E2(i2c3, 0x5A)
# Perform various clock operations
clock.set_frequency(156_250_000)
freq, regs = clock.get_frequency()
clock.regs2freq(regs)
clock.set_registers(regs)
# Close I2C-3 bus
i2c3.close()
I2C-GPIO Expander Example
from pyrpio.i2c import I2C
from pyrpiic.ioexpander.tca6416a import TCA6416A
# Create and open I2C-3 bus
i2c3 = I2C('/dev/i2c-3')
i2c3.open()
# Create gpio expander
gpio_exp = TCA6416A(i2c3, 0x21)
# Set GPIO P00 as output pulled high
gpio_exp.set_gpio_direction('P00', 'OUT')
gpio_exp.set_gpio_output('P00', high=True)
# Set GPIO P01 as input w/ flipped polarity and read value
gpio_exp.set_gpio_direction('P01', 'IN')
gpio_exp.set_gpio_polarity('P01', flipped=True)
gpio_exp.get_gpio_input('P01')
# Close I2C-3 bus
i2c3.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PyRPIIC-1.4.0.tar.gz
(20.2 kB
view details)
Built Distribution
PyRPIIC-1.4.0-py3-none-any.whl
(26.2 kB
view details)
File details
Details for the file PyRPIIC-1.4.0.tar.gz
.
File metadata
- Download URL: PyRPIIC-1.4.0.tar.gz
- Upload date:
- Size: 20.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.8.11 Linux/5.4.92-flatcar
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4760abf159e4cc37e6a000d9cbc2a722df2c47d87dc66e19bd732d4a6dffe76 |
|
MD5 | f3a21a7308770301508d27ab25904cee |
|
BLAKE2b-256 | 4f07b824ddcb39e2d4f1015a9045c68259588e47abb91f3e4984db1f75adfb6c |
File details
Details for the file PyRPIIC-1.4.0-py3-none-any.whl
.
File metadata
- Download URL: PyRPIIC-1.4.0-py3-none-any.whl
- Upload date:
- Size: 26.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.8.11 Linux/5.4.92-flatcar
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 610e3626226dd44014e36761f40573a08c872fa96ae5dee88440ad738bbd06d2 |
|
MD5 | aa04d8ef2dcfeeb653fe4510344bafe9 |
|
BLAKE2b-256 | 949dd4513024331a373d1b3ab6b08dff25c776c44ba1c11c3624f1662df31784 |