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
32 changes: 32 additions & 0 deletions +adi/+AD9172/Tx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
classdef Tx < adi.AD917x.Tx & adi.AD917x.Base
% adi.AD9172.Tx Transmit data to the AD9172 high speed DAC
%
% tx = adi.AD9172.Tx;
% tx = adi.AD9172.Tx('uri','192.168.2.1');
%
% <a href="http://www.analog.com/media/en/technical-documentation/data-sheets/ad9172.pdf">AD9172 Datasheet</a>
%

properties (Nontunable, Hidden)
devName = 'axi-ad9172-hpc';
channel_names = {'voltage0_i','voltage0_q'};
end

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

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


%% External Dependency Methods
methods (Hidden, Static)
function bName = getDescriptiveName(~)
bName = 'AD9172';
end

end
end

65 changes: 65 additions & 0 deletions +adi/+internal/+AD917x/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
%AD917x 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 = true;
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

45 changes: 45 additions & 0 deletions +adi/+internal/+AD917x/Tx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
classdef Tx < adi.common.Tx & adi.AD917x.Base & adi.common.DDS
% adi.AD917x.Tx
%
% <a href="https://www.analog.com/en/design-center/evaluation-hardware-and-software/software/AD917x-API.html#software-overview">AD917x </a>
%


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

methods
%% Constructor
function obj = Tx(varargin)
% Returns the matlabshared.libiio.base object
coder.allowpcode('plain');
obj = obj@adi.AD917x.Base(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
end
end

21 changes: 21 additions & 0 deletions test/AD9172Test.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
classdef AD9172Test < matlab.unittest.TestCase
properties
uri = 'ip:analog.local';
author = 'ADI';
end


methods(Test)
function testAD9172Tx(testCase)
tx = adi.AD9172.Tx('uri',testCase.uri);
tx.EnableCyclicBuffers = true;
x = linspace(-pi,pi,2^15).';

b1 = sin(x);
tx(b1);
tx.step(b1);
end
end

end