Skip to content

Commit 5cda9be

Browse files
committed
edited devName<0,1,2,3> in properties in Tx.m. Added DSAChip<A,B,C,D>, HPF, and LPF to properties and removed ExternalAttenuation from properties in Rx.m. Added methods set.DSAChip<A,B,C,D> in Rx.m. Updated devName<0,1,2,3> in properties in Rx.m
1 parent 0d0478c commit 5cda9be

File tree

2 files changed

+116
-34
lines changed

2 files changed

+116
-34
lines changed

+adi/+QuadAD9084/Rx.m

Lines changed: 110 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,12 @@
163163
properties
164164
%ExternalAttenuation External Attenuation
165165
% Attenuation value of external HMC425a
166-
ExternalAttenuation = 0;
166+
DSAChipA = 0;
167+
DSAChipB = 0;
168+
DSAChipC = 0;
169+
DSAChipD = 0;
170+
HPF = 0;
171+
LPF = 0;
167172
end
168173

169174
properties(Logical, Nontunable)
@@ -205,10 +210,10 @@
205210
num_coarse_attr_channels = 4;
206211
num_fine_attr_channels = 4;
207212
devName = 'axi-ad9084-rx-hpc';
208-
devName0 = 'iio:device11';
209-
devName1 = 'iio:device12';
210-
devName2 = 'iio:device13';
211-
devName3 = '';
213+
devName0 = '';
214+
devName1 = 'iio:device13';
215+
devName2 = 'iio:device16';
216+
devName3 = 'iio:device19';
212217
end
213218

214219
properties (Hidden)
@@ -217,6 +222,12 @@
217222
iioDev2;
218223
iioDev3;
219224
iioHMC425a;
225+
iioDev23;
226+
iioDev24;
227+
iioDev25;
228+
iioDev26;
229+
iioDev10;
230+
iioDev11;
220231
end
221232

222233
methods
@@ -432,21 +443,85 @@
432443
% end
433444
% end
434445

435-
%%
436-
% Check ExternalAttenuation
437-
function set.ExternalAttenuation(obj, value)
438-
% validateattributes( value, { 'double','single' }, ...
439-
% { 'real', 'scalar', 'finite', 'nonnan', 'nonempty', '>=', -4,'<=', 71}, ...
440-
% '', 'Gain');
441-
% assert(mod(value,1/4)==0, 'Gain must be a multiple of 0.25');
442-
obj.ExternalAttenuation = value;
443-
if obj.ConnectedToDevice
444-
id = 'voltage0';
445-
obj.setAttributeLongLong(id,'hardwaregain',value,true,0,obj.iioHMC425a);
446-
end
446+
447+
% Check ExternalAttenuation
448+
449+
function set.DSAChipA(obj, value)
450+
if all(and(value>0, value<-31.5))
451+
fprintf('DSA set value out of range. Must be between -31.5 and 0 \n')
452+
return
453+
end
454+
obj.DSAChipA = value;
455+
if obj.ConnectedToDevice
456+
id = 'voltage0';
457+
obj.setAttributeLongLong(id,'hardwaregain',value,true,0,obj.iioDev23);
458+
end
459+
end
460+
461+
function set.DSAChipB(obj,value)
462+
if all(and(value>0, value<-31.5))
463+
fprintf('DSA set value out of range. Must be between -31.5 and 0 \n')
464+
return
465+
end
466+
obj.DSAChipB = value;
467+
if obj.ConnectedToDevice
468+
id = 'voltage0';
469+
obj.setAttributeLongLong(id,'hardwaregain',value,true,0,obj.iioDev24);
470+
end
471+
end
472+
473+
function set.DSAChipC(obj,value)
474+
if all(and(value>0, value<-31.5))
475+
fprintf('DSA set value out of range. Must be between -31.5 and 0 \n')
476+
return
477+
end
478+
obj.DSAChipC = value;
479+
if obj.ConnectedToDevice
480+
id = 'voltage0';
481+
obj.setAttributeLongLong(id, 'hardwaregain',value,true,0,obj.iioDev25);
482+
end
483+
end
484+
485+
function set.DSAChipD(obj,value)
486+
if all(and(value>0, value<-31.5))
487+
fprintf('DSA set value out of range. Must be between -31.5 and 0 \n')
488+
return
447489
end
490+
obj.DSAChipD = value;
491+
if obj.ConnectedToDevice
492+
id = 'voltage0';
493+
obj.setAttributeLongLong(id,'hardwaregain',value,true,0,obj.iioDev26);
494+
end
495+
end
496+
497+
function set.HPF(obj,value)
498+
if(value > 15 || value < 0 || floor(value) ~= value)
499+
fprintf('Filter state must be an integer between 0 and 15\n')
500+
return
501+
end
502+
obj.HPF = value;
503+
if obj.ConnectedToDevice
504+
obj.setDeviceAttributeLongLong('mux_select', value, obj.iioDev11);
505+
end
506+
448507
end
508+
509+
function set.LPF(obj,value)
510+
if(value > 15 || value < 0 || floor(value) ~= value)
511+
fprintf('Filter state must be an integer between 0 and 15\n')
512+
return
513+
end
514+
obj.LPF = value;
515+
if obj.ConnectedToDevice
516+
obj.setDeviceAttributeLongLong('mux_select', value, obj.iioDev10);
517+
end
518+
end
519+
520+
end
521+
522+
449523

