diff --git a/.github/license_header.txt b/.github/license_header.txt new file mode 100644 index 000000000..4ba7c8ddc --- /dev/null +++ b/.github/license_header.txt @@ -0,0 +1,3 @@ +Copyright (C) 2023 Analog Devices, Inc. + +SPDX short identifier: ADIBSD diff --git a/.licenserc.json b/.licenserc.json index 828442309..5894deea6 100644 --- a/.licenserc.json +++ b/.licenserc.json @@ -3,5 +3,8 @@ "# Copyright (C) 2019-2023 Analog Devices, Inc.", "#", "# SPDX short identifier: ADIBSD" + ], + "ignore": [ + "adi/sshfs.py" ] } diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cad232ab1..ea28dd8a9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,3 +37,14 @@ repos: hooks: - id: blacken-docs additional_dependencies: [black==19.10b0] +- repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.5.1 + hooks: + - id: insert-license + files: adi\/.*\.py$ + args: + - --license-filepath + - .github/license_header.txt + - --use-current-year + - --no-extra-eol + - --detect-license-in-X-top-lines=3 diff --git a/adi/QuadMxFE_multi.py b/adi/QuadMxFE_multi.py index 00aa45634..e6b2e067c 100644 --- a/adi/QuadMxFE_multi.py +++ b/adi/QuadMxFE_multi.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/__init__.py b/adi/__init__.py index 5e27738c6..4d679110b 100644 --- a/adi/__init__.py +++ b/adi/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad4020.py b/adi/ad4020.py index f6a55d47a..06fc3bed5 100644 --- a/adi/ad4020.py +++ b/adi/ad4020.py @@ -1,30 +1,30 @@ -# Copyright (C) 2022 Analog Devices, Inc. -# -# SPDX short identifier: ADIBSD - -import numpy as np -from adi.context_manager import context_manager -from adi.rx_tx import rx - - -class ad4020(rx, context_manager): - """AD4020 device""" - - _device_name = "ad4020" - _rx_data_type = np.int32 - _complex_data = False - _rx_channel_names = ["voltage0"] - - def __init__(self, uri=""): - - context_manager.__init__(self, uri, self._device_name) - - self._rxadc = self._ctx.find_device("ad4020") - self._ctrl = self._ctx.find_device("ad4020") - rx.__init__(self) - - @property - def sampling_frequency(self): - """sample_rate: Only readable - """ - return self._get_iio_dev_attr("sampling_frequency") +# Copyright (C) 2022-2023 Analog Devices, Inc. +# +# SPDX short identifier: ADIBSD + +import numpy as np +from adi.context_manager import context_manager +from adi.rx_tx import rx + + +class ad4020(rx, context_manager): + """AD4020 device""" + + _device_name = "ad4020" + _rx_data_type = np.int32 + _complex_data = False + _rx_channel_names = ["voltage0"] + + def __init__(self, uri=""): + + context_manager.__init__(self, uri, self._device_name) + + self._rxadc = self._ctx.find_device("ad4020") + self._ctrl = self._ctx.find_device("ad4020") + rx.__init__(self) + + @property + def sampling_frequency(self): + """sample_rate: Only readable + """ + return self._get_iio_dev_attr("sampling_frequency") diff --git a/adi/ad4110.py b/adi/ad4110.py index a4ca0d1b5..f6d230c4d 100644 --- a/adi/ad4110.py +++ b/adi/ad4110.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad4130.py b/adi/ad4130.py index 7dc653216..eb2b7c6d0 100644 --- a/adi/ad4130.py +++ b/adi/ad4130.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad4630.py b/adi/ad4630.py index 79a91d8f0..e1e60811a 100644 --- a/adi/ad4630.py +++ b/adi/ad4630.py @@ -1,200 +1,200 @@ -# Copyright (C) 2022 Analog Devices, Inc. -# -# SPDX short identifier: ADIBSD - - -import numpy as np -from adi.attribute import attribute -from adi.context_manager import context_manager -from adi.rx_tx import rx - - -def _sign_extend(value, nbits): - sign_bit = 1 << (nbits - 1) - return (value & (sign_bit - 1)) - (value & sign_bit) - - -def _bitmask(nbits): - mask = 0 - for i in range(0, nbits): - mask = (mask << 1) | 1 - return mask - - -class ad4630(rx, context_manager, attribute): - - """ AD4630 is low power 24-bit precision SAR ADC """ - - _complex_data = False - _data_type = "voltage" - _device_name = "" - _rx_channel_names = [] - - """ Default part to initialize is ad4630-24. If you don't hardware test fails""" - - def __init__(self, uri="", device_name="ad4630-24"): - - context_manager.__init__(self, uri, self._device_name) - - compatible_parts = ["ad4630-24", "ad4030-24", "ad4630-16"] - - if device_name not in compatible_parts: - raise Exception( - "Not a compatible device: " - + str(device_name) - + ". Please select from " - + str(compatible_parts) - ) - else: - self._ctrl = self._ctx.find_device(device_name) - self._rxadc = self._ctx.find_device(device_name) - - _channels = [] - self.output_bits = [] - for ch in self._ctrl.channels: - self.output_bits.append(ch.data_format.bits) - self._rx_channel_names.append(ch.id) - if "differential" in ch.name: - _channels.append((ch.id, self._diff_channel(self._ctrl, ch.id))) - if "0" in ch.name: - self.chan0 = self._diff_channel(self._ctrl, ch.name) - if "1" in ch.name: - self.chan1 = self._diff_channel(self._ctrl, ch.name) - - rx.__init__(self) - - def rx(self): - - if not self._rx__rxbuf: - self._rx_init_channels() - self._rx__rxbuf.refill() - buff = np.frombuffer(self._rx__rxbuf.read(), dtype=np.uint32) - - data = [buff[0::2], buff[1::2]] - temp = [] - if self._num_rx_channels != 2: - for ch in range(0, self._num_rx_channels): - nbits = self._ctrl.channels[ch].data_format.bits - shift = self._ctrl.channels[ch].data_format.shift - ch_data = np.zeros(data[int(ch / 2)].shape, dtype=np.uint32) - for index in range(0, len(data[int(ch / 2)])): - ch_data[index] = (data[int(ch / 2)][index] >> shift) & _bitmask( - nbits - ) - temp.append(np.vectorize(_sign_extend)(ch_data, nbits)) - data = temp - else: - for idx, ch_data in enumerate(data): - nbits = self._ctrl.channels[idx].data_format.bits - temp.append(np.vectorize(_sign_extend)(ch_data, nbits)) - data = np.vectorize(_sign_extend)(data, nbits) - - return data - - def output_data_mode(self): - """Determine the output data mode in which device is configured.""" - if self.output_bits[0] == 30: - return "30bit_avg" - if self.output_bits[0] == 32: - return "32bit_test_pattern" - if self.output_bits[0] == 16: - return "16bit_diff_8bit_cm" - if len(self.output_bits) == 1 and self.output_bits[0] == 24: - return "24bit_diff" - if len(self.output_bits) == 2 and self.output_bits[0] == self.output_bits[1]: - return "24bit_diff" - else: - return "24bit_diff_8bit_cm" - - @property - def sample_rate(self): - """Get/Set the sampling frequency.""" - return self._get_iio_dev_attr("sampling_frequency") - - @sample_rate.setter - def sample_rate(self, rate): - """Get/Set the sampling frequency.""" - if str(rate) in str(self.sample_rate_avail): - self._set_iio_dev_attr("sampling_frequency", str(rate)) - else: - raise ValueError( - "Error: Sample rate not supported \nUse one of: " - + str(self.sample_rate_avail) - ) - - @property - def sample_rate_avail(self): - """Get list of all the sampling frequency available.""" - return self._get_iio_dev_attr("sampling_frequency_available") - - @property - def operating_mode_avail(self): - """Get list of all the operating mode available.""" - return self._get_iio_dev_attr_str("operating_mode_available") - - @property - def operating_mode(self): - """Get/Set the operating mode.""" - return self._get_iio_dev_attr_str("operating_mode") - - @operating_mode.setter - def operating_mode(self, mode): - """Get/Set the operating mode.""" - if mode in self.operating_mode_avail: - self._set_iio_dev_attr_str("operating_mode", mode) - else: - raise ValueError( - "Error: Operating mode not supported \nUse one of: " - + str(self.operating_mode_avail) - ) - - @property - def sample_averaging_avail(self): - """Get list of all the sample averaging values available. Only available in 30bit averaged mode.""" - return self._get_iio_dev_attr("sample_averaging_available") - - @property - def sample_averaging(self): - """Get/Set the sample averaging. Only available in 30bit averaged mode.""" - return self._get_iio_dev_attr_str("sample_averaging") - - @sample_averaging.setter - def sample_averaging(self, n_sample): - """Get/Set the sample averaging. Only available in 30bit averaged mode.""" - if str(self.sample_averaging) != "OFF": - if str(n_sample) in str(self.sample_averaging_avail): - self._set_iio_dev_attr("sample_averaging", str(n_sample)) - else: - raise ValueError( - "Error: Number of avg samples not supported \nUse one of: " - + str(self.sample_averaging_avail) - ) - else: - raise Exception("Sample Averaging only available in 30bit averaged mode.") - - class _diff_channel(attribute): - """AD4x30 differential channel.""" - - def __init__(self, ctrl, channel_name): - self.name = channel_name - self._ctrl = ctrl - - @property - def hw_gain(self): - """Get/Set the hardwaregain of differential channel.""" - return self._get_iio_attr(self.name, "hardwaregain", False) - - @hw_gain.setter - def hw_gain(self, gain): - """Get/Set the hardwaregain of differential channel.""" - self._set_iio_attr(self.name, "hardwaregain", False, int(gain)) - - @property - def offset(self): - """Get/Set the offset of differential channel.""" - return self._get_iio_attr(self.name, "offset", False, self._ctrl) - - @offset.setter - def offset(self, offset): - """Get/Set the offset of differential channel.""" - self._set_iio_attr(self.name, "offset", False, int(offset), self._ctrl) +# Copyright (C) 2022-2023 Analog Devices, Inc. +# +# SPDX short identifier: ADIBSD + + +import numpy as np +from adi.attribute import attribute +from adi.context_manager import context_manager +from adi.rx_tx import rx + + +def _sign_extend(value, nbits): + sign_bit = 1 << (nbits - 1) + return (value & (sign_bit - 1)) - (value & sign_bit) + + +def _bitmask(nbits): + mask = 0 + for i in range(0, nbits): + mask = (mask << 1) | 1 + return mask + + +class ad4630(rx, context_manager, attribute): + + """ AD4630 is low power 24-bit precision SAR ADC """ + + _complex_data = False + _data_type = "voltage" + _device_name = "" + _rx_channel_names = [] + + """ Default part to initialize is ad4630-24. If you don't hardware test fails""" + + def __init__(self, uri="", device_name="ad4630-24"): + + context_manager.__init__(self, uri, self._device_name) + + compatible_parts = ["ad4630-24", "ad4030-24", "ad4630-16"] + + if device_name not in compatible_parts: + raise Exception( + "Not a compatible device: " + + str(device_name) + + ". Please select from " + + str(compatible_parts) + ) + else: + self._ctrl = self._ctx.find_device(device_name) + self._rxadc = self._ctx.find_device(device_name) + + _channels = [] + self.output_bits = [] + for ch in self._ctrl.channels: + self.output_bits.append(ch.data_format.bits) + self._rx_channel_names.append(ch.id) + if "differential" in ch.name: + _channels.append((ch.id, self._diff_channel(self._ctrl, ch.id))) + if "0" in ch.name: + self.chan0 = self._diff_channel(self._ctrl, ch.name) + if "1" in ch.name: + self.chan1 = self._diff_channel(self._ctrl, ch.name) + + rx.__init__(self) + + def rx(self): + + if not self._rx__rxbuf: + self._rx_init_channels() + self._rx__rxbuf.refill() + buff = np.frombuffer(self._rx__rxbuf.read(), dtype=np.uint32) + + data = [buff[0::2], buff[1::2]] + temp = [] + if self._num_rx_channels != 2: + for ch in range(0, self._num_rx_channels): + nbits = self._ctrl.channels[ch].data_format.bits + shift = self._ctrl.channels[ch].data_format.shift + ch_data = np.zeros(data[int(ch / 2)].shape, dtype=np.uint32) + for index in range(0, len(data[int(ch / 2)])): + ch_data[index] = (data[int(ch / 2)][index] >> shift) & _bitmask( + nbits + ) + temp.append(np.vectorize(_sign_extend)(ch_data, nbits)) + data = temp + else: + for idx, ch_data in enumerate(data): + nbits = self._ctrl.channels[idx].data_format.bits + temp.append(np.vectorize(_sign_extend)(ch_data, nbits)) + data = np.vectorize(_sign_extend)(data, nbits) + + return data + + def output_data_mode(self): + """Determine the output data mode in which device is configured.""" + if self.output_bits[0] == 30: + return "30bit_avg" + if self.output_bits[0] == 32: + return "32bit_test_pattern" + if self.output_bits[0] == 16: + return "16bit_diff_8bit_cm" + if len(self.output_bits) == 1 and self.output_bits[0] == 24: + return "24bit_diff" + if len(self.output_bits) == 2 and self.output_bits[0] == self.output_bits[1]: + return "24bit_diff" + else: + return "24bit_diff_8bit_cm" + + @property + def sample_rate(self): + """Get/Set the sampling frequency.""" + return self._get_iio_dev_attr("sampling_frequency") + + @sample_rate.setter + def sample_rate(self, rate): + """Get/Set the sampling frequency.""" + if str(rate) in str(self.sample_rate_avail): + self._set_iio_dev_attr("sampling_frequency", str(rate)) + else: + raise ValueError( + "Error: Sample rate not supported \nUse one of: " + + str(self.sample_rate_avail) + ) + + @property + def sample_rate_avail(self): + """Get list of all the sampling frequency available.""" + return self._get_iio_dev_attr("sampling_frequency_available") + + @property + def operating_mode_avail(self): + """Get list of all the operating mode available.""" + return self._get_iio_dev_attr_str("operating_mode_available") + + @property + def operating_mode(self): + """Get/Set the operating mode.""" + return self._get_iio_dev_attr_str("operating_mode") + + @operating_mode.setter + def operating_mode(self, mode): + """Get/Set the operating mode.""" + if mode in self.operating_mode_avail: + self._set_iio_dev_attr_str("operating_mode", mode) + else: + raise ValueError( + "Error: Operating mode not supported \nUse one of: " + + str(self.operating_mode_avail) + ) + + @property + def sample_averaging_avail(self): + """Get list of all the sample averaging values available. Only available in 30bit averaged mode.""" + return self._get_iio_dev_attr("sample_averaging_available") + + @property + def sample_averaging(self): + """Get/Set the sample averaging. Only available in 30bit averaged mode.""" + return self._get_iio_dev_attr_str("sample_averaging") + + @sample_averaging.setter + def sample_averaging(self, n_sample): + """Get/Set the sample averaging. Only available in 30bit averaged mode.""" + if str(self.sample_averaging) != "OFF": + if str(n_sample) in str(self.sample_averaging_avail): + self._set_iio_dev_attr("sample_averaging", str(n_sample)) + else: + raise ValueError( + "Error: Number of avg samples not supported \nUse one of: " + + str(self.sample_averaging_avail) + ) + else: + raise Exception("Sample Averaging only available in 30bit averaged mode.") + + class _diff_channel(attribute): + """AD4x30 differential channel.""" + + def __init__(self, ctrl, channel_name): + self.name = channel_name + self._ctrl = ctrl + + @property + def hw_gain(self): + """Get/Set the hardwaregain of differential channel.""" + return self._get_iio_attr(self.name, "hardwaregain", False) + + @hw_gain.setter + def hw_gain(self, gain): + """Get/Set the hardwaregain of differential channel.""" + self._set_iio_attr(self.name, "hardwaregain", False, int(gain)) + + @property + def offset(self): + """Get/Set the offset of differential channel.""" + return self._get_iio_attr(self.name, "offset", False, self._ctrl) + + @offset.setter + def offset(self, offset): + """Get/Set the offset of differential channel.""" + self._set_iio_attr(self.name, "offset", False, int(offset), self._ctrl) diff --git a/adi/ad469x.py b/adi/ad469x.py index e84ab89cb..2c37dfc58 100644 --- a/adi/ad469x.py +++ b/adi/ad469x.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad5592r.py b/adi/ad5592r.py index 4abe44c1d..a91cac85c 100644 --- a/adi/ad5592r.py +++ b/adi/ad5592r.py @@ -1,35 +1,6 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# - Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# - Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# - Neither the name of Analog Devices, Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# - The use of this software may or may not infringe the patent rights -# of one or more patent holders. This license does not release you -# from the requirement that you obtain separate licenses from these -# patent holders to use this software. -# - Use of the software either in source or binary form, must be run -# on or directly connected to an Analog Devices Inc. component. -# -# THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A -# PARTICULAR PURPOSE ARE DISCLAIMED. -# -# IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY -# RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# SPDX short identifier: ADIBSD from adi.attribute import attribute from adi.context_manager import context_manager diff --git a/adi/ad5627.py b/adi/ad5627.py index 420b97d12..01e8ab30c 100644 --- a/adi/ad5627.py +++ b/adi/ad5627.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad5686.py b/adi/ad5686.py index a6dc4a37b..8b8bfb3d0 100644 --- a/adi/ad5686.py +++ b/adi/ad5686.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad5940.py b/adi/ad5940.py index 2e8fda4e9..4f8a58881 100644 --- a/adi/ad5940.py +++ b/adi/ad5940.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad6676.py b/adi/ad6676.py index 52013f5ea..5d986c98f 100644 --- a/adi/ad6676.py +++ b/adi/ad6676.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad7124.py b/adi/ad7124.py index 8794c3afa..9eda4a0c0 100644 --- a/adi/ad7124.py +++ b/adi/ad7124.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad717x.py b/adi/ad717x.py index 83ae5d19e..2f30e83dd 100644 --- a/adi/ad717x.py +++ b/adi/ad717x.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad719x.py b/adi/ad719x.py index 47d1e0199..b57c2580d 100644 --- a/adi/ad719x.py +++ b/adi/ad719x.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad7291.py b/adi/ad7291.py index 581a5df2b..17fded6ed 100644 --- a/adi/ad7291.py +++ b/adi/ad7291.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad7606.py b/adi/ad7606.py index 6da861441..e3f1cb7ce 100644 --- a/adi/ad7606.py +++ b/adi/ad7606.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad7689.py b/adi/ad7689.py index 568639e41..233088bb7 100644 --- a/adi/ad7689.py +++ b/adi/ad7689.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad7746.py b/adi/ad7746.py index 9e52db7b7..e5675e3e8 100644 --- a/adi/ad7746.py +++ b/adi/ad7746.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad7768.py b/adi/ad7768.py index 5dc70121b..8ddc0a7a4 100644 --- a/adi/ad7768.py +++ b/adi/ad7768.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad7799.py b/adi/ad7799.py index d01286138..581276a7a 100644 --- a/adi/ad7799.py +++ b/adi/ad7799.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9081.py b/adi/ad9081.py index d90ec3b62..77d2849b1 100644 --- a/adi/ad9081.py +++ b/adi/ad9081.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9081_mc.py b/adi/ad9081_mc.py index 6e5bfce92..bb893b21f 100644 --- a/adi/ad9081_mc.py +++ b/adi/ad9081_mc.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9083.py b/adi/ad9083.py index 8049acad8..e757634bb 100644 --- a/adi/ad9083.py +++ b/adi/ad9083.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9094.py b/adi/ad9094.py index dbf4349d6..eea9d3b97 100644 --- a/adi/ad9094.py +++ b/adi/ad9094.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9136.py b/adi/ad9136.py index 9080bce14..1a5a5ab11 100644 --- a/adi/ad9136.py +++ b/adi/ad9136.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9144.py b/adi/ad9144.py index 54176f88f..a6b6e0800 100644 --- a/adi/ad9144.py +++ b/adi/ad9144.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9152.py b/adi/ad9152.py index 4fb4ba971..1e8946879 100644 --- a/adi/ad9152.py +++ b/adi/ad9152.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9162.py b/adi/ad9162.py index 17661b30b..cd9eb9bbc 100644 --- a/adi/ad9162.py +++ b/adi/ad9162.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9166.py b/adi/ad9166.py index 5b90522ad..c3f454e26 100644 --- a/adi/ad9166.py +++ b/adi/ad9166.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9172.py b/adi/ad9172.py index a8289087a..0a1477e3d 100644 --- a/adi/ad9172.py +++ b/adi/ad9172.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9250.py b/adi/ad9250.py index d2ca678f1..1403e2b2c 100644 --- a/adi/ad9250.py +++ b/adi/ad9250.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9265.py b/adi/ad9265.py index ab97424fd..d20baff4b 100644 --- a/adi/ad9265.py +++ b/adi/ad9265.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad936x.py b/adi/ad936x.py index 083de50f8..80975e5df 100644 --- a/adi/ad936x.py +++ b/adi/ad936x.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9371.py b/adi/ad9371.py index 0d9561d54..553a724f9 100644 --- a/adi/ad9371.py +++ b/adi/ad9371.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9434.py b/adi/ad9434.py index 5cd3417f3..06edf2529 100644 --- a/adi/ad9434.py +++ b/adi/ad9434.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9467.py b/adi/ad9467.py index be917f123..434ba1cb4 100644 --- a/adi/ad9467.py +++ b/adi/ad9467.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9625.py b/adi/ad9625.py index af307b6bd..6be4b4b00 100644 --- a/adi/ad9625.py +++ b/adi/ad9625.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9680.py b/adi/ad9680.py index 0cdd050c2..9cc8b7f52 100644 --- a/adi/ad9680.py +++ b/adi/ad9680.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ad9739a.py b/adi/ad9739a.py index 551e855bb..46b5211e1 100644 --- a/adi/ad9739a.py +++ b/adi/ad9739a.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ada4961.py b/adi/ada4961.py index f1a5be687..c9aa8182a 100644 --- a/adi/ada4961.py +++ b/adi/ada4961.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adaq8092.py b/adi/adaq8092.py index 93312964a..4796ed12c 100644 --- a/adi/adaq8092.py +++ b/adi/adaq8092.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adar1000.py b/adi/adar1000.py index f435ec68a..5314c2d02 100644 --- a/adi/adar1000.py +++ b/adi/adar1000.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adf4159.py b/adi/adf4159.py index ba65768b5..feeabdc5b 100644 --- a/adi/adf4159.py +++ b/adi/adf4159.py @@ -1,107 +1,107 @@ -# Copyright (C) 2021 Analog Devices, Inc. -# -# SPDX short identifier: ADIBSD - - -from adi.attribute import attribute -from adi.context_manager import context_manager - - -class adf4159(context_manager, attribute): - - """ ADF4159 is a 13 GHz Fractional-N Frequency Synthesizer """ - - _device_name = "adf4159" - - def __init__(self, uri=""): - - context_manager.__init__(self, uri, self._device_name) - # Find the device - self._ctrl = self._ctx.find_device(self._device_name) - # Raise an exception if the device isn't found - if not self._ctrl: - raise Exception("ADF4159 device not found") - - @property - def ramp_mode(self): - """Get/Set the Ramp output mode.""" - return self._get_iio_attr_str("altvoltage0", "ramp_mode", True, self._ctrl) - - @ramp_mode.setter - def ramp_mode(self, value): - """Get/Set the Ramp output mode.""" - - valid = self._get_iio_attr_str( - "altvoltage0", "ramp_mode_available", True, self._ctrl - ) - if value not in valid: - - raise ValueError( - f'ramp_mode of "{value}" is invalid. Valid options: "{valid}"' - ) - - self._set_iio_attr("altvoltage0", "ramp_mode", True, value, self._ctrl) - - @property - def enable(self): - """Get/Set the enable status of the RF output.""" - return bool( - int(self._get_iio_attr("altvoltage0", "powerdown", True, self._ctrl)) - ) - - @enable.setter - def enable(self, value): - """Get/Set the enable status of the RF output.""" - self._set_iio_attr("altvoltage0", "powerdown", True, int(value), self._ctrl) - - @property - def frequency(self): - """Get/Set the Output Frequency of PLL.""" - return self._get_iio_attr("altvoltage0", "frequency", True, self._ctrl) - - @frequency.setter - def frequency(self, value): - """Get/Set the Output Frequency of PLL.""" - self._set_iio_attr("altvoltage0", "frequency", True, value, self._ctrl) - - @property - def freq_dev_range(self): - """Get/Set the PLL frequency deviation range.""" - return self._get_iio_attr( - "altvoltage0", "frequency_deviation_range", True, self._ctrl - ) - - @freq_dev_range.setter - def freq_dev_range(self, value): - """Get/Set the PLL frequency deviation range.""" - self._set_iio_attr( - "altvoltage0", "frequency_deviation_range", True, value, self._ctrl - ) - - @property - def freq_dev_step(self): - """Get/Set the PLL frequency deviation step.""" - return self._get_iio_attr( - "altvoltage0", "frequency_deviation_step", True, self._ctrl - ) - - @freq_dev_step.setter - def freq_dev_step(self, value): - """Get/Set the PLL frequency deviation step.""" - self._set_iio_attr( - "altvoltage0", "frequency_deviation_step", True, (1 + value), self._ctrl - ) - - @property - def freq_dev_time(self): - """Get/Set the PLL frequency deviation time.""" - return self._get_iio_attr( - "altvoltage0", "frequency_deviation_time", True, self._ctrl - ) - - @freq_dev_time.setter - def freq_dev_time(self, value): - """Get/Set the PLL frequency deviation time.""" - self._set_iio_attr( - "altvoltage0", "frequency_deviation_time", True, value, self._ctrl - ) +# Copyright (C) 2021-2023 Analog Devices, Inc. +# +# SPDX short identifier: ADIBSD + + +from adi.attribute import attribute +from adi.context_manager import context_manager + + +class adf4159(context_manager, attribute): + + """ ADF4159 is a 13 GHz Fractional-N Frequency Synthesizer """ + + _device_name = "adf4159" + + def __init__(self, uri=""): + + context_manager.__init__(self, uri, self._device_name) + # Find the device + self._ctrl = self._ctx.find_device(self._device_name) + # Raise an exception if the device isn't found + if not self._ctrl: + raise Exception("ADF4159 device not found") + + @property + def ramp_mode(self): + """Get/Set the Ramp output mode.""" + return self._get_iio_attr_str("altvoltage0", "ramp_mode", True, self._ctrl) + + @ramp_mode.setter + def ramp_mode(self, value): + """Get/Set the Ramp output mode.""" + + valid = self._get_iio_attr_str( + "altvoltage0", "ramp_mode_available", True, self._ctrl + ) + if value not in valid: + + raise ValueError( + f'ramp_mode of "{value}" is invalid. Valid options: "{valid}"' + ) + + self._set_iio_attr("altvoltage0", "ramp_mode", True, value, self._ctrl) + + @property + def enable(self): + """Get/Set the enable status of the RF output.""" + return bool( + int(self._get_iio_attr("altvoltage0", "powerdown", True, self._ctrl)) + ) + + @enable.setter + def enable(self, value): + """Get/Set the enable status of the RF output.""" + self._set_iio_attr("altvoltage0", "powerdown", True, int(value), self._ctrl) + + @property + def frequency(self): + """Get/Set the Output Frequency of PLL.""" + return self._get_iio_attr("altvoltage0", "frequency", True, self._ctrl) + + @frequency.setter + def frequency(self, value): + """Get/Set the Output Frequency of PLL.""" + self._set_iio_attr("altvoltage0", "frequency", True, value, self._ctrl) + + @property + def freq_dev_range(self): + """Get/Set the PLL frequency deviation range.""" + return self._get_iio_attr( + "altvoltage0", "frequency_deviation_range", True, self._ctrl + ) + + @freq_dev_range.setter + def freq_dev_range(self, value): + """Get/Set the PLL frequency deviation range.""" + self._set_iio_attr( + "altvoltage0", "frequency_deviation_range", True, value, self._ctrl + ) + + @property + def freq_dev_step(self): + """Get/Set the PLL frequency deviation step.""" + return self._get_iio_attr( + "altvoltage0", "frequency_deviation_step", True, self._ctrl + ) + + @freq_dev_step.setter + def freq_dev_step(self, value): + """Get/Set the PLL frequency deviation step.""" + self._set_iio_attr( + "altvoltage0", "frequency_deviation_step", True, (1 + value), self._ctrl + ) + + @property + def freq_dev_time(self): + """Get/Set the PLL frequency deviation time.""" + return self._get_iio_attr( + "altvoltage0", "frequency_deviation_time", True, self._ctrl + ) + + @freq_dev_time.setter + def freq_dev_time(self, value): + """Get/Set the PLL frequency deviation time.""" + self._set_iio_attr( + "altvoltage0", "frequency_deviation_time", True, value, self._ctrl + ) diff --git a/adi/adf4355.py b/adi/adf4355.py index e253f58e6..ec589e42b 100644 --- a/adi/adf4355.py +++ b/adi/adf4355.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adf4371.py b/adi/adf4371.py index 1e396b841..44f11e48f 100644 --- a/adi/adf4371.py +++ b/adi/adf4371.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adf5610.py b/adi/adf5610.py index 7b8a8bd71..043a50ebd 100644 --- a/adi/adf5610.py +++ b/adi/adf5610.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adg2128.py b/adi/adg2128.py index a1980c7aa..07c86db2f 100644 --- a/adi/adg2128.py +++ b/adi/adg2128.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adis16460.py b/adi/adis16460.py index 29dc0499f..134ad3461 100644 --- a/adi/adis16460.py +++ b/adi/adis16460.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adis16495.py b/adi/adis16495.py index 605a3081a..681c6d558 100644 --- a/adi/adis16495.py +++ b/adi/adis16495.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adis16507.py b/adi/adis16507.py index 7f7813d64..fe5c476da 100644 --- a/adi/adis16507.py +++ b/adi/adis16507.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adl5240.py b/adi/adl5240.py index 61c2f8c88..a9406a864 100644 --- a/adi/adl5240.py +++ b/adi/adl5240.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adl5960.py b/adi/adl5960.py index e2f89eabd..a5d76807f 100644 --- a/adi/adl5960.py +++ b/adi/adl5960.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/admv8818.py b/adi/admv8818.py index c33a7d4bd..1c9f5622b 100644 --- a/adi/admv8818.py +++ b/adi/admv8818.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adpd1080.py b/adi/adpd1080.py index 3fad61ba9..5cd0ee123 100644 --- a/adi/adpd1080.py +++ b/adi/adpd1080.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adpd188.py b/adi/adpd188.py index 6ccf51ca1..0c619eba7 100644 --- a/adi/adpd188.py +++ b/adi/adpd188.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adpd410x.py b/adi/adpd410x.py index 7f292022d..b9623295b 100644 --- a/adi/adpd410x.py +++ b/adi/adpd410x.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adrf5720.py b/adi/adrf5720.py index 8197af364..6939ee8ab 100644 --- a/adi/adrf5720.py +++ b/adi/adrf5720.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adrv9002.py b/adi/adrv9002.py index 1c8cdb76a..6d5b00a96 100644 --- a/adi/adrv9002.py +++ b/adi/adrv9002.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adrv9009.py b/adi/adrv9009.py index cb0610248..20271ad51 100644 --- a/adi/adrv9009.py +++ b/adi/adrv9009.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adrv9009_zu11eg.py b/adi/adrv9009_zu11eg.py index 8837a4121..52036466a 100644 --- a/adi/adrv9009_zu11eg.py +++ b/adi/adrv9009_zu11eg.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adrv9009_zu11eg_fmcomms8.py b/adi/adrv9009_zu11eg_fmcomms8.py index d1459d865..baf94adb8 100644 --- a/adi/adrv9009_zu11eg_fmcomms8.py +++ b/adi/adrv9009_zu11eg_fmcomms8.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adrv9009_zu11eg_multi.py b/adi/adrv9009_zu11eg_multi.py index b4277540f..a67257d6e 100644 --- a/adi/adrv9009_zu11eg_multi.py +++ b/adi/adrv9009_zu11eg_multi.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adt7420.py b/adi/adt7420.py index 5001843ed..b7c4cf83d 100644 --- a/adi/adt7420.py +++ b/adi/adt7420.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adxl313.py b/adi/adxl313.py index cee0a78c4..6e12018df 100644 --- a/adi/adxl313.py +++ b/adi/adxl313.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adxl345.py b/adi/adxl345.py index cadf4e4ed..b86c21c20 100644 --- a/adi/adxl345.py +++ b/adi/adxl345.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adxl355.py b/adi/adxl355.py index 0a225fb3c..1776bad0f 100644 --- a/adi/adxl355.py +++ b/adi/adxl355.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/adxrs290.py b/adi/adxrs290.py index 85b5dc81b..68abc77f5 100644 --- a/adi/adxrs290.py +++ b/adi/adxrs290.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/attribute.py b/adi/attribute.py index 983eaf48c..ce5f0f2f3 100644 --- a/adi/attribute.py +++ b/adi/attribute.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/cn0511.py b/adi/cn0511.py index d9022fc5e..3ab1f8672 100644 --- a/adi/cn0511.py +++ b/adi/cn0511.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD import numpy as np diff --git a/adi/cn0532.py b/adi/cn0532.py index 29d29e4f1..de8a87d4c 100644 --- a/adi/cn0532.py +++ b/adi/cn0532.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/cn0540.py b/adi/cn0540.py index 53a699701..5f18bf7f8 100644 --- a/adi/cn0540.py +++ b/adi/cn0540.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/context_manager.py b/adi/context_manager.py index 0760df0b2..7fbc88d87 100644 --- a/adi/context_manager.py +++ b/adi/context_manager.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/daq2.py b/adi/daq2.py index 0d1d29f6c..81c3b8d9c 100644 --- a/adi/daq2.py +++ b/adi/daq2.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/daq3.py b/adi/daq3.py index dd95d5bdd..cca24f7df 100644 --- a/adi/daq3.py +++ b/adi/daq3.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/dds.py b/adi/dds.py index a40ef0f3d..33c99d544 100644 --- a/adi/dds.py +++ b/adi/dds.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/dsp.py b/adi/dsp.py index ab1fedd4f..876643cc4 100644 --- a/adi/dsp.py +++ b/adi/dsp.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/fmc_vna.py b/adi/fmc_vna.py index afeb2f776..69ed1c27b 100644 --- a/adi/fmc_vna.py +++ b/adi/fmc_vna.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/fmcadc3.py b/adi/fmcadc3.py index 3e9416b54..d58568ab3 100644 --- a/adi/fmcadc3.py +++ b/adi/fmcadc3.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/fmcjesdadc1.py b/adi/fmcjesdadc1.py index cb1cd5a9e..9b275994a 100644 --- a/adi/fmcjesdadc1.py +++ b/adi/fmcjesdadc1.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/fmclidar1.py b/adi/fmclidar1.py index a2364fec4..298029425 100644 --- a/adi/fmclidar1.py +++ b/adi/fmclidar1.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/fmcomms11.py b/adi/fmcomms11.py index 3280cf303..f9aae6607 100644 --- a/adi/fmcomms11.py +++ b/adi/fmcomms11.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/fmcomms5.py b/adi/fmcomms5.py index 182e6a2d8..dfaf5f4c4 100644 --- a/adi/fmcomms5.py +++ b/adi/fmcomms5.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/gen_mux.py b/adi/gen_mux.py index 9c3f9407c..42d7420c9 100644 --- a/adi/gen_mux.py +++ b/adi/gen_mux.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/jesd.py b/adi/jesd.py index 105aae6fa..f4283ba3b 100644 --- a/adi/jesd.py +++ b/adi/jesd.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/jesd_internal.py b/adi/jesd_internal.py index ffe0d88eb..a698238f6 100644 --- a/adi/jesd_internal.py +++ b/adi/jesd_internal.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/lm75.py b/adi/lm75.py index f718f4c6d..5ba0eb815 100644 --- a/adi/lm75.py +++ b/adi/lm75.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ltc2314_14.py b/adi/ltc2314_14.py index 0b920131d..5fc9d09eb 100644 --- a/adi/ltc2314_14.py +++ b/adi/ltc2314_14.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/ltc2387.py b/adi/ltc2387.py index 48be6f0c6..b904a8dad 100644 --- a/adi/ltc2387.py +++ b/adi/ltc2387.py @@ -1,63 +1,63 @@ -# Copyright (C) 2022 Analog Devices, Inc. -# -# SPDX short identifier: ADIBSD - -import numpy as np -from adi.context_manager import context_manager -from adi.rx_tx import rx - - -class ltc2387(rx, context_manager): - - """LTC2387 family devices""" - - _device_name = "" - _rx_data_type = np.int32 - _complex_data = False - _rx_channel_names = ["voltage"] - - def __init__(self, uri="", device_index=0): - - context_manager.__init__(self, uri, self._device_name) - - compatible_parts = [ - "ltc2387", - "ltc2387-16", - "ltc2387-18", - "adaq23876", - "adaq23878", - ] - - self._ctrl = None - index = 0 - - # Selecting the device_index-th device from the xxx2387 family as working device. - for device in self._ctx.devices: - if device.name in compatible_parts: - if index == device_index: - self._ctrl = device - self._rxadc = device - break - else: - index += 1 - - rx.__init__(self) - - @property - def sampling_frequency(self): - - """sample_rate: Sample rate in samples per second. - Valid options are: - Device's maximum sample rate (15000000 in the case of the LTC2387-18) and lower. - Actual sample rates will be the master clock divided by an integer, for example, - the CN0577 has a 120 MHz clock, so available sample rates will be: - 120 MHz / 8 = 15 Msps - 120 MHz / 9 = 13.333 Msps - 120 MHz / 10 = 12 Msps - etc. - """ - return self._get_iio_dev_attr("sampling_frequency") - - @sampling_frequency.setter - def sampling_frequency(self, value): - self._set_iio_dev_attr_str("sampling_frequency", value) +# Copyright (C) 2022-2023 Analog Devices, Inc. +# +# SPDX short identifier: ADIBSD + +import numpy as np +from adi.context_manager import context_manager +from adi.rx_tx import rx + + +class ltc2387(rx, context_manager): + + """LTC2387 family devices""" + + _device_name = "" + _rx_data_type = np.int32 + _complex_data = False + _rx_channel_names = ["voltage"] + + def __init__(self, uri="", device_index=0): + + context_manager.__init__(self, uri, self._device_name) + + compatible_parts = [ + "ltc2387", + "ltc2387-16", + "ltc2387-18", + "adaq23876", + "adaq23878", + ] + + self._ctrl = None + index = 0 + + # Selecting the device_index-th device from the xxx2387 family as working device. + for device in self._ctx.devices: + if device.name in compatible_parts: + if index == device_index: + self._ctrl = device + self._rxadc = device + break + else: + index += 1 + + rx.__init__(self) + + @property + def sampling_frequency(self): + + """sample_rate: Sample rate in samples per second. + Valid options are: + Device's maximum sample rate (15000000 in the case of the LTC2387-18) and lower. + Actual sample rates will be the master clock divided by an integer, for example, + the CN0577 has a 120 MHz clock, so available sample rates will be: + 120 MHz / 8 = 15 Msps + 120 MHz / 9 = 13.333 Msps + 120 MHz / 10 = 12 Msps + etc. + """ + return self._get_iio_dev_attr("sampling_frequency") + + @sampling_frequency.setter + def sampling_frequency(self, value): + self._set_iio_dev_attr_str("sampling_frequency", value) diff --git a/adi/ltc2499.py b/adi/ltc2499.py index bb6c1e8fb..39bd7aa98 100644 --- a/adi/ltc2499.py +++ b/adi/ltc2499.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD from collections import OrderedDict diff --git a/adi/ltc2983.py b/adi/ltc2983.py index 2cf6f61b8..7557f3c50 100644 --- a/adi/ltc2983.py +++ b/adi/ltc2983.py @@ -1,3 +1,6 @@ +# Copyright (C) 2023 Analog Devices, Inc. +# +# SPDX short identifier: ADIBSD import numbers from collections import OrderedDict from collections.abc import Iterable diff --git a/adi/max11205.py b/adi/max11205.py index 77bdece73..93ace91dc 100644 --- a/adi/max11205.py +++ b/adi/max11205.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/max31855.py b/adi/max31855.py index d30e40b7b..9976f7b31 100644 --- a/adi/max31855.py +++ b/adi/max31855.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/max31865.py b/adi/max31865.py index 7b7906bf5..45947a2f9 100644 --- a/adi/max31865.py +++ b/adi/max31865.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD import numpy as np diff --git a/adi/obs.py b/adi/obs.py index 54c2adc3b..ddfe30b9d 100644 --- a/adi/obs.py +++ b/adi/obs.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/one_bit_adc_dac.py b/adi/one_bit_adc_dac.py index 1bda17581..d0ec81701 100644 --- a/adi/one_bit_adc_dac.py +++ b/adi/one_bit_adc_dac.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 Analog Devices, Inc. +# Copyright (C) 2020-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/rx_tx.py b/adi/rx_tx.py index c0eaa09ca..8f19b8adb 100644 --- a/adi/rx_tx.py +++ b/adi/rx_tx.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019 Analog Devices, Inc. +# Copyright (C) 2019-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/sshfs.py b/adi/sshfs.py index 1618a2d6f..af47d3560 100644 --- a/adi/sshfs.py +++ b/adi/sshfs.py @@ -1,5 +1,5 @@ # Copyright (C) 2021 Xiphos Systems Corp. -# +# SKIP LICENSE INSERTION # SPDX short identifier: ADIBSD from contextlib import suppress diff --git a/adi/sync_start.py b/adi/sync_start.py index 18b2fd58e..3b2cebe52 100644 --- a/adi/sync_start.py +++ b/adi/sync_start.py @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Analog Devices, Inc. +# Copyright (C) 2022-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/adi/tdd.py b/adi/tdd.py index fbdd6b75e..dacdf12ee 100644 --- a/adi/tdd.py +++ b/adi/tdd.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Analog Devices, Inc. +# Copyright (C) 2021-2023 Analog Devices, Inc. # # SPDX short identifier: ADIBSD diff --git a/examples/cn0548_py.py b/examples/cn0548_py.py index d9ca9ad5e..1018e44f3 100644 --- a/examples/cn0548_py.py +++ b/examples/cn0548_py.py @@ -2,7 +2,7 @@ # Description: IIO python script for CN0548 # Author: Antoniu Miclaus (antoniu.miclaus@analog.com) # -# Copyright 2021(c) Analog Devices, Inc. +# Copyright 2019-2019-2023(c) Analog Devices, Inc. # # All rights reserved. #