2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 11:18:27 +08:00

pxi6733: use a method as DoneEvent callback

This commit is contained in:
Yann Sionneau 2015-05-22 16:08:07 +02:00
parent ea53ed1af7
commit d78a275655

View File

@ -12,11 +12,6 @@ class DAQmxSim:
pass
def done_callback_py(taskhandle, status, callback_data):
callback_data.daq.DAQmxClearTask(taskhandle)
callback_data.tasks.remove(taskhandle)
class DAQmx:
"""NI PXI6733 DAQ interface."""
@ -29,6 +24,10 @@ class DAQmx:
self.tasks = []
self.daq = daq
def done_callback_py(self, taskhandle, status, callback_data):
self.daq.DAQmxClearTask(taskhandle)
self.tasks.remove(taskhandle)
def load_sample_values(self, values):
"""Load sample values into PXI 6733 device.
@ -60,9 +59,9 @@ class DAQmx:
if ret:
raise IOError("Error while writing samples to the channel buffer")
done_callback = self.daq.DAQmxDoneEventCallbackPtr(done_callback_py)
done_cb = self.daq.DAQmxDoneEventCallbackPtr(self.done_callback_py)
self.tasks.append(t.taskHandle)
self.daq.DAQmxRegisterDoneEvent(t.taskHandle, 0, done_callback, self)
self.daq.DAQmxRegisterDoneEvent(t.taskHandle, 0, done_cb, None)
t.StartTask()
def close(self):