Python Logic Analyzer
Streaming data analyzer for Saleae logic based on Saleae SDK. Currently supports the 8-port version. Support for other aquisition modules is possible. (Send me some hardware!)
Python's generators are a nice abstraction for working with data streams.
Most protocols allow for a large data rate reduction in the first processing step. This can be written in C++ while the rest can be done easily in Python.
SWIG makes it easy to write C++ modules that can be used in Python
CMake allows straightforward cross-platform development
The Saleae Logic is a neat little device!
This is a work in progress. Code is carefully designed to make it modular with minimal dependencies. An idea is to be able to reuse the C++ frontend code on a bare-bones microcontroller.
C++: Synchronous serial, Asynchronous serial, De-duplication
Python: all C++ code wrapped as Python generators for ad-hoc processing. Some examples include console dump ASCII, HEX.
Python: composition of C++ modules
Simple Serial chaining
Parallel/Serial chaining (RPN dataflow programs)
- Cross-platform Qt GUI tools in Python PySide
To add a processing class, take the measurement module as an example.
Add a set of header / code files to create a new module. ( It might be more appropriate to add to an existing header / code file. )
touch measure.h measure.cpp git add measure.h measure.cpp
Add the new C++ file
CMakeLists.txtin the variable
Add the new header file
#include "measure.h"at the top and
%include "measure.h"at the bottom.
Define a new class in
class frequency : public frontend. The
frontendclass is in
pylacore.i, indicating to SWIG it needs to look inside the
shared_ptr<frequency>object to expose
If the constructor of the new object has no arguments (which is preferred), add a line
shared.h. Otherwise write a manual wrapper following the examples in at the bottom of the file. Also add
Your new object is now available in python:
import pyla f = pyla.frequency()
The choice was made to keep memory management separate from the definition of the processing classes.
Memory management in the form of
shared_ptr is implemented
shared.h. For each class
CLS we manually create a
static inline factory function
shared_CLS that constructs a
shared_ptr<CLS> oject. Code in
pyla.py performs additional Python
wrapping automatically, making the extended object available as
It seems that Swig does not handle
automatically, hence some extra annotation in
pylacore.i is needed.