Skip to content

Ownezx/pyBusPirateLite

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyBusPirateLite

Python library for BusPirate based on code from Garrett Berg. It tries to be more Pythonic than the original code.

This library allows using the following modes:

  • SPI
  • I2C
  • UART
  • Bitbang
  • Onewire
  • Rawwire

For more information about the BusPirate see http://dangerousprototypes.com/docs/Bus_Pirate

Based on code from Garrett Berg [email protected] (http://dangerousprototypes.com/2011/03/14/new-version-of-pybuspiratelite-python-library/)

Examples

SPI

from pyBusPirateLite.SPI import *

spi = SPI()
spi.pins = PIN_POWER | PIN_CS 
spi.config = CFG_PUSH_PULL | CFG_IDLE
spi.speed = '1MHz'

# send two bytes and receive answer
spi.cs = True
data = spi.transfer( [0x82, 0x00])
spi.cs = False

Bitbang

from pyBusPirateLite.BitBang import BitBang
from pyBusPirateLite.BBIO_base import PIN_AUX

bb = BitBang()
bb.outputs = PIN_AUX
bb.pins = 0        # set aux pin = 0   
bb.pins = PIN_AUX  # set aux pin = 1

Automatically detect port

from pyBusPirateLite.BitBang import BitBang
bb = BitBang(connect=False)
port = bb.get_port()
print(port)

I2C

from pyBusPirateLite.SPI import *

i2c = I2C()
i2c.pins = PIN_POWER | PIN_CS 
i2c.speed = '50kHz'

About

Python library for BusPirate

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%