Yet Another Bus Pirate Library
Latest Version: 1.1.0
A Bus Pirate is a handy little debug tool. Its firmware, command documentation and artwork are released into the public domain. The python libraries that I could find have gone untouched for many years. This is another library built from the command documentation.
git clone https://github.com/jdpatt/yabp.git
cd yabp
- Create a virtual environment with
python -m venv .venv
- Activate that environment
pip install -r requirements-dev.txt
pre-commit install
pip install -e .
tox
import logging
import time
import yabp
if __name__ == "__main__":
# Create a generic root logger.
logging.basicConfig(level=logging.DEBUG)
logging.getLogger()
# Change the message level of yabp.
logging.getLogger("yabp").setLevel(logging.ERROR)
# Traditional usage:
try:
bp = yabp.I2C("COM3", 115200) # Specified the com port and baud rate.
bp.write_register(address=0x23, register=0x01, data=0xFF)
bp.close()
except ConnectionError as error:
logging.error(error)
raise
# Or as a context manager:
with yabp.I2C() as bp: # Let the library find the correct serial port.
bp.write_register(0x23, 0x01, 0xFF)