diff --git a/+adi/+AD4020/Rx.m b/+adi/+AD4020/Rx.m
new file mode 100644
index 0000000..0a904cc
--- /dev/null
+++ b/+adi/+AD4020/Rx.m
@@ -0,0 +1,101 @@
+classdef Rx < adi.common.Rx & matlabshared.libiio.base & adi.common.Attribute
+ % AD4020 Precision ADC Class
+ % adi.AD4020.Rx Receives data from the AD4020 ADC
+ % The adi.AD4020.Rx System object is a signal source that can receive
+ % data from the AD4020.
+ %
+ % rx = adi.AD4020.Rx;
+ % rx = adi.AD4020.Rx('uri','192.168.2.1');
+ %
+ % AD4020 Datasheet
+
+ properties (Nontunable)
+ % SamplesPerFrame Samples Per Frame
+ % Number of samples per frame, specified as an even positive
+ % integer.
+ SamplesPerFrame = 4096
+ end
+
+ properties (Dependent)
+ % Voltage
+ % ADC Voltage in mV
+ Voltage
+
+ % VoltageScale Voltage Scale
+ % ADC Voltage scale.
+ VoltageScale
+
+ % VoltageOffset Voltage Offset
+ % ADC Voltage offset.
+ VoltageOffset
+ end
+
+ % Channel names
+ properties (Nontunable, Hidden, Constant)
+ channel_names = {'voltage0'}
+ end
+
+ % isOutput
+ properties (Hidden, Nontunable, Access = protected)
+ isOutput = false
+ end
+
+ properties (Nontunable, Hidden)
+ Timeout = Inf
+ kernelBuffersCount = 1
+ dataTypeStr = 'int32'
+ phyDevName = 'ad4020'
+ devName = 'ad4020'
+ end
+
+ properties (Nontunable, Hidden, Constant)
+ Type = 'Rx'
+ end
+
+ properties (Hidden, Constant)
+ ComplexData = false
+ end
+
+ methods
+ %% Constructor
+ function obj = Rx(varargin)
+ obj = obj@matlabshared.libiio.base(varargin{:});
+ obj.enableExplicitPolling = false;
+ obj.EnabledChannels = 1;
+ obj.BufferTypeConversionEnable = true;
+ end
+
+ %% Check Voltage
+ function rValue = get.Voltage(obj)
+ if obj.ConnectedToDevice
+ rValue = obj.getAttributeRAW('voltage0', 'raw', obj.isOutput);
+ else
+ rValue = NaN;
+ end
+ end
+
+ %% Check Voltage Scale
+ function rValue = get.VoltageScale(obj)
+ if obj.ConnectedToDevice
+ rValue = obj.getAttributeDouble('voltage0', 'scale', obj.isOutput);
+ else
+ rValue = NaN;
+ end
+ end
+
+ %% Check Voltage Offset
+ function rValue = get.VoltageOffset(obj)
+ if obj.ConnectedToDevice
+ rValue = obj.getAttributeDouble('voltage0', 'offset', obj.isOutput);
+ else
+ rValue = NaN;
+ end
+ end
+ end
+
+ %% API Functions
+ methods (Hidden, Access = protected)
+ function setupInit(~)
+ end
+ end
+end
diff --git a/+adi/Contents.m b/+adi/Contents.m
index 56c2d5a..735aea5 100644
--- a/+adi/Contents.m
+++ b/+adi/Contents.m
@@ -13,3 +13,4 @@
% AD4630-24 - ADC
% AD4858 - ADC
% AD2S1210 - Resolver-to-Digital Converter
+% AD4020 - ADC
diff --git a/CI/doc/SysObjsProps.m b/CI/doc/SysObjsProps.m
index 16083f6..c088b24 100644
--- a/CI/doc/SysObjsProps.m
+++ b/CI/doc/SysObjsProps.m
@@ -8,3 +8,4 @@
% * AD7768
% * AD7768
% * AD2S1210
+% * AD4020
diff --git a/CI/doc/genhtml.m b/CI/doc/genhtml.m
index add1204..77043be 100644
--- a/CI/doc/genhtml.m
+++ b/CI/doc/genhtml.m
@@ -1,6 +1,6 @@
mfiledir = '..\..\+adi\';
docdir = '..\..\doc\';
-parts = {'AD4630','AD4030','AD463x','AD7768','AD4858','AD2S1210'};
+parts = {'AD4630','AD4030','AD463x','AD7768','AD4858','AD2S1210','AD4020'};
trx_files = {'Rx','Base','Tx'};
for ii = 1:numel(parts)
for jj = 1:numel(trx_files)
diff --git a/CI/gen_doc/docs/_pages/index.md b/CI/gen_doc/docs/_pages/index.md
index 0df7e5c..2b66df5 100644
--- a/CI/gen_doc/docs/_pages/index.md
+++ b/CI/gen_doc/docs/_pages/index.md
@@ -35,3 +35,4 @@ The following have device-specific implementations in MATLAB and Simulink. If a
| AD4630-24 | Zedboard | Yes | No | ADI (2021b) |
| AD4858 | Zedboard | Yes | No | ADI (2021b) |
| AD2S1210 | Zedboard | Yes | No | ADI (2021b) |
+| AD4020 | Zedboard | Yes | No | ADI (2021b) |
diff --git a/CI/gen_doc/docs/gen_sysobj_doc.m b/CI/gen_doc/docs/gen_sysobj_doc.m
index 20b7dde..f4e0c29 100644
--- a/CI/gen_doc/docs/gen_sysobj_doc.m
+++ b/CI/gen_doc/docs/gen_sysobj_doc.m
@@ -15,6 +15,7 @@
, {'AD4630_24', {'Rx'}}...
, {'AD4858', {'Rx'}}...
, {'AD2S1210', {'Rx'}}...
+ , {'AD4020', {'Rx'}}...
%{'QuadMxFE',{'Rx','Tx'}}...
};
diff --git a/CI/gen_doc/docs/sysobjs.json b/CI/gen_doc/docs/sysobjs.json
index 33adcd8..6caceaf 100644
--- a/CI/gen_doc/docs/sysobjs.json
+++ b/CI/gen_doc/docs/sysobjs.json
@@ -236,5 +236,46 @@
"prop_description": "Hostname or IP address of remote libIIO deviceHelp for adi.AD2S1210.Rx/uri is inherited from superclass matlabshared.libiio.base"
}
]
+ },
+ {
+ "name": "adi.AD4020.Rx",
+ "dec": " adi.AD4020.Rx Receives data from the AD4020 ADC
The adi.AD4020.Rx System object is a signal source that can receive
data from the AD4020.
rx = adi.AD4020.Rx;
rx = adi.AD4020.Rx('uri','192.168.2.1');
AD4020 Datasheet
Documentation for adi.AD4020.Rx
doc adi.AD4020.Rx
",
+ "props": [
+ {
+ "prop_name": "EnabledChannels",
+ "prop_title": " EnabledChannels Enabled Channels",
+ "prop_description": "Indexs of channels to be enabled. Input should be a [1xN] vector with the indexes of channels to be enabled. Order is irrelevant"
+ },
+ {
+ "prop_name": "SamplesPerFrame",
+ "prop_title": " Frame size",
+ "prop_description": "Size of the frame in samplesHelp for adi.AD4020.Rx/SamplesPerFrame is inherited from superclass matlabshared.libiio.base"
+ },
+ {
+ "prop_name": "SamplingFrequency",
+ "prop_title": " SamplingFrequency",
+ "prop_description": "Sampling Frequency in Hertz."
+ },
+ {
+ "prop_name": "Voltage",
+ "prop_title": " Voltage",
+ "prop_description": "ADC Voltage in mV"
+ },
+ {
+ "prop_name": "VoltageOffset",
+ "prop_title": " VoltageOffset Voltage Offset",
+ "prop_description": "ADC Voltage offset."
+ },
+ {
+ "prop_name": "VoltageScale",
+ "prop_title": " VoltageScale Voltage Scale",
+ "prop_description": "ADC Voltage scale."
+ },
+ {
+ "prop_name": "uri",
+ "prop_title": " URI - remote host URI",
+ "prop_description": "Hostname or IP address of remote libIIO deviceHelp for adi.AD4020.Rx/uri is inherited from superclass matlabshared.libiio.base"
+ }
+ ]
}
]
diff --git a/examples/ad4020_DataCapture.m b/examples/ad4020_DataCapture.m
new file mode 100644
index 0000000..5e92fe9
--- /dev/null
+++ b/examples/ad4020_DataCapture.m
@@ -0,0 +1,18 @@
+%% Script for capturing data from a connected AD4020 board
+
+% Instantiate the system object
+rx = adi.AD4020.Rx('uri','ip:analog.local');
+
+% Connect to device and initialize data
+rx();
+
+% Retrieve ADC voltage, scale and offset
+rx.Voltage();
+rx.VoltageScale();
+rx.VoltageOffset();
+
+% Print system object properties
+rx
+
+% Delete the system object
+release(rx)