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

Add AD762x series support #37

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
22 changes: 22 additions & 0 deletions +adi/+AD7625/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
classdef Rx < adi.AD762x.Base & matlabshared.libiio.base & adi.common.Attribute
% AD7625 Precision ADC Class
%
% adi.AD7625.Rx Receives data from the AD7625 ADC
% The adi.AD7625.Rx System object is a signal source that can receive
% data from the AD7625.
%
% `rx = adi.AD7625.Rx;`
% `rx = adi.AD7625.Rx('uri','192.168.2.1');`
%
% `AD7625 Datasheet <https://www.analog.com/media/en/technical-documentation/data-sheets/AD7625.pdf>`_

methods
%% Constructor
function obj = Rx(varargin)
obj = [email protected]('ad7625', 'ad7625', 'int16', varargin{:});
obj.enableExplicitPolling = false;
obj.EnabledChannels = 1;
obj.BufferTypeConversionEnable = true;
end
end
end
22 changes: 22 additions & 0 deletions +adi/+AD7626/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
classdef Rx < adi.AD762x.Base & matlabshared.libiio.base & adi.common.Attribute
% AD7626 Precision ADC Class
%
% adi.AD7626.Rx Receives data from the AD7626 ADC
% The adi.AD7626.Rx System object is a signal source that can receive
% data from the AD7626.
%
% `rx = adi.AD7626.Rx;`
% `rx = adi.AD7626.Rx('uri','192.168.2.1');`
%
% `AD7626 Datasheet <https://www.analog.com/media/en/technical-documentation/data-sheets/AD7626.pdf>`_

methods
%% Constructor
function obj = Rx(varargin)
obj = [email protected]('ad7626', 'ad7626', 'int16', varargin{:});
obj.enableExplicitPolling = false;
obj.EnabledChannels = 1;
obj.BufferTypeConversionEnable = true;
end
end
end
97 changes: 97 additions & 0 deletions +adi/+AD762x/Base.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
classdef Base < adi.common.Rx & matlabshared.libiio.base & adi.common.Attribute
% AD762X is a family of fully-differential precision ADCs with
% maximum sample rates between 5 MSPS and 10 MSPS
%
% AD7625 is a single-channel, 16-bit signed ADC with a max sample
% rate of 6 MSPS
% AD7626 is a single-channel, 16-bit signed ADC with a max sample
% rate of 10 MSPS
% AD7960 is a single-channel, 18-bit signed ADC with a max sample
% rate of 5 MSPS
% AD7961 is a single-channel, 16-bit signed ADC with a max sample
% rate of 5 MSPS

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 = '500000'
end

properties (Dependent)
% VoltageScale Voltage Scale
% ADC Voltage scale.
VoltageScale

% VoltageOffset Voltage Offset
% ADC Voltage offset.
VoltageOffset
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
phyDevName
devName
end

properties (Nontunable, Hidden, Constant)
Type = 'Rx'
end

properties (Hidden, Constant)
ComplexData = false
end

methods
%% Constructor
function obj = Base(phydev, dev, dtype, varargin)
obj = [email protected](varargin{:});
obj.phyDevName = phydev;
obj.devName = dev;
obj.dataTypeStr = dtype;
end

%% Set SampleRate
function set.SampleRate(obj, value)
% Set device sampling rate
obj.SampleRate = value;
if obj.ConnectedToDevice
obj.setDeviceAttributeRAW('sampling_frequency', num2str(value));
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(obj)
obj.setDeviceAttributeRAW('sampling_frequency', ...
num2str(obj.SampleRate));
end
end
end
22 changes: 22 additions & 0 deletions +adi/+AD7960/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
classdef Rx < adi.AD762x.Base & matlabshared.libiio.base & adi.common.Attribute
% AD7960 Precision ADC Class
%
% adi.AD7960.Rx Receives data from the AD7960 ADC
% The adi.AD7960.Rx System object is a signal source that can receive
% data from the AD7960.
%
% `rx = adi.AD7960.Rx;`
% `rx = adi.AD7960.Rx('uri','192.168.2.1');`
%
% `AD7960 Datasheet <https://www.analog.com/media/en/technical-documentation/data-sheets/ad7960.pdf>`_

methods
%% Constructor
function obj = Rx(varargin)
obj = [email protected]('ad7960', 'ad7960', 'int32', varargin{:});
obj.enableExplicitPolling = false;
obj.EnabledChannels = 1;
obj.BufferTypeConversionEnable = true;
end
end
end
22 changes: 22 additions & 0 deletions +adi/+AD7961/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
classdef Rx < adi.AD762x.Base & matlabshared.libiio.base & adi.common.Attribute
% AD7961 Precision ADC Class
%
% adi.AD7961.Rx Receives data from the AD7961 ADC
% The adi.AD7961.Rx System object is a signal source that can receive
% data from the AD7961.
%
% `rx = adi.AD7961.Rx;`
% `rx = adi.AD7961.Rx('uri','192.168.2.1');`
%
% `AD7961 Datasheet <https://www.analog.com/media/en/technical-documentation/data-sheets/ad7961.pdf>`_

