Skip to content

Commit

Permalink
AD7944/85/86: Add preliminary support, docs
Browse files Browse the repository at this point in the history
Signed-off-by: Trevor Gamblin <[email protected]>
  • Loading branch information
threexc committed Feb 13, 2024
1 parent 7ea4c14 commit 9a98075
Show file tree
Hide file tree
Showing 9 changed files with 309 additions and 2 deletions.
93 changes: 93 additions & 0 deletions +adi/+AD7944/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
classdef Rx < adi.common.Rx & matlabshared.libiio.base & adi.common.Attribute
% AD7944 Precision ADC Class
% adi.AD7944.Rx Receives data from the AD7944 ADC
% The adi.AD7944.Rx System object is a signal source that can receive
% data from the AD7944.
%
% rx = adi.AD7944.Rx;
% rx = adi.AD7944.Rx('uri','192.168.2.1');
%
% <a href="https://www.analog.com/media/en/technical-documentation/data-sheets/ad7944.pdf">AD7944 Datasheet</a>

properties (Nontunable)
% SamplesPerFrame Samples Per Frame
% Number of samples per frame, specified as an even positive
% integer.
SamplesPerFrame = 4096

% SampleRate Sample Rate
% Baseband sampling rate in Hz, specified as a scalar
% in samples per second.
SampleRate = 2500000
end

properties (Dependent)
% Voltage
% ADC Voltage in mV
Voltage

% VoltageScale Voltage Scale
% ADC Voltage scale.
VoltageScale
end

% Channel names
properties (Nontunable, Hidden, Constant)
channel_names = {'voltage0-voltage1'}
end

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

properties (Nontunable, Hidden)
Timeout = Inf
kernelBuffersCount = 1
dataTypeStr = 'uint16'
phyDevName = 'ad7944'
devName = 'ad7944'
end

properties (Nontunable, Hidden, Constant)
Type = 'Rx'
end

properties (Hidden, Constant)
ComplexData = false
end

methods
%% Constructor
function obj = Rx(varargin)
obj = [email protected](varargin{:});
obj.enableExplicitPolling = false;
obj.EnabledChannels = 1;
obj.BufferTypeConversionEnable = true;
end

%% Check Voltage
function rValue = get.Voltage(obj)
if obj.ConnectedToDevice
rValue = obj.getAttributeRAW('voltage0-voltage1', 'raw', obj.isOutput);
else
rValue = NaN;
end
end

%% Check Voltage Scale
function rValue = get.VoltageScale(obj)
if obj.ConnectedToDevice
rValue = obj.getAttributeDouble('voltage0-voltage1', 'scale', obj.isOutput);
else
rValue = NaN;
end
end
end

%% API Functions
methods (Hidden, Access = protected)
function setupInit(~)
end
end
end
93 changes: 93 additions & 0 deletions +adi/+AD7985/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
classdef Rx < adi.common.Rx & matlabshared.libiio.base & adi.common.Attribute
% AD7985 Precision ADC Class
% adi.AD7985.Rx Receives data from the AD7985 ADC
% The adi.AD7985.Rx System object is a signal source that can receive
% data from the AD7985.
%
% rx = adi.AD7985.Rx;
% rx = adi.AD7985.Rx('uri','192.168.2.1');
%
% <a href="https://www.analog.com/media/en/technical-documentation/data-sheets/ad7985.pdf">AD7985 Datasheet</a>

properties (Nontunable)
% SamplesPerFrame Samples Per Frame
% Number of samples per frame, specified as an even positive
% integer.
SamplesPerFrame = 4096

% SampleRate Sample Rate
% Baseband sampling rate in Hz, specified as a scalar
% in samples per second.
SampleRate = 2500000
end

properties (Dependent)
% Voltage
% ADC Voltage in mV
Voltage

% VoltageScale Voltage Scale
% ADC Voltage scale.
VoltageScale
end

% Channel names
properties (Nontunable, Hidden, Constant)
channel_names = {'voltage0-voltage1'}
end

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

properties (Nontunable, Hidden)
Timeout = Inf
kernelBuffersCount = 1
dataTypeStr = 'uint16'
phyDevName = 'ad7985'
devName = 'ad7985'
end

properties (Nontunable, Hidden, Constant)
Type = 'Rx'
end

properties (Hidden, Constant)
ComplexData = false
end

methods
%% Constructor
function obj = Rx(varargin)
obj = [email protected](varargin{:});
obj.enableExplicitPolling = false;
obj.EnabledChannels = 1;
obj.BufferTypeConversionEnable = true;
end

%% Check Voltage
function rValue = get.Voltage(obj)
if obj.ConnectedToDevice
rValue = obj.getAttributeRAW('voltage0-voltage1', 'raw', obj.isOutput);
else
rValue = NaN;
end
end

%% Check Voltage Scale
function rValue = get.VoltageScale(obj)
if obj.ConnectedToDevice
rValue = obj.getAttributeDouble('voltage0-voltage1', 'scale', obj.isOutput);
else
rValue = NaN;
end
end
end

%% API Functions
methods (Hidden, Access = protected)
function setupInit(~)
end
end
end
93 changes: 93 additions & 0 deletions +adi/+AD7986/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
classdef Rx < adi.common.Rx & matlabshared.libiio.base & adi.common.Attribute
% AD7986 Precision ADC Class
% adi.AD7986.Rx Receives data from the AD7986 ADC
% The adi.AD7986.Rx System object is a signal source that can receive
% data from the AD7986.
%
% rx = adi.AD7986.Rx;
% rx = adi.AD7986.Rx('uri','192.168.2.1');
%
% <a href="https://www.analog.com/media/en/technical-documentation/data-sheets/ad7986.pdf">AD7986 Datasheet</a>

properties (Nontunable)
% SamplesPerFrame Samples Per Frame
% Number of samples per frame, specified as an even positive
% integer.
SamplesPerFrame = 4096

% SampleRate Sample Rate
% Baseband sampling rate in Hz, specified as a scalar
% in samples per second.
SampleRate = 2000000
end

properties (Dependent)
% Voltage
% ADC Voltage in mV
Voltage

% VoltageScale Voltage Scale
% ADC Voltage scale.
VoltageScale
end

% Channel names
properties (Nontunable, Hidden, Constant)
channel_names = {'voltage0-voltage1'}
end

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

properties (Nontunable, Hidden)
Timeout = Inf
kernelBuffersCount = 1
dataTypeStr = 'int32'
phyDevName = 'ad7986'
devName = 'ad7986'
end

properties (Nontunable, Hidden, Constant)
Type = 'Rx'
end

properties (Hidden, Constant)
ComplexData = false
end

methods
%% Constructor
function obj = Rx(varargin)
obj = [email protected](varargin{:});
obj.enableExplicitPolling = false;
obj.EnabledChannels = 1;
obj.BufferTypeConversionEnable = true;
end

%% Check Voltage
function rValue = get.Voltage(obj)
if obj.ConnectedToDevice
rValue = obj.getAttributeRAW('voltage0-voltage1', 'raw', obj.isOutput);
else
rValue = NaN;
end
end

%% Check Voltage Scale
function rValue = get.VoltageScale(obj)
if obj.ConnectedToDevice
rValue = obj.getAttributeDouble('voltage0-voltage1', 'scale', obj.isOutput);
else
rValue = NaN;
end
end
end

%% API Functions
methods (Hidden, Access = protected)
function setupInit(~)
end
end
end
5 changes: 4 additions & 1 deletion +adi/Contents.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
% <a href="matlab:help adi.AD4858 ">AD4858</a> - ADC
% <a href="matlab:help adi.AD2S1210 ">AD2S1210</a> - Resolver-to-Digital Converter
% <a href="matlab:help adi.AD4020 ">AD4020</a> - ADC
% <a href="matlab:help adi.AD7944 ">AD7944</a> - ADC
% <a href="matlab:help adi.AD7985 ">AD7985</a> - ADC
% <a href="matlab:help adi.AD7986 ">AD7986</a> - ADC
% <a href="matlab:help adi.AD5760 ">AD5760</a> - DAC
% <a href="matlab:help adi.AD5780 ">AD5780</a> - DAC
% <a href="matlab:help adi.AD5781 ">AD5781</a> - DAC
% <a href="matlab:help adi.AD5790 ">AD5790</a> - DAC
% <a href="matlab:help adi.AD5791 ">AD5791</a> - DAC
% <a href="matlab:help adi.AD5791 ">AD5791</a> - DAC
3 changes: 3 additions & 0 deletions CI/doc/SysObjsProps.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
% * AD7768 <AD4858_Rx.html Rx>
% * AD2S1210 <AD2S1210_Rx.html Rx>
% * AD4020 <AD4020_Rx.html Rx>
% * AD7944 <AD7944_Rx.html Rx>
% * AD7985 <AD7985_Rx.html Rx>
% * AD7986 <AD7986_Rx.html Rx>
2 changes: 1 addition & 1 deletion CI/doc/genhtml.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mfiledir = '..\..\+adi\';
docdir = '..\..\doc\';
parts = {'AD4630','AD4030','AD463x','AD7768','AD4858','AD2S1210','AD4020'};
parts = {'AD4630','AD4030','AD463x','AD7768','AD4858','AD2S1210','AD4020','AD7944','AD7985','AD7986'};
trx_files = {'Rx','Base','Tx'};
for ii = 1:numel(parts)
for jj = 1:numel(trx_files)
Expand Down
3 changes: 3 additions & 0 deletions CI/gen_doc/docs/_pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ The following have device-specific implementations in MATLAB and Simulink. If a
| AD4858 | Zedboard | Yes | No | ADI (2021b) |
| AD2S1210 | Zedboard | Yes | No | ADI (2021b) |
| AD4020 | Zedboard | Yes | No | ADI (2021b) |
| AD7944 | Zedboard | Yes | No | ADI (2021b) |
| AD7985 | Zedboard | Yes | No | ADI (2021b) |
| AD7986 | Zedboard | Yes | No | ADI (2021b) |
3 changes: 3 additions & 0 deletions CI/gen_doc/docs/gen_sysobj_doc.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
, {'AD4858', {'Rx'}}...
, {'AD2S1210', {'Rx'}}...
, {'AD4020', {'Rx'}}...
, {'AD7944', {'Rx'}}...
, {'AD7985', {'Rx'}}...
, {'AD7986', {'Rx'}}...
, {'AD5760', {'Tx'}}...
, {'AD5780', {'Tx'}}...
, {'AD5781', {'Tx'}}...
Expand Down
16 changes: 16 additions & 0 deletions examples/ad7944_DataCapture.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
%% Script for capturing data from a connected AD7944 board

% Instantiate the system object
rx = adi.AD7944.Rx('uri','ip:analog.local');

% Connect to device and initialize data
rx();

% Retrieve ADC voltage scale
rx.VoltageScale();

% Print system object properties
rx

% Delete the system object
release(rx)

0 comments on commit 9a98075

Please sign in to comment.