mirror of https://github.com/m-labs/artiq.git
pxi6733: use a method as DoneEvent callback
This commit is contained in:
parent
ea53ed1af7
commit
d78a275655
|
@ -12,11 +12,6 @@ class DAQmxSim:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def done_callback_py(taskhandle, status, callback_data):
|
|
||||||
callback_data.daq.DAQmxClearTask(taskhandle)
|
|
||||||
callback_data.tasks.remove(taskhandle)
|
|
||||||
|
|
||||||
|
|
||||||
class DAQmx:
|
class DAQmx:
|
||||||
"""NI PXI6733 DAQ interface."""
|
"""NI PXI6733 DAQ interface."""
|
||||||
|
|
||||||
|
@ -29,6 +24,10 @@ class DAQmx:
|
||||||
self.tasks = []
|
self.tasks = []
|
||||||
self.daq = daq
|
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):
|
def load_sample_values(self, values):
|
||||||
"""Load sample values into PXI 6733 device.
|
"""Load sample values into PXI 6733 device.
|
||||||
|
|
||||||
|
@ -60,9 +59,9 @@ class DAQmx:
|
||||||
if ret:
|
if ret:
|
||||||
raise IOError("Error while writing samples to the channel buffer")
|
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.tasks.append(t.taskHandle)
|
||||||
self.daq.DAQmxRegisterDoneEvent(t.taskHandle, 0, done_callback, self)
|
self.daq.DAQmxRegisterDoneEvent(t.taskHandle, 0, done_cb, None)
|
||||||
t.StartTask()
|
t.StartTask()
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
|
Loading…
Reference in New Issue