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

AD400x: Add support for AD400x series #17

Merged
merged 1 commit into from
Mar 6, 2024
Merged
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
21 changes: 21 additions & 0 deletions +adi/+AD4000/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute
% AD4000 Precision ADC Class
% adi.AD4000.Rx Receives data from the AD4000 ADC
% The adi.AD4000.Rx System object is a signal source that can receive
% data from the AD4000.
%
% rx = adi.AD4000.Rx;
% rx = adi.AD4000.Rx('uri','192.168.2.1');
%
% <a href="https://www.analog.com/media/en/technical-documentation/data-sheets/ad4000-4004-4008.pdf">AD4000 Datasheet</a>

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

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

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

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

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

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

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

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

methods
%% Constructor
function obj = Rx(varargin)
obj = [email protected]('ad4008', 'ad4008', 'int16', varargin{:});
obj.enableExplicitPolling = false;
obj.EnabledChannels = 1;
obj.BufferTypeConversionEnable = true;
end
end
end
102 changes: 102 additions & 0 deletions +adi/+AD400x/Base.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
classdef Base < adi.common.Rx & matlabshared.libiio.base & adi.common.Attribute
% AD400X is a family of precision ADCs with sample rates between 500
% kSPS and 2 MSPS
%
% AD4000/AD4004/AD4008 are single-channel, 16-bit unsigned ADCs
% AD4001/AD4005 are single-channel, 16-bit signed ADCs
% AD4002/AD4006/AD4010 are single-channel, 18-bit unsigned ADCs
% AD4003/AD4007/AD4011 are single-channel, 18-bit signed ADCs

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'}
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', 'scale', obj.isOutput);
else
rValue = NaN;
end
end

%% Check Voltage Offset
function rValue = get.VoltageOffset(obj)
if obj.ConnectedToDevice
rValue = obj.getAttributeDouble('voltage0', 'offset', 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
21 changes: 21 additions & 0 deletions +adi/+AD4010/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute
% AD4010 Precision ADC Class
% adi.AD4010.Rx Receives data from the AD4010 ADC
% The adi.AD4010.Rx System object is a signal source that can receive
% data from the AD4010.
%
% rx = adi.AD4010.Rx;
% rx = adi.AD4010.Rx('uri','192.168.2.1');
%
% <a href="https://www.analog.com/media/en/technical-documentation/data-sheets/ad4002-4006-4010.pdf">AD4010 Datasheet</a>

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

methods
%% Constructor
function obj = Rx(varargin)
obj = [email protected]('ad4011', 'ad4011', 'int32', varargin{:});
obj.enableExplicitPolling = false;
obj.EnabledChannels = 1;
obj.BufferTypeConversionEnable = true;
end
end
end
Loading
Loading