Skip to content

Commit

Permalink
Merge pull request #129 from analogdevicesinc/ad9208_streaming
Browse files Browse the repository at this point in the history
streaming for AD9208
  • Loading branch information
tfcollins authored Mar 23, 2023
2 parents 55a5a52 + 39e46c6 commit 13892f3
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 0 deletions.
75 changes: 75 additions & 0 deletions +adi/+AD9208/Base.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
classdef (Abstract) Base < ...
adi.common.RxTx & ...
matlabshared.libiio.base
%AD9208 Base Class

properties (Nontunable)
%SamplesPerFrame Samples Per Frame
% Number of samples per frame, specified as an even positive
% integer from 2 to 16,777,216. Using values less than 3660 can
% yield poor performance.
SamplesPerFrame = 2^15;
end

properties(Nontunable, Hidden)
Timeout = Inf;
kernelBuffersCount = 2;
dataTypeStr = 'int16';
end

properties (Abstract, Hidden, Constant)
Type
end

properties (Hidden, Constant)
ComplexData = false;
end

methods
%% Constructor
function obj = Base(varargin)
% Returns the matlabshared.libiio.base object
coder.allowpcode('plain');
obj = [email protected](varargin{:});
end
% Check SamplesPerFrame
function set.SamplesPerFrame(obj, value)
validateattributes( value, { 'double','single' }, ...
{ 'real', 'positive','scalar', 'finite', 'nonnan', 'nonempty','integer','>',0,'<',2^20+1}, ...
'', 'SamplesPerFrame');
obj.SamplesPerFrame = value;
end
end

%% API Functions
methods (Hidden, Access = protected)

function icon = getIconImpl(obj)
icon = sprintf(['AD9208 ',obj.Type]);
end

function setupInit(~)
% Unused
end

end

%% External Dependency Methods
methods (Hidden, Static)

function tf = isSupportedContext(bldCfg)
tf = matlabshared.libiio.ExternalDependency.isSupportedContext(bldCfg);
end

function updateBuildInfo(buildInfo, bldCfg)
% Call the matlabshared.libiio.method first
matlabshared.libiio.ExternalDependency.updateBuildInfo(buildInfo, bldCfg);
end

function bName = getDescriptiveName(~)
bName = 'AD9208';
end

end
end

61 changes: 61 additions & 0 deletions +adi/+AD9208/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
classdef Rx < adi.common.Rx & adi.AD9208.Base
% adi.AD9208.Rx Receive data from the AD9208 high speed multi-channel ADC
% The adi.AD9208.Rx System object is a signal source that can receive
% data from the AD9208.
%
% rx = adi.AD9208.Rx;
% rx = adi.AD9208.Rx('uri','192.168.2.1');
%
% <a href="http://www.analog.com/media/en/technical-documentation/data-sheets/AD9208.pdf">AD9208 Datasheet</a>
%

properties (Constant)
%SamplingRate Sampling Rate
% Baseband sampling rate in Hz, specified as a scalar
% in samples per second. This value is constant
SamplingRate = 125e6;
end
properties (Hidden, Nontunable, Access = protected)
isOutput = false;
end

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

properties (Nontunable, Hidden)
devName = 'axi-AD9208-rx-hpc';
channel_names = {...
'voltage0',...
'voltage1',...
};
end

methods
%% Constructor
function obj = Rx(varargin)
% Returns the matlabshared.libiio.base object
coder.allowpcode('plain');
obj = [email protected](varargin{:});
end
end

%% External Dependency Methods
methods (Hidden, Static)

function tf = isSupportedContext(bldCfg)
tf = matlabshared.libiio.ExternalDependency.isSupportedContext(bldCfg);
end

function updateBuildInfo(buildInfo, bldCfg)
% Call the matlabshared.libiio.method first
matlabshared.libiio.ExternalDependency.updateBuildInfo(buildInfo, bldCfg);
end

function bName = getDescriptiveName(~)
bName = 'AD9208';
end

end
end

0 comments on commit 13892f3

Please sign in to comment.