Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AD7944/85/86: Add preliminary support, docs #16

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
80 changes: 80 additions & 0 deletions +adi/+AD7944/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
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','ip: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)
% VoltageScale Voltage Scale
% ADC Voltage scale.
VoltageScale
end

% Channel names
properties (Nontunable, Hidden, Constant)
channel_names = {'voltage0'}
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 Scale
function rValue = get.VoltageScale(obj)
if obj.ConnectedToDevice
rValue = obj.getAttributeDouble('voltage0', 'scale', obj.isOutput);
else
rValue = NaN;
end
end
end

%% API Functions
methods (Hidden, Access = protected)
function setupInit(~)
end
end
end
80 changes: 80 additions & 0 deletions +adi/+AD7985/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
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','ip: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)
% VoltageScale Voltage Scale
% ADC Voltage scale.
VoltageScale
end

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

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

properties (Nontunable, Hidden)
Timeout = Inf
kernelBuffersCount = 1
dataTypeStr = 'uint32'
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 Scale
function rValue = get.VoltageScale(obj)
if obj.ConnectedToDevice
rValue = obj.getAttributeDouble('voltage0', 'scale', obj.isOutput);
else
rValue = NaN;
end
end
end

%% API Functions
methods (Hidden, Access = protected)
function setupInit(~)
end
end
end
80 changes: 80 additions & 0 deletions +adi/+AD7986/Rx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
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','ip: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)
% 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 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
3 changes: 3 additions & 0 deletions +adi/Contents.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
% <a href="matlab:help adi.AD7380 ">AD7380</a> - ADC
% <a href="matlab:help adi.AD7768 ">AD7768</a> - ADC
% <a href="matlab:help adi.AD7768_1 ">AD7768-1</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.AD2S1210 ">AD2S1210</a> - Resolver-to-Digital Converter
% <a href="matlab:help adi.AD5760 ">AD5760</a> - DAC
% <a href="matlab:help adi.AD5780 ">AD5780</a> - DAC
Expand Down
3 changes: 3 additions & 0 deletions CI/doc/SysObjsProps.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@
% * AD463x <AD463x_Rx.html Rx>
% * AD7768 <AD7768_Rx.html Rx>
% * AD7768 <AD4858_Rx.html Rx>
% * AD7944 <AD7944_Rx.html Rx>
% * AD7985 <AD7985_Rx.html Rx>
% * AD7986 <AD7986_Rx.html Rx>
% * AD2S1210 <AD2S1210_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','AD4000', 'AD4001', 'AD4002', 'AD4003', 'AD4004', 'AD4005', 'AD4006', 'AD4007', 'AD4008', 'AD4010', 'AD4011', 'AD4020', 'AD4021', 'AD4022'};
parts = {'AD4630','AD4030','AD463x','AD7768','AD4858','AD2S1210','AD4000', 'AD4001', 'AD4002', 'AD4003', 'AD4004', 'AD4005', 'AD4006', 'AD4007', 'AD4008', 'AD4010', 'AD4011', 'AD4020', 'AD4021', 'AD4022', 'AD7944', 'AD7985', 'AD7986'};
trx_files = {'Rx','Base','Tx'};
for ii = 1:numel(parts)
for jj = 1:numel(trx_files)
Expand Down
5 changes: 4 additions & 1 deletion CI/gen_doc/docs/_pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ The following have device-specific implementations in MATLAB and Simulink. If a
| AD7380 | Zedboard | Yes | No | ADI (2021b) |
| AD7768 | Zedboard | Yes | No | ADI (2021b) |
| AD7768-1 | Zedboard | Yes | No | ADI (2021b) |
| AD7944 | Zedboard | Yes | No | ADI (2021b) |
| AD7985 | Zedboard | Yes | No | ADI (2021b) |
| AD7986 | Zedboard | Yes | No | ADI (2021b) |
| AD4030-24 | Zedboard | Yes | No | ADI (2021b) |
| AD4630-16 | Zedboard | Yes | No | ADI (2021b) |
| AD4630-24 | Zedboard | Yes | No | ADI (2021b) |
Expand All @@ -50,4 +53,4 @@ The following have device-specific implementations in MATLAB and Simulink. If a
| AD4021 | Zedboard | Yes | No | ADI (2021b) |
| AD4022 | Zedboard | Yes | No | ADI (2021b) |
| AD7124-4 | Zedboard | Yes | No | ADI (2021b) |
| AD7124-8 | Zedboard | Yes | No | ADI (2021b) |
| AD7124-8 | 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 @@ -10,6 +10,9 @@
{'AD7380',{'Rx'}}...
, {'AD7768', {'Rx'}}...
, {'AD7768_1', {'Rx'}}...
, {'AD7944', {'Rx'}}...
, {'AD7985', {'Rx'}}...
, {'AD7986', {'Rx'}}...
, {'AD4030', {'Rx'}}...
, {'AD4630_16', {'Rx'}}...
, {'AD4630_24', {'Rx'}}...
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)