I'm using libm2k (v0.3.2-g567fd42) in a python environment. I have a data collection script which I would like to use to A) generate a triggering event from a separate device and B) measure the resulting waveforms through the M2K. My problem is that calling
m2k.getAnalogIn().getSamples(N_SAMPLES) seems to cause all interpreter threads to block, so I haven't been able to capture the results from my triggering event.
Here is some pseudocode of what I'm trying to do:
for i in range(100):
thread = threading.Thread(target=event_loop)
samples = m2k.getAnalogIn().getSamples(N_SAMPLES)
The output looks something like:
I0802 14:25:20.687490 24504 m2kanalogin_impl.cpp:296] [BEGIN] M2kAnalogIn getSamples
I0802 14:25:20.687490 24504 devicegeneric.cpp:200] [m2k-adc][sampling_frequency][read] 10000000.000000
I0802 14:25:20.687490 24504 channel.cpp:140] [m2k-adc][voltage0] Enable channel
I0802 14:25:20.687490 24504 channel.cpp:140] [m2k-adc][voltage1] Enable channel
I0802 14:25:20.687490 24504 buffer.cpp:84] [m2k-adc] RX buffer created (8192 samples)
I0802 14:25:23.195003 24504 buffer.cpp:530] [m2k-adc] Buffer destroyed
The program exits before "join" gets printed since no triggering event happens after the call to getSamples.
Is there a way to fix or get around the blocking behaviour of getSamples to allow for the event call to happen?