Skip to content

Commit

Permalink
Fix dynamic channel config classes
Browse files Browse the repository at this point in the history
A large set of classes were not reseting their channel names during
their init. This will create undesired behavior since
_rx/tx_channel_names are class properties and shared across all
instances

Signed-off-by: Travis F. Collins <[email protected]>
  • Loading branch information
tfcollins committed Feb 9, 2024
1 parent a240ae4 commit 64990d5
Show file tree
Hide file tree
Showing 27 changed files with 43 additions and 4 deletions.
2 changes: 2 additions & 0 deletions adi/ad4110.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def __init__(self, uri="", device_name=""):
if not self._rxadc:
raise Exception("Error in selecting matching device")

self._rx_channel_names = []
self.channel = []
for ch in self._ctrl.channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
2 changes: 2 additions & 0 deletions adi/ad4130.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def __init__(self, uri="", device_name=""):
self._rxadc = device
break

self._rx_channel_names = []
self.channel = []
for ch in self._ctrl.channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
1 change: 1 addition & 0 deletions adi/ad469x.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(self, uri="", device_name=""):
if not self._rxadc:
raise Exception("Error in selecting matching device")

self._rx_channel_names = []
for ch in self._ctrl.channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
2 changes: 2 additions & 0 deletions adi/ad4858.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def __init__(self, uri="", device_name=""):
if not self._rxadc:
raise Exception("Error in selecting matching device")

self._rx_channel_names = []
self.channel = []
for ch in self._ctrl.channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
1 change: 1 addition & 0 deletions adi/ad5686.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def __init__(self, uri="", device_index=0):
else:
index += 1

self.channel = []
for ch in self._ctrl.channels:
name = ch.id
self.channel.append(self._channel(self._ctrl, name))
Expand Down
2 changes: 2 additions & 0 deletions adi/ad5754r.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def __init__(self, uri="", device_name=""):
raise Exception("Error in selecting matching device")

self.output_bits = []
self.channel = []
self._tx_channel_names = []
for ch in self._ctrl.channels:
name = ch.id
self.output_bits.append(ch.data_format.bits)
Expand Down
2 changes: 2 additions & 0 deletions adi/ad578x.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def __init__(self, uri="", device_name=""):
raise Exception("Error in selecting matching device")

self.output_bits = []
self.channel = []
self._tx_channel_names = []
for ch in self._ctrl.channels:
name = ch.id
self.output_bits.append(ch.data_format.bits)
Expand Down
1 change: 1 addition & 0 deletions adi/ad5940.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(self, uri=""):
break
# dynamically get channels
_channels = []
self._rx_channel_names = []
for ch in self._ctrl.channels:
self._rx_channel_names.append(ch.id)
if ch.name == "bia":
Expand Down
2 changes: 2 additions & 0 deletions adi/ad717x.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def __init__(self, uri="", device_name=""):
if not self._rxadc:
raise Exception("Error in selecting matching device")

self._rx_channel_names = []
self.channel = []
for ch in self._ctrl.channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
2 changes: 2 additions & 0 deletions adi/ad719x.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def __init__(self, uri="", device_name=""):
if not self._rxadc:
raise Exception("Error in selecting matching device")

self._rx_channel_names = []
self.channel = []
for ch in self._ctrl.channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
2 changes: 2 additions & 0 deletions adi/ad7606.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def __init__(self, uri="", device_name=""):
self._rxadc = device
break

self._rx_channel_names = []
self.channel = []
for ch in self._ctrl.channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
2 changes: 2 additions & 0 deletions adi/ad7689.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def __init__(self, uri="", device_name=""):
self._rxadc = device
break

self._rx_channel_names = []
self.channel = []
for ch in self._ctrl.channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
1 change: 1 addition & 0 deletions adi/ad7746.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def __init__(self, uri="", device_name=""):
break
# dynamically get channels
_channels = []
self._rx_channel_names = []
for ch in self._ctrl.channels:
self._rx_channel_names.append(ch.id)
if "capacitance" in ch.id:
Expand Down
1 change: 1 addition & 0 deletions adi/ad7768.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(
if not self._rxadc:
raise Exception("Error in selecting matching device")

self._rx_channel_names = []
for ch in self._rxadc.channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
2 changes: 2 additions & 0 deletions adi/ad777x.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def __init__(self, uri="", device_name=""):
if not self._rxadc:
raise Exception("Error in selecting matching device")

self._rx_channel_names = []
self.channel = []
for ch in self._ctrl.channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
1 change: 1 addition & 0 deletions adi/ad7799.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def __init__(self, uri=""):

self._rxadc = self._ctx.find_device("AD7799")

self.channel = []
for name in self._rx_channel_names:
self.channel.append(self._channel(self._rxadc, name))

Expand Down
1 change: 1 addition & 0 deletions adi/ad9083.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, uri=""):
if not self._rxadc:
raise Exception("Cannot find device axi-ad9083-rx-hpc")

