Skip to content

Commit

Permalink
Merge pull request #159 from analogdevicesinc/tfcollins/ad9361-srs
Browse files Browse the repository at this point in the history
Update AD9361 Sample rate prop
  • Loading branch information
tfcollins authored Oct 25, 2023
2 parents 8ac4c5d + 5952cc3 commit df13b04
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 44 deletions.
6 changes: 4 additions & 2 deletions +adi/+AD9361/Rx.m
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,14 @@

obj.SamplingRate = value;
if obj.ConnectedToDevice && ~obj.EnableCustomFilter
id = 'voltage0';
p = 'sampling_frequency';
if libisloaded('libad9361')
calllib('libad9361','ad9361_set_bb_rate',obj.iioDevPHY,int32(value));
else
id = 'voltage0';
obj.setAttributeLongLong(id,'sampling_frequency',value,true,4);
obj.setAttributeLongLong(id,p,value,true,4);
end
obj.SamplingRate = double(obj.getAttributeLongLong(id,p,true));
end
end
function set.LoopbackMode(obj, value)
Expand Down
6 changes: 4 additions & 2 deletions +adi/+AD9361/Tx.m
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,14 @@
end
obj.SamplingRate = value;
if obj.ConnectedToDevice && ~obj.EnableCustomFilter
id = 'voltage0';
p = 'sampling_frequency';
if libisloaded('libad9361')
calllib('libad9361','ad9361_set_bb_rate',obj.iioDevPHY,int32(value));
else
id = 'voltage0';
obj.setAttributeLongLong(id,'sampling_frequency',value,true,4);
obj.setAttributeLongLong(id,p,value,true,4);
end
obj.SamplingRate = double(obj.getAttributeLongLong(id,p,true));
end
end
end
Expand Down
47 changes: 7 additions & 40 deletions CI/scripts/genTlbx.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ function genTlbx(examples)
v = adi.Version;
uuid = matlab.lang.internal.uuid;

%% Unpack verilog source
if ~examples
cd('../../');
cd('hdl/vendor/AnalogDevices/vivado');
!find -name '*.zip' -exec sh -c 'unzip -d "${1%.*}" "$1"' _ {} \;
!find . -name "*.zip" -type f -delete
cd('../../../..');
cd('CI/scripts');
end

%%
cd(fileparts((mfilename('fullpath'))));
cd('../..');
Expand Down Expand Up @@ -60,6 +50,13 @@ function genTlbx(examples)
ps = [ps(:)',{'hdl'}];
end

% Check for deps
if ~isfolder('deps')
error('deps folder with libad9361 not available')
else
ps = [ps(:)',{'deps'}];
end

paths = '';
for p = ps
pp = genpath(p{:});
Expand All @@ -79,36 +76,6 @@ function genTlbx(examples)
end
matlab.addons.toolbox.packageToolbox(projectFile,outputFile)

if ~usejava('desktop')
%% Update toolbox paths
mkdir other
movefile([outputFile,'.mltbx'], ['other/',outputFile,'.zip']);
cd other
unzip([outputFile,'.zip'],'out');
cd('out')
cd('metadata');
fid = fopen('configuration.xml','r');
f=fread(fid,'*char')';
fclose(fid);

s = '</matlabPaths>';
sections = strsplit(f,s);
s1 = sections{1};
s2 = sections{2};
newfile = [s1,paths,s,s2];

fid = fopen('configuration.xml','w');
fprintf(fid,'%s',newfile);
fclose(fid);

%% Repack
cd('..');
zip([outputFile,'.zip'], '*');
movefile([outputFile,'.zip'],['../../',outputFile,'.mltbx']);
cd('../..');
rmdir('other','s');
end

delete bsp.prj


Expand Down

0 comments on commit df13b04

Please sign in to comment.