Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

sphinx_docs #160

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
11 changes: 10 additions & 1 deletion blocklib/analog/agc/agc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ parameters:
- id: rate
label: Rate
dtype: float
default: 1e-4
# default: 1e-4
doc: the update rate of the loop
- id: reference
label: Reference
dtype: float
default: 1.0
doc: reference value to adjust signal power to
- id: gain
label: Gain
dtype: float
default: 1.0
doc: initial gain value

ports:
- domain: stream
Expand All @@ -38,6 +41,12 @@ ports:
direction: output
type: typekeys/T

doc:
brief: high performance Automatic Gain Control Block.
long: |-
Power is approximated by absolute value
second line

implementations:
- id: cpu

Expand Down
2 changes: 2 additions & 0 deletions docs/sphinx/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_build
!Makefile
20 changes: 20 additions & 0 deletions docs/sphinx/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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 = .
BUILDDIR = _build

# 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)
1 change: 1 addition & 0 deletions docs/sphinx/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**newsched**
58 changes: 58 additions & 0 deletions docs/sphinx/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = 'newsched'
copyright = '2021, Josh Morman'
author = 'Josh Morman'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.napoleon'
]

autosummary_generate = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
25 changes: 25 additions & 0 deletions docs/sphinx/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. newsched documentation master file, created by
sphinx-quickstart on Mon Nov 22 16:46:33 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to newsched's documentation!
====================================

.. automodule:: newsched
.. automodule:: newsched.analog
.. autoblock:: newsched.analog.agc_cc


.. toctree::
:maxdepth: 2
:caption: Contents:



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
35 changes: 35 additions & 0 deletions docs/sphinx/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
21 changes: 19 additions & 2 deletions utils/blockbuilder/templates/blockname_pybind_templated.cc.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,20 @@ void bind_{{ block }}_template(py::module& m, const char* classname)
{
// using block_class = gr::{{ module }}::{{ block }}<{{typestr}}>;

py::class_<gr::{{ module }}::{{ block }}<{{typestr}}>, {{ inherits }}{{',' if inherits}} gr::block, gr::node, std::shared_ptr<gr::{{ module }}::{{ block }}<{{typestr}}>>> {{block}}_class(m, classname);
py::class_<gr::{{ module }}::{{ block }}<{{typestr}}>, {{ inherits }}{{',' if inherits}} gr::block, gr::node, std::shared_ptr<gr::{{ module }}::{{ block }}<{{typestr}}>>> {{block}}_class(m, classname
{% if doc %}{% if 'brief' in doc -%}
,"{{doc['brief']}}"
{% endif -%}
{% if 'long' in doc -%}
{% if 'brief' in doc and 'long' in doc-%}
"\n\n"
{%endif-%}
{% set list1 = doc['long'].split('\n') -%}
{% for item in list1 -%}
"{{item}}{{"\\n" if not loop.last}}"
{% endfor -%}
{% endif -%}
{% endif -%});

py::enum_<typename ::gr::{{ module }}::{{ block }}<{{typestr}}>::available_impl>({{block}}_class, "available_impl")
{% for impl in implementations -%}
Expand All @@ -26,7 +39,11 @@ void bind_{{ block }}_template(py::module& m, const char* classname)
return ::gr::{{ module }}::{{block}}<{{typestr}}>::make({ {% if parameters %}{% for param in parameters -%}{% if 'cotr' not in param or param['cotr']%}{{ param['id'] }}{{ ", " if not loop.last }}{% endif %}{%endfor%}{% endif %} }, impl);
}),
{% if parameters %} {% for param in parameters -%}{% if 'cotr' not in param or param['cotr']%}
py::arg("{{ param['id'] }}"){% if 'default' in param %} = {{param['default']}}{% endif %},{% endif %}
{% if 'doc' in param -%}
py::arg_v("{{ param['id'] }}", {% if 'default' in param %}{{param['default']}}{%else%}static_cast<{{param['dtype']}}*>(nullptr){% endif %},"{{param['doc']}}")
{% else -%}
py::arg("{{ param['id'] }}"){% if 'default' in param %} = {{param['default']}}{% endif %}
{%- endif -%},{% endif -%}
{% endfor -%} {% endif %}
py::arg("impl") = gr::{{module}}::{{block}}<{{typestr}}>::available_impl::{{ implementations[0]['id'] | upper }})
{% for cb in callbacks -%}
Expand Down