Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion +adi/+AD463x/Base.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
isOutput = false
end

properties(Access = protected)
InSetup = false;
end

properties (Abstract, Nontunable, Hidden)
Timeout
kernelBuffersCount
Expand Down Expand Up @@ -81,8 +85,10 @@
end

% Connects to device temporarily and fetches the channel names
obj.InSetup = true;
obj.setup();
release(obj);
obj.InSetup = false;
end

function set.SamplesPerFrame(obj, value)
Expand Down Expand Up @@ -138,6 +144,14 @@ function setupInit(obj)
end

obj.set_channel_names();
if obj.InSetup
obj.EnabledChannels = 1:length(obj.channel_names);
else
% This looks like an HDL bug, but all channels need to be
% enabled or they will timeout or not correctly be configured
assert(length(obj.EnabledChannels)==length(obj.channel_names), ...
'All channels must be enabled for platform');
end

end

Expand All @@ -147,7 +161,7 @@ function set_channel_names(obj)
chanCount = obj.iio_device_get_channels_count(phydev);
for c = 1:chanCount
chanPtr = obj.iio_device_get_channel(phydev, c - 1);
obj.channel_names{end + 1} = obj.iio_channel_get_name(chanPtr);
obj.channel_names{end + 1} = obj.iio_channel_get_id(chanPtr);
end
end

Expand Down
2 changes: 1 addition & 1 deletion examples/ad4630_DataCapture.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

% Only a select few channel groupings yield sensible outputs. Refer to the
% Limitations section in the documentation for more details
rx.EnabledChannels = [1];
rx.EnabledChannels = [1,2];

% Capture data
data = rx();
Expand Down