# FreeBSD I2C wrapper for Python
The ```pyfbsdi2c-tspspi``` project contains a very thin wrapper for the ```ioctl``` requests for the ```iic``` device on FreeBSD
to test various hardware devices from Python. It allows direct access to the I2C bus on devices like the RaspberryPi when running
under FreeBSD.
## Installation
```
pip install pyfbsdi2c-tspspi
```
## Usage
The bus can be instantiated using context management of it's constructor. One can select the bus via it's first constructor
argument:
```
from fbsdi2c import FbsdI2C
```
To instantiate via context management one can use:
```
with FbsdI2C() as i2c:
# Use i2c.
```
To instantiate using the constructor:
```
i2c = FbsdI2C()
# Use i2c.
```
To use multiple busses:
```
i2c0 = FbsdI2C("/dev/iic0")
i2c1 = FbsdI2C("/dev/iic1")
```
## Supported methods
This module exposes the ```pylabdevs``` ```I2CBus``` interface:
### Scanning for bus devices
To print a list with all device addresses that respond:
```
with FbsdI2C() as i2c:
print(i2c.scan())
```
### Reading and writing from a buffer
```
with FbsdI2C() as i2c:
i2c.write(0x33, bytearray(1,2,3))
data = i2c.read(0x33, 5)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/tspspi/fbsdi2cwrapper",
"name": "pyfbsdi2c-tspspi",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Thomas Spielauer",
"author_email": "pypipackages01@tspi.at",
"download_url": "https://files.pythonhosted.org/packages/67/8f/7bc414bacf55dceeb3f08483c29524e790b2211d96f16b58e5088c91b006/pyfbsdi2c-tspspi-1.0.0.tar.gz",
"platform": null,
"description": "# FreeBSD I2C wrapper for Python\n\nThe ```pyfbsdi2c-tspspi``` project contains a very thin wrapper for the ```ioctl``` requests for the ```iic``` device on FreeBSD\nto test various hardware devices from Python. It allows direct access to the I2C bus on devices like the RaspberryPi when running\nunder FreeBSD.\n\n## Installation\n\n```\npip install pyfbsdi2c-tspspi\n```\n\n## Usage\n\nThe bus can be instantiated using context management of it's constructor. One can select the bus via it's first constructor\nargument:\n\n```\nfrom fbsdi2c import FbsdI2C\n```\n\nTo instantiate via context management one can use:\n\n```\nwith FbsdI2C() as i2c:\n # Use i2c.\n```\n\nTo instantiate using the constructor:\n\n```\ni2c = FbsdI2C()\n# Use i2c.\n```\n\nTo use multiple busses:\n\n```\ni2c0 = FbsdI2C(\"/dev/iic0\")\ni2c1 = FbsdI2C(\"/dev/iic1\")\n```\n\n## Supported methods\n\nThis module exposes the ```pylabdevs``` ```I2CBus``` interface:\n\n### Scanning for bus devices\n\nTo print a list with all device addresses that respond:\n\n```\nwith FbsdI2C() as i2c:\n print(i2c.scan())\n```\n\n### Reading and writing from a buffer\n\n```\nwith FbsdI2C() as i2c:\n i2c.write(0x33, bytearray(1,2,3))\n data = i2c.read(0x33, 5)\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "iic (I2C) ioctl wrapper for FreeBSD",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/tspspi/fbsdi2cwrapper"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "58e6573fabc02c309cfcb69634970069a92fc455045bbecaa0535a195923f8a9",
"md5": "be0e623ca48d505381feba5dbb02fb2f",
"sha256": "185d763d54a1e9eb9e631e3d46f1606958dc7a85e69431bb4bb6d2f39c04c659"
},
"downloads": -1,
"filename": "pyfbsdi2c_tspspi-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "be0e623ca48d505381feba5dbb02fb2f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 2735,
"upload_time": "2024-03-28T23:43:36",
"upload_time_iso_8601": "2024-03-28T23:43:36.485749Z",
"url": "https://files.pythonhosted.org/packages/58/e6/573fabc02c309cfcb69634970069a92fc455045bbecaa0535a195923f8a9/pyfbsdi2c_tspspi-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "678f7bc414bacf55dceeb3f08483c29524e790b2211d96f16b58e5088c91b006",
"md5": "e8f5789637cb7e6cf00a48bdd9504032",
"sha256": "f5c1b311d648c551ac33a95f3c155875400fee014befca9c9c521f9dc39192b5"
},
"downloads": -1,
"filename": "pyfbsdi2c-tspspi-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "e8f5789637cb7e6cf00a48bdd9504032",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 2683,
"upload_time": "2024-03-28T23:43:38",
"upload_time_iso_8601": "2024-03-28T23:43:38.685256Z",
"url": "https://files.pythonhosted.org/packages/67/8f/7bc414bacf55dceeb3f08483c29524e790b2211d96f16b58e5088c91b006/pyfbsdi2c-tspspi-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-28 23:43:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tspspi",
"github_project": "fbsdi2cwrapper",
"github_not_found": true,
"lcname": "pyfbsdi2c-tspspi"
}