Skip to content

Commit

Permalink
pxi6733: use a method as DoneEvent callback
Browse files Browse the repository at this point in the history
fallen committed May 22, 2015
1 parent ea53ed1 commit d78a275
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions artiq/devices/pxi6733/driver.py
Original file line number Diff line number Diff line change
@@ -12,11 +12,6 @@ def close(self):
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 @@ def __init__(self, device, analog_output, clock):
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 @@ def load_sample_values(self, values):
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):

0 comments on commit d78a275

Please sign in to comment.