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

adi: adis16475: Set default trigger #551

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions adi/adis16475.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __init__(self, uri="", device_name="adis16505-2"):
else:
self._ctrl = self._ctx.find_device(device_name)
self._rxadc = self._ctx.find_device(device_name)
trigger_name = device_name + "-dev0"

if self._ctrl is None:
print(
Expand All @@ -76,10 +77,15 @@ def __init__(self, uri="", device_name="adis16505-2"):
self._rxadc = self._ctx.find_device(i)
if self._ctrl is not None:
print("Fond device = " + i + ". Will use this device instead.")
trigger_name = i + "-dev0"
break
if self._ctrl is None:
raise Exception("No compatible device found")

# Set default trigger
self._trigger = self._ctx.find_device(trigger_name)
self._rxadc._set_trigger(self._trigger)

self.anglvel_x = self._channel_with_offset(self._ctrl, "anglvel_x")
self.anglvel_y = self._channel_with_offset(self._ctrl, "anglvel_y")
self.anglvel_z = self._channel_with_offset(self._ctrl, "anglvel_z")
Expand Down
14 changes: 7 additions & 7 deletions test/test_adis16475_p.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_adis16475_rx_data(test_dma_rx, iio_uri, classname, channel):
test_dma_rx(iio_uri, classname, channel, buffer_size=16)


@pytest.mark.iio_hardware(hardware)
@pytest.mark.iio_hardware(hardware, True)
def test_adis16475_filter_low_pass_3db_frequency(iio_uri):
adis16475 = adi.adis16475(uri=iio_uri)

Expand Down Expand Up @@ -49,35 +49,35 @@ def test_adis16475_filter_low_pass_3db_frequency(iio_uri):
assert adis16475.filter_low_pass_3db_frequency <= 720


@pytest.mark.iio_hardware(hardware)
@pytest.mark.iio_hardware(hardware, True)
def test_adis16475_firmware_date(iio_uri):
adis16475 = adi.adis16475(uri=iio_uri)

assert adis16475.firmware_date != "00-00-0000"


@pytest.mark.iio_hardware(hardware)
@pytest.mark.iio_hardware(hardware, True)
def test_adis16475_firmware_revision(iio_uri):
adis16475 = adi.adis16475(uri=iio_uri)

assert adis16475.firmware_revision != "0.0"


@pytest.mark.iio_hardware(hardware)
@pytest.mark.iio_hardware(hardware, True)
def test_adis16475_product_id(iio_uri):
adis16475 = adi.adis16475(uri=iio_uri)

assert adis16475.product_id != 0


@pytest.mark.iio_hardware(hardware)
@pytest.mark.iio_hardware(hardware, True)
def test_adis16475_serial_number(iio_uri):
adis16475 = adi.adis16475(uri=iio_uri)

assert adis16475.serial_number != "0x0000"


@pytest.mark.iio_hardware(hardware)
@pytest.mark.iio_hardware(hardware, True)
def test_adis16476_conv_data(iio_uri):
adis16475 = adi.adis16475(uri=iio_uri)

Expand All @@ -90,7 +90,7 @@ def test_adis16476_conv_data(iio_uri):
assert adis16475.temp_conv != 0.0


@pytest.mark.iio_hardware(hardware)
@pytest.mark.iio_hardware(hardware, True)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize(
"attr, start, stop, step, tol",
Expand Down
Loading