self._rx_channel_names = []
for ch in self._rxadc.channels:
if ch.scan_element and not ch.output:
self._rx_channel_names.append(ch._id)
Expand Down
1 change: 1 addition & 0 deletions adi/ad9172.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, uri=""):
if not self._txdac:
raise RuntimeError("Could not find axi-ad9172-hpc")

self._tx_channel_names = []
for chan in self._txdac.channels:
if (
hasattr(chan, "scan_element")
Expand Down
5 changes: 3 additions & 2 deletions adi/adaq8092.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class adaq8092(rx, context_manager):
"""ADAQ8092 14-Bit, 105MSPS, Dual-Channel uModule Data Acquisition Solution"""

_device_name = "adaq8092"
_rx_stack_interleaved = True
_rx_data_type = np.int16

def __init__(
self, uri="",
Expand All @@ -27,8 +29,7 @@ def __init__(
self._rxadc = self._ctx.find_device("cf_axi_adc")
self._device_name = "cf_axi_adc"

rx._rx_stack_interleaved = True
rx._rx_data_type = np.int16
self._rx_channel_names = []
for ch in self._rxadc.channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
3 changes: 2 additions & 1 deletion adi/adpd1080.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def __init__(self, uri="", device_index=0):

# dynamically get channels and sorting them after the color
# self._ctrl.channels.sort(key=lambda x: str(x.id[14:]))

self._rx_channel_names = []
self.channel = []
for ch in self._ctrl._channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
3 changes: 2 additions & 1 deletion adi/adpd188.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def __init__(self, uri="", device_index=0):

# dynamically get channels and sorting them after the color
# self._ctrl.channels.sort(key=lambda x: str(x.id[14:]))

self._rx_channel_names = []
self.channel = []
for ch in self._ctrl._channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
1 change: 1 addition & 0 deletions adi/adpd410x.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__(self, uri=""):

self._rxadc = self._ctx.find_device("adpd410x")

self.channel = []
for name in self._rx_channel_names:
self.channel.append(self._channel(self._rxadc, name))

Expand Down
1 change: 1 addition & 0 deletions adi/ltc2499.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, uri=""):
raise Exception("No device found")

_channels = []
self._rx_channel_names = []
for ch in self._ctrl.channels:
self._rx_channel_names.append(ch.id)
_channels.append((ch.id, self._channel(self._ctrl, ch.id)))
Expand Down
1 change: 1 addition & 0 deletions adi/ltc2983.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(self, uri=""):

# dynamically get channels
_channels = []
self._rx_channel_names = []
for ch in self._ctrl.channels:
self._rx_channel_names.append(ch.id)
_channels.append((ch.id, self._channel(self._ctrl, ch.id)))
Expand Down
2 changes: 2 additions & 0 deletions adi/max11205.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def __init__(self, uri="", device_name=""):
if not self._rxadc:
raise Exception("Error in selecting matching device")

self._rx_channel_names = []
self.channel = []
for ch in self._ctrl.channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
2 changes: 2 additions & 0 deletions adi/max14001.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def __init__(self, uri="", device_name=""):
if not self._rxadc:
raise Exception("Error in selecting matching device")

self._rx_channel_names = []
self.channel = []
for ch in self._ctrl.channels:
name = ch._id
self._rx_channel_names.append(name)
Expand Down
1 change: 1 addition & 0 deletions adi/max9611.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def __init__(self, uri="", device_name=""):
raise Exception("Error in selecting matching device")

# Dynamically get channels after the index
self._rx_channel_names = []
for ch in self._ctrl.channels:
name = ch._id

Expand Down

0 comments on commit 64990d5

Please sign in to comment.