API Documentation Template
Use this file (docs/en/api-reference/template.rst) as a template to document API.
Change the file name to the name of the header file that represents the documented API.
Include respective files with descriptions from the API folder using
Optionally provide description right in this file.
Once done, remove all instructions like this one and any superfluous headers.
Provide overview where and how this API may be used.
Include code snippets to illustrate functionality of particular functions when applicable.
To distinguish between sections, use the following heading levels:
#with overline, for parts
*with overline, for chapters
Prepare one or more practical examples to demonstrate functionality of this API.
Each example should follow pattern of projects located in
Place example in this folder, and add
Provide overview of demonstrated functionality in
With good overview readers should be able to understand what example does without opening the source code.
Depending on complexity of example, break down description of code into parts and provide overview of functionality of each part.
Include flow diagram and screenshots of application output if applicable.
Finally add in this section synopsis of each example together with link to respective folder in
ESP-IDF repository provides automatic update of API reference documentation using code markup retrieved by Doxygen from header files.
Update is done on each documentation build by invoking Sphinx extension
esp_extensions/run_doxygen.pyfor all header files listed in the
INPUTstatement of docs/doxygen/Doxyfile.
Each line of the
INPUTstatement (other than a comment that begins with
##) contains a path to header file
*.hthat is used to generate corresponding
## ## Wi-Fi - API Reference ## ../components/esp32/include/esp_wifi.h \ ../components/esp32/include/esp_smartconfig.h \
When the headers are expanded, any macros defined by default in
sdkconfig.has well as any macros defined in SOC-specific
include/soc/*_caps.hheaders will be expanded. This allows the headers to include or exclude material based on the
*.incfiles contain formatted reference of API members generated automatically on each documentation build. All
*.incfiles are placed in Sphinx
_builddirectory. To see directives generated, e.g.,
python gen-dxd.py esp32/include/esp_wifi.h.
To show contents of
*.incfile in documentation, include it as follows:
.. include-build-file:: inc/esp_wifi.inc
For example see docs/en/api-reference/network/esp_wifi.rst
Optionally, rather that using
*.incfiles, you may want to describe API in you own way. See docs/en/api-reference/storage/fatfs.rst for example.
Below is the list of common
.. doxygenfunction:: name_of_function
.. doxygenunion:: name_of_union
.. doxygenstruct:: name_of_structuretogether with
.. doxygendefine:: name_of_define
Type Definitions -
.. doxygentypedef:: name_of_type
.. doxygenenum:: name_of_enumeration
See Breathe documentation for additional information.
To provide a link to header file, use the link custom role directive as follows:
In any case, to generate API reference, the file docs/doxygen/Doxyfile should be updated with paths to
*.hheaders that are being documented.
When changes are committed and documentation is built, check how this section has been rendered. Correct annotations in respective header files, if required.