-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sphinx doc #23
Open
SrikanthPagadarai
wants to merge
9
commits into
master
Choose a base branch
from
sphinx_doc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Sphinx doc #23
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1663f89
First commit of doc with new folder org
SrikanthPagadarai df59d04
Added github actions. Removed hdl ref design pieces.
SrikanthPagadarai f7cc883
Update doc.yml to point to new build folder
SrikanthPagadarai ada5581
Removed CI/scripts folder
SrikanthPagadarai 7fbb761
Deleted unused svg files
SrikanthPagadarai dac5d71
Chnaged the folder where generated objects.md is put
SrikanthPagadarai cdca11b
project name and copyright fixes
SrikanthPagadarai bb7a5e8
Removed unused files
SrikanthPagadarai 4acf0fd
Updated release label
SrikanthPagadarai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Documentation | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
BuildDocs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt install -y python3-numpy | ||
pip install -r CI/doc/requirements_doc.txt | ||
- name: Check doc build | ||
run: | | ||
make -C CI/doc gen_autodocs html | ||
|
||
- name: Publish master doc | ||
if: github.ref == 'refs/heads/master' | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./CI/doc/build/html | ||
destination_dir: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# CI Signaling | ||
|
||
Its possible to configure CI on build a project based on flags in the commit message. This is done by adding a special line to the commit that starts with CI: (must be all caps). The line can contain a list of flags separated by semi-colons. The following flags are supported: | ||
- skip=<Name of stage> | ||
- skip_branch=<Name of parallel branch to skip>:<Name of parent stage> | ||
- enable_only_branch=<Name of parallel branch to enable>:<Name of parent stage> | ||
- env:<Name of environment variable>=<Value of environment variable> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = source | ||
BUILDDIR = build | ||
|
||
PYTHON = python | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
gen_autodocs: | ||
cd gen_pages ; \ | ||
$(PYTHON) gen_sysobj_pages.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Doc Creation | ||
|
||
Doc is create by leveraging Sphinx as the documentation engine. To create the entire documentation set you must generate the dynamic pages which document the system object APIs and the reference designs. Then the output targets can be run. Since doc gen requires sphinx and some plugins they need to be installed first and ideally in a virtual environment. The following commands will create a virtual environment and install the necessary packages: | ||
|
||
```bash | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
pip install -r CI/doc/requirements_doc.txt | ||
``` | ||
|
||
Next we can build the documentation. The following commands will build the documentation and place it in the *build* folder under the *CI/doc* folder: | ||
|
||
```bash | ||
make -C CI/doc gen_autodocs html | ||
``` | ||
|
||
## Updating the System Object Documentation | ||
|
||
The system object documentation is generated from the MATLAB code and comments, which requires use of MATLAB itself. By running the script gen_sysobj_doc.m within the *gen_pages* folder, it will create the necessary sysobjs.json file which sphinx will then use to create the individual component pages. This is done by running the following command from the root of the toolbox in MATLAB: | ||
|
||
```matlab | ||
cd CI/doc/gen_pages | ||
gen_sysobj_doc | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Define the Python interpreter | ||
PYTHON = python | ||
|
||
# Define the targets and their dependencies | ||
all: gen_sysobj_pages gen_rd_svg gen_hdl_refdesigns | ||
|
||
gen_sysobj_pages: | ||
$(PYTHON) gen_sysobj_pages.py | ||
|
||
gen_rd_svg: | ||
$(PYTHON) gen_rd_svg.py | ||
|
||
gen_hdl_refdesigns: | ||
$(PYTHON) gen_hdl_refdesigns.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% include 'header.tmpl' %} | ||
# Hardware Interface APIs | ||
|
||
Available hardware streaming interfaces in HSX Toolbox: | ||
<!-- | ||
- [{{ obj }}](matlab:web([docroot '/3ptoolbox/analogdevicesinchighspeedconvertertoolboxtoolbox/doc/sysobjects/{{ obj }}/index.html'])) | ||
--> | ||
|
||
```{eval-rst} | ||
.. toctree:: | ||
:maxdepth: 1 | ||
{% for obj in devices %} | ||
_generated/sysobjects/{{ obj }} | ||
{%- endfor %} | ||
|
||
``` | ||
|
||
|
||
|
||
Click on left table of contents for individual component pages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{%- if disable_nav -%} | ||
--- | ||
hide: | ||
- navigation | ||
- toc | ||
--- | ||
{%- endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{% block content %} | ||
# {{ obj.name }} | ||
<!-- <div class="sysobj_h1">{{ obj.name }}</div> --> | ||
|
||
<!-- <div class="sysobj_top_desc"> | ||
Receive data from Analog Devices AD9361 transceiver | ||
</div> --> | ||
|
||
<!-- <div class="sysobj_desc_title">Description</div> --> | ||
|
||
<div class="sysobj_desc_txt"> | ||
<span> | ||
{{ obj.dec }} | ||
</span> | ||
|
||
</div> | ||
|
||
<div class="sysobj_desc_title">Creation</div> | ||
|
||
The class can be instantiated in the following way with and without property name value pairs. | ||
|
||
```matlab | ||
dev = {{ obj.name }} | ||
dev = {{ obj.name }}(Name, Value) | ||
``` | ||
|
||
<div class="sysobj_desc_title">Properties</div> | ||
|
||
<div class="sysobj_desc_txt"> | ||
<span> | ||
Unless otherwise indicated, properties are non-tunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them. | ||
<br><br> | ||
If a property is tunable, you can change its value at any time. | ||
<br><br> | ||
For more information on changing property values, see <a href="https://www.mathworks.com/help/matlab/matlab_prog/system-design-in-matlab-using-system-objects.html">System Design in MATLAB Using System Objects.</a> | ||
</span> | ||
</div> | ||
<br> | ||
|
||
|
||
{% for prop in obj.props %} | ||
:::{dropdown} {{ prop.prop_name }} | ||
{{ prop.prop_description }} | ||
::: | ||
{% endfor -%} | ||
|
||
|
||
|
||
|
||
{% endblock %} | ||
|
||
<br> | ||
<div class="sysobj_desc_title">Example Usage</div> | ||
|
||
```matlab | ||
{% if obj.type == "Tx" %} | ||
%% Configure device | ||
tx = {{ obj.name }}; | ||
tx.uri = 'ip:analog.local'; | ||
{% if obj.name == "adi.ADRV9002.Tx" %} | ||
tx.CenterFrequencyChannel0 = 1e9; | ||
{% else %} | ||
tx.CenterFrequency = 1e9; | ||
{% endif %} | ||
tx.DataSource = 'DMA'; | ||
tx.EnableCyclicBuffers = true; | ||
tx.EnabledChannels = 1; | ||
%% Generate tone | ||
amplitude = 2^15; frequency = 0.12e6; | ||
swv1 = dsp.SineWave(amplitude, frequency); | ||
swv1.ComplexOutput = true; | ||
swv1.SamplesPerFrame = 2^14; | ||
swv1.SampleRate = tx.SamplingRate; | ||
y = swv1(); | ||
% Send | ||
tx(y); | ||
{% else %} | ||
%% Rx set up | ||
rx = {{ obj.name }}('uri','ip:analog.local'); | ||
{% if obj.name == "adi.ADRV9002.Rx" %} | ||
rx.CenterFrequencyChannel0 = 1e9; | ||
{% else %} | ||
rx.CenterFrequency = 1e9; | ||
{% endif %} | ||
rx.EnabledChannels = 1; | ||
%% Run | ||
for k=1:10 | ||
valid = false; | ||
while ~valid | ||
[out, valid] = rx(); | ||
end | ||
end | ||
{% endif %} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
[filepath,name,ext] = fileparts(mfilename('fullpath')); | ||
cd(filepath); | ||
cd('..'); | ||
files = dir(filepath); | ||
|
||
mfiledir = fullfile('adi'); | ||
docdir = fullfile('doc'); | ||
|
||
rootClasses = {... | ||
{'Attribute'},... | ||
{'DDS'},... | ||
{'Tx'},... | ||
{'BufferADI'},... | ||
{'Channel'},... | ||
{'DDS'},... | ||
{'DebugAttribute'},... | ||
{'DeviceAttribute'},... | ||
{'RegisterReadWrite'},... | ||
{'Rx'},... | ||
{'RxTx'},... | ||
{'Sensor'},... | ||
}; | ||
|
||
all_devs = []; | ||
for ii = 1:numel(rootClasses) | ||
part = rootClasses{ii}{1}; | ||
all_props = []; | ||
dotmfilename = strcat(part); | ||
props = properties(dotmfilename); | ||
for prop = 1:length(props) | ||
|
||
if props{prop} == "enIO" | ||
continue; | ||
end | ||
pdoc = help(strcat(dotmfilename,'.',props{prop})); | ||
|
||
pdocs = strsplit(pdoc,'\n'); | ||
prop_title = pdocs{1}; | ||
prop_description = strip(replace(strjoin(pdocs(2:end),'\n'),'\n','')); | ||
prop_description = int32(prop_description); | ||
prop_description(prop_description==10) = []; | ||
prop_description(prop_description==13) = []; | ||
prop_description = char(prop_description); | ||
prop_description = replace(prop_description,' ',' '); | ||
prop_description = replace(prop_description,' ',' '); | ||
|
||
s = struct('prop_name',props{prop},... | ||
'prop_title',prop_title,... | ||
'prop_description',prop_description); | ||
all_props = [all_props,s]; | ||
end | ||
top_doc = help(dotmfilename); | ||
top_doc = strsplit(top_doc,'\n'); | ||
top_doc = replace(top_doc,'\n','<br>'); | ||
top_doc = strjoin(top_doc(2:end),'<br>'); | ||
|
||
% top_doc = strip(replace(top_doc,'\n','')); | ||
% top_doc = int32(top_doc); | ||
% top_doc(top_doc==10) = []; | ||
% top_doc(top_doc==13) = []; | ||
% top_doc = char(top_doc); | ||
% top_doc = replace(top_doc,' ',' '); | ||
% top_doc = replace(top_doc,' ',' '); | ||
|
||
|
||
oname = struct('name',dotmfilename, 'dec',top_doc, 'props',all_props); | ||
all_devs = [all_devs, oname]; | ||
end | ||
%% | ||
jsonText = jsonencode(all_devs,'PrettyPrint',true); | ||
fid = fopen('docs/sysobjs.json', 'w'); | ||
fprintf(fid, '%s', jsonText); | ||
fclose(fid); | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed