From 2986920457563533752c3c97fecf57669a65b15c Mon Sep 17 00:00:00 2001 From: CharlesDias Date: Sat, 17 Dec 2022 09:50:44 -0300 Subject: [PATCH] docs: add Doxygen configuration --- .gitignore | 3 + CMakeLists.txt | 4 + Makefile | 19 ++++- cmake/Docs.cmake | 9 +++ docs/Doxyfile | 78 +++++++++++++++++++ .../Libraries/Drivers/Include/gpio.h | 17 +++- 6 files changed, 122 insertions(+), 8 deletions(-) create mode 100644 cmake/Docs.cmake create mode 100644 docs/Doxyfile diff --git a/.gitignore b/.gitignore index b75b1f1..fb9a862 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +### Doxygen ### +docs/html/ + ### Eclipse ### Debug/ Release/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 38076dc..5cca72e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,10 @@ option(ENABLE_COVERAGE "Enable a Code Coverage build." OFF) ### CMAKE MODULES set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/) + +# Doxygen module +include(Docs) + if (ENABLE_COVERAGE) include(CodeCoverage) append_coverage_compiler_flags() diff --git a/Makefile b/Makefile index 5b48c85..a9cb183 100644 --- a/Makefile +++ b/Makefile @@ -19,12 +19,23 @@ coverage: cmake --build build --config Debug --target coverage -j4 @echo "" -report: - @echo "-------------------- Coverage Report ---------------------" - lcov --capture --directory build/coverage --output-file coverage.info - genhtml coverage.info --output-directory test/ +doxygen: build + @echo "-------------------- Build Coverage--------------------------" + cmake --build build --config Debug --target docs -j4 @echo "" +gtest_report: + cd build-artifacts/gtest_report && xsltproc gtest2html.xslt out/*.xml > gtest_report.html + # cd report && xsltproc gtest2html.xslt *.xml > gtest_report.html + # cd report && xsltproc test.xslt *.xml > gtest_report.html + # cd report && xsltproc newgtest2html.xsl *.xml > gtest_report.html +# Don't work!!!! +# report: +# @echo "-------------------- Coverage Report ---------------------" +# lcov --capture --directory build/coverage --output-file coverage.info +# genhtml coverage.info --output-directory test/ +# @echo "" + dependency: @echo "-------------------- Create Graph Dependecy --------------" cd build && cmake .. --graphviz=graph.dot && dot -Tpng graph.dot -o graph_image.png diff --git a/cmake/Docs.cmake b/cmake/Docs.cmake new file mode 100644 index 0000000..6567752 --- /dev/null +++ b/cmake/Docs.cmake @@ -0,0 +1,9 @@ +find_package(Doxygen) + +if (DOXYGEN_FOUND) + add_custom_target( + docs + ${DOXYGEN_EXECUTABLE} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs + ) +endif() diff --git a/docs/Doxyfile b/docs/Doxyfile new file mode 100644 index 0000000..07cd3b7 --- /dev/null +++ b/docs/Doxyfile @@ -0,0 +1,78 @@ +# Configuration for Doxygen for use with CMake +# Only options that deviate from the default are included +# To create a new Doxyfile containing all available options, call `doxygen -g` + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = "STM32 C code and Google Test Framework" +PROJECT_NUMBER = 1.0 +PROJECT_BRIEF = +PROJECT_LOGO = +OUTPUT_DIRECTORY = ./ +OUTPUT_LANGUAGE = English +MARKDOWN_SUPPORT = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +RECURSIVE = YES +GENERATE_HTML = YES +GENERATE_LATEX = NO +HAVE_DOT = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT tags are set +# to YES then doxygen will generate a graph for each documented file showing the direct +# and indirect include dependencies of the file with other documented files. +INCLUDE_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen will graphical +# hierarchy of all classes instead of a textual one. +GRAPHICAL_HIERARCHY = YES + +# If the CLASS_DIAGRAMS tag is set to YES (the default) doxygen will generate a class +# diagram (in HTML and $\mbox{\LaTeX}$) for classes with base or super classes. +CLASS_DIAGRAMS = YES + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen will generate a graph +# for each documented class showing the direct and indirect inheritance relations. +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen will generate a +# graph for each documented class showing the direct and indirect implementation dependencies +# (inheritance, containment, and class references variables) of the class with other documented classes. +COLLABORATION_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will generate a call +# dependency graph for every global function or class method +CALL_GRAPH = YES +UML_LOOK = YES +UML_LIMIT_NUM_FIELDS = 50 +TEMPLATE_RELATIONS = YES +DOT_GRAPH_MAX_NODES = 100 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = YES +HIDE_UNDOC_RELATIONS = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- +USE_MDFILE_AS_MAINPAGE = ../README.md +IMAGE_PATH = ./images +INPUT = ../README.md \ +INPUT = ../source/nucleo-f446ze-library/Libraries +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cpp \ + *.c++ \ + *.h \ + *.hpp \ + *.h++ \ + *.md \ + *.dox \ + *.doc \ + *.txt + diff --git a/source/nucleo-f446ze-library/Libraries/Drivers/Include/gpio.h b/source/nucleo-f446ze-library/Libraries/Drivers/Include/gpio.h index 9259453..644845b 100644 --- a/source/nucleo-f446ze-library/Libraries/Drivers/Include/gpio.h +++ b/source/nucleo-f446ze-library/Libraries/Drivers/Include/gpio.h @@ -25,14 +25,23 @@ typedef enum }GpioState_t; +/** + * @struct A structure to represent the GPIO pin. + */ typedef struct Gpio { - bool init; - const GpioPort_t *port; - GpioPin_t pin; + bool init; /**< Flag to inform if the structure has been initialized.*/ + const GpioPort_t *port; /**< Port number.*/ + GpioPin_t pin; /**< Pin number.*/ }Gpio_t; - +/** + * @brief Initialize the \ref Gpio_t structure. + * + * @param me Pointer to \ref Gpio_t. + * @param port Port number. + * @param pin Pin number. + */ void GPIO_Initialize(Gpio_t * const me, const GpioPort_t * const port, const GpioPin_t pin); void GPIO_TogglePin(const Gpio_t * const me); void GPIO_WritePin(const Gpio_t * const me, const GpioState_t state);