-
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.
try setting sample rate in the device class
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
- Loading branch information
Showing
17 changed files
with
1,002 additions
and
0 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
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
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,120 @@ | ||
From 849166893ffa1841a03dee595a5ac9a4b6493b4b Mon Sep 17 00:00:00 2001 | ||
From: Trevor Gamblin <tgamblin@baylibre.com> | ||
Date: Tue, 4 Feb 2025 17:11:04 -0500 | ||
Subject: [PATCH] AD4020: try isolating | ||
|
||
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
--- | ||
+adi/+AD4020/Rx.m | 88 +++++++++++++++++++++++++++++++++++++++++++++-- | ||
1 file changed, 86 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/+adi/+AD4020/Rx.m b/+adi/+AD4020/Rx.m | ||
index b5fd904..7468f15 100644 | ||
--- a/+adi/+AD4020/Rx.m | ||
+++ b/+adi/+AD4020/Rx.m | ||
@@ -1,4 +1,4 @@ | ||
-classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute | ||
+classdef Rx < matlabshared.libiio.base & adi.common.Attribute | ||
% AD4020 Precision ADC Class | ||
% | ||
% adi.AD4020.Rx Receives data from the AD4020 ADC | ||
@@ -10,11 +10,95 @@ classdef Rx < adi.AD400x.Base & matlabshared.libiio.base & adi.common.Attribute | ||
% | ||
% `AD4020 Datasheet <https://www.analog.com/media/en/technical-documentation/data-sheets/ad4020-4021-4022.pdf>`_ | ||
|
||
- % Channel names | ||
+ 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 = '500000' | ||
+ end | ||
+ | ||
+ properties (Dependent) | ||
+ % VoltageScale Voltage Scale | ||
+ % ADC Voltage scale. | ||
+ VoltageScale | ||
+ | ||
+ % VoltageOffset Voltage Offset | ||
+ % ADC Voltage offset. | ||
+ VoltageOffset | ||
+ end | ||
+ | ||
+ % isOutput | ||
+ properties (Hidden, Nontunable, Access = protected) | ||
+ isOutput = false | ||
+ end | ||
+ | ||
+ properties (Nontunable, Hidden) | ||
+ Timeout = Inf | ||
+ kernelBuffersCount = 1 | ||
+ dataTypeStr | ||
+ phyDevName | ||
+ devName | ||
+ end | ||
+ | ||
properties (Nontunable, Hidden, Constant) | ||
+ Type = 'Rx' | ||
channel_names = {'voltage0-voltage1'} | ||
end | ||
|
||
+ properties (Hidden, Constant) | ||
+ ComplexData = false | ||
+ end | ||
+ | ||
+ methods | ||
+ %% Constructor | ||
+ function obj = Base(phydev, dev, dtype, varargin) | ||
+ obj = obj@matlabshared.libiio.base(varargin{:}); | ||
+ obj.phyDevName = phydev; | ||
+ obj.devName = dev; | ||
+ obj.dataTypeStr = dtype; | ||
+ end | ||
+ | ||
+ %% Set SampleRate | ||
+ function set.SampleRate(obj, value) | ||
+ % Set device sampling rate | ||
+ obj.SampleRate = value; | ||
+ if obj.ConnectedToDevice | ||
+ obj.setAttributeRAW('voltage0-voltage1', 'sampling_frequency', num2str(value), false); | ||
+ 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 | ||
+ | ||
+ %% Check Voltage Offset | ||
+ function rValue = get.VoltageOffset(obj) | ||
+ if obj.ConnectedToDevice | ||
+ rValue = obj.getAttributeDouble('voltage0-voltage1', 'offset', obj.isOutput); | ||
+ else | ||
+ rValue = NaN; | ||
+ end | ||
+ end | ||
+ end | ||
+ | ||
+ %% API Functions | ||
+ methods (Hidden, Access = protected) | ||
+ function setupInit(obj) | ||
+ obj.setAttributeRAW('voltage0-voltage1', 'sampling_frequency', num2str(obj.SampleRate), false); | ||
+ end | ||
+ end | ||
+end | ||
+ | ||
methods | ||
%% Constructor | ||
function obj = Rx(varargin) | ||
-- | ||
2.39.5 | ||
|
Oops, something went wrong.