methods
%% Constructor
function obj = Rx(varargin)
obj = [email protected]('ad7961', 'ad7961', 'int16', varargin{:});
obj.enableExplicitPolling = false;
obj.EnabledChannels = 1;
obj.BufferTypeConversionEnable = true;
end
end
end
4 changes: 4 additions & 0 deletions +adi/Contents.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
% <a href="matlab:help adi.ADAQ4224 ">ADAQ4224</a> - ADAQ
% <a href="matlab:help adi.AD4858 ">AD4858</a> - ADC
% <a href="matlab:help adi.AD7380 ">AD7380</a> - ADC
% <a href="matlab:help adi.AD7625 ">AD7625</a> - ADC
% <a href="matlab:help adi.AD7626 ">AD7626</a> - ADC
% <a href="matlab:help adi.AD7960 ">AD7960</a> - ADC
% <a href="matlab:help adi.AD7961 ">AD7961</a> - ADC
% <a href="matlab:help adi.AD7768 ">AD7768</a> - ADC
% <a href="matlab:help adi.AD7768_1 ">AD7768-1</a> - ADC
% <a href="matlab:help adi.AD2S1210 ">AD2S1210</a> - Resolver-to-Digital Converter
Expand Down
4 changes: 4 additions & 0 deletions CI/doc/SysObjsProps.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
% * AD4630 <AD4630_Rx.html Rx>
% * AD4030 <AD4030_Rx.html Rx>
% * AD463x <AD463x_Rx.html Rx>
% * AD7625 <AD7625_Rx.html Rx>
% * AD7626 <AD7626_Rx.html Rx>
% * AD7960 <AD7960_Rx.html Rx>
% * AD7961 <AD7961_Rx.html Rx>
% * AD7768 <AD7768_Rx.html Rx>
% * AD7768 <AD4858_Rx.html Rx>
% * AD2S1210 <AD2S1210_Rx.html Rx>
3 changes: 2 additions & 1 deletion CI/doc/genhtml.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mfiledir = '..\..\+adi\';
docdir = '..\..\doc\';
parts = {'AD4630','AD4030','AD463x','AD7768','AD4858','AD2S1210','AD4000', 'AD4001', 'AD4002', 'AD4003', 'AD4004', 'AD4005', 'AD4006', 'AD4007', 'AD4008', 'AD4010', 'AD4011', 'AD4020', 'AD4021', 'AD4022'};
parts = {'AD4630','AD4030','AD463x','AD7625', 'AD7626', 'AD7960',
'AD7961','AD7768','AD4858','AD2S1210','AD4000', 'AD4001', 'AD4002', 'AD4003', 'AD4004', 'AD4005', 'AD4006', 'AD4007', 'AD4008', 'AD4010', 'AD4011', 'AD4020', 'AD4021', 'AD4022'};
trx_files = {'Rx','Base','Tx'};
for ii = 1:numel(parts)
for jj = 1:numel(trx_files)
Expand Down
6 changes: 5 additions & 1 deletion CI/gen_doc/docs/_pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ The following have device-specific implementations in MATLAB and Simulink. If a
| Evaluation Card | FPGA Board | Streaming Support | Targeting | Variants and Minimum Supported Release |
| --------- | --------- | --------- | --------- | --------- |
| AD7380 | Zedboard | Yes | No | ADI (2021b) |
| AD7625 | Zedboard | Yes | No | ADI (2021b) |
| AD7626 | Zedboard | Yes | No | ADI (2021b) |
| AD7960 | Zedboard | Yes | No | ADI (2021b) |
| AD7961 | Zedboard | Yes | No | ADI (2021b) |
| AD7768 | Zedboard | Yes | No | ADI (2021b) |
| AD7768-1 | Zedboard | Yes | No | ADI (2021b) |
| AD4030-24 | Zedboard | Yes | No | ADI (2021b) |
Expand All @@ -50,4 +54,4 @@ The following have device-specific implementations in MATLAB and Simulink. If a
| AD4021 | Zedboard | Yes | No | ADI (2021b) |
| AD4022 | Zedboard | Yes | No | ADI (2021b) |
| AD7124-4 | Zedboard | Yes | No | ADI (2021b) |
| AD7124-8 | Zedboard | Yes | No | ADI (2021b) |
| AD7124-8 | Zedboard | Yes | No | ADI (2021b) |
4 changes: 4 additions & 0 deletions CI/gen_doc/docs/gen_sysobj_doc.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

rootClasses = {...
{'AD7380',{'Rx'}}...
, {'AD7625', {'Rx'}}...
, {'AD7626', {'Rx'}}...
, {'AD7960', {'Rx'}}...
, {'AD7961', {'Rx'}}...
, {'AD7768', {'Rx'}}...
, {'AD7768_1', {'Rx'}}...
, {'AD4030', {'Rx'}}...
Expand Down
Loading