-
Notifications
You must be signed in to change notification settings - Fork 11
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
adi:ad559xr:Added Matlab Support #47
Merged
+170
−1
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,26 @@ | ||
classdef Rx < adi.common.Rx & adi.common.RxTx ... | ||
& adi.AD559xr.Base | ||
% AD5592r Precision ADC Class | ||
% adi.AD5592r.Rx Receives data from the AD5592r ADC | ||
% The adi.AD5592r.Rx System object is a signal source that can receive | ||
% data from the AD5592r. | ||
% | ||
% rx = adi.AD5592r.Rx; | ||
% rx = adi.AD5592r.Rx('uri','ip:192.168.2.1'); | ||
% | ||
% <a href="https://www.analog.com/media/en/technical-documentation/data-sheets/ad5592r.pdf"</a> | ||
|
||
properties (Nontunable, Hidden) | ||
channel_names = {'voltage0','voltage1','voltage2'... | ||
'voltage3','voltage4','voltage5','voltage6','voltage7'}; | ||
end | ||
|
||
methods | ||
%% Constructor | ||
function obj = Rx(varargin) | ||
obj = obj@adi.AD559xr.Base('ad5592r','ad5592r',varargin{:}); | ||
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,26 @@ | ||
classdef Rx < adi.common.Rx & adi.common.RxTx ... | ||
& adi.AD559xr.Base | ||
% AD5593r Precision ADC Class | ||
% adi.AD5593r.Rx Receives data from the AD5593r ADC | ||
% The adi.AD5593r.Rx System object is a signal source that can receive | ||
% data from the AD5593r. | ||
% | ||
% rx = adi.AD5593r.Rx; | ||
% rx = adi.AD5593r.Rx('uri','ip:192.168.2.1'); | ||
% | ||
% <a href="https://www.analog.com/media/en/technical-documentation/data-sheets/AD5593r.pdf"</a> | ||
|
||
properties (Nontunable, Hidden) | ||
channel_names = {'voltage0','voltage1','voltage2'... | ||
'voltage3','voltage4','voltage5','voltage6','voltage7'}; | ||
end | ||
|
||
methods | ||
%% Constructor | ||
function obj = Rx(varargin) | ||
obj = obj@adi.AD559xr.Base('ad5593r','ad5593r',varargin{:}); | ||
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,84 @@ | ||
classdef Base < adi.common.Rx & adi.common.RxTx & ... | ||
matlabshared.libiio.base & adi.common.Attribute & ... | ||
adi.common.RegisterReadWrite & adi.common.Channel | ||
% AD559xr Precision ADC Class | ||
% AD5592r is a SPI Interface ADC | ||
% AD5593r is an I2C Interface ADC | ||
|
||
properties (Nontunable) | ||
% SamplesPerFrame Samples Per Frame | ||
% Number of samples per frame, specified as an even positive | ||
% integer. | ||
SamplesPerFrame = 400 | ||
end | ||
|
||
% isOutput | ||
properties (Hidden, Nontunable, Access = protected) | ||
isOutput = false | ||
end | ||
|
||
properties (Nontunable, Hidden, Constant) | ||
Type = 'Rx' | ||
end | ||
|
||
properties (Nontunable, Hidden) | ||
Timeout = Inf | ||
kernelBuffersCount = 1 | ||
dataTypeStr = 'int16' | ||
phyDevName | ||
devName | ||
end | ||
|
||
properties (Hidden, Constant) | ||
ComplexData = false | ||
end | ||
|
||
methods | ||
%% Constructor | ||
function obj = Base(phydev,dev,varargin) | ||
coder.allowpcode('plain'); | ||
% Initialize the Rx object | ||
obj = obj@matlabshared.libiio.base(varargin{:}); | ||
obj.enableExplicitPolling = false; | ||
obj.EnabledChannels = 1; | ||
obj.BufferTypeConversionEnable = true; | ||
obj.phyDevName = phydev; | ||
obj.devName = dev; | ||
obj.uri = 'ip:analog.local'; | ||
end | ||
|
||
function flush(obj) | ||
% Flush the buffer | ||
flushBuffers(obj); | ||
end | ||
|
||
function delete(obj) | ||
% Destructor | ||
delete@adi.common.RxTx(obj); | ||
end | ||
|
||
end | ||
|
||
%% API Functions | ||
methods (Hidden, Access = protected) | ||
function setupInit(obj) | ||
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 = 'AD559xr ADC'; | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
%% Script for capturing and displaying a continuous set of samples from a | ||
%% connected AD559xr board | ||
D-Disha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
% Instantiate the system object | ||
rx = adi.AD5592r.Rx(); | ||
rx.uri = 'ip:analog.local'; | ||
|
||
% Samples Per Frame | ||
rx.SamplesPerFrame = 400; | ||
|
||
% Enable the channels that are selected as ADC in the firmware | ||
rx.EnabledChannels = [1 2 3 4 5 6 7 8]; | ||
|
||
% Capture data | ||
data = rx(); | ||
|
||
enabledChannels = size(data,2); | ||
figure(1); | ||
for i = 1:enabledChannels | ||
subplot(enabledChannels, 1, i); | ||
plot(data(1:rx.SamplesPerFrame, i)); | ||
title("Channel " + num2str(rx.EnabledChannels(i))); | ||
end | ||
|
||
% Delete the system object | ||
release(rx); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we not adding any attributes here in the driver?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No this is only targeted at data capture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can still add s-rate attribute perhaps? (if it's already part of Linux driver)