diff --git a/+adi/+AD7944/Rx.m b/+adi/+AD7944/Rx.m new file mode 100644 index 0000000..cfd6d5d --- /dev/null +++ b/+adi/+AD7944/Rx.m @@ -0,0 +1,93 @@ +classdef Rx < adi.common.Rx & matlabshared.libiio.base & adi.common.Attribute + % AD7944 Precision ADC Class + % adi.AD7944.Rx Receives data from the AD7944 ADC + % The adi.AD7944.Rx System object is a signal source that can receive + % data from the AD7944. + % + % rx = adi.AD7944.Rx; + % rx = adi.AD7944.Rx('uri','192.168.2.1'); + % + % AD7944 Datasheet + + properties (Nontunable) + % SamplesPerFrame Samples Per Frame + % Number of samples per frame, specified as an even positive + % integer. + SamplesPerFrame = 4096 + + % SampleRate Sample Rate + % Baseband sampling rate in Hz, specified as a scalar + % in samples per second. + SampleRate = 2500000 + end + + properties (Dependent) + % Voltage + % ADC Voltage in mV + Voltage + + % VoltageScale Voltage Scale + % ADC Voltage scale. + VoltageScale + end + + % Channel names + properties (Nontunable, Hidden, Constant) + channel_names = {'voltage0-voltage1'} + end + + % isOutput + properties (Hidden, Nontunable, Access = protected) + isOutput = false + end + + properties (Nontunable, Hidden) + Timeout = Inf + kernelBuffersCount = 1 + dataTypeStr = 'uint16' + phyDevName = 'ad7944' + devName = 'ad7944' + end + + properties (Nontunable, Hidden, Constant) + Type = 'Rx' + end + + properties (Hidden, Constant) + ComplexData = false + end + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@matlabshared.libiio.base(varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + + %% Check Voltage + function rValue = get.Voltage(obj) + if obj.ConnectedToDevice + rValue = obj.getAttributeRAW('voltage0-voltage1', 'raw', obj.isOutput); + else + rValue = NaN; + end + end + + %% Check Voltage Scale + function rValue = get.VoltageScale(obj) + if obj.ConnectedToDevice + rValue = obj.getAttributeDouble('voltage0-voltage1', 'scale', obj.isOutput); + else + rValue = NaN; + end + end + end + + %% API Functions + methods (Hidden, Access = protected) + function setupInit(~) + end + end +end diff --git a/+adi/+AD7985/Rx.m b/+adi/+AD7985/Rx.m new file mode 100644 index 0000000..1106f60 --- /dev/null +++ b/+adi/+AD7985/Rx.m @@ -0,0 +1,93 @@ +classdef Rx < adi.common.Rx & matlabshared.libiio.base & adi.common.Attribute + % AD7985 Precision ADC Class + % adi.AD7985.Rx Receives data from the AD7985 ADC + % The adi.AD7985.Rx System object is a signal source that can receive + % data from the AD7985. + % + % rx = adi.AD7985.Rx; + % rx = adi.AD7985.Rx('uri','192.168.2.1'); + % + % AD7985 Datasheet + + properties (Nontunable) + % SamplesPerFrame Samples Per Frame + % Number of samples per frame, specified as an even positive + % integer. + SamplesPerFrame = 4096 + + % SampleRate Sample Rate + % Baseband sampling rate in Hz, specified as a scalar + % in samples per second. + SampleRate = 2500000 + end + + properties (Dependent) + % Voltage + % ADC Voltage in mV + Voltage + + % VoltageScale Voltage Scale + % ADC Voltage scale. + VoltageScale + end + + % Channel names + properties (Nontunable, Hidden, Constant) + channel_names = {'voltage0-voltage1'} + end + + % isOutput + properties (Hidden, Nontunable, Access = protected) + isOutput = false + end + + properties (Nontunable, Hidden) + Timeout = Inf + kernelBuffersCount = 1 + dataTypeStr = 'uint16' + phyDevName = 'ad7985' + devName = 'ad7985' + end + + properties (Nontunable, Hidden, Constant) + Type = 'Rx' + end + + properties (Hidden, Constant) + ComplexData = false + end + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@matlabshared.libiio.base(varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + + %% Check Voltage + function rValue = get.Voltage(obj) + if obj.ConnectedToDevice + rValue = obj.getAttributeRAW('voltage0-voltage1', 'raw', obj.isOutput); + else + rValue = NaN; + end + end + + %% Check Voltage Scale + function rValue = get.VoltageScale(obj) + if obj.ConnectedToDevice + rValue = obj.getAttributeDouble('voltage0-voltage1', 'scale', obj.isOutput); + else + rValue = NaN; + end + end + end + + %% API Functions + methods (Hidden, Access = protected) + function setupInit(~) + end + end +end diff --git a/+adi/+AD7986/Rx.m b/+adi/+AD7986/Rx.m new file mode 100644 index 0000000..6f12d42 --- /dev/null +++ b/+adi/+AD7986/Rx.m @@ -0,0 +1,93 @@ +classdef Rx < adi.common.Rx & matlabshared.libiio.base & adi.common.Attribute + % AD7986 Precision ADC Class + % adi.AD7986.Rx Receives data from the AD7986 ADC + % The adi.AD7986.Rx System object is a signal source that can receive + % data from the AD7986. + % + % rx = adi.AD7986.Rx; + % rx = adi.AD7986.Rx('uri','192.168.2.1'); + % + % AD7986 Datasheet + + properties (Nontunable) + % SamplesPerFrame Samples Per Frame + % Number of samples per frame, specified as an even positive + % integer. + SamplesPerFrame = 4096 + + % SampleRate Sample Rate + % Baseband sampling rate in Hz, specified as a scalar + % in samples per second. + SampleRate = 2000000 + end + + properties (Dependent) + % Voltage + % ADC Voltage in mV + Voltage + + % VoltageScale Voltage Scale + % ADC Voltage scale. + VoltageScale + end + + % Channel names + properties (Nontunable, Hidden, Constant) + channel_names = {'voltage0-voltage1'} + end + + % isOutput + properties (Hidden, Nontunable, Access = protected) + isOutput = false + end + + properties (Nontunable, Hidden) + Timeout = Inf + kernelBuffersCount = 1 + dataTypeStr = 'int32' + phyDevName = 'ad7986' + devName = 'ad7986' + end + + properties (Nontunable, Hidden, Constant) + Type = 'Rx' + end + + properties (Hidden, Constant) + ComplexData = false + end + + methods + %% Constructor + function obj = Rx(varargin) + obj = obj@matlabshared.libiio.base(varargin{:}); + obj.enableExplicitPolling = false; + obj.EnabledChannels = 1; + obj.BufferTypeConversionEnable = true; + end + + %% Check Voltage + function rValue = get.Voltage(obj) + if obj.ConnectedToDevice + rValue = obj.getAttributeRAW('voltage0-voltage1', 'raw', obj.isOutput); + else + rValue = NaN; + end + end + + %% Check Voltage Scale + function rValue = get.VoltageScale(obj) + if obj.ConnectedToDevice + rValue = obj.getAttributeDouble('voltage0-voltage1', 'scale', obj.isOutput); + else + rValue = NaN; + end + end + end + + %% API Functions + methods (Hidden, Access = protected) + function setupInit(~) + end + end +end diff --git a/+adi/Contents.m b/+adi/Contents.m index 044e80c..330a803 100644 --- a/+adi/Contents.m +++ b/+adi/Contents.m @@ -14,8 +14,11 @@ % AD4858 - ADC % AD2S1210 - Resolver-to-Digital Converter % AD4020 - ADC +% AD7944 - ADC +% AD7985 - ADC +% AD7986 - ADC % AD5760 - DAC % AD5780 - DAC % AD5781 - DAC % AD5790 - DAC -% AD5791 - DAC \ No newline at end of file +% AD5791 - DAC diff --git a/CI/doc/SysObjsProps.m b/CI/doc/SysObjsProps.m index c088b24..059d0b2 100644 --- a/CI/doc/SysObjsProps.m +++ b/CI/doc/SysObjsProps.m @@ -9,3 +9,6 @@ % * AD7768 % * AD2S1210 % * AD4020 +% * AD7944 +% * AD7985 +% * AD7986 diff --git a/CI/doc/genhtml.m b/CI/doc/genhtml.m index 77043be..b12b516 100644 --- a/CI/doc/genhtml.m +++ b/CI/doc/genhtml.m @@ -1,6 +1,6 @@ mfiledir = '..\..\+adi\'; docdir = '..\..\doc\'; -parts = {'AD4630','AD4030','AD463x','AD7768','AD4858','AD2S1210','AD4020'}; +parts = {'AD4630','AD4030','AD463x','AD7768','AD4858','AD2S1210','AD4020','AD7944','AD7985','AD7986'}; trx_files = {'Rx','Base','Tx'}; for ii = 1:numel(parts) for jj = 1:numel(trx_files) diff --git a/CI/gen_doc/docs/_pages/index.md b/CI/gen_doc/docs/_pages/index.md index 2b66df5..8c25530 100644 --- a/CI/gen_doc/docs/_pages/index.md +++ b/CI/gen_doc/docs/_pages/index.md @@ -36,3 +36,6 @@ The following have device-specific implementations in MATLAB and Simulink. If a | AD4858 | Zedboard | Yes | No | ADI (2021b) | | AD2S1210 | Zedboard | Yes | No | ADI (2021b) | | AD4020 | Zedboard | Yes | No | ADI (2021b) | +| AD7944 | Zedboard | Yes | No | ADI (2021b) | +| AD7985 | Zedboard | Yes | No | ADI (2021b) | +| AD7986 | Zedboard | Yes | No | ADI (2021b) | diff --git a/CI/gen_doc/docs/gen_sysobj_doc.m b/CI/gen_doc/docs/gen_sysobj_doc.m index 3031e69..e56cf10 100644 --- a/CI/gen_doc/docs/gen_sysobj_doc.m +++ b/CI/gen_doc/docs/gen_sysobj_doc.m @@ -16,6 +16,9 @@ , {'AD4858', {'Rx'}}... , {'AD2S1210', {'Rx'}}... , {'AD4020', {'Rx'}}... + , {'AD7944', {'Rx'}}... + , {'AD7985', {'Rx'}}... + , {'AD7986', {'Rx'}}... , {'AD5760', {'Tx'}}... , {'AD5780', {'Tx'}}... , {'AD5781', {'Tx'}}... diff --git a/examples/ad7944_DataCapture.m b/examples/ad7944_DataCapture.m new file mode 100644 index 0000000..98103bf --- /dev/null +++ b/examples/ad7944_DataCapture.m @@ -0,0 +1,16 @@ +%% Script for capturing data from a connected AD7944 board + +% Instantiate the system object +rx = adi.AD7944.Rx('uri','ip:analog.local'); + +% Connect to device and initialize data +rx(); + +% Retrieve ADC voltage scale +rx.VoltageScale(); + +% Print system object properties +rx + +% Delete the system object +release(rx)