{ "info": { "author": "Adafruit Industries", "author_email": "circuitpython@adafruit.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries", "Topic :: System :: Hardware" ], "description": "Introduction\n============\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-bluefruitspi/badge/?version=latest\n :target: https://circuitpython.readthedocs.io/projects/bluefruitspi/en/latest/\n :alt: Documentation Status\n\n.. image:: https://img.shields.io/discord/327254708534116352.svg\n :target: https://discord.gg/nBQh6qu\n :alt: Discord\n\n.. image:: https://travis-ci.com/adafruit/Adafruit_CircuitPython_BluefruitSPI.svg?branch=master\n :target: https://travis-ci.com/adafruit/Adafruit_CircuitPython_BluefruitSPI\n :alt: Build Status\n\nHelper class to work with the Adafruit Bluefruit LE SPI Friend.\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython `_\n* `Bus Device `_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle `_.\n\nInstalling from PyPI\n--------------------\n\nOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from\nPyPI `_. To install for current user:\n\n.. code-block:: shell\n\n pip3 install adafruit-circuitpython-bluefruitspi\n\nTo install system-wide (this may be required in some cases):\n\n.. code-block:: shell\n\n sudo pip3 install adafruit-circuitpython-bluefruitspi\n\nTo install in a virtual environment in your current project:\n\n.. code-block:: shell\n\n mkdir project-name && cd project-name\n python3 -m venv .env\n source .env/bin/activate\n pip3 install adafruit-circuitpython-bluefruitspi\n\nUsage Example\n=============\n\n.. code-block:: python\n\n # A simple echo test for the Feather M0 Bluefruit\n # Sets the name, then echo's all RX'd data with a reversed packet\n\n import time\n import busio\n import board\n from digitalio import DigitalInOut\n from adafruit_bluefruitspi import BluefruitSPI\n\n spi_bus = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)\n cs = DigitalInOut(board.D8)\n irq = DigitalInOut(board.D7)\n rst = DigitalInOut(board.D4)\n bluefruit = BluefruitSPI(spi_bus, cs, irq, rst, debug=False)\n\n # Initialize the device and perform a factory reset\n print(\"Initializing the Bluefruit LE SPI Friend module\")\n bluefruit.init()\n bluefruit.command_check_OK(b'AT+FACTORYRESET', delay=1)\n\n # Print the response to 'ATI' (info request) as a string\n print(str(bluefruit.command_check_OK(b'ATI'), 'utf-8'))\n\n # Change advertised name\n bluefruit.command_check_OK(b'AT+GAPDEVNAME=BlinkaBLE')\n\n while True:\n print(\"Waiting for a connection to Bluefruit LE Connect ...\")\n # Wait for a connection ...\n dotcount = 0\n while not bluefruit.connected:\n print(\".\", end=\"\")\n dotcount = (dotcount + 1) % 80\n if dotcount == 79:\n print(\"\")\n time.sleep(0.5)\n\n # Once connected, check for incoming BLE UART data\n print(\"\\n *Connected!*\")\n connection_timestamp = time.monotonic()\n while True:\n # Check our connection status every 3 seconds\n if time.monotonic() - connection_timestamp > 3:\n connection_timestamp = time.monotonic()\n if not bluefruit.connected:\n break\n\n # OK we're still connected, see if we have any data waiting\n resp = bluefruit.uart_rx()\n if not resp:\n continue # nothin'\n print(\"Read %d bytes: %s\" % (len(resp), resp))\n # Now write it!\n print(\"Writing reverse...\")\n send = []\n for i in range(len(resp), 0, -1):\n send.append(resp[i-1])\n print(bytes(send))\n bluefruit.uart_tx(bytes(send))\n\n print(\"Connection lost.\")\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n`_\nbefore contributing to help this project stay welcoming.\n\nBuilding locally\n================\n\nZip release files\n-----------------\n\nTo build this library locally you'll need to install the\n`circuitpython-build-tools `_ package.\n\n.. code-block:: shell\n\n python3 -m venv .env\n source .env/bin/activate\n pip install circuitpython-build-tools\n\nOnce installed, make sure you are in the virtual environment:\n\n.. code-block:: shell\n\n source .env/bin/activate\n\nThen run the build:\n\n.. code-block:: shell\n\n circuitpython-build-bundles --filename_prefix adafruit-circuitpython-bluefruitspi --library_location .\n\nSphinx documentation\n-----------------------\n\nSphinx is used to build the documentation based on rST files and comments in the code. First,\ninstall dependencies (feel free to reuse the virtual environment from above):\n\n.. code-block:: shell\n\n python3 -m venv .env\n source .env/bin/activate\n pip install Sphinx sphinx-rtd-theme\n\nNow, once you have the virtual environment activated:\n\n.. code-block:: shell\n\n cd docs\n sphinx-build -E -W -b html . _build/html\n\nThis will output the documentation to ``docs/_build/html``. Open the index.html in your browser to\nview them. It will also (due to -W) error out on any warning like Travis will. This is a good way to\nlocally verify it will pass.", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/adafruit/Adafruit_CircuitPython_BluefruitSPI", "keywords": "adafruit ble bluetooth bluefruit spi friend hardware micropython circuitpython", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "adafruit-circuitpython-bluefruitspi", "package_url": "https://pypi.org/project/adafruit-circuitpython-bluefruitspi/", "platform": "", "project_url": "https://pypi.org/project/adafruit-circuitpython-bluefruitspi/", "project_urls": { "Homepage": "https://github.com/adafruit/Adafruit_CircuitPython_BluefruitSPI" }, "release_url": "https://pypi.org/project/adafruit-circuitpython-bluefruitspi/1.0.2/", "requires_dist": null, "requires_python": "", "summary": "CircuitPython helper class to work with the Adafruit Bluefruit LE SPI Friend.", "version": "1.0.2" }, "last_serial": 4701199, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "c5a3daec216d37f79a2bd88d35983493", "sha256": "0a51d2cada82a92725f6b0b57371978e0304db67afc5dcb280aef0723ac56a4d" }, "downloads": -1, "filename": "adafruit-circuitpython-bluefruitspi-1.0.0.tar.gz", "has_sig": false, "md5_digest": "c5a3daec216d37f79a2bd88d35983493", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24996, "upload_time": "2018-11-06T19:22:34", "url": "https://files.pythonhosted.org/packages/d5/d5/be147ce3319ab9c59de9d53a96618b6621e1534246601b520f0946871e03/adafruit-circuitpython-bluefruitspi-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "b94e0ac618bebae06cd28ab97e80422d", "sha256": "f13693944b06e5cfe102c22e77be4f4238d35f0a16f0ec20192b27efe59a695b" }, "downloads": -1, "filename": "adafruit-circuitpython-bluefruitspi-1.0.1.tar.gz", "has_sig": false, "md5_digest": "b94e0ac618bebae06cd28ab97e80422d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24996, "upload_time": "2018-12-03T22:07:00", "url": "https://files.pythonhosted.org/packages/ae/7c/625aad9f570518fe9ac9b6cf359c24a161d3d2333c61074b03ea62349c79/adafruit-circuitpython-bluefruitspi-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "2a62f651e2c8be4c18f0ade2ae14b3ab", "sha256": "fa5201ae45341d407a27c4927397487aa573f838c62c9a22982c756c3d43d137" }, "downloads": -1, "filename": "adafruit-circuitpython-bluefruitspi-1.0.2.tar.gz", "has_sig": false, "md5_digest": "2a62f651e2c8be4c18f0ade2ae14b3ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24689, "upload_time": "2019-01-16T02:12:32", "url": "https://files.pythonhosted.org/packages/ac/71/08f4b68442db59377afa77db3ace5777909b3a032ceab31d4cc39d3c9932/adafruit-circuitpython-bluefruitspi-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2a62f651e2c8be4c18f0ade2ae14b3ab", "sha256": "fa5201ae45341d407a27c4927397487aa573f838c62c9a22982c756c3d43d137" }, "downloads": -1, "filename": "adafruit-circuitpython-bluefruitspi-1.0.2.tar.gz", "has_sig": false, "md5_digest": "2a62f651e2c8be4c18f0ade2ae14b3ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24689, "upload_time": "2019-01-16T02:12:32", "url": "https://files.pythonhosted.org/packages/ac/71/08f4b68442db59377afa77db3ace5777909b3a032ceab31d4cc39d3c9932/adafruit-circuitpython-bluefruitspi-1.0.2.tar.gz" } ] }