-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDeviceAttribute.m
56 lines (50 loc) · 2.14 KB
/
DeviceAttribute.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
classdef (Abstract) DeviceAttribute < adi.common.RegisterReadWrite & adi.common.DebugAttribute
% DeviceAttribute IIO device attribute function calls
methods (Hidden)
function cnt = iio_context_get_devices_count(obj, ctxPtr)
% iio_context_get_devices_count(const struct iio_context * ctx)
%
% Enumerate the devices found in the given context.
if useCalllib(obj)
cnt = calllib(obj.libName, 'iio_context_get_devices_count', ctxPtr);
end
end
function devPtr = iio_context_get_device(obj, ctxPtr, index)
% iio_context_get_device(const struct iio_context * ctx, unsigned int index)
%
% Get the device present at the given index.
if useCalllib(obj)
devPtr = calllib(obj.libName, 'iio_context_get_device', ctxPtr, index);
status = cPtrCheck(obj,devPtr);
if status ~= 0
releaseImpl(obj);
error("Failed to find device with index: %s",index);
end
end
end
function cnt = iio_device_get_attrs_count(obj, devPtr)
% iio_device_get_attrs_count(const struct iio_device *dev)
%
% Enumerate the devices found in the given context.
if useCalllib(obj)
cnt = calllib(obj.libName, 'iio_device_get_attrs_count', devPtr);
end
end
function name = iio_device_get_name(obj, devPtr)
% iio_device_get_name(const struct iio_device *dev)
%
% Get the name of the given device
if useCalllib(obj)
name = calllib(obj.libName, 'iio_device_get_name', devPtr);
end
end
function attr = iio_device_get_attr(obj, devPtr, index)
% iio_device_get_attr(const struct iio_device *dev, unsigned int index)
%
% Get the value of the given channel-specific attribute.
if useCalllib(obj)
attr = calllib(obj.libName, 'iio_device_get_attr', devPtr, index);
end
end
end
end