diff --git a/+adi/+ADRV9002/Rx.m b/+adi/+ADRV9002/Rx.m index aacd599c..88b0e153 100644 --- a/+adi/+ADRV9002/Rx.m +++ b/+adi/+ADRV9002/Rx.m @@ -200,7 +200,7 @@ % hardware RSSIChannel1 end - + properties(Constant, Hidden) ENSMModeChannel0Set = matlab.system.StringSet({ ... 'calibrated','primed','rf_enabled'}); @@ -221,15 +221,13 @@ 'automatic','spi'}); DigitalGainControlModeChannel1Set = matlab.system.StringSet({ ... 'automatic','spi'}); - - InterfaceGainChannel0Set = matlab.system.StringSet({... - '18dB', '12dB', '6dB', '0dB', '-6dB', '-12dB', '-18dB',... - '-24dB', '-30dB','-36dB'}); - InterfaceGainChannel1Set = matlab.system.StringSet({... - '18dB', '12dB', '6dB', '0dB', '-6dB', '-12dB', '-18dB',... - '-24dB', '-30dB','-36dB'}); end + properties(Hidden) + InterfaceGainAvailableChannel0 + InterfaceGainAvailableChannel1 + end + properties (Hidden, Nontunable, Access = protected) isOutput = false; end @@ -264,6 +262,22 @@ value = NaN; end end + function values = get.InterfaceGainAvailableChannel0(obj) + if obj.ConnectedToDevice + values = obj.getAttributeRAW('voltage0','interface_gain_available',false); + values = strsplit(values); + else + values = NaN; + end + end + function values = get.InterfaceGainAvailableChannel1(obj) + if obj.ConnectedToDevice + values = obj.getAttributeRAW('voltage0','interface_gain_available',false); + values = strsplit(values); + else + values = NaN; + end + end % Check ENSMModeChannel0 function set.ENSMModeChannel0(obj, value) @@ -352,6 +366,7 @@ % Check InterfaceGainChannel0 function set.InterfaceGainChannel0(obj, value) + mustBeMember(value,obj.InterfaceGainAvailableChannel0); obj.InterfaceGainChannel0 = value; if obj.ConnectedToDevice id = 'voltage0'; @@ -363,6 +378,7 @@ end % Check InterfaceGainChannel1 function set.InterfaceGainChannel1(obj, value) + mustBeMember(value,obj.InterfaceGainAvailableChannel1); obj.InterfaceGainChannel1 = value; if obj.ConnectedToDevice id = 'voltage1'; diff --git a/test/ADRV9002Tests.m b/test/ADRV9002Tests.m index b0f04853..3dba5825 100644 --- a/test/ADRV9002Tests.m +++ b/test/ADRV9002Tests.m @@ -321,7 +321,7 @@ function testADRV9002ManualGainControlError(testCase) rx.CustomStreamFileName = which('lte_5_cmos_api_68_0_6.stream'); rx.DigitalGainControlModeChannel0 = 'spi'; - rx.InterfaceGainChannel0 = '6dB'; + rx.InterfaceGainChannel0 = rx.InterfaceGainAvailableChannel0{1}; verifyError(testCase, @() rx(), ?MException); end @@ -335,7 +335,7 @@ function testADRV9002ManualGainControl(testCase) rx.CustomStreamFileName = which('lte_5_cmos_api_68_0_6.stream'); rx.DigitalGainControlModeChannel0 = 'spi'; - rx.InterfaceGainChannel0 = '6dB'; + rx.InterfaceGainChannel0 = rx.InterfaceGainAvailableChannel0{1}; [~,valid] = rx(); testCase.assertTrue(valid); end