Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 49e7094

Browse files
committed
Add support for devices without scan elements
Signed-off-by: Travis Collins <travis.collins@analog.com>
1 parent 33f3f64 commit 49e7094

File tree

3 files changed

+31
-22
lines changed

3 files changed

+31
-22
lines changed

+adi/+common/DebugAttribute.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
classdef (Abstract) DebugAttribute < matlabshared.libiio.base
22

3-
methods (Hidden, Access = protected)
3+
methods (Hidden)
44
function setDebugAttributeLongLong(obj,attr,value)
55
phydev = getDev(obj, obj.phyDevName);
66
if (nargin == 1)
@@ -26,13 +26,13 @@ function setDebugAttributeBool(obj,attr,value)
2626
end
2727
status = iio_device_debug_attr_write_bool(obj,phydev,attr,value);
2828
cstatus(obj,status,['Attribute write failed for : ' attr]);
29-
% Check
30-
[status, rValue] = iio_device_debug_attr_read_bool(obj,phydev,attr);
31-
cstatus(obj,status,['Error reading attribute: ' attr]);
32-
if value ~= rValue
33-
status = -1;
34-
cstatus(obj,status,['Attribute ' attr ' return value ' num2str(rValue) ', expected ' num2str(value)]);
35-
end
29+
% Check (Not implemented yet)
30+
% [status, rValue] = iio_device_debug_attr_read_bool(obj,phydev,attr);
31+
% cstatus(obj,status,['Error reading attribute: ' attr]);
32+
% if value ~= rValue
33+
% status = -1;
34+
% cstatus(obj,status,['Attribute ' attr ' return value ' num2str(rValue) ', expected ' num2str(value)]);
35+
% end
3636
end
3737
end
3838
end

+adi/+common/Rx.m

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@
77

88
function varargout = stepImpl(obj)
99
% Get the data
10-
[dataRAW, valid] = getData(obj);
11-
index = 1;
1210
c = obj.channelCount/2;
13-
varargout = cell(c+1,1);
14-
for k = 1:c
15-
varargout{k} = complex(dataRAW(index,:),dataRAW(index+1,:)).';
16-
index = index+2;
11+
if c > 0
12+
[dataRAW, valid] = getData(obj);
13+
index = 1;
14+
varargout = cell(c+1,1);
15+
for k = 1:c
16+
varargout{k} = complex(dataRAW(index,:),dataRAW(index+1,:)).';
17+
index = index+2;
18+
end
19+
varargout{end} = valid;
20+
else
21+
varargout = cell(1,1);
22+
varargout{1} = true;
1723
end
18-
varargout{end} = valid;
1924
end
2025

2126
end

+adi/+common/RxTx.m

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,18 @@ function releaseChanBuffers(obj)
106106
obj.enabledChannels = true;
107107

108108
% Create the buffers
109-
status = createBuf(obj);
110-
if status
111-
for k=1:obj.channelCount
112-
disableChannel(obj, obj.channel_names{k}, obj.isOutput);
109+
if obj.channelCount>0
110+
status = createBuf(obj);
111+
if status
112+
for k=1:obj.channelCount
113+
disableChannel(obj, obj.channel_names{k}, obj.isOutput);
114+
end
115+
releaseChanBuffers(obj);
116+
cerrmsg(obj,status,['Failed to create buffer for: ' obj.devName]);
117+
return
113118
end
114-
releaseChanBuffers(obj);
115-
cerrmsg(obj,status,['Failed to create buffer for: ' obj.devName]);
116-
return
119+
else
120+
status = 0;
117121
end
118122

119123
end

0 commit comments

Comments
 (0)