pylibftdi
=========
pylibftdi is a minimal Pythonic interface to FTDI devices using libftdi_.
.. _libftdi: http://www.intra2net.com/en/developer/libftdi/
:Features:
- No dependencies beyond standard library and a `libftdi` install.
- Supports parallel and serial devices
- Support for multiple devices
- File-like interface wherever appropriate
- Cross-platform
:Limitations:
- The API might change prior to reaching a 1.0 release.
Usage
-----
The primary interface is the ``Device`` class in the pylibftdi package; this
gives serial access on relevant FTDI devices (e.g. the UM232R), providing a
file-like interface (read, write). Baudrate is controlled with the ``baudrate``
property.
If a Device instance is created with ``mode='t'`` (text mode) then read() and
write() can use the given ``encoding`` (defaulting to latin-1). This allows
easier integration with passing unicode strings between devices.
Multiple devices are supported by passing the desired device serial number (as
a string) in the ``device_id`` parameter - this is the first parameter in both
Device() and BitBangDevice() constructors. Alternatively the device 'description'
can be given, and an attempt will be made to match this if matching by serial
number fails.
Examples
~~~~~~~~
::
>>> from pylibftdi import Device
>>>
>>> with Device(mode='t') as dev:
... dev.baudrate = 115200
... dev.write('Hello World')
The pylibftdi.BitBangDevice wrapper provides access to the parallel IO mode of
operation through the ``port`` and ``direction`` properties. These provide an
8 bit IO port including all the relevant bit operations to make things simple.
::
>>> from pylibftdi import BitBangDevice
>>>
>>> with BitBangDevice('FTE00P4L') as bb:
... bb.direction = 0x0F # four LSB are output(1), four MSB are input(0)
... bb.port |= 2 # set bit 1
... bb.port &= 0xFE # clear bit 0
There is support for a number of external devices and protocols, including
interfacing with HD44780 LCDs using the 4-bit interface.
History & Motivation
--------------------
This package is the result of various bits of work using FTDI's
devices, primarily for controlling external devices. Some of this
is documented on the codedstructure blog, codedstructure.blogspot.com
Several other open-source Python FTDI wrappers exist, and each may be
best for some projects. Some aim at closely wrapping the libftdi interface,
others use FTDI's own D2XX driver (ftd2xx_) or talk directly to USB via
libusb or similar (such as pyftdi_).
.. _ftd2xx: http://pypi.python.org/pypi/ftd2xx
.. _pyftdi: https://github.com/eblot/pyftdi
The aim for pylibftdi is to work with libftdi, but to provide
a high-level Pythonic interface. Various wrappers and utility
functions are also part of the distribution; following Python's
batteries included approach, there are various interesting devices
supported out-of-the-box - or at least there will be soon!
Plans
-----
* Add more examples: SPI devices, knight-rider effects, input devices, MIDI...
* Perhaps add support for D2XX driver, though the name then becomes a
slight liability ;)
License
-------
Copyright (c) 2010-2024 Ben Bass <benbass@codedstructure.net>
pylibftdi is released under the MIT licence; see the file "LICENSE.txt"
for information.
All trademarks referenced herein are property of their respective
holders.
libFTDI itself is developed by Intra2net AG. No association with
Intra2net is claimed or implied, but I have found their library
helpful and had fun with it...
Raw data
{
"_id": null,
"home_page": "https://github.com/codedstructure/pylibftdi",
"name": "pylibftdi",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7.0",
"maintainer_email": null,
"keywords": "ftdi, libftdi, usb",
"author": "Ben Bass",
"author_email": "benbass@codedstructure.net",
"download_url": "https://files.pythonhosted.org/packages/9d/f0/551ccbd8e989e898707e0e0859344fcf538c2310521847a1035ad3e9b164/pylibftdi-0.23.0.tar.gz",
"platform": null,
"description": "pylibftdi\n=========\n\npylibftdi is a minimal Pythonic interface to FTDI devices using libftdi_.\n\n.. _libftdi: http://www.intra2net.com/en/developer/libftdi/\n\n:Features:\n\n - No dependencies beyond standard library and a `libftdi` install.\n - Supports parallel and serial devices\n - Support for multiple devices\n - File-like interface wherever appropriate\n - Cross-platform\n\n:Limitations:\n\n - The API might change prior to reaching a 1.0 release.\n\nUsage\n-----\n\nThe primary interface is the ``Device`` class in the pylibftdi package; this\ngives serial access on relevant FTDI devices (e.g. the UM232R), providing a\nfile-like interface (read, write). Baudrate is controlled with the ``baudrate``\nproperty.\n\nIf a Device instance is created with ``mode='t'`` (text mode) then read() and\nwrite() can use the given ``encoding`` (defaulting to latin-1). This allows\neasier integration with passing unicode strings between devices.\n\nMultiple devices are supported by passing the desired device serial number (as\na string) in the ``device_id`` parameter - this is the first parameter in both\nDevice() and BitBangDevice() constructors. Alternatively the device 'description'\ncan be given, and an attempt will be made to match this if matching by serial\nnumber fails.\n\nExamples\n~~~~~~~~\n\n::\n\n >>> from pylibftdi import Device\n >>>\n >>> with Device(mode='t') as dev:\n ... dev.baudrate = 115200\n ... dev.write('Hello World')\n\nThe pylibftdi.BitBangDevice wrapper provides access to the parallel IO mode of\noperation through the ``port`` and ``direction`` properties. These provide an\n8 bit IO port including all the relevant bit operations to make things simple.\n\n::\n\n >>> from pylibftdi import BitBangDevice\n >>>\n >>> with BitBangDevice('FTE00P4L') as bb:\n ... bb.direction = 0x0F # four LSB are output(1), four MSB are input(0)\n ... bb.port |= 2 # set bit 1\n ... bb.port &= 0xFE # clear bit 0\n\nThere is support for a number of external devices and protocols, including\ninterfacing with HD44780 LCDs using the 4-bit interface.\n\nHistory & Motivation\n--------------------\nThis package is the result of various bits of work using FTDI's\ndevices, primarily for controlling external devices. Some of this\nis documented on the codedstructure blog, codedstructure.blogspot.com\n\nSeveral other open-source Python FTDI wrappers exist, and each may be\nbest for some projects. Some aim at closely wrapping the libftdi interface,\nothers use FTDI's own D2XX driver (ftd2xx_) or talk directly to USB via\nlibusb or similar (such as pyftdi_).\n\n.. _ftd2xx: http://pypi.python.org/pypi/ftd2xx\n.. _pyftdi: https://github.com/eblot/pyftdi\n\nThe aim for pylibftdi is to work with libftdi, but to provide\na high-level Pythonic interface. Various wrappers and utility\nfunctions are also part of the distribution; following Python's\nbatteries included approach, there are various interesting devices\nsupported out-of-the-box - or at least there will be soon!\n\nPlans\n-----\n * Add more examples: SPI devices, knight-rider effects, input devices, MIDI...\n * Perhaps add support for D2XX driver, though the name then becomes a\n slight liability ;)\n\nLicense\n-------\n\nCopyright (c) 2010-2024 Ben Bass <benbass@codedstructure.net>\n\npylibftdi is released under the MIT licence; see the file \"LICENSE.txt\"\nfor information.\n\nAll trademarks referenced herein are property of their respective\nholders.\nlibFTDI itself is developed by Intra2net AG. No association with\nIntra2net is claimed or implied, but I have found their library\nhelpful and had fun with it...\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Pythonic interface to FTDI devices using libftdi.",
"version": "0.23.0",
"project_urls": {
"Documentation": "https://pylibftdi.readthedocs.io/en/latest/",
"Homepage": "https://github.com/codedstructure/pylibftdi",
"Repository": "https://github.com/codedstructure/pylibftdi"
},
"split_keywords": [
"ftdi",
" libftdi",
" usb"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "637eb3f579dfefeb680b4671b3049a56d7e3f6eb025e27b1481f8de4ae677f95",
"md5": "70813b27c68398f597cb3d7ba3668a6b",
"sha256": "4fe05879ffd5ba64b6fb8a777231f33487d97a888a4f84fa9b1f207e976c0cf2"
},
"downloads": -1,
"filename": "pylibftdi-0.23.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "70813b27c68398f597cb3d7ba3668a6b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7.0",
"size": 33018,
"upload_time": "2024-11-13T21:43:32",
"upload_time_iso_8601": "2024-11-13T21:43:32.522474Z",
"url": "https://files.pythonhosted.org/packages/63/7e/b3f579dfefeb680b4671b3049a56d7e3f6eb025e27b1481f8de4ae677f95/pylibftdi-0.23.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9df0551ccbd8e989e898707e0e0859344fcf538c2310521847a1035ad3e9b164",
"md5": "c3f06a398c7e7e2bc9d6ff8476378d5e",
"sha256": "bf5b4c6ba73d79a6f6df849c345b00ba763d023201bed9ba51d876a4397b16d8"
},
"downloads": -1,
"filename": "pylibftdi-0.23.0.tar.gz",
"has_sig": false,
"md5_digest": "c3f06a398c7e7e2bc9d6ff8476378d5e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7.0",
"size": 27405,
"upload_time": "2024-11-13T21:43:33",
"upload_time_iso_8601": "2024-11-13T21:43:33.620042Z",
"url": "https://files.pythonhosted.org/packages/9d/f0/551ccbd8e989e898707e0e0859344fcf538c2310521847a1035ad3e9b164/pylibftdi-0.23.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-13 21:43:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "codedstructure",
"github_project": "pylibftdi",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pylibftdi"
}