Skip to content
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
59 changes: 2 additions & 57 deletions +adi/+AD9152/Base.m
Original file line number Diff line number Diff line change
@@ -1,75 +1,20 @@
classdef (Abstract) Base < ...
adi.common.RxTx & ...
matlabshared.libiio.base
classdef (Abstract) Base < adi.AD915x.Base
%AD9152 Base

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 = obj@matlabshared.libiio.base(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(['AD9152 ',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 = 'AD9152';
end

end
end

50 changes: 4 additions & 46 deletions +adi/+AD9152/Tx.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
classdef Tx < adi.common.Tx & adi.AD9152.Base & adi.common.DDS & adi.common.Attribute
classdef Tx < adi.AD915x.Tx & adi.AD9152.Base
% adi.AD9152.Tx Transmit data to the AD9144 high speed DAC
Comment thread
IonutMuthi marked this conversation as resolved.
% The adi.AD9152.Tx System object is a signal source that can send
% complex data from the AD9144.
Expand All @@ -10,60 +10,18 @@
%
% See also adi.DAQ3.Tx

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

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

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

properties (Nontunable, Hidden)
devName = 'axi-ad9152-hpc';
phyDevName = 'axi-ad9152-hpc';
channel_names = {'voltage0','voltage1'};
end

methods
%% Constructor
function obj = Tx(varargin)
% Returns the matlabshared.libiio.base object
coder.allowpcode('plain');
obj = obj@adi.AD9152.Base(varargin{:});
end

function value = get.SamplingRate(obj)
if obj.ConnectedToDevice
value= obj.getAttributeLongLong('voltage0','sampling_frequency',true);
else
value = NaN;
end
end
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 = 'AD9152';
end

end
end
end

65 changes: 65 additions & 0 deletions +adi/+internal/+AD915x/Base.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
classdef (Abstract) Base < ...
adi.common.RxTx & ...
matlabshared.libiio.base
%AD915x Base

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 = obj@matlabshared.libiio.base(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 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
end
end

51 changes: 51 additions & 0 deletions +adi/+internal/+AD915x/Tx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
classdef Tx < adi.common.Tx & adi.AD915x.Base & adi.common.DDS & adi.common.Attribute
% adi.AD915x.Tx
%
%

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

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

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

methods
%% Constructor
function obj = Tx(varargin)
% Returns the matlabshared.libiio.base object
coder.allowpcode('plain');
obj = obj@adi.AD915x.Base(varargin{:});
end

function value = get.SamplingRate(obj)
if obj.ConnectedToDevice
value= obj.getAttributeLongLong('voltage0','sampling_frequency',true);
else
value = NaN;
end
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
end
end