{ "info": { "author": "Robert Ginda", "author_email": "rginda@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "# Silicon Labs cp2110 Python library\n\nThis library provides a Python interface to the [Silicon Labs CP2110](https://www.silabs.com/documents/public/data-sheets/CP2110.pdf) HID USB to UART bridge.\n\nAt this point in time this library presents only the parts of the [available API](https://www.silabs.com/documents/public/application-notes/AN434-CP2110-4-Interface-Specification.pdf) that are required for basic UART access.\n\n# cp2110 Installation\n\nInstall via pip: `python -m pip install cp2110`.\n\nThe cp2110 library depends on the [pyhidapi](https://github.com/apmorton/pyhidapi) Python module, which itself requires the `hidapi` shared library. On Linux distributions, this is generally in the repositories (for instance, under Debian you can install either libhidapi-hidraw0 or libhidapi-libusb0 depending on which backend you want to use).\n\n# Example usage\n\n```\n import cp2110\n import time\n\n # This will raise an exception if a device is not found. Called with no\n # parameters, this looks for the default (VID, PID) of the CP2110, which are\n # (0x10c4, 0xEA80).\n try:\n d = cp2110.CP2110Device()\n except:\n pass\n\n # In some cases the device maker will override the VID and/or PID at the\n # factory, so you'll need to pass parameters\n try:\n cp2110.CP2110Device(vid=0xDEAD, pid=0xBEEF)\n except:\n pass\n\n # You can also find a device by path.\n cp2110.CP2110Device(path='/dev/hidraw0')\n\n # If you want to avoid the exception or want to detect the presence of a\n # device without creating an object as a side-effect, use the\n # `cp2110.enumerate` function. This has the same default values as the\n # `CP2110Device` constructor.\n usb_info = cp2110.enumerate()\n if usb_info:\n print(usb_info.as_dict())\n\n usb_info = cp2110.enumerate(vid=0xDEAD, pid=0xBEEF)\n if usb_info:\n print(usb_info.as_dict())\n\n # Fetch the current uart configuration. This is the UART connection from the\n # CP2110 to the microcontroller (or whatever) it's wired up to.\n c = d.get_uart_config()\n\n # The UART settings are dictated by the device that embeds the CP2110. It\n # may be configured correctly by default, or you may need to set manually.\n d.set_uart_config(UARTConfig(\n baud=38400,\n parity=cp2110.PARITY.NONE,\n flow_control=cp2110.FLOW_CONTROL.DISABLED,\n data_bits=cp2110.DATA_BITS.EIGHT,\n stop_bits=STOP_BITS.SHORT))\n\n # If you ever need to disable the UART, you can.\n d.disable_uart()\n\n # And you can clear any pending data in the on-chip I/O buffers.\n d.purge_fifos() # The default is cp2110.FIFO.BOTH\n d.purge_fifos(cp2110.FIFO.TX)\n d.purge_fifos(cp2110.FIFO.RX)\n\n # Check if the UART is enabled.\n print(d.is_uart_enabled())\n\n # The UART in your device may need to be explicitly enabled, particularly if\n # you've already explicitly disabled it as in this example.\n d.enable_uart()\n\n # The write method accepts byte strings or arrays of ints.\n d.write(b'hello world')\n d.write([0x01, 0xff])\n\n # The default read size will return 63 bytes (at most), which is the maximum\n # supported by this chip. Reads do not block.\n rv = d.read()\n\n```\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rginda/pycp2110", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pycp2110", "package_url": "https://pypi.org/project/pycp2110/", "platform": "", "project_url": "https://pypi.org/project/pycp2110/", "project_urls": { "Homepage": "https://github.com/rginda/pycp2110" }, "release_url": "https://pypi.org/project/pycp2110/1.0.0/", "requires_dist": [ "hid (>=1.0.1)" ], "requires_python": "", "summary": "Silabs CP2110 USB HID to UART bridge library", "version": "1.0.0" }, "last_serial": 5241446, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "240feb5ff58ec415be14e70a5ee5bb58", "sha256": "2e56e74f6dc02f36d541db88fd53d0ab120eaf374b66729c786b2807dbf44d19" }, "downloads": -1, "filename": "pycp2110-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "240feb5ff58ec415be14e70a5ee5bb58", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6503, "upload_time": "2019-05-08T05:15:14", "url": "https://files.pythonhosted.org/packages/a5/34/008e5d8211296e7ae14c216ad1d5bd3e401b5d5930b8e65a3cb9188a7702/pycp2110-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2b92e0924f29ecffee7ece576798fb31", "sha256": "2fd3dc03070561b12e42ec63bbcdc01bb7d9a474d940345e7a4c8f26ae3c0f8b" }, "downloads": -1, "filename": "pycp2110-1.0.0.tar.gz", "has_sig": false, "md5_digest": "2b92e0924f29ecffee7ece576798fb31", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4484, "upload_time": "2019-05-08T05:15:16", "url": "https://files.pythonhosted.org/packages/a6/8f/4c1ca1871e72357c1194e61db4471f2fb6639567dd95d6890ea9cc627ca5/pycp2110-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "240feb5ff58ec415be14e70a5ee5bb58", "sha256": "2e56e74f6dc02f36d541db88fd53d0ab120eaf374b66729c786b2807dbf44d19" }, "downloads": -1, "filename": "pycp2110-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "240feb5ff58ec415be14e70a5ee5bb58", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6503, "upload_time": "2019-05-08T05:15:14", "url": "https://files.pythonhosted.org/packages/a5/34/008e5d8211296e7ae14c216ad1d5bd3e401b5d5930b8e65a3cb9188a7702/pycp2110-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2b92e0924f29ecffee7ece576798fb31", "sha256": "2fd3dc03070561b12e42ec63bbcdc01bb7d9a474d940345e7a4c8f26ae3c0f8b" }, "downloads": -1, "filename": "pycp2110-1.0.0.tar.gz", "has_sig": false, "md5_digest": "2b92e0924f29ecffee7ece576798fb31", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4484, "upload_time": "2019-05-08T05:15:16", "url": "https://files.pythonhosted.org/packages/a6/8f/4c1ca1871e72357c1194e61db4471f2fb6639567dd95d6890ea9cc627ca5/pycp2110-1.0.0.tar.gz" } ] }