diff --git a/test/AD4630_24Tests.m b/test/AD4630_24Tests.m index 2072f1e..0ff7ff2 100644 --- a/test/AD4630_24Tests.m +++ b/test/AD4630_24Tests.m @@ -6,7 +6,10 @@ end properties(TestParameter) - sample_rate = {{1000,2000000,30000,0.0015,10}}; + sample_rate = {'10000', '50000', '100000', ... + '200000', '500000', '1000000', ... + '1760000', '2000000'}; + sample_averaging_length = { ... '2', '4', '8', '16', '32', '64', '128', '256', ... '512', '1024', '2048', '4096', '8192', '16384', ... @@ -31,35 +34,26 @@ function testAD4630_24Smoke(testCase) testCase.assertTrue(sum(abs(double(data)))>0); end - function testAD7768_1AttrSamplesPerFrame(testCase,sample_rate) - % TODO: Test this test - adc = adi.AD7768_1.Rx; + function testAD4630_24AttrSampleRate(testCase,sample_rate) + % '1750000' is set as '1754386' + adc = adi.AD4630_24.Rx('uri',testCase.uri); adc.uri = testCase.uri; - - start = sample_rate{1}; - stop = sample_rate{2}; - step = sample_rate{3}; - tol = sample_rate{4}; - repeats = sample_rate{5}; - numints = round((stop-start)/step); - for ii = 1:repeats - ind = randi([0, numints]); - val = start+(step*ind); - adc.SampleRate = num2str(val); - [data, valid] = adc(); - ret_val = adc.getDeviceAttributeRAW('sample_rate',8); - adc.release(); - testCase.assertTrue(valid); - testCase.assertTrue(sum(abs(double(data)))>0); - testCase.verifyEqual(str2double(ret_val),val,'RelTol',tol,... - 'Sample rate unexpected') - end + val = sample_rate; + adc.SampleRate = val; + [data,valid] = adc(); + ret_val = adc.getDeviceAttributeRAW('sampling_frequency',9); + adc.release(); + testCase.assertTrue(valid); + testCase.assertTrue(sum(abs(double(data)))>0); +% testCase.assertTrue(strcmp(val,string(ret_val)), ... +% 'Sample rate unexpected') + testCase.verifyEqual(str2double(ret_val),str2double(val), ... + 'RelTol',0,'Sample rate unexpected') end function testAD4630_24AttrSampleAveragingLength(testCase,sample_averaging_length) - % TODO: Test this test - adc = adi.AD4630_24.Rx; - adc.uri = testCase.uri; + % The average mode works only with the output data mode set to 30-bit average + adc = adi.AD4630_24.Rx('uri',testCase.uri); val = sample_averaging_length; adc.SampleAveragingLength = val; [data,valid] = adc();