Skip to content

Instantly share code, notes, and snippets.

@Marcus10110
Created May 4, 2017 22:39
Show Gist options
  • Save Marcus10110/8dac5ce2f71625dbe117a1f52beadbef to your computer and use it in GitHub Desktop.
Save Marcus10110/8dac5ce2f71625dbe117a1f52beadbef to your computer and use it in GitHub Desktop.
Saleae python capture and analyzer export example
import saleae
#add this function to saleae.py:
# def capture_blocking(self):
# '''Start a new capture and immediately return.'''
# try:
# self._cmd('CAPTURE', True)
# return True
# except self.CommandNAKedError:
# return False
s = saleae.Saleae()
s.set_capture_seconds(.5)
# new function added to saleae.py manually.
s.capture_blocking()
print "done capturing"
analyzers = s.get_analyzers()
spi_index = analyzers[0][1]
path = "c:\QuickShare\spi.csv"
spi_results = s.export_analyzer( spi_index, path, True, True )
print "finished receiving SPI results"
lines = spi_results.split('\n')
lines.pop(0)
mosi = []
miso = []
for line in lines:
elements = line.split(',')
if len(elements) == 4:
mosi.append(elements[2])
miso.append(elements[3])
print "MISO:"
print miso
print "MOSI:"
print mosi
@oomek
Copy link

oomek commented May 19, 2020

I do not see a file named saleae.py anywhere. How ca I use this to export data to file from your Fancy I2C extension?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment