-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AD7944/85/86: Add preliminary support, docs
Signed-off-by: Trevor Gamblin <[email protected]>
- Loading branch information
Showing
9 changed files
with
309 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |