diff --git a/+adi/+AD9152/Base.m b/+adi/+AD9152/Base.m index f94415d6..f6e46506 100644 --- a/+adi/+AD9152/Base.m +++ b/+adi/+AD9152/Base.m @@ -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 diff --git a/+adi/+AD9152/Tx.m b/+adi/+AD9152/Tx.m index 3f21525e..93892004 100644 --- a/+adi/+AD9152/Tx.m +++ b/+adi/+AD9152/Tx.m @@ -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 % The adi.AD9152.Tx System object is a signal source that can send % complex data from the AD9144. @@ -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 diff --git a/+adi/+internal/+AD915x/Base.m b/+adi/+internal/+AD915x/Base.m new file mode 100644 index 00000000..7e498454 --- /dev/null +++ b/+adi/+internal/+AD915x/Base.m @@ -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 + diff --git a/+adi/+internal/+AD915x/Tx.m b/+adi/+internal/+AD915x/Tx.m new file mode 100644 index 00000000..d294b455 --- /dev/null +++ b/+adi/+internal/+AD915x/Tx.m @@ -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 +