Created
May 4, 2017 22:39
-
-
Save Marcus10110/8dac5ce2f71625dbe117a1f52beadbef to your computer and use it in GitHub Desktop.
Saleae python capture and analyzer export example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?