bitbangio — Digital protocols implemented by the CPU

The bitbangio module contains classes to provide digital bus protocol support regardless of whether the underlying hardware exists to use the protocol.

First try to use busio module instead which may utilize peripheral hardware to implement the protocols. Native implementations will be faster than bitbanged versions and have more capabilities.

Libraries

All libraries change hardware state and should be deinitialized when they are no longer needed. To do so, either call deinit() or use a context manager.

For example:

import bitbangio
from board import *

with bitbangio.I2C(SCL, SDA) as i2c:
  i2c.scan()

This example will initialize the the device, run scan() and then deinit() the hardware.