Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issues causing errors in test cases using real devices #321

Merged
merged 12 commits into from
May 5, 2023
Merged
59 changes: 24 additions & 35 deletions generated/nidaqmx/_library_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4317,7 +4317,7 @@ def read_digital_lines(
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_int,
ctypes.c_double, ctypes.c_int,
wrapped_ndpointer(dtype=numpy.uint8, flags=('C','W')),
wrapped_ndpointer(dtype=bool, flags=('C','W')),
ctypes.c_uint, ctypes.POINTER(ctypes.c_int),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)]

Expand Down Expand Up @@ -5543,9 +5543,8 @@ def write_analog_f64(
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_int, c_bool32,
ctypes.c_double, ctypes.c_int,
wrapped_ndpointer(dtype=numpy.float64,
flags=('C','W')), ctypes.POINTER(ctypes.c_int),
ctypes.POINTER(c_bool32)]
wrapped_ndpointer(dtype=numpy.float64, flags=('C')),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)]

error_code = cfunc(
task, num_samps_per_chan, auto_start, timeout, data_layout,
Expand Down Expand Up @@ -5578,7 +5577,7 @@ def write_binary_i16(
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_int, c_bool32,
ctypes.c_double, ctypes.c_int,
wrapped_ndpointer(dtype=numpy.int16, flags=('C','W')),
wrapped_ndpointer(dtype=numpy.int16, flags=('C')),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)]

error_code = cfunc(
Expand All @@ -5599,7 +5598,7 @@ def write_binary_i32(
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_int, c_bool32,
ctypes.c_double, ctypes.c_int,
wrapped_ndpointer(dtype=numpy.int32, flags=('C','W')),
wrapped_ndpointer(dtype=numpy.int32, flags=('C')),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)]

error_code = cfunc(
Expand All @@ -5620,9 +5619,8 @@ def write_binary_u16(
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_int, c_bool32,
ctypes.c_double, ctypes.c_int,
wrapped_ndpointer(dtype=numpy.uint16,
flags=('C','W')), ctypes.POINTER(ctypes.c_int),
ctypes.POINTER(c_bool32)]
wrapped_ndpointer(dtype=numpy.uint16, flags=('C')),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)]

error_code = cfunc(
task, num_samps_per_chan, auto_start, timeout, data_layout,
Expand All @@ -5642,9 +5640,8 @@ def write_binary_u32(
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_int, c_bool32,
ctypes.c_double, ctypes.c_int,
wrapped_ndpointer(dtype=numpy.uint32,
flags=('C','W')), ctypes.POINTER(ctypes.c_int),
ctypes.POINTER(c_bool32)]
wrapped_ndpointer(dtype=numpy.uint32, flags=('C')),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)]

error_code = cfunc(
task, num_samps_per_chan, auto_start, timeout, data_layout,
Expand All @@ -5664,11 +5661,9 @@ def write_ctr_freq(
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_int, c_bool32,
ctypes.c_double, ctypes.c_int,
wrapped_ndpointer(dtype=numpy.float64,
flags=('C','W')),
wrapped_ndpointer(dtype=numpy.float64,
flags=('C','W')), ctypes.POINTER(ctypes.c_int),
ctypes.POINTER(c_bool32)]
wrapped_ndpointer(dtype=numpy.float64, flags=('C')),
wrapped_ndpointer(dtype=numpy.float64, flags=('C')),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)]

error_code = cfunc(
task, num_samps_per_chan, auto_start, timeout, data_layout,
Expand Down Expand Up @@ -5704,11 +5699,9 @@ def write_ctr_ticks(
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_int, c_bool32,
ctypes.c_double, ctypes.c_int,
wrapped_ndpointer(dtype=numpy.uint32,
flags=('C','W')),
wrapped_ndpointer(dtype=numpy.uint32,
flags=('C','W')), ctypes.POINTER(ctypes.c_int),
ctypes.POINTER(c_bool32)]
wrapped_ndpointer(dtype=numpy.uint32, flags=('C')),
wrapped_ndpointer(dtype=numpy.uint32, flags=('C')),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)]

error_code = cfunc(
task, num_samps_per_chan, auto_start, timeout, data_layout,
Expand Down Expand Up @@ -5743,11 +5736,9 @@ def write_ctr_time(
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_int, c_bool32,
ctypes.c_double, ctypes.c_int,
wrapped_ndpointer(dtype=numpy.float64,
flags=('C','W')),
wrapped_ndpointer(dtype=numpy.float64,
flags=('C','W')), ctypes.POINTER(ctypes.c_int),
ctypes.POINTER(c_bool32)]
wrapped_ndpointer(dtype=numpy.float64, flags=('C')),
wrapped_ndpointer(dtype=numpy.float64, flags=('C')),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)]

