# PyRPIIC
![./icon.png](./icon.png)
A [Py]thon 3 addon for [R]aspberry [Pi] that enables [i]nterfacing w/ a variety of low-level board [IC]s.
![PyPI](https://img.shields.io/pypi/v/pyrpiic)
## 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)
```python
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
```python
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()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Samtec-ASH/pyrpiic",
"name": "PyRPIIC",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Adam Page",
"author_email": "adam.page@samtec.com",
"download_url": "https://files.pythonhosted.org/packages/4f/07/b824ddcb39e2d4f1015a9045c68259588e47abb91f3e4984db1f75adfb6c/PyRPIIC-1.4.0.tar.gz",
"platform": "",
"description": "# PyRPIIC\n\n![./icon.png](./icon.png)\n\nA [Py]thon 3 addon for [R]aspberry [Pi] that enables [i]nterfacing w/ a variety of low-level board [IC]s.\n\n![PyPI](https://img.shields.io/pypi/v/pyrpiic)\n\n## Compatibility\n\n- Raspberry Pi Models: A, B (revisions 1.0 and 2.0), A+, B+, 2, 3, 3+, 3 A+, 4, Compute Module 3, Zero.\n- Python 3.7+\n\n## Install\n\nInstall the latest from PyPi:\n\n`pip install pyrpiic`\n\n## Modules\n\n### Clocks\n\n- LMK612\n- SI570\n\n### EEPROMs\n\n- Generic\n- M24C02\n\n### I2C-GPIO Expanders\n\n- TCA6416A\n\n### Sensors\n\n- LDC1412\n- LDC1414\n- LDC1612\n- LDC1614\n\n## Examples\n\n### Clocks (Programmable Oscillators)\n\n```python\n\nfrom pyrpio.i2c import I2C\nfrom pyrpiic.clock.lmk61e2 import LMK61E2\n\n# Create and open I2C-3 bus\ni2c3 = I2C('/dev/i2c-3')\ni2c3.open()\n\n# Create clock\nclock = LMK61E2(i2c3, 0x5A)\n\n# Perform various clock operations\nclock.set_frequency(156_250_000)\nfreq, regs = clock.get_frequency()\nclock.regs2freq(regs)\nclock.set_registers(regs)\n\n# Close I2C-3 bus\ni2c3.close()\n```\n\n### I2C-GPIO Expander Example\n\n```python\n\nfrom pyrpio.i2c import I2C\nfrom pyrpiic.ioexpander.tca6416a import TCA6416A\n\n# Create and open I2C-3 bus\ni2c3 = I2C('/dev/i2c-3')\ni2c3.open()\n\n# Create gpio expander\ngpio_exp = TCA6416A(i2c3, 0x21)\n\n# Set GPIO P00 as output pulled high\ngpio_exp.set_gpio_direction('P00', 'OUT')\ngpio_exp.set_gpio_output('P00', high=True)\n\n# Set GPIO P01 as input w/ flipped polarity and read value\ngpio_exp.set_gpio_direction('P01', 'IN')\ngpio_exp.set_gpio_polarity('P01', flipped=True)\ngpio_exp.get_gpio_input('P01')\n\n# Close I2C-3 bus\ni2c3.close()\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python RPI interface to low-level ICs",
"version": "1.4.0",
"project_urls": {
"Homepage": "https://github.com/Samtec-ASH/pyrpiic",
"Repository": "https://github.com/Samtec-ASH/pyrpiic"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "949dd4513024331a373d1b3ab6b08dff25c776c44ba1c11c3624f1662df31784",
"md5": "aa04d8ef2dcfeeb653fe4510344bafe9",
"sha256": "610e3626226dd44014e36761f40573a08c872fa96ae5dee88440ad738bbd06d2"
},
"downloads": -1,
"filename": "PyRPIIC-1.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "aa04d8ef2dcfeeb653fe4510344bafe9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 26213,
"upload_time": "2021-08-09T21:35:42",
"upload_time_iso_8601": "2021-08-09T21:35:42.005242Z",
"url": "https://files.pythonhosted.org/packages/94/9d/d4513024331a373d1b3ab6b08dff25c776c44ba1c11c3624f1662df31784/PyRPIIC-1.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4f07b824ddcb39e2d4f1015a9045c68259588e47abb91f3e4984db1f75adfb6c",
"md5": "f3a21a7308770301508d27ab25904cee",
"sha256": "e4760abf159e4cc37e6a000d9cbc2a722df2c47d87dc66e19bd732d4a6dffe76"
},
"downloads": -1,
"filename": "PyRPIIC-1.4.0.tar.gz",
"has_sig": false,
"md5_digest": "f3a21a7308770301508d27ab25904cee",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 20213,
"upload_time": "2021-08-09T21:35:43",
"upload_time_iso_8601": "2021-08-09T21:35:43.395730Z",
"url": "https://files.pythonhosted.org/packages/4f/07/b824ddcb39e2d4f1015a9045c68259588e47abb91f3e4984db1f75adfb6c/PyRPIIC-1.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-08-09 21:35:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Samtec-ASH",
"github_project": "pyrpiic",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyrpiic"
}