Introduction
============
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-bitbangio/badge/?version=latest
:target: https://docs.circuitpython.org/projects/bitbangio/en/latest/
:alt: Documentation Status
.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
:target: https://adafru.it/discord
:alt: Discord
.. image:: https://github.com/adafruit/Adafruit_CircuitPython_BitbangIO/workflows/Build%20CI/badge.svg
:target: https://github.com/adafruit/Adafruit_CircuitPython_BitbangIO/actions
:alt: Build Status
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code Style: Black
A library for adding bitbang I2C and SPI to CircuitPython without the built-in bitbangio module.
The interface is intended to be the same as bitbangio and therefore there is no bit order or chip
select functionality. If your board supports bitbangio, it is recommended to use that instead
as the timing should be more reliable.
Dependencies
=============
This driver depends on:
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_.
Installing from PyPI
=====================
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/adafruit-circuitpython-bitbangio/>`_. To install for current user:
.. code-block:: shell
pip3 install adafruit-circuitpython-bitbangio
To install system-wide (this may be required in some cases):
.. code-block:: shell
sudo pip3 install adafruit-circuitpython-bitbangio
To install in a virtual environment in your current project:
.. code-block:: shell
mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-bitbangio
Usage Example
=============
.. code-block:: python
"""
This example is for demonstrating how to retrieving the
board ID from a BME280, which is stored in register 0xD0.
It should return a result of [96]
"""
import board
import digitalio
import adafruit_bitbangio as bitbangio
# Change these to the actual connections
SCLK_PIN = board.D6
MOSI_PIN = board.D17
MISO_PIN = board.D18
CS_PIN = board.D5
cs = digitalio.DigitalInOut(CS_PIN)
cs.switch_to_output(value=True)
spi = bitbangio.SPI(SCLK_PIN, MOSI=MOSI_PIN, MISO=MISO_PIN)
cs.value = 0
while not spi.try_lock():
pass
spi.write([0xD0])
data = [0x00]
spi.readinto(data)
spi.unlock()
cs.value = 1
print("Result is {}".format(data))
Documentation
=============
API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/bitbangio/en/latest/>`_.
For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.
Contributing
============
Contributions are welcome! Please read our `Code of Conduct
<https://github.com/adafruit/Adafruit_CircuitPython_BitbangIO/blob/main/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.
Raw data
{
"_id": null,
"home_page": "",
"name": "adafruit-circuitpython-bitbangio",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "adafruit,blinka,circuitpython,micropython,bitbangio,bitbang,spi,i2c,software",
"author": "",
"author_email": "Adafruit Industries <circuitpython@adafruit.com>",
"download_url": "https://files.pythonhosted.org/packages/19/43/3aec909ec98e7cbb97845338253458b323ee09744beb4024fdfab756062e/adafruit-circuitpython-bitbangio-1.3.14.tar.gz",
"platform": null,
"description": "Introduction\n============\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-bitbangio/badge/?version=latest\n :target: https://docs.circuitpython.org/projects/bitbangio/en/latest/\n :alt: Documentation Status\n\n.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg\n :target: https://adafru.it/discord\n :alt: Discord\n\n.. image:: https://github.com/adafruit/Adafruit_CircuitPython_BitbangIO/workflows/Build%20CI/badge.svg\n :target: https://github.com/adafruit/Adafruit_CircuitPython_BitbangIO/actions\n :alt: Build Status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/psf/black\n :alt: Code Style: Black\n\nA library for adding bitbang I2C and SPI to CircuitPython without the built-in bitbangio module.\nThe interface is intended to be the same as bitbangio and therefore there is no bit order or chip\nselect functionality. If your board supports bitbangio, it is recommended to use that instead\nas the timing should be more reliable.\n\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_.\n\nInstalling from PyPI\n=====================\nOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from\nPyPI <https://pypi.org/project/adafruit-circuitpython-bitbangio/>`_. To install for current user:\n\n.. code-block:: shell\n\n pip3 install adafruit-circuitpython-bitbangio\n\nTo install system-wide (this may be required in some cases):\n\n.. code-block:: shell\n\n sudo pip3 install adafruit-circuitpython-bitbangio\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 .venv\n source .venv/bin/activate\n pip3 install adafruit-circuitpython-bitbangio\n\nUsage Example\n=============\n\n.. code-block:: python\n\n \"\"\"\n This example is for demonstrating how to retrieving the\n board ID from a BME280, which is stored in register 0xD0.\n It should return a result of [96]\n \"\"\"\n\n import board\n import digitalio\n import adafruit_bitbangio as bitbangio\n\n # Change these to the actual connections\n SCLK_PIN = board.D6\n MOSI_PIN = board.D17\n MISO_PIN = board.D18\n CS_PIN = board.D5\n\n cs = digitalio.DigitalInOut(CS_PIN)\n cs.switch_to_output(value=True)\n\n spi = bitbangio.SPI(SCLK_PIN, MOSI=MOSI_PIN, MISO=MISO_PIN)\n cs.value = 0\n while not spi.try_lock():\n pass\n spi.write([0xD0])\n data = [0x00]\n spi.readinto(data)\n spi.unlock()\n cs.value = 1\n print(\"Result is {}\".format(data))\n\nDocumentation\n=============\n\nAPI documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/bitbangio/en/latest/>`_.\n\nFor information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n<https://github.com/adafruit/Adafruit_CircuitPython_BitbangIO/blob/main/CODE_OF_CONDUCT.md>`_\nbefore contributing to help this project stay welcoming.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A library for adding bitbang I2C and SPI to CircuitPython without the built-in bitbangio module",
"version": "1.3.14",
"project_urls": {
"Homepage": "https://github.com/adafruit/Adafruit_CircuitPython_BitbangIO"
},
"split_keywords": [
"adafruit",
"blinka",
"circuitpython",
"micropython",
"bitbangio",
"bitbang",
"spi",
"i2c",
"software"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b76757fc10cb09a387f09146ad531583758d3ae956b1e962406166d901577b3c",
"md5": "af120bc55b31d5dd712f7cde22cb7033",
"sha256": "9320a1922b881943b32ea9a32e895901716054af0773dbd2c3b4b0abcac8e66a"
},
"downloads": -1,
"filename": "adafruit_circuitpython_bitbangio-1.3.14-py3-none-any.whl",
"has_sig": false,
"md5_digest": "af120bc55b31d5dd712f7cde22cb7033",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7800,
"upload_time": "2024-02-12T02:21:48",
"upload_time_iso_8601": "2024-02-12T02:21:48.270233Z",
"url": "https://files.pythonhosted.org/packages/b7/67/57fc10cb09a387f09146ad531583758d3ae956b1e962406166d901577b3c/adafruit_circuitpython_bitbangio-1.3.14-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "19433aec909ec98e7cbb97845338253458b323ee09744beb4024fdfab756062e",
"md5": "7f7a1ceea95f5400df973b7b84573f8a",
"sha256": "ef49ccec974e5482a3bf7550f72a90da02d8978f8d9acbb4b1aeec573e66c178"
},
"downloads": -1,
"filename": "adafruit-circuitpython-bitbangio-1.3.14.tar.gz",
"has_sig": false,
"md5_digest": "7f7a1ceea95f5400df973b7b84573f8a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 28957,
"upload_time": "2024-02-12T02:21:49",
"upload_time_iso_8601": "2024-02-12T02:21:49.946019Z",
"url": "https://files.pythonhosted.org/packages/19/43/3aec909ec98e7cbb97845338253458b323ee09744beb4024fdfab756062e/adafruit-circuitpython-bitbangio-1.3.14.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-12 02:21:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "adafruit",
"github_project": "Adafruit_CircuitPython_BitbangIO",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "adafruit-circuitpython-bitbangio"
}