You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
the Adafruit library and driver bundle.
Installing from PyPI
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from
PyPI. To install for current user:
pip3 install adafruit-circuitpython-bitbangio
To install system-wide (this may be required in some cases):
"""This example is for demonstrating how to retrieving theboard ID from a BME280, which is stored in register 0xD0.It should return a result of [96]"""importboardimportdigitalioimportadafruit_bitbangioasbitbangio# Change these to the actual connectionsSCLK_PIN=board.D6MOSI_PIN=board.D17MISO_PIN=board.D18CS_PIN=board.D5cs=digitalio.DigitalInOut(CS_PIN)
cs.switch_to_output(value=True)
spi=bitbangio.SPI(SCLK_PIN, MOSI=MOSI_PIN, MISO=MISO_PIN)
cs.value=0whilenotspi.try_lock():
passspi.write([0xD0])
data= [0x00]
spi.readinto(data)
spi.unlock()
cs.value=1print("Result is {}".format(data))
Documentation
API documentation for this library can be found on Read the Docs.
For information on building library documentation, please check out this guide.
Contributing
Contributions are welcome! Please read our Code of Conduct
before contributing to help this project stay welcoming.
About
A library for adding bitbang I2C and SPI to CircuitPython without the built-in bitbangio module