Skip to content

Commit

Permalink
Merge pull request #2 from analogdevicesinc/dev
Browse files Browse the repository at this point in the history
Master merge before first release
  • Loading branch information
tfcollins authored Sep 14, 2019
2 parents d97a5ff + f352f2a commit 1899219
Show file tree
Hide file tree
Showing 130 changed files with 7,277 additions and 2 deletions.
75 changes: 75 additions & 0 deletions +adi/+AD9144/Base.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
classdef (Abstract) Base < matlabshared.libiio.base & ...
matlab.system.mixin.CustomIcon
%AD9144 Base Summary of this class goes here
% Detailed explanation goes here

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(['AD9144 ',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 = 'AD9144';
end

end
end

60 changes: 60 additions & 0 deletions +adi/+AD9144/Tx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
classdef Tx < adi.AD9144.Base & adi.common.Tx & adi.common.DDS
% adi.AD9144.Tx Transmit data to the AD9144 high speed DAC
% The adi.AD9144.Tx System object is a signal source that can send
% complex data from the AD9144.
%
% tx = adi.AD9144.Tx;
% tx = adi.AD9144.Tx('uri','192.168.2.1');
%
% <a href="http://www.analog.com/media/en/technical-documentation/data-sheets/AD9144.pdf">AD9144 Datasheet</a>
%
% See also adi.DAQ2.Tx

properties (Constant)
%SamplingRate Sampling Rate
% Baseband sampling rate in Hz, specified as a scalar
% in samples per second. This value is constant
SamplingRate = 1e9;
end

properties (Hidden, Nontunable, Access = protected)
isOutput = true;
end

properties(Nontunable, Hidden, Constant)
Type = 'Tx';
channel_names = {'voltage0','voltage1'};
end

properties (Nontunable, Hidden)
devName = 'axi-ad9144-hpc';
end

methods
%% Constructor
function obj = Tx(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 = 'AD9144';
end

end
end

72 changes: 72 additions & 0 deletions +adi/+AD9467/Base.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
classdef (Abstract) Base < adi.common.Attribute & ...
matlabshared.libiio.base & ...
matlab.system.mixin.CustomIcon
%AD9467 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';
phyDevName = 'cf-ad9467-core-lpc';
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(['AD9467 ',obj.Type]);
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 = 'AD9467';
end

end
end

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

properties (Dependent)
%SamplingRate Sampling Rate
% Baseband sampling rate in Hz, specified as a scalar
% in samples per second. This value read from the hardware after
% the object is setup.
SamplingRate
end

properties
%TestMode Test Mode
% Select ADC test mode. Options are:
% 'off'
% 'midscale_short'
% 'pos_fullscale'
% 'neg_fullscale'
% 'checkerboard'
% 'pn_long'
% 'pn_short'
% 'one_zero_toggle'
TestMode = 'off';
%FilterHighPass3dbFrequency Filter High Pass 3db Frequency
% FilterHighPass3dbFrequency
FilterHighPass3dbFrequency = 0;
%Scale Scale
% Scale received data. Possible options are:
% 0.030517 0.032043 0.033569 0.035095 0.036621 0.038146
Scale = 0.038146;
end

properties(Constant, Hidden)
TestModeSet = matlab.system.StringSet({ ...
'off','midscale_short', 'pos_fullscale', 'neg_fullscale',...
'checkerboard', 'pn_long', 'pn_short', 'one_zero_toggle'});
end

properties (Hidden, Nontunable, Access = protected)
isOutput = false;
end

properties(Nontunable, Hidden, Constant)
Type = 'Rx';
channel_names = {'voltage0'};
end

properties (Nontunable, Hidden)
devName = 'cf-ad9467-core-lpc';
end

methods
%% Constructor
function obj = Rx(varargin)
% Returns the matlabshared.libiio.base object
coder.allowpcode('plain');
obj = [email protected](varargin{:});
end
% Check TestMode
function set.TestMode(obj, value)
obj.TestMode = value;
if obj.ConnectedToDevice
id = 'voltage0';
obj.setAttributeRAW(id,'test_mode',value,false);
end
end
% Check FilterHighPass3dbFrequency
function set.FilterHighPass3dbFrequency(obj, value)
obj.FilterHighPass3dbFrequency = value;
if obj.ConnectedToDevice
id = 'voltage0';
obj.setAttributeLongLong(id,'filter_high_pass_3db_frequency',value,false);
end
end
% Check Scale
function set.Scale(obj, value)
options = [0.030517 0.032043 0.033569 0.035095 0.036621 0.038146];
if ~any(value==options)
error(['Scale must be one of ',num2str(options)]);
end
obj.Scale = value;
if obj.ConnectedToDevice
id = 'voltage0';
obj.setAttributeRAW(id,'scale',num2str(value),false);
end
end
function value = get.SamplingRate(obj)
if obj.ConnectedToDevice
id = 'voltage0';
value = obj.getAttributeLongLong(id,'sampling_frequency',false);
else
value = 0;
end
end

end

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

function numOut = getNumOutputsImpl(obj)
numOut = ceil(obj.channelCount) + 1; % +1 for valid
end

function setupInit(obj)
% Write all attributes to device once connected through set
% methods
id = 'voltage0';

obj.setAttributeRAW(id,'test_mode',obj.TestMode,false);
obj.setAttributeLongLong(id,'filter_high_pass_3db_frequency',...
obj.FilterHighPass3dbFrequency,false);
obj.setAttributeRAW(id,'scale',num2str(obj.Scale),false);

obj.setAttributeLongLong(id,'calibbias',obj.CalibrationBias,...
false);
obj.setAttributeRAW(id,'calibphase',...
num2str(obj.CalibrationPhase),false);
obj.setAttributeRAW(id,'calibscale',...
num2str(obj.CalibrationScale),false);


end

% Hide unused parameters when in specific modes
function flag = isInactivePropertyImpl(obj, prop)
% Call the superclass method
flag = [email protected](obj,prop);
end
end

methods (Access=protected)


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 = 'AD9467';
end

end
end

Loading

0 comments on commit 1899219

Please sign in to comment.