# FreeBSD GPIO ioctl wrapper for Python
This is a simple wrapper around the FreeBSD ```ioctl``` calles for the
GPIO device. It allows very simple access to configuration and I/O facilities
of the GPIO pins.
## Installation
```
pip install pyfbsdgpio-tspspi
```
## Basic usage
For now this section only summarizes the most basic usage of the module (it
also supports setting pullup and pulldown resistors and selecting different
drive characteristics if the GPIO chipset supports it).
### Determining pin count of the GPIO module
One can determine the number of I/O pins available on the GPIO device:
```
from labdevices.gpio import GpioDirection, GpioDrive, GpioPull
from fbsdgpio import FbsdGPIO
gpio = FbsdGPIO()
print(f"We have {gpio.getIOCount()} I/O ports")
```
### Fetching the current configuration of an I/O port
```
from labdevices.gpio import GpioDirection, GpioDrive, GpioPull
from fbsdgpio import FbsdGPIO
gpio = FbsdGPIO()
print(f"Current configuration of pin 13: {gpio.getConfig(13)}")
```
### Setting pin as input or output
```
from labdevices.gpio import GpioDirection, GpioDrive, GpioPull
from fbsdgpio import FbsdGPIO
with FbsdGPIO() as gpio:
gpio.setConfig(13, direction=GpioDirection.Input)
```
```
with FbsdGPIO() as gpio:
gpio.setConfig(13, direction=GpioDirection.Output)
```
### Pulse output
```
# Pulse for 100 microseconds
with FbsdGPIO() as gpio:
gpio.pulse(13, 100)
```
Also specifying the pulsed (not current) state so the module
does not have to query it:
```
with FbsdGPIO() as gpio:
gpio.pulse(13, 100, False)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/tspspi/fbsdgpiowrapper",
"name": "pyfbsdgpio-tspspi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Thomas Spielauer",
"author_email": "pypipackages01@tspi.at",
"download_url": "https://files.pythonhosted.org/packages/35/ba/7f0fd61f5e0cdd070ed278daaa0ce0751baf4636e3b9aadaaa12d6e6e633/pyfbsdgpio-tspspi-0.0.1.tar.gz",
"platform": null,
"description": "# FreeBSD GPIO ioctl wrapper for Python\n\nThis is a simple wrapper around the FreeBSD ```ioctl``` calles for the\nGPIO device. It allows very simple access to configuration and I/O facilities\nof the GPIO pins.\n\n## Installation\n\n```\npip install pyfbsdgpio-tspspi\n```\n\n## Basic usage\n\nFor now this section only summarizes the most basic usage of the module (it\nalso supports setting pullup and pulldown resistors and selecting different\ndrive characteristics if the GPIO chipset supports it).\n\n### Determining pin count of the GPIO module\n\nOne can determine the number of I/O pins available on the GPIO device:\n\n```\nfrom labdevices.gpio import GpioDirection, GpioDrive, GpioPull\nfrom fbsdgpio import FbsdGPIO\n\ngpio = FbsdGPIO()\nprint(f\"We have {gpio.getIOCount()} I/O ports\")\n```\n\n### Fetching the current configuration of an I/O port\n\n```\nfrom labdevices.gpio import GpioDirection, GpioDrive, GpioPull\nfrom fbsdgpio import FbsdGPIO\n\ngpio = FbsdGPIO()\nprint(f\"Current configuration of pin 13: {gpio.getConfig(13)}\")\n```\n\n### Setting pin as input or output\n\n```\nfrom labdevices.gpio import GpioDirection, GpioDrive, GpioPull\nfrom fbsdgpio import FbsdGPIO\n\nwith FbsdGPIO() as gpio:\n gpio.setConfig(13, direction=GpioDirection.Input)\n```\n\n```\nwith FbsdGPIO() as gpio:\n gpio.setConfig(13, direction=GpioDirection.Output)\n```\n\n### Pulse output\n\n```\n# Pulse for 100 microseconds\n\nwith FbsdGPIO() as gpio:\n gpio.pulse(13, 100)\n```\n\nAlso specifying the pulsed (not current) state so the module\ndoes not have to query it:\n\n```\nwith FbsdGPIO() as gpio:\n gpio.pulse(13, 100, False)\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "FreeBSD gpio device ioctl wrapper",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://github.com/tspspi/fbsdgpiowrapper"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "df6a007ce921bb4ffbf32f467c1bac72e858a2521ddb0bc8d5ff8498ef1db235",
"md5": "c41a6842799b0088bf6e103a48d7f8fc",
"sha256": "9c1d8eb7c154cb46d1ef3a8ab932e19d1fbe8291dca172099627d2a3b30b7ca3"
},
"downloads": -1,
"filename": "pyfbsdgpio_tspspi-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c41a6842799b0088bf6e103a48d7f8fc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 2834,
"upload_time": "2023-11-05T02:47:52",
"upload_time_iso_8601": "2023-11-05T02:47:52.829032Z",
"url": "https://files.pythonhosted.org/packages/df/6a/007ce921bb4ffbf32f467c1bac72e858a2521ddb0bc8d5ff8498ef1db235/pyfbsdgpio_tspspi-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "35ba7f0fd61f5e0cdd070ed278daaa0ce0751baf4636e3b9aadaaa12d6e6e633",
"md5": "58d7aae1878bd86eff1618b24c54d8af",
"sha256": "cf0e7397cab68e9331169a902aa06ba63cf216bfe794b2ad933b946a0f3b7b82"
},
"downloads": -1,
"filename": "pyfbsdgpio-tspspi-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "58d7aae1878bd86eff1618b24c54d8af",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 2742,
"upload_time": "2023-11-05T02:47:54",
"upload_time_iso_8601": "2023-11-05T02:47:54.350479Z",
"url": "https://files.pythonhosted.org/packages/35/ba/7f0fd61f5e0cdd070ed278daaa0ce0751baf4636e3b9aadaaa12d6e6e633/pyfbsdgpio-tspspi-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-05 02:47:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tspspi",
"github_project": "fbsdgpiowrapper",
"github_not_found": true,
"lcname": "pyfbsdgpio-tspspi"
}