Skip to content

Commit

Permalink
Merge pull request #551 from analogdevicesinc/dev/adis16475_trig
Browse files Browse the repository at this point in the history
adi: adis16475: Set default trigger
  • Loading branch information
tfcollins authored Apr 17, 2024
2 parents eba8149 + 8c7ec94 commit 5c7b70e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
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

0 comments on commit 5c7b70e

Please sign in to comment.