error_code = cfunc(
task, num_samps_per_chan, auto_start, timeout, data_layout,
Expand Down Expand Up @@ -5783,7 +5774,7 @@ def write_digital_lines(
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_int, c_bool32,
ctypes.c_double, ctypes.c_int,
wrapped_ndpointer(dtype=numpy.uint8, flags=('C','W')),
wrapped_ndpointer(dtype=bool, flags=('C')),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)]

error_code = cfunc(
Expand Down Expand Up @@ -5817,9 +5808,8 @@ def write_digital_u16(
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_int, c_bool32,
ctypes.c_double, ctypes.c_int,
wrapped_ndpointer(dtype=numpy.uint16,
flags=('C','W')), ctypes.POINTER(ctypes.c_int),
ctypes.POINTER(c_bool32)]
wrapped_ndpointer(dtype=numpy.uint16, flags=('C')),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)]

error_code = cfunc(
task, num_samps_per_chan, auto_start, timeout, data_layout,
Expand All @@ -5839,9 +5829,8 @@ def write_digital_u32(
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_int, c_bool32,
ctypes.c_double, ctypes.c_int,
wrapped_ndpointer(dtype=numpy.uint32,
flags=('C','W')), ctypes.POINTER(ctypes.c_int),
ctypes.POINTER(c_bool32)]
wrapped_ndpointer(dtype=numpy.uint32, flags=('C')),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)]

error_code = cfunc(
task, num_samps_per_chan, auto_start, timeout, data_layout,
Expand All @@ -5861,7 +5850,7 @@ def write_digital_u8(
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_int, c_bool32,
ctypes.c_double, ctypes.c_int,
wrapped_ndpointer(dtype=numpy.uint8, flags=('C','W')),
wrapped_ndpointer(dtype=numpy.uint8, flags=('C')),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)]

error_code = cfunc(
Expand Down
4 changes: 2 additions & 2 deletions generated/nidaqmx/_task_modules/in_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,8 +1083,8 @@ def read(self, number_of_samples_per_channel=READ_ALL_AVAILABLE):
numpy_array = numpy.zeros(number_of_samples, dtype=dtype)

_, samples_read, _ = self._interpreter.read_raw(
self._handle, numpy_array, num_samps_per_chan,
self.timeout)
self._handle, num_samps_per_chan,
self.timeout, numpy_array)

if samples_read != number_of_samples:
return numpy_array[:samples_read]
Expand Down
2 changes: 1 addition & 1 deletion generated/nidaqmx/stream_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ def read_one_sample_multi_line(self, data, timeout=10):
self._verify_array_digital_lines(data, False, True)

_, samps_per_chan_read, num_bytes_per_samp = self._interpreter.read_digital_lines(
self._handle, data, 1, timeout, FillMode.GROUP_BY_CHANNEL.value)
self._handle, 1, timeout, FillMode.GROUP_BY_CHANNEL.value, data)

def read_one_sample_one_line(self, timeout=10):
"""
Expand Down
2 changes: 1 addition & 1 deletion generated/nidaqmx/stream_writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ def write_one_sample_port_uint32(self, data, timeout=10):
AUTO_START_UNSET else True)

return self._interpreter.write_digital_scalar_u32(
self._handle, auto_start, timeout, FillMode.GROUP_BY_CHANNEL.value, data)
self._handle, auto_start, timeout, data)


class DigitalMultiChannelWriter(ChannelWriterBase):
Expand Down
6 changes: 3 additions & 3 deletions generated/nidaqmx/system/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def get_digital_power_up_states(self, device_name):
for d, p in zip(device.do_lines, states):
power_up_states.append(
DOPowerUpState(physical_channel=d.name,
power_up_state=PowerUpStates(p.value)))
power_up_state=PowerUpStates(p)))

return power_up_states

Expand Down Expand Up @@ -346,7 +346,7 @@ def get_digital_pull_up_pull_down_states(self, device_name):
power_up_states.append(
DOResistorPowerUpState(
physical_channel=d.name,
power_up_state=ResistorState(p.value)))
power_up_state=ResistorState(p)))

return power_up_states

Expand Down Expand Up @@ -451,7 +451,7 @@ def get_analog_power_up_states(self, device_name):
power_up_states.append(
AOPowerUpState(
physical_channel=a.name,
power_up_state=p.value,
power_up_state=p,
channel_type=AOPowerUpOutputBehavior(c.value)))

return power_up_states
Expand Down
4 changes: 2 additions & 2 deletions src/codegen/metadata/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18564,7 +18564,7 @@
'type': 'int32'
},
{
'ctypes_data_type': 'numpy.uint8',
'ctypes_data_type': 'numpy.bool',
'direction': 'out',
'has_explicit_buffer_size': True,
'is_list': True,
Expand Down Expand Up @@ -24148,7 +24148,7 @@
'type': 'int32'
},
{
'ctypes_data_type': 'numpy.uint8',
'ctypes_data_type': 'numpy.bool',
'direction': 'in',
'is_list': True,
'is_optional_in_python': False,
Expand Down
Loading