Skip to content

Commit 8da7a2e

Browse files
author
Ionut.Muthi
committed
update AD9152 to work with AD915x
1 parent e7fd67b commit 8da7a2e

4 files changed

Lines changed: 122 additions & 103 deletions

File tree

+adi/+AD9152/Base.m

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,20 @@
1-
classdef (Abstract) Base < ...
2-
adi.common.RxTx & ...
3-
matlabshared.libiio.base
1+
classdef (Abstract) Base < adi.AD915x.Base
42
%AD9152 Base
53

6-
properties (Nontunable)
7-
%SamplesPerFrame Samples Per Frame
8-
% Number of samples per frame, specified as an even positive
9-
% integer from 2 to 16,777,216. Using values less than 3660 can
10-
% yield poor performance.
11-
SamplesPerFrame = 2^15;
12-
end
13-
14-
properties(Nontunable, Hidden)
15-
Timeout = Inf;
16-
kernelBuffersCount = 2;
17-
dataTypeStr = 'int16';
18-
end
19-
20-
properties (Abstract, Hidden, Constant)
21-
Type
22-
end
23-
24-
properties (Hidden, Constant)
25-
ComplexData = false;
26-
end
27-
28-
methods
29-
%% Constructor
30-
function obj = Base(varargin)
31-
% Returns the matlabshared.libiio.base object
32-
coder.allowpcode('plain');
33-
obj = obj@matlabshared.libiio.base(varargin{:});
34-
end
35-
% Check SamplesPerFrame
36-
function set.SamplesPerFrame(obj, value)
37-
validateattributes( value, { 'double','single' }, ...
38-
{ 'real', 'positive','scalar', 'finite', 'nonnan', 'nonempty','integer','>',0,'<',2^20+1}, ...
39-
'', 'SamplesPerFrame');
40-
obj.SamplesPerFrame = value;
41-
end
42-
end
43-
4+
445
%% API Functions
456
methods (Hidden, Access = protected)
467

478
function icon = getIconImpl(obj)
489
icon = sprintf(['AD9152 ',obj.Type]);
4910
end
50-
51-
function setupInit(~)
52-
% Unused
53-
end
54-
5511
end
5612

5713
%% External Dependency Methods
5814
methods (Hidden, Static)
59-
60-
function tf = isSupportedContext(bldCfg)
61-
tf = matlabshared.libiio.ExternalDependency.isSupportedContext(bldCfg);
62-
end
63-
64-
function updateBuildInfo(buildInfo, bldCfg)
65-
% Call the matlabshared.libiio.method first
66-
matlabshared.libiio.ExternalDependency.updateBuildInfo(buildInfo, bldCfg);
67-
end
68-
6915
function bName = getDescriptiveName(~)
7016
bName = 'AD9152';
7117
end
72-
7318
end
7419
end
7520

+adi/+AD9152/Tx.m

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
classdef Tx < adi.common.Tx & adi.AD9152.Base & adi.common.DDS & adi.common.Attribute
1+
classdef Tx < adi.AD915x.Tx & adi.AD9152.Base
22
% adi.AD9152.Tx Transmit data to the AD9144 high speed DAC
33
% The adi.AD9152.Tx System object is a signal source that can send
44
% complex data from the AD9144.
@@ -10,60 +10,18 @@
1010
%
1111
% See also adi.DAQ3.Tx
1212

13-
properties (Dependent)
14-
%SamplingRate Sampling Rate
15-
% Baseband sampling rate in Hz, specified as a scalar
16-
% in samples per second. This value is constant
17-
SamplingRate
18-
end
19-
20-
properties (Hidden, Nontunable, Access = protected)
21-
isOutput = true;
22-
end
23-
24-
properties(Nontunable, Hidden, Constant)
25-
Type = 'Tx';
26-
end
27-
2813
properties (Nontunable, Hidden)
2914
devName = 'axi-ad9152-hpc';
3015
phyDevName = 'axi-ad9152-hpc';
3116
channel_names = {'voltage0','voltage1'};
32-
end
33-
34-
methods
35-
%% Constructor
36-
function obj = Tx(varargin)
37-
% Returns the matlabshared.libiio.base object
38-
coder.allowpcode('plain');
39-
obj = obj@adi.AD9152.Base(varargin{:});
40-
end
41-
42-
function value = get.SamplingRate(obj)
43-
if obj.ConnectedToDevice
44-
value= obj.getAttributeLongLong('voltage0','sampling_frequency',true);
45-
else
46-
value = NaN;
47-
end
48-
end
49-
end
17+
end
5018

5119
%% External Dependency Methods
5220
methods (Hidden, Static)
53-
54-
function tf = isSupportedContext(bldCfg)
55-
tf = matlabshared.libiio.ExternalDependency.isSupportedContext(bldCfg);
56-
end
57-
58-
function updateBuildInfo(buildInfo, bldCfg)
59-
% Call the matlabshared.libiio.method first
60-
matlabshared.libiio.ExternalDependency.updateBuildInfo(buildInfo, bldCfg);
61-
end
62-
21+
6322
function bName = getDescriptiveName(~)
6423
bName = 'AD9152';
65-
end
66-
24+
end
6725
end
6826
end
6927

+adi/+internal/+AD915x/Base.m

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
classdef (Abstract) Base < ...
2+
adi.common.RxTx & ...
3+
matlabshared.libiio.base
4+
%AD915x Base
5+
6+
properties (Nontunable)
7+
%SamplesPerFrame Samples Per Frame
8+
% Number of samples per frame, specified as an even positive
9+
% integer from 2 to 16,777,216. Using values less than 3660 can
10+
% yield poor performance.
11+
SamplesPerFrame = 2^15;
12+
end
13+
14+
properties(Nontunable, Hidden)
15+
Timeout = Inf;
16+
kernelBuffersCount = 2;
17+
dataTypeStr = 'int16';
18+
end
19+
20+
properties (Abstract, Hidden, Constant)
21+
Type
22+
end
23+
24+
properties (Hidden, Constant)
25+
ComplexData = false;
26+
end
27+
28+
methods
29+
%% Constructor
30+
function obj = Base(varargin)
31+
% Returns the matlabshared.libiio.base object
32+
coder.allowpcode('plain');
33+
obj = obj@matlabshared.libiio.base(varargin{:});
34+
end
35+
% Check SamplesPerFrame
36+
function set.SamplesPerFrame(obj, value)
37+
validateattributes( value, { 'double','single' }, ...
38+
{ 'real', 'positive','scalar', 'finite', 'nonnan', 'nonempty','integer','>',0,'<',2^20+1}, ...
39+
'', 'SamplesPerFrame');
40+
obj.SamplesPerFrame = value;
41+
end
42+
end
43+
44+
%% API Functions
45+
methods (Hidden, Access = protected)
46+
function setupInit(~)
47+
% Unused
48+
end
49+
50+
end
51+
52+
%% External Dependency Methods
53+
methods (Hidden, Static)
54+
55+
function tf = isSupportedContext(bldCfg)
56+
tf = matlabshared.libiio.ExternalDependency.isSupportedContext(bldCfg);
57+
end
58+
59+
function updateBuildInfo(buildInfo, bldCfg)
60+
% Call the matlabshared.libiio.method first
61+
matlabshared.libiio.ExternalDependency.updateBuildInfo(buildInfo, bldCfg);
62+
end
63+
end
64+
end
65+

+adi/+internal/+AD915x/Tx.m

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
classdef Tx < adi.common.Tx & adi.AD915x.Base & adi.common.DDS & adi.common.Attribute
2+
% adi.AD915x.Tx Transmit data to the AD9144 high speed DAC
3+
%
4+
%
5+
6+
properties (Dependent)
7+
%SamplingRate Sampling Rate
8+
% Baseband sampling rate in Hz, specified as a scalar
9+
% in samples per second. This value is constant
10+
SamplingRate
11+
end
12+
13+
properties (Hidden, Nontunable, Access = protected)
14+
isOutput = true;
15+
end
16+
17+
properties(Nontunable, Hidden, Constant)
18+
Type = 'Tx';
19+
end
20+
21+
methods
22+
%% Constructor
23+
function obj = Tx(varargin)
24+
% Returns the matlabshared.libiio.base object
25+
coder.allowpcode('plain');
26+
obj = obj@adi.AD915x.Base(varargin{:});
27+
end
28+
29+
function value = get.SamplingRate(obj)
30+
if obj.ConnectedToDevice
31+
value= obj.getAttributeLongLong('voltage0','sampling_frequency',true);
32+
else
33+
value = NaN;
34+
end
35+
end
36+
end
37+
38+
%% External Dependency Methods
39+
methods (Hidden, Static)
40+
41+
function tf = isSupportedContext(bldCfg)
42+
tf = matlabshared.libiio.ExternalDependency.isSupportedContext(bldCfg);
43+
end
44+
45+
function updateBuildInfo(buildInfo, bldCfg)
46+
% Call the matlabshared.libiio.method first
47+
matlabshared.libiio.ExternalDependency.updateBuildInfo(buildInfo, bldCfg);
48+
end
49+
end
50+
end
51+

0 commit comments

Comments
 (0)