Skip to content

Commit 1e81162

Browse files
ADRV9002: Added properties to access Rx interface gains available
Signed-off-by: Pagadarai <[email protected]>
1 parent 4b1b3c6 commit 1e81162

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

+adi/+ADRV9002/Rx.m

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
% hardware
201201
RSSIChannel1
202202
end
203-
203+
204204
properties(Constant, Hidden)
205205
ENSMModeChannel0Set = matlab.system.StringSet({ ...
206206
'calibrated','primed','rf_enabled'});
@@ -221,15 +221,13 @@
221221
'automatic','spi'});
222222
DigitalGainControlModeChannel1Set = matlab.system.StringSet({ ...
223223
'automatic','spi'});
224-
225-
InterfaceGainChannel0Set = matlab.system.StringSet({...
226-
'18dB', '12dB', '6dB', '0dB', '-6dB', '-12dB', '-18dB',...
227-
'-24dB', '-30dB','-36dB'});
228-
InterfaceGainChannel1Set = matlab.system.StringSet({...
229-
'18dB', '12dB', '6dB', '0dB', '-6dB', '-12dB', '-18dB',...
230-
'-24dB', '-30dB','-36dB'});
231224
end
232225

226+
properties(Hidden)
227+
InterfaceGainAvailableChannel0
228+
InterfaceGainAvailableChannel1
229+
end
230+
233231
properties (Hidden, Nontunable, Access = protected)
234232
isOutput = false;
235233
end
@@ -264,6 +262,22 @@
264262
value = NaN;
265263
end
266264
end
265+
function values = get.InterfaceGainAvailableChannel0(obj)
266+
if obj.ConnectedToDevice
267+
values = obj.getAttributeRAW('voltage0','interface_gain_available',false);
268+
values = strsplit(values);
269+
else
270+
values = NaN;
271+
end
272+
end
273+
function values = get.InterfaceGainAvailableChannel1(obj)
274+
if obj.ConnectedToDevice
275+
values = obj.getAttributeRAW('voltage0','interface_gain_available',false);
276+
values = strsplit(values);
277+
else
278+
values = NaN;
279+
end
280+
end
267281

268282
% Check ENSMModeChannel0
269283
function set.ENSMModeChannel0(obj, value)
@@ -352,6 +366,7 @@
352366

353367
% Check InterfaceGainChannel0
354368
function set.InterfaceGainChannel0(obj, value)
369+
mustBeMember(value,obj.InterfaceGainAvailableChannel0);
355370
obj.InterfaceGainChannel0 = value;
356371
if obj.ConnectedToDevice
357372
id = 'voltage0';
@@ -363,6 +378,7 @@
363378
end
364379
% Check InterfaceGainChannel1
365380
function set.InterfaceGainChannel1(obj, value)
381+
mustBeMember(value,obj.InterfaceGainAvailableChannel1);
366382
obj.InterfaceGainChannel1 = value;
367383
if obj.ConnectedToDevice
368384
id = 'voltage1';

test/ADRV9002Tests.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ function testADRV9002ManualGainControlError(testCase)
321321
rx.CustomStreamFileName = which('lte_5_cmos_api_68_0_6.stream');
322322

323323
rx.DigitalGainControlModeChannel0 = 'spi';
324-
rx.InterfaceGainChannel0 = '6dB';
324+
rx.InterfaceGainChannel0 = rx.InterfaceGainAvailableChannel0{1};
325325
verifyError(testCase, @() rx(), ?MException);
326326
end
327327

@@ -335,7 +335,7 @@ function testADRV9002ManualGainControl(testCase)
335335
rx.CustomStreamFileName = which('lte_5_cmos_api_68_0_6.stream');
336336

337337
rx.DigitalGainControlModeChannel0 = 'spi';
338-
rx.InterfaceGainChannel0 = '6dB';
338+
rx.InterfaceGainChannel0 = rx.InterfaceGainAvailableChannel0{1};
339339
[~,valid] = rx();
340340
testCase.assertTrue(valid);
341341
end

0 commit comments

Comments
 (0)