524+
450525
%% API Functions
451526
methods (Hidden, Access = protected)
452527

@@ -484,22 +559,29 @@ function setupInit(obj)
484559

485560
% xmlData = calllib(obj.libName, 'iio_context_get_xml', obj.iioCtx);
486561

487-
% Get additional devices
488-
obj.iioDev0 = getDev(obj, obj.devName0);
562+
% Get additional device
489563
obj.iioDev1 = getDev(obj, obj.devName1);
490564
obj.iioDev2 = getDev(obj, obj.devName2);
491-
if ~strcmpi(obj.devName3,'')
492-
obj.iioDev3 = getDev(obj, obj.devName3);
565+
obj.iioDev3 = getDev(obj, obj.devName3);
566+
if ~strcmpi(obj.devName0,'')
567+
obj.iioDev0 = getDev(obj, obj.devName0);
493568
else
494-
obj.iioDev3 = getDev(obj, obj.devName);
569+
obj.iioDev0 = getDev(obj, obj.devName);
495570
end
496571

497572
% Rev C uses a different DSA
498-
obj.iioHMC425a = getDev(obj, 'hmc425a');
573+
%obj.iioHMC425a = getDev(obj, 'hmc425a');
574+
obj.iioDev23 = getDev(obj, 'iio:device22');
575+
obj.iioDev24 = getDev(obj, 'iio:device23');
576+
obj.iioDev25 = getDev(obj, 'iio:device24');
577+
obj.iioDev26 = getDev(obj, 'iio:device25');
578+
obj.iioDev10 = getDev(obj, 'iio:device9');
579+
obj.iioDev11 = getDev(obj, 'iio:device10');
499580
% obj.iioHMC425a = iio_context_find_device(obj, obj.iioCtx, 'hmc425a');
500-
% status = cPtrCheck(obj,obj.iioHMC425a);
581+
% obj.iioDev22 = iio_context_find_device(obj, obj.iioCtx, 'dsa0');
582+
% status = cPtrCheck(obj,obj.iioDev22);
501583
% if status < 0
502-
% obj.iioHMC425a = getDev(obj, 'hmc540s');
584+
% obj.iioDev22 = getDev(obj, 'iio:device22');
503585
% end
504586

505587
if obj.CalibrationBoardAttached
@@ -593,11 +675,11 @@ function setupInit(obj)
593675
% obj.writeFilterFile(obj.iioDev3,obj.PFIRFilenamesChipD);
594676
% end
595677
%%
596-
obj.setAttributeLongLong('voltage0','hardwaregain',...
597-
obj.ExternalAttenuation,true,0,obj.iioHMC425a);
678+
% obj.setAttributeLongLong('voltage0','hardwaregain',...
679+
% obj.ExternalAttenuation,true,0,obj.iioHMC425a);
598680

599681
end
600682

601683
end
602684

603-
end
685+
end

+adi/+QuadAD9084/Tx.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,15 @@
172172

173173
properties (Nontunable, Hidden)
174174
channel_names;
175-
num_data_channels = 32;
175+
num_data_channels = 16;
176176
num_coarse_attr_channels = 4;
177-
num_fine_attr_channels = 8;
177+
num_fine_attr_channels = 4;
178178
num_dds_channels = 128;
179179
devName = 'axi-ad9084-tx-hpc';
180-
devName0 = 'iio:device11';
181-
devName1 = 'iio:device12';
182-
devName2 = 'iio:device13';
183-
devName3 = 'iio:device18';
180+
devName0 = 'axi-ad9084-rx-hpc';
181+
devName1 = 'axi-ad9084-rx1';
182+
devName2 = 'axi-ad9084-rx2';
183+
devName3 = 'axi-ad9084-rx3';
184184
end
185185

186186
properties (Hidden)

0 commit comments

Comments
 (0)