add changes from spark abacus project

This commit is contained in:
King Kévin 2016-10-23 17:42:27 +02:00
parent a625a03cd8
commit 7aa9c23a27
7 changed files with 631 additions and 345 deletions

400
Doxyfile
View File

@ -1,4 +1,4 @@
# Doxyfile 1.8.6 # Doxyfile 1.8.11
# This file describes the settings to be used by the documentation system # This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project. # doxygen (www.doxygen.org) for a project.
@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places. # title of most generated pages and in a few other places.
# The default value is: My Project. # The default value is: My Project.
PROJECT_NAME = "project name to be set in Doxyfile" PROJECT_NAME = "CuVoodoo STM32F1 firmware template"
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This # The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
@ -46,10 +46,10 @@ PROJECT_NUMBER =
PROJECT_BRIEF = PROJECT_BRIEF =
# With the PROJECT_LOGO tag one can specify an logo or icon that is included in # With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# the documentation. The maximum height of the logo should not exceed 55 pixels # in the documentation. The maximum height of the logo should not exceed 55
# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# to the output directory. # the logo to the output directory.
PROJECT_LOGO = PROJECT_LOGO =
@ -60,7 +60,7 @@ PROJECT_LOGO =
OUTPUT_DIRECTORY = doc OUTPUT_DIRECTORY = doc
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and # directories (in 2 levels) under the output directory of each output format and
# will distribute the generated files over these directories. Enabling this # will distribute the generated files over these directories. Enabling this
# option can be useful when feeding doxygen a huge amount of source files, where # option can be useful when feeding doxygen a huge amount of source files, where
@ -70,6 +70,14 @@ OUTPUT_DIRECTORY = doc
CREATE_SUBDIRS = NO CREATE_SUBDIRS = NO
# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
# characters to appear in the names of generated files. If set to NO, non-ASCII
# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
# U+3044.
# The default value is: NO.
ALLOW_UNICODE_NAMES = NO
# The OUTPUT_LANGUAGE tag is used to specify the language in which all # The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this # documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language. # information to generate all constant output in the proper language.
@ -85,14 +93,14 @@ CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English OUTPUT_LANGUAGE = English
# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
# descriptions after the members that are listed in the file and class # descriptions after the members that are listed in the file and class
# documentation (similar to Javadoc). Set to NO to disable this. # documentation (similar to Javadoc). Set to NO to disable this.
# The default value is: YES. # The default value is: YES.
BRIEF_MEMBER_DESC = YES BRIEF_MEMBER_DESC = YES
# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief # If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
# description of a member or function before the detailed description # description of a member or function before the detailed description
# #
# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
@ -127,7 +135,7 @@ ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO INLINE_INHERITED_MEMB = NO
# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path # If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
# before files name in the file list and in the header files. If set to NO the # before files name in the file list and in the header files. If set to NO the
# shortest path that makes the file name unique will be used # shortest path that makes the file name unique will be used
# The default value is: YES. # The default value is: YES.
@ -197,9 +205,9 @@ MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES INHERIT_DOCS = YES
# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a # If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
# new page for each member. If set to NO, the documentation of a member will be # page for each member. If set to NO, the documentation of a member will be part
# part of the file/class/namespace that contains it. # of the file/class/namespace that contains it.
# The default value is: NO. # The default value is: NO.
SEPARATE_MEMBER_PAGES = NO SEPARATE_MEMBER_PAGES = NO
@ -261,11 +269,14 @@ OPTIMIZE_OUTPUT_VHDL = NO
# extension. Doxygen has a built-in mapping, but you can override or extend it # extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and # using this tag. The format is ext=language, where ext is a file extension, and
# language is one of the parsers supported by doxygen: IDL, Java, Javascript, # language is one of the parsers supported by doxygen: IDL, Java, Javascript,
# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make # C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
# (default is Fortran), use: inc=Fortran f=C. # Fortran. In the later case the parser tries to guess whether the code is fixed
# or free formatted code, this is the default for Fortran type files), VHDL. For
# instance to make doxygen treat .inc files as Fortran files (default is PHP),
# and .f files as C (default is Fortran), use: inc=Fortran f=C.
# #
# Note For files without extension you can use no_extension as a placeholder. # Note: For files without extension you can use no_extension as a placeholder.
# #
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise # Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen. # the files are not read by doxygen.
@ -284,8 +295,8 @@ MARKDOWN_SUPPORT = YES
# When enabled doxygen tries to link words that correspond to documented # When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can # classes, or namespaces to their corresponding documentation. Such a link can
# be prevented in individual cases by by putting a % sign in front of the word # be prevented in individual cases by putting a % sign in front of the word or
# or globally by setting AUTOLINK_SUPPORT to NO. # globally by setting AUTOLINK_SUPPORT to NO.
# The default value is: YES. # The default value is: YES.
AUTOLINK_SUPPORT = YES AUTOLINK_SUPPORT = YES
@ -325,13 +336,20 @@ SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES IDL_PROPERTY_SUPPORT = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES, then doxygen will reuse the documentation of the first # tag is set to YES then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default # member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly. # all members of a group must be documented explicitly.
# The default value is: NO. # The default value is: NO.
DISTRIBUTE_GROUP_DOC = NO DISTRIBUTE_GROUP_DOC = NO
# If one adds a struct or class to a group and this option is enabled, then also
# any nested class or struct is added to the same group. By default this option
# is disabled and one has to add nested compounds explicitly via \ingroup.
# The default value is: NO.
GROUP_NESTED_COMPOUNDS = NO
# Set the SUBGROUPING tag to YES to allow class member groups of the same type # Set the SUBGROUPING tag to YES to allow class member groups of the same type
# (for instance a group of public functions) to be put as a subgroup of that # (for instance a group of public functions) to be put as a subgroup of that
# type (e.g. under the Public Functions section). Set it to NO to prevent # type (e.g. under the Public Functions section). Set it to NO to prevent
@ -390,7 +408,7 @@ LOOKUP_CACHE_SIZE = 0
# Build related configuration options # Build related configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
# documentation are documented, even if no documentation was available. Private # documentation are documented, even if no documentation was available. Private
# class members and static file members will be hidden unless the # class members and static file members will be hidden unless the
# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
@ -400,35 +418,35 @@ LOOKUP_CACHE_SIZE = 0
EXTRACT_ALL = NO EXTRACT_ALL = NO
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
# be included in the documentation. # be included in the documentation.
# The default value is: NO. # The default value is: NO.
EXTRACT_PRIVATE = YES EXTRACT_PRIVATE = YES
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
# scope will be included in the documentation. # scope will be included in the documentation.
# The default value is: NO. # The default value is: NO.
EXTRACT_PACKAGE = YES EXTRACT_PACKAGE = YES
# If the EXTRACT_STATIC tag is set to YES all static members of a file will be # If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
# included in the documentation. # included in the documentation.
# The default value is: NO. # The default value is: NO.
EXTRACT_STATIC = YES EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined # If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
# locally in source files will be included in the documentation. If set to NO # locally in source files will be included in the documentation. If set to NO,
# only classes defined in header files are included. Does not have any effect # only classes defined in header files are included. Does not have any effect
# for Java sources. # for Java sources.
# The default value is: YES. # The default value is: YES.
EXTRACT_LOCAL_CLASSES = YES EXTRACT_LOCAL_CLASSES = YES
# This flag is only useful for Objective-C code. When set to YES local methods, # This flag is only useful for Objective-C code. If set to YES, local methods,
# which are defined in the implementation section but not in the interface are # which are defined in the implementation section but not in the interface are
# included in the documentation. If set to NO only methods in the interface are # included in the documentation. If set to NO, only methods in the interface are
# included. # included.
# The default value is: NO. # The default value is: NO.
@ -453,21 +471,21 @@ HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy. If set # undocumented classes that are normally visible in the class hierarchy. If set
# to NO these classes will be included in the various overviews. This option has # to NO, these classes will be included in the various overviews. This option
# no effect if EXTRACT_ALL is enabled. # has no effect if EXTRACT_ALL is enabled.
# The default value is: NO. # The default value is: NO.
HIDE_UNDOC_CLASSES = NO HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
# (class|struct|union) declarations. If set to NO these declarations will be # (class|struct|union) declarations. If set to NO, these declarations will be
# included in the documentation. # included in the documentation.
# The default value is: NO. # The default value is: NO.
HIDE_FRIEND_COMPOUNDS = NO HIDE_FRIEND_COMPOUNDS = NO
# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
# documentation blocks found inside the body of a function. If set to NO these # documentation blocks found inside the body of a function. If set to NO, these
# blocks will be appended to the function's detailed documentation block. # blocks will be appended to the function's detailed documentation block.
# The default value is: NO. # The default value is: NO.
@ -481,7 +499,7 @@ HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO INTERNAL_DOCS = NO
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file # If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
# names in lower-case letters. If set to YES upper-case letters are also # names in lower-case letters. If set to YES, upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ # allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows # in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO. # and Mac users are advised to set this option to NO.
@ -490,12 +508,19 @@ INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES CASE_SENSE_NAMES = YES
# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
# their full class and namespace scopes in the documentation. If set to YES the # their full class and namespace scopes in the documentation. If set to YES, the
# scope will be hidden. # scope will be hidden.
# The default value is: NO. # The default value is: NO.
HIDE_SCOPE_NAMES = NO HIDE_SCOPE_NAMES = NO
# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
# append additional text to a page's title, such as Class Reference. If set to
# YES the compound reference will be hidden.
# The default value is: NO.
HIDE_COMPOUND_REFERENCE= NO
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
# the files that are included by a file in the documentation of that file. # the files that are included by a file in the documentation of that file.
# The default value is: YES. # The default value is: YES.
@ -523,14 +548,14 @@ INLINE_INFO = YES
# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
# (detailed) documentation of file and class members alphabetically by member # (detailed) documentation of file and class members alphabetically by member
# name. If set to NO the members will appear in declaration order. # name. If set to NO, the members will appear in declaration order.
# The default value is: YES. # The default value is: YES.
SORT_MEMBER_DOCS = YES SORT_MEMBER_DOCS = YES
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
# descriptions of file, namespace and class members alphabetically by member # descriptions of file, namespace and class members alphabetically by member
# name. If set to NO the members will appear in declaration order. Note that # name. If set to NO, the members will appear in declaration order. Note that
# this will also influence the order of the classes in the class list. # this will also influence the order of the classes in the class list.
# The default value is: NO. # The default value is: NO.
@ -575,27 +600,25 @@ SORT_BY_SCOPE_NAME = NO
STRICT_PROTO_MATCHING = NO STRICT_PROTO_MATCHING = NO
# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the # The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
# todo list. This list is created by putting \todo commands in the # list. This list is created by putting \todo commands in the documentation.
# documentation.
# The default value is: YES. # The default value is: YES.
GENERATE_TODOLIST = YES GENERATE_TODOLIST = YES
# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the # The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
# test list. This list is created by putting \test commands in the # list. This list is created by putting \test commands in the documentation.
# documentation.
# The default value is: YES. # The default value is: YES.
GENERATE_TESTLIST = YES GENERATE_TESTLIST = YES
# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug # The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
# list. This list is created by putting \bug commands in the documentation. # list. This list is created by putting \bug commands in the documentation.
# The default value is: YES. # The default value is: YES.
GENERATE_BUGLIST = YES GENERATE_BUGLIST = YES
# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
# the deprecated list. This list is created by putting \deprecated commands in # the deprecated list. This list is created by putting \deprecated commands in
# the documentation. # the documentation.
# The default value is: YES. # The default value is: YES.
@ -620,8 +643,8 @@ ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30 MAX_INITIALIZER_LINES = 30
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
# the bottom of the documentation of classes and structs. If set to YES the list # the bottom of the documentation of classes and structs. If set to YES, the
# will mention the files that were used to generate the documentation. # list will mention the files that were used to generate the documentation.
# The default value is: YES. # The default value is: YES.
SHOW_USED_FILES = YES SHOW_USED_FILES = YES
@ -669,8 +692,7 @@ LAYOUT_FILE =
# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. # to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
# For LaTeX the style of the bibliography can be controlled using # For LaTeX the style of the bibliography can be controlled using
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. Do not use file names with spaces, bibtex cannot handle them. See # search path. See also \cite for info how to create references.
# also \cite for info how to create references.
CITE_BIB_FILES = CITE_BIB_FILES =
@ -686,7 +708,7 @@ CITE_BIB_FILES =
QUIET = NO QUIET = NO
# The WARNINGS tag can be used to turn on/off the warning messages that are # The WARNINGS tag can be used to turn on/off the warning messages that are
# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES # generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
# this implies that the warnings are on. # this implies that the warnings are on.
# #
# Tip: Turn warnings on while writing the documentation. # Tip: Turn warnings on while writing the documentation.
@ -694,7 +716,7 @@ QUIET = NO
WARNINGS = YES WARNINGS = YES
# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate # If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
# will automatically be disabled. # will automatically be disabled.
# The default value is: YES. # The default value is: YES.
@ -711,12 +733,18 @@ WARN_IF_DOC_ERROR = YES
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
# are documented, but have no documentation for their parameters or return # are documented, but have no documentation for their parameters or return
# value. If set to NO doxygen will only warn about wrong or incomplete parameter # value. If set to NO, doxygen will only warn about wrong or incomplete
# documentation, but not about the absence of documentation. # parameter documentation, but not about the absence of documentation.
# The default value is: NO. # The default value is: NO.
WARN_NO_PARAMDOC = YES WARN_NO_PARAMDOC = YES
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
# a warning is encountered.
# The default value is: NO.
WARN_AS_ERROR = NO
# The WARN_FORMAT tag determines the format of the warning messages that doxygen # The WARN_FORMAT tag determines the format of the warning messages that doxygen
# can produce. The string should contain the $file, $line, and $text tags, which # can produce. The string should contain the $file, $line, and $text tags, which
# will be replaced by the file and line number from which the warning originated # will be replaced by the file and line number from which the warning originated
@ -740,10 +768,11 @@ WARN_LOGFILE =
# The INPUT tag is used to specify the files and/or directories that contain # The INPUT tag is used to specify the files and/or directories that contain
# documented source files. You may enter file names like myfile.cpp or # documented source files. You may enter file names like myfile.cpp or
# directories like /usr/src/myproject. Separate the files or directories with # directories like /usr/src/myproject. Separate the files or directories with
# spaces. # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = . lib/ INPUT = . \
lib/
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@ -756,12 +785,17 @@ INPUT_ENCODING = UTF-8
# If the value of the INPUT tag contains directories, you can use the # If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
# *.h) to filter out the source-files in the directories. If left blank the # *.h) to filter out the source-files in the directories.
# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, #
# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, # Note that for custom extensions or not directly supported extensions you also
# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, # need to set EXTENSION_MAPPING for the extension otherwise the files are not
# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, # read by doxygen.
# *.qsf, *.as and *.js. #
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl,
# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js.
FILE_PATTERNS = FILE_PATTERNS =
@ -847,6 +881,10 @@ IMAGE_PATH =
# Note that the filter must not add or remove lines; it is applied before the # Note that the filter must not add or remove lines; it is applied before the
# code is scanned, but not when the output code is generated. If lines are added # code is scanned, but not when the output code is generated. If lines are added
# or removed, the anchors will not be placed correctly. # or removed, the anchors will not be placed correctly.
#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
INPUT_FILTER = INPUT_FILTER =
@ -856,11 +894,15 @@ INPUT_FILTER =
# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the # filters are used. If the FILTER_PATTERNS tag is empty or if none of the
# patterns match the file name, INPUT_FILTER is applied. # patterns match the file name, INPUT_FILTER is applied.
#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
FILTER_PATTERNS = FILTER_PATTERNS =
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER ) will also be used to filter the input files that are used for # INPUT_FILTER) will also be used to filter the input files that are used for
# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
# The default value is: NO. # The default value is: NO.
@ -920,7 +962,7 @@ REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO REFERENCES_RELATION = NO
# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
# to YES, then the hyperlinks from functions in REFERENCES_RELATION and # to YES then the hyperlinks from functions in REFERENCES_RELATION and
# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
# link to the documentation. # link to the documentation.
# The default value is: YES. # The default value is: YES.
@ -997,7 +1039,7 @@ IGNORE_PREFIX =
# Configuration options related to the HTML output # Configuration options related to the HTML output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output # If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
# The default value is: YES. # The default value is: YES.
GENERATE_HTML = YES GENERATE_HTML = YES
@ -1059,13 +1101,15 @@ HTML_FOOTER =
HTML_STYLESHEET = HTML_STYLESHEET =
# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- # The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# defined cascading style sheet that is included after the standard style sheets # cascading style sheets that are included after the standard style sheets
# created by doxygen. Using this option one can overrule certain style aspects. # created by doxygen. Using this option one can overrule certain style aspects.
# This is preferred over using HTML_STYLESHEET since it does not replace the # This is preferred over using HTML_STYLESHEET since it does not replace the
# standard style sheet and is therefor more robust against future updates. # standard style sheet and is therefore more robust against future updates.
# Doxygen will copy the style sheet file to the output directory. For an example # Doxygen will copy the style sheet files to the output directory.
# see the documentation. # Note: The order of the extra style sheet files is of importance (e.g. the last
# style sheet in the list overrules the setting of the previous ones in the
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_STYLESHEET = HTML_EXTRA_STYLESHEET =
@ -1081,7 +1125,7 @@ HTML_EXTRA_STYLESHEET =
HTML_EXTRA_FILES = HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the stylesheet and background images according to # will adjust the colors in the style sheet and background images according to
# this color. Hue is specified as an angle on a colorwheel, see # this color. Hue is specified as an angle on a colorwheel, see
# http://en.wikipedia.org/wiki/Hue for more information. For instance the value # http://en.wikipedia.org/wiki/Hue for more information. For instance the value
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
@ -1112,8 +1156,9 @@ HTML_COLORSTYLE_GAMMA = 80
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting this # page will contain the date and time when the page was generated. Setting this
# to NO can help when comparing the output of multiple runs. # to YES can help to show when doxygen was last run and thus if the
# The default value is: YES. # documentation is up to date.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_TIMESTAMP = YES HTML_TIMESTAMP = YES
@ -1209,28 +1254,29 @@ GENERATE_HTMLHELP = NO
CHM_FILE = CHM_FILE =
# The HHC_LOCATION tag can be used to specify the location (absolute path # The HHC_LOCATION tag can be used to specify the location (absolute path
# including file name) of the HTML help compiler ( hhc.exe). If non-empty # including file name) of the HTML help compiler (hhc.exe). If non-empty,
# doxygen will try to run the HTML help compiler on the generated index.hhp. # doxygen will try to run the HTML help compiler on the generated index.hhp.
# The file has to be specified with full path. # The file has to be specified with full path.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES. # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
HHC_LOCATION = HHC_LOCATION =
# The GENERATE_CHI flag controls if a separate .chi index file is generated ( # The GENERATE_CHI flag controls if a separate .chi index file is generated
# YES) or that it should be included in the master .chm file ( NO). # (YES) or that it should be included in the master .chm file (NO).
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES. # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
GENERATE_CHI = NO GENERATE_CHI = NO
# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) # The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
# and project file content. # and project file content.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES. # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
CHM_INDEX_ENCODING = CHM_INDEX_ENCODING =
# The BINARY_TOC flag controls whether a binary table of contents is generated ( # The BINARY_TOC flag controls whether a binary table of contents is generated
# YES) or a normal table of contents ( NO) in the .chm file. # (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
# enables the Previous and Next buttons.
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES. # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
@ -1343,7 +1389,7 @@ DISABLE_INDEX = NO
# index structure (just like the one that is generated for HTML Help). For this # index structure (just like the one that is generated for HTML Help). For this
# to work a browser that supports JavaScript, DHTML, CSS and frames is required # to work a browser that supports JavaScript, DHTML, CSS and frames is required
# (i.e. any modern browser). Windows users are probably better off using the # (i.e. any modern browser). Windows users are probably better off using the
# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
# further fine-tune the look of the index. As an example, the default style # further fine-tune the look of the index. As an example, the default style
# sheet generated by doxygen has an example that shows how to put an image at # sheet generated by doxygen has an example that shows how to put an image at
# the root of the tree instead of the PROJECT_NAME. Since the tree basically has # the root of the tree instead of the PROJECT_NAME. Since the tree basically has
@ -1371,7 +1417,7 @@ ENUM_VALUES_PER_LINE = 4
TREEVIEW_WIDTH = 250 TREEVIEW_WIDTH = 250
# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to # If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
# external symbols imported via tag files in a separate window. # external symbols imported via tag files in a separate window.
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
@ -1400,7 +1446,7 @@ FORMULA_TRANSPARENT = YES
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
# http://www.mathjax.org) which uses client side Javascript for the rendering # http://www.mathjax.org) which uses client side Javascript for the rendering
# instead of using prerendered bitmaps. Use this if you do not have LaTeX # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When # installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path # enabled you may also need to install MathJax separately and configure the path
# to it using the MATHJAX_RELPATH option. # to it using the MATHJAX_RELPATH option.
@ -1470,11 +1516,11 @@ SEARCHENGINE = YES
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be # When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript. There # implemented using a web server instead of a web client using Javascript. There
# are two flavours of web server based searching depending on the # are two flavors of web server based searching depending on the EXTERNAL_SEARCH
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for # setting. When disabled, doxygen will generate a PHP script for searching and
# searching and an index file used by the script. When EXTERNAL_SEARCH is # an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
# enabled the indexing and searching needs to be provided by external tools. See # and searching needs to be provided by external tools. See the section
# the section "External Indexing and Searching" for details. # "External Indexing and Searching" for details.
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag SEARCHENGINE is set to YES. # This tag requires that the tag SEARCHENGINE is set to YES.
@ -1486,7 +1532,7 @@ SERVER_BASED_SEARCH = NO
# external search engine pointed to by the SEARCHENGINE_URL option to obtain the # external search engine pointed to by the SEARCHENGINE_URL option to obtain the
# search results. # search results.
# #
# Doxygen ships with an example indexer ( doxyindexer) and search engine # Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library # (doxysearch.cgi) which are based on the open source search engine library
# Xapian (see: http://xapian.org/). # Xapian (see: http://xapian.org/).
# #
@ -1499,7 +1545,7 @@ EXTERNAL_SEARCH = NO
# The SEARCHENGINE_URL should point to a search engine hosted by a web server # The SEARCHENGINE_URL should point to a search engine hosted by a web server
# which will return the search results when EXTERNAL_SEARCH is enabled. # which will return the search results when EXTERNAL_SEARCH is enabled.
# #
# Doxygen ships with an example indexer ( doxyindexer) and search engine # Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library # (doxysearch.cgi) which are based on the open source search engine library
# Xapian (see: http://xapian.org/). See the section "External Indexing and # Xapian (see: http://xapian.org/). See the section "External Indexing and
# Searching" for details. # Searching" for details.
@ -1537,7 +1583,7 @@ EXTRA_SEARCH_MAPPINGS =
# Configuration options related to the LaTeX output # Configuration options related to the LaTeX output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output. # If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES. # The default value is: YES.
GENERATE_LATEX = NO GENERATE_LATEX = NO
@ -1568,7 +1614,7 @@ LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex MAKEINDEX_CMD_NAME = makeindex
# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX # If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
# documents. This may be useful for small projects and may help to save some # documents. This may be useful for small projects and may help to save some
# trees in general. # trees in general.
# The default value is: NO. # The default value is: NO.
@ -1586,9 +1632,12 @@ COMPACT_LATEX = NO
PAPER_TYPE = a4 PAPER_TYPE = a4
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names # The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
# that should be included in the LaTeX output. To get the times font for # that should be included in the LaTeX output. The package can be specified just
# instance you can specify # by its name or with the correct syntax as to be used with the LaTeX
# EXTRA_PACKAGES=times # \usepackage command. To get the times font for instance you can specify :
# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
# To use the option intlimits with the amsmath package you can specify:
# EXTRA_PACKAGES=[intlimits]{amsmath}
# If left blank no extra packages will be included. # If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES. # This tag requires that the tag GENERATE_LATEX is set to YES.
@ -1602,23 +1651,36 @@ EXTRA_PACKAGES =
# #
# Note: Only use a user-defined header if you know what you are doing! The # Note: Only use a user-defined header if you know what you are doing! The
# following commands have a special meaning inside the header: $title, # following commands have a special meaning inside the header: $title,
# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will # $datetime, $date, $doxygenversion, $projectname, $projectnumber,
# replace them by respectively the title of the page, the current date and time, # $projectbrief, $projectlogo. Doxygen will replace $title with the empty
# only the current date, the version number of doxygen, the project name (see # string, for the replacement values of the other commands the user is referred
# PROJECT_NAME), or the project number (see PROJECT_NUMBER). # to HTML_HEADER.
# This tag requires that the tag GENERATE_LATEX is set to YES. # This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_HEADER = LATEX_HEADER =
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
# generated LaTeX document. The footer should contain everything after the last # generated LaTeX document. The footer should contain everything after the last
# chapter. If it is left blank doxygen will generate a standard footer. # chapter. If it is left blank doxygen will generate a standard footer. See
# LATEX_HEADER for more information on how to generate a default footer and what
# special commands can be used inside the footer.
# #
# Note: Only use a user-defined footer if you know what you are doing! # Note: Only use a user-defined footer if you know what you are doing!
# This tag requires that the tag GENERATE_LATEX is set to YES. # This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_FOOTER = LATEX_FOOTER =
# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# LaTeX style sheets that are included after the standard style sheets created
# by doxygen. Using this option one can overrule certain style aspects. Doxygen
# will copy the style sheet files to the output directory.
# Note: The order of the extra style sheet files is of importance (e.g. the last
# style sheet in the list overrules the setting of the previous ones in the
# list).
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_EXTRA_STYLESHEET =
# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or # The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the LATEX_OUTPUT output # other source files which should be copied to the LATEX_OUTPUT output
# directory. Note that the files will be copied as-is; there are no commands or # directory. Note that the files will be copied as-is; there are no commands or
@ -1636,8 +1698,8 @@ LATEX_EXTRA_FILES =
PDF_HYPERLINKS = YES PDF_HYPERLINKS = YES
# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate # If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
# the PDF file directly from the LaTeX files. Set this option to YES to get a # the PDF file directly from the LaTeX files. Set this option to YES, to get a
# higher quality PDF documentation. # higher quality PDF documentation.
# The default value is: YES. # The default value is: YES.
# This tag requires that the tag GENERATE_LATEX is set to YES. # This tag requires that the tag GENERATE_LATEX is set to YES.
@ -1678,11 +1740,19 @@ LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain LATEX_BIB_STYLE = plain
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
# page will contain the date and time when the page was generated. Setting this
# to NO can help when comparing the output of multiple runs.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_TIMESTAMP = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the RTF output # Configuration options related to the RTF output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The # If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
# RTF output is optimized for Word 97 and may not look too pretty with other RTF # RTF output is optimized for Word 97 and may not look too pretty with other RTF
# readers/editors. # readers/editors.
# The default value is: NO. # The default value is: NO.
@ -1697,7 +1767,7 @@ GENERATE_RTF = NO
RTF_OUTPUT = rtf RTF_OUTPUT = rtf
# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF # If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
# documents. This may be useful for small projects and may help to save some # documents. This may be useful for small projects and may help to save some
# trees in general. # trees in general.
# The default value is: NO. # The default value is: NO.
@ -1734,11 +1804,21 @@ RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE = RTF_EXTENSIONS_FILE =
# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
# with syntax highlighting in the RTF output.
#
# Note that which sources are shown also depends on other settings such as
# SOURCE_BROWSER.
# The default value is: NO.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_SOURCE_CODE = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the man page output # Configuration options related to the man page output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for # If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
# classes and files. # classes and files.
# The default value is: NO. # The default value is: NO.
@ -1762,6 +1842,13 @@ MAN_OUTPUT = man
MAN_EXTENSION = .3 MAN_EXTENSION = .3
# The MAN_SUBDIR tag determines the name of the directory created within
# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
# MAN_EXTENSION with the initial . removed.
# This tag requires that the tag GENERATE_MAN is set to YES.
MAN_SUBDIR =
# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it # If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
# will generate one additional man file for each entity documented in the real # will generate one additional man file for each entity documented in the real
# man page(s). These additional files only source the real man page, but without # man page(s). These additional files only source the real man page, but without
@ -1775,7 +1862,7 @@ MAN_LINKS = NO
# Configuration options related to the XML output # Configuration options related to the XML output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that # If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
# captures the structure of the code including all documentation. # captures the structure of the code including all documentation.
# The default value is: NO. # The default value is: NO.
@ -1789,19 +1876,7 @@ GENERATE_XML = NO
XML_OUTPUT = xml XML_OUTPUT = xml
# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a # If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
# validating XML parser to check the syntax of the XML files.
# This tag requires that the tag GENERATE_XML is set to YES.
XML_SCHEMA =
# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
# validating XML parser to check the syntax of the XML files.
# This tag requires that the tag GENERATE_XML is set to YES.
XML_DTD =
# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
# listings (including syntax highlighting and cross-referencing information) to # listings (including syntax highlighting and cross-referencing information) to
# the XML output. Note that enabling this will significantly increase the size # the XML output. Note that enabling this will significantly increase the size
# of the XML output. # of the XML output.
@ -1814,7 +1889,7 @@ XML_PROGRAMLISTING = YES
# Configuration options related to the DOCBOOK output # Configuration options related to the DOCBOOK output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files # If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
# that can be used to generate PDF. # that can be used to generate PDF.
# The default value is: NO. # The default value is: NO.
@ -1828,14 +1903,23 @@ GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook DOCBOOK_OUTPUT = docbook
# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
# program listings (including syntax highlighting and cross-referencing
# information) to the DOCBOOK output. Note that enabling this will significantly
# increase the size of the DOCBOOK output.
# The default value is: NO.
# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
DOCBOOK_PROGRAMLISTING = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output # Configuration options for the AutoGen Definitions output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
# Definitions (see http://autogen.sf.net) file that captures the structure of # AutoGen Definitions (see http://autogen.sf.net) file that captures the
# the code including all documentation. Note that this feature is still # structure of the code including all documentation. Note that this feature is
# experimental and incomplete at the moment. # still experimental and incomplete at the moment.
# The default value is: NO. # The default value is: NO.
GENERATE_AUTOGEN_DEF = NO GENERATE_AUTOGEN_DEF = NO
@ -1844,7 +1928,7 @@ GENERATE_AUTOGEN_DEF = NO
# Configuration options related to the Perl module output # Configuration options related to the Perl module output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module # If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
# file that captures the structure of the code including all documentation. # file that captures the structure of the code including all documentation.
# #
# Note that this feature is still experimental and incomplete at the moment. # Note that this feature is still experimental and incomplete at the moment.
@ -1852,7 +1936,7 @@ GENERATE_AUTOGEN_DEF = NO
GENERATE_PERLMOD = NO GENERATE_PERLMOD = NO
# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary # If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI # Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
# output from the Perl module output. # output from the Perl module output.
# The default value is: NO. # The default value is: NO.
@ -1860,9 +1944,9 @@ GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO PERLMOD_LATEX = NO
# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely # If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
# formatted so it can be parsed by a human reader. This is useful if you want to # formatted so it can be parsed by a human reader. This is useful if you want to
# understand what is going on. On the other hand, if this tag is set to NO the # understand what is going on. On the other hand, if this tag is set to NO, the
# size of the Perl module output will be much smaller and Perl will parse it # size of the Perl module output will be much smaller and Perl will parse it
# just the same. # just the same.
# The default value is: YES. # The default value is: YES.
@ -1882,14 +1966,14 @@ PERLMOD_MAKEVAR_PREFIX =
# Configuration options related to the preprocessor # Configuration options related to the preprocessor
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all # If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
# C-preprocessor directives found in the sources and include files. # C-preprocessor directives found in the sources and include files.
# The default value is: YES. # The default value is: YES.
ENABLE_PREPROCESSING = YES ENABLE_PREPROCESSING = YES
# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names # If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
# in the source code. If set to NO only conditional compilation will be # in the source code. If set to NO, only conditional compilation will be
# performed. Macro expansion can be done in a controlled way by setting # performed. Macro expansion can be done in a controlled way by setting
# EXPAND_ONLY_PREDEF to YES. # EXPAND_ONLY_PREDEF to YES.
# The default value is: NO. # The default value is: NO.
@ -1905,7 +1989,7 @@ MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO EXPAND_ONLY_PREDEF = NO
# If the SEARCH_INCLUDES tag is set to YES the includes files in the # If the SEARCH_INCLUDES tag is set to YES, the include files in the
# INCLUDE_PATH will be searched if a #include is found. # INCLUDE_PATH will be searched if a #include is found.
# The default value is: YES. # The default value is: YES.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
@ -1947,9 +2031,9 @@ PREDEFINED =
EXPAND_AS_DEFINED = EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all refrences to function-like macros that are alone on a line, have an # remove all references to function-like macros that are alone on a line, have
# all uppercase name, and do not end with a semicolon. Such function macros are # an all uppercase name, and do not end with a semicolon. Such function macros
# typically used for boiler-plate code, and will confuse the parser if not # are typically used for boiler-plate code, and will confuse the parser if not
# removed. # removed.
# The default value is: YES. # The default value is: YES.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
@ -1969,7 +2053,7 @@ SKIP_FUNCTION_MACROS = YES
# where loc1 and loc2 can be relative or absolute paths or URLs. See the # where loc1 and loc2 can be relative or absolute paths or URLs. See the
# section "Linking to external documentation" for more information about the use # section "Linking to external documentation" for more information about the use
# of tag files. # of tag files.
# Note: Each tag file must have an unique name (where the name does NOT include # Note: Each tag file must have a unique name (where the name does NOT include
# the path). If a tag file is not located in the directory in which doxygen is # the path). If a tag file is not located in the directory in which doxygen is
# run, you must also specify the path to the tagfile here. # run, you must also specify the path to the tagfile here.
@ -1981,20 +2065,21 @@ TAGFILES =
GENERATE_TAGFILE = GENERATE_TAGFILE =
# If the ALLEXTERNALS tag is set to YES all external class will be listed in the # If the ALLEXTERNALS tag is set to YES, all external class will be listed in
# class index. If set to NO only the inherited external classes will be listed. # the class index. If set to NO, only the inherited external classes will be
# listed.
# The default value is: NO. # The default value is: NO.
ALLEXTERNALS = NO ALLEXTERNALS = NO
# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in # If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
# the modules index. If set to NO, only the current project's groups will be # in the modules index. If set to NO, only the current project's groups will be
# listed. # listed.
# The default value is: YES. # The default value is: YES.
EXTERNAL_GROUPS = YES EXTERNAL_GROUPS = YES
# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in # If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
# the related pages index. If set to NO, only the current project's pages will # the related pages index. If set to NO, only the current project's pages will
# be listed. # be listed.
# The default value is: YES. # The default value is: YES.
@ -2011,7 +2096,7 @@ PERL_PATH = /usr/bin/perl
# Configuration options related to the dot tool # Configuration options related to the dot tool
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram # If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to # (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
# NO turns the diagrams off. Note that this option also works with HAVE_DOT # NO turns the diagrams off. Note that this option also works with HAVE_DOT
# disabled, but it is recommended to install and use dot, since it yields more # disabled, but it is recommended to install and use dot, since it yields more
@ -2036,7 +2121,7 @@ MSCGEN_PATH =
DIA_PATH = DIA_PATH =
# If set to YES, the inheritance and collaboration graphs will hide inheritance # If set to YES the inheritance and collaboration graphs will hide inheritance
# and usage relations if the target is undocumented or is not a class. # and usage relations if the target is undocumented or is not a class.
# The default value is: YES. # The default value is: YES.
@ -2061,7 +2146,7 @@ HAVE_DOT = NO
DOT_NUM_THREADS = 0 DOT_NUM_THREADS = 0
# When you want a differently looking font n the dot files that doxygen # When you want a differently looking font in the dot files that doxygen
# generates you can specify the font name using DOT_FONTNAME. You need to make # generates you can specify the font name using DOT_FONTNAME. You need to make
# sure dot is able to find the font, which can be done by putting it in a # sure dot is able to find the font, which can be done by putting it in a
# standard location or by setting the DOTFONTPATH environment variable or by # standard location or by setting the DOTFONTPATH environment variable or by
@ -2109,7 +2194,7 @@ COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES GROUP_GRAPHS = YES
# If the UML_LOOK tag is set to YES doxygen will generate inheritance and # If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
# collaboration diagrams in a style similar to the OMG's Unified Modeling # collaboration diagrams in a style similar to the OMG's Unified Modeling
# Language. # Language.
# The default value is: NO. # The default value is: NO.
@ -2161,7 +2246,8 @@ INCLUDED_BY_GRAPH = YES
# #
# Note that enabling this option will significantly increase the time of a run. # Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable call graphs for selected # So in most cases it will be better to enable call graphs for selected
# functions only using the \callgraph command. # functions only using the \callgraph command. Disabling a call graph can be
# accomplished by means of the command \hidecallgraph.
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.
@ -2172,7 +2258,8 @@ CALL_GRAPH = NO
# #
# Note that enabling this option will significantly increase the time of a run. # Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable caller graphs for selected # So in most cases it will be better to enable caller graphs for selected
# functions only using the \callergraph command. # functions only using the \callergraph command. Disabling a caller graph can be
# accomplished by means of the command \hidecallergraph.
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.
@ -2195,11 +2282,15 @@ GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES DIRECTORY_GRAPH = YES
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot. # generated by dot. For an explanation of the image formats see the section
# output formats in the documentation of the dot tool (Graphviz (see:
# http://www.graphviz.org/)).
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
# to make the SVG files visible in IE 9+ (other browsers do not have this # to make the SVG files visible in IE 9+ (other browsers do not have this
# requirement). # requirement).
# Possible values are: png, jpg, gif and svg. # Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo,
# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
# png:gdiplus:gdiplus.
# The default value is: png. # The default value is: png.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.
@ -2242,6 +2333,19 @@ MSCFILE_DIRS =
DIAFILE_DIRS = DIAFILE_DIRS =
# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
# path where java can find the plantuml.jar file. If left blank, it is assumed
# PlantUML is not used or called during a preprocessing step. Doxygen will
# generate a warning when it encounters a \startuml command in this case and
# will not generate output for the diagram.
PLANTUML_JAR_PATH =
# When using plantuml, the specified paths are searched for files specified by
# the !include statement in a plantuml block.
PLANTUML_INCLUDE_PATH =
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
# that will be shown in the graph. If the number of nodes in a graph becomes # that will be shown in the graph. If the number of nodes in a graph becomes
# larger than this value, doxygen will truncate the graph, which is visualized # larger than this value, doxygen will truncate the graph, which is visualized
@ -2278,7 +2382,7 @@ MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = NO DOT_TRANSPARENT = NO
# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This # files in one run (i.e. multiple -o and -T options on the command line). This
# makes dot run faster, but since only newer versions of dot (>1.8.10) support # makes dot run faster, but since only newer versions of dot (>1.8.10) support
# this, this feature is disabled by default. # this, this feature is disabled by default.
@ -2295,7 +2399,7 @@ DOT_MULTI_TARGETS = YES
GENERATE_LEGEND = YES GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot # If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
# files that are used to generate the various graphs. # files that are used to generate the various graphs.
# The default value is: YES. # The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.

108
Makefile
View File

@ -45,11 +45,13 @@ LIB_OBJ = $(patsubst %.c,%.o,$(LIB_CSRC))
# populates LIB_CSRC based on the library files used # populates LIB_CSRC based on the library files used
-include $(DEPENDENCIES) -include $(DEPENDENCIES)
# executables # executables for linking, compiling, debugging, ...
PREFIX ?= arm-none-eabi PREFIX ?= arm-none-eabi
# use gcc as compiler
CC := $(PREFIX)-gcc CC := $(PREFIX)-gcc
CXX := $(PREFIX)-g++ # use clang as compiler
LD := $(PREFIX)-gcc #CC := clang -target $(PREFIX)
LD := $(PREFIX)-ld
AR := $(PREFIX)-ar AR := $(PREFIX)-ar
AS := $(PREFIX)-as AS := $(PREFIX)-as
OBJCOPY := $(PREFIX)-objcopy OBJCOPY := $(PREFIX)-objcopy
@ -58,11 +60,12 @@ GDB := $(PREFIX)-gdb
# opencm3 libraries # opencm3 libraries
OPENCM3_DIR := libopencm3 OPENCM3_DIR := libopencm3
INCLUDE_DIR = $(OPENCM3_DIR)/include OPENCM3_INC = $(OPENCM3_DIR)/include
LIB_DIR = $(OPENCM3_DIR)/lib OPENCM3_LIB = $(OPENCM3_DIR)/lib
SCRIPT_DIR = $(OPENCM3_DIR)/scripts # library for the STM32F1 (provided by opencm3)
STM32F1_LIB = opencm3_stm32f1
# linker script # linker script for STN32F1 boards
ifeq ($(BOARD),SYSTEM_BOARD) ifeq ($(BOARD),SYSTEM_BOARD)
LDSCRIPT = $(OPENCM3_DIR)/lib/stm32/f1/stm32f103x8.ld LDSCRIPT = $(OPENCM3_DIR)/lib/stm32/f1/stm32f103x8.ld
else ifeq ($(BOARD),BLUE_PILL) else ifeq ($(BOARD),BLUE_PILL)
@ -71,42 +74,78 @@ else ifeq ($(BOARD),MAPLE_MINI)
LDSCRIPT = $(OPENCM3_DIR)/lib/stm32/f1/stm32f103xb.ld LDSCRIPT = $(OPENCM3_DIR)/lib/stm32/f1/stm32f103xb.ld
endif endif
# verify if libopencm3 has been downloaded # verify if opencm3 has been downloaded
OPENCM3_DIR_EXISTS = $(shell [ -f $(LDSCRIPT) ] && echo 1 || echo 0 ) OPENCM3_DIR_EXISTS = $(shell [ -f $(LDSCRIPT) ] && echo 1 || echo 0 )
ifeq ($(OPENCM3_DIR_EXISTS), 0) ifeq ($(OPENCM3_DIR_EXISTS), 0)
$(info run "git submodule init" and "git submodule update" before runnig make) $(info run "git submodule init" and "git submodule update" before runnig make)
$(error libopencm3 repository is not initialized) $(error libopencm3 repository is not initialized)
endif endif
# device flags # device micro-controller and board
DEFS += -DSTM32F1 -D$(BOARD) DEFS += -DSTM32F1 -D$(BOARD)
# C flags # C flags
CFLAGS += -Os -g # optimize for size
CFLAGS += -std=c99 -Wpedantic -Wall -Werror -Wundef -Wextra -Wshadow -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -Wstrict-overflow=5 CFLAGS += -Os
# add debug symbols (remove for smaller release)
CFLAGS += -g
# use C99 (supported by most an sufficient)
CFLAGS += -std=c99
# have strict warning (for better code)
CFLAGS += -Wpedantic -Wall -Werror -Wundef -Wextra -Wshadow -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -Wstrict-overflow=5
# add options for better code optimization
CFLAGS += -fno-common -ffunction-sections -fdata-sections CFLAGS += -fno-common -ffunction-sections -fdata-sections
CFLAGS += -I. -I$(INCLUDE_DIR) $(patsubst %,-I%,$(LIB)) # use variable size enum (opencm3, gcc, and compiler-rt do)
CFLAGS += -fshort-enums
# use no variable size enum (musl does not)
#CFLAGS += -fno-short-enums
# don't use system main definition (the starting point)
CFLAGS += -ffreestanding
# don't use the standard library
#CFLAGS += -nostdlib -nostdinc
# include musl libc
#CFLAGS += -I /media/data/tmp/arm-linux-musleabi/arm-linux-musleabi/include
# include newlib libc
#CFLAGS += -I/usr/arm-none-eabi/include/
# include gcc standard library (for printf)
#CFLAGS += -I/usr/lib/gcc/arm-none-eabi/6.1.1/include/
# include own libraries
CFLAGS += -I . $(patsubst %,-I%,$(LIB))
# include opencm3 libraries
CFLAGS += -I $(OPENCM3_INC)
# add defines for micro-controller and board
CFLAGS += $(DEFS) CFLAGS += $(DEFS)
# linker flags # linker flags
LDFLAGS += --static -nostartfiles # build static binary (no shared libraries on the micro-controller)
LDFLAGS += -L$(LIB_DIR) LDFLAGS += -static
LDFLAGS += -I. $(patsubst %,-I%,$(LIB)) # don's include the system start files
LDFLAGS += -T$(LDSCRIPT) LDFLAGS += -nostartfiles
LDFLAGS += -Wl,-Map=$(*).map # only keep used sections
LDFLAGS += -Wl,--gc-sections LDFLAGS += --gc-sections
ifeq ($(V),99) # don't use system libraries
LDFLAGS += -Wl,--print-gc-sections #LDFLAGS += -nostdlib -nostdinc
endif # add musl libraries (for libc, libm)
#LDFLAGS += --library-path /media/data/tmp/arm-linux-musleabi/arm-linux-musleabi/lib
# add system libraries (for libc, libm, libnosys)
LDFLAGS += --library-path /usr/arm-none-eabi/lib/armv7-m/
# add gcc library (for ARM ABI to be used by gcc)
LDFLAGS += --library-path /usr/lib/gcc/arm-none-eabi/*/armv7-m/
# add compiler-rt library (for ARM ABI to be used by clang)
#LDFLAGS += --library-path /usr/arm-none-eabi/lib/armv7-m/
# opencm3 libraries
LDFLAGS += --library-path $(OPENCM3_LIB)
# used libraries # linker script with definitions for micro-controller
LIBNAME = opencm3_stm32f1 LDFLAGS += --script $(LDSCRIPT)
LDLIBS += -lm -l$(LIBNAME)
LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
# device specific flags # used libraries when using gcc (must be provided after objects)
FP_FLAGS ?= -msoft-float LDLIBS += --library $(STM32F1_LIB) --library c --library gcc --library nosys --library m
ARCH_FLAGS = -mthumb -mcpu=cortex-m3 $(FP_FLAGS) -mfix-cortex-m3-ldrd # used libraries when using clang (must be provided after objects)
#LDLIBS += --library $(STM32F1_LIB) --library c --library m --library clang_rt.builtins
# target micro-controller information (ARM Cortex-M3 supports thumb and thumnb2, but does not include a floating point unit)
ARCH_FLAGS = -mthumb -mcpu=cortex-m3 -msoft-float
# SWD adapter used # SWD adapter used
# supported are : st-link v2 (STLINKV2), black magic probe (BMP) # supported are : st-link v2 (STLINKV2), black magic probe (BMP)
@ -144,12 +183,13 @@ list: $(BINARY).list
%.map %.list: %.elf %.map %.list: %.elf
$(Q)$(OBJDUMP) -S $(<) > $(@) $(Q)$(OBJDUMP) -S $(<) > $(@)
%.elf: $(LDSCRIPT) $(LIB_DIR)/lib$(LIBNAME).a $(OBJ) $(LIB_OBJ) %.elf: $(LDSCRIPT) $(OPENCM3_LIB)/lib$(STM32F1_LIB).a $(OBJ) $(LIB_OBJ)
$(info compiling $(@)) $(info linking $(@))
$(Q)$(LD) $(LDFLAGS) $(ARCH_FLAGS) $(OBJ) $(LIB_OBJ) $(LDLIBS) -o $(@) $(Q)$(LD) $(LDFLAGS) $(OBJ) $(LIB_OBJ) $(LDLIBS) -o $(@)
$(Q)size $(@) $(Q)size $(@)
%.o: %.c $(CHDR) $(LIB_CHDR) %.o: %.c $(CHDR) $(LIB_CHDR)
$(info compiling $(@))
$(Q)$(CC) $(CFLAGS) $(ARCH_FLAGS) -o $(@) -c $(<) $(Q)$(CC) $(CFLAGS) $(ARCH_FLAGS) -o $(@) -c $(<)
# generate dependencies # generate dependencies
@ -168,8 +208,8 @@ doc: Doxyfile README.md $(CSRC) $(CHDR) $(LIB_CSRC) $(LIB_CHDR)
clean: clean:
$(Q)$(RM) $(BINARY).elf $(BINARY).bin $(BINARY).hex $(BINARY).map $(OBJ) $(LIB_OBJ) $(LIB)/*.o $(DEPENDENCIES) $(Q)$(RM) $(BINARY).elf $(BINARY).bin $(BINARY).hex $(BINARY).map $(OBJ) $(LIB_OBJ) $(LIB)/*.o $(DEPENDENCIES)
# make libopencm3 if not done # make libopencm3 if library for STM32F1 is not yet existing
$(LIB_DIR)/lib$(LIBNAME).a: $(OPENCM3_LIB)/lib$(STM32F1_LIB).a:
$(info compiling libopencm3 library) $(info compiling libopencm3 library)
$(Q)$(MAKE) -C $(OPENCM3_DIR) $(Q)$(MAKE) -C $(OPENCM3_DIR)
@ -197,4 +237,4 @@ else ifeq ($(SWD_ADAPTER),BMP)
$(Q)$(GDB) --eval-command="target extended-remote $(BMPPORT)" --eval-command="monitor version" --eval-command="monitor swdp_scan" --eval-command="attach 1" $(<) $(Q)$(GDB) --eval-command="target extended-remote $(BMPPORT)" --eval-command="monitor version" --eval-command="monitor swdp_scan" --eval-command="attach 1" $(<)
endif endif
.PHONY: clean elf bin hex srec list libraries flash reset .PHONY: clean elf bin hex srec list flash reset

109
global.c Normal file
View File

@ -0,0 +1,109 @@
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/** global definitions and methods (code)
* @file global.c
* @author King Kévin <kingkevin@cuvoodoo.info>
* @date 2016
*/
/* standard libraries */
#include <stdint.h> // standard integer types
#include <stdlib.h> // general utilities
/* STM32 (including CM3) libraries */
#include <libopencm3/stm32/rcc.h> // real-time control clock library
#include <libopencm3/stm32/gpio.h> // general purpose input output library
#include <libopencm3/stm32/timer.h> // timer library
#include <libopencm3/cm3/nvic.h> // interrupt handler
#include <libopencm3/stm32/exti.h> // external interrupt defines
#include "global.h" // common methods
#include "string.h" // memory utilities
volatile bool button_flag = false;
char* b2s(uint64_t binary, uint8_t rjust)
{
static char string[64+1] = {0}; // the string representation to return
uint8_t bit = LENGTH(string)-1; // the index of the bit to print
string[bit--] = '\0'; // terminate string
while (binary) {
if (binary & 1) {
string[bit--] = '1';
} else {
string[bit--] = '0';
}
binary >>= 1;
}
while (64-bit-1<rjust && bit>0) {
string[bit--] = '0';
}
return string;
}
/** switch on board LED */
void led_on(void)
{
#if defined(SYSTEM_BOARD) || defined(BLUE_PILL)
gpio_clear(GPIO(LED_PORT), GPIO(LED_PIN));
#elif defined(MAPLE_MINI)
gpio_set(GPIO(LED_PORT), GPIO(LED_PIN));
#endif
}
/** switch off board LED */
void led_off(void)
{
#if defined(SYSTEM_BOARD) || defined(BLUE_PILL)
gpio_set(GPIO(LED_PORT), GPIO(LED_PIN));
#elif defined(MAPLE_MINI)
gpio_clear(GPIO(LED_PORT), GPIO(LED_PIN));
#endif
}
/** toggle board LED */
void led_toggle(void)
{
gpio_toggle(GPIO(LED_PORT), GPIO(LED_PIN));
}
void board_setup(void)
{
// setup LED
rcc_periph_clock_enable(RCC_GPIO(LED_PORT)); // enable clock for LED
gpio_set_mode(GPIO(LED_PORT), GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO(LED_PIN)); // set LED pin to 'output push-pull'
led_off(); // switch off LED per default
// setup button
#if defined(BUTTON_PORT) && defined(BUTTON_PIN)
rcc_periph_clock_enable(RCC_GPIO(BUTTON_PORT)); // enable clock for button
gpio_set_mode(GPIO(BUTTON_PORT), GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, GPIO(BUTTON_PIN)); // set button pin to input
gpio_clear(GPIO(BUTTON_PORT), GPIO(BUTTON_PIN)); // pull down to be able to detect button push (go high)
rcc_periph_clock_enable(RCC_AFIO); // enable alternate function clock for external interrupt
exti_select_source(EXTI(BUTTON_PIN), GPIO(BUTTON_PORT)); // mask external interrupt of this pin only for this port
exti_set_trigger(EXTI(BUTTON_PIN), EXTI_TRIGGER_RISING); // trigger when button is pressed
exti_enable_request(EXTI(BUTTON_PIN)); // enable external interrupt
nvic_enable_irq(NVIC_EXTI_IRQ(BUTTON_PIN)); // enable interrupt
#endif
}
#if defined(BUTTON_PIN)
/** interrupt service routine called when button is pressed */
void EXTI_ISR(BUTTON_PIN)(void)
{
exti_reset_request(EXTI(BUTTON_PIN)); // reset interrupt
button_flag = true; // perform button action
}
#endif

141
global.h
View File

@ -12,37 +12,106 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
/** global definitions and methods /** global definitions and methods (API)
* @file global.h * @file global.h
* @author King Kévin <kingkevin@cuvoodoo.info> * @author King Kévin <kingkevin@cuvoodoo.info>
* @date 2016 * @date 2016
*/ */
#pragma once #pragma once
#include <libopencm3/stm32/gpio.h> // GPIO defines
#include <libopencm3/cm3/nvic.h> // interrupt defines /** enable debugging functionalities */
#include <libopencm3/stm32/exti.h> // external interrupt defines #define DEBUG true
/** get the length of an array */ /** get the length of an array */
#define LENGTH(x) (sizeof(x) / sizeof((x)[0])) #define LENGTH(x) (sizeof(x) / sizeof((x)[0]))
/** concatenate 2 arguments (used to defer concatenation) */
#define CAT2(x,y) x##y
/** concatenate 3 arguments (used to defer concatenation) */
#define CAT3(x,y,z) x##y##z
/** @defgroup reg_macro macros to define values based on other defines values
* @note used when the value is calculated or isn't a value
* @{
*/
/** get GPIO based on GPIO identifier */
#define GPIO(x) CAT2(GPIO,x)
/** get RCC for GPIO based on GPIO identifier */
#define RCC_GPIO(x) CAT2(RCC_GPIO,x)
/** get TIM based on TIM identifier */
#define TIM(x) CAT2(TIM,x)
/** get RCC for timer based on TIM identifier */
#define RCC_TIM(x) CAT2(RCC_TIM,x)
/** get NVIC IRQ for timer base on TIM identifier */
#define NVIC_TIM_IRQ(x) CAT3(NVIC_TIM,x,_IRQ)
/** get interrupt service routine for timer base on TIM identifier */
#define TIM_ISR(x) CAT3(tim,x,_isr)
/** get external interrupt based on pin identifier */
#define EXTI(x) CAT2(EXTI,x)
/** get NVIC IRQ for external interrupt base on external interrupt/pin */
#define NVIC_EXTI_IRQ(x) CAT3(NVIC_EXTI,x,_IRQ)
#define NVIC_EXTI5_IRQ NVIC_EXTI9_5_IRQ /**< IRQ for line 9 to 5 for pin 5 */
#define NVIC_EXTI6_IRQ NVIC_EXTI9_5_IRQ /**< IRQ for line 9 to 5 for pin 6 */
#define NVIC_EXTI7_IRQ NVIC_EXTI9_5_IRQ /**< IRQ for line 9 to 5 for pin 7 */
#define NVIC_EXTI8_IRQ NVIC_EXTI9_5_IRQ /**< IRQ for line 9 to 5 for pin 8 */
#define NVIC_EXTI9_IRQ NVIC_EXTI9_5_IRQ /**< IRQ for line 9 to 5 for pin 9 */
#define NVIC_EXTI10_IRQ NVIC_EXTI15_10_IRQ /**< IRQ for line 15 to 10 for pin 10 */
#define NVIC_EXTI11_IRQ NVIC_EXTI15_10_IRQ /**< IRQ for line 15 to 10 for pin 11 */
#define NVIC_EXTI12_IRQ NVIC_EXTI15_10_IRQ /**< IRQ for line 15 to 10 for pin 12 */
#define NVIC_EXTI13_IRQ NVIC_EXTI15_10_IRQ /**< IRQ for line 15 to 10 for pin 13 */
#define NVIC_EXTI14_IRQ NVIC_EXTI15_10_IRQ /**< IRQ for line 15 to 10 for pin 14 */
#define NVIC_EXTI15_IRQ NVIC_EXTI15_10_IRQ /**< IRQ for line 15 to 10 for pin 15 */
/** get interrupt service routine for timer base on external interrupt/pin */
#define EXTI_ISR(x) CAT3(exti,x,_isr)
#define exti5_isr exti9_5_isr /**< isr for line 9 to 5 for pin 5 */
#define exti6_isr exti9_5_isr /**< isr for line 9 to 5 for pin 6 */
#define exti7_isr exti9_5_isr /**< isr for line 9 to 5 for pin 7 */
#define exti8_isr exti9_5_isr /**< isr for line 9 to 5 for pin 8 */
#define exti9_isr exti9_5_isr /**< isr for line 9 to 5 for pin 9 */
#define exti10_isr exti15_10_isr /**< isr for line 15 to 10 for pin 10 */
#define exti11_isr exti15_10_isr /**< isr for line 15 to 10 for pin 11 */
#define exti12_isr exti15_10_isr /**< isr for line 15 to 10 for pin 12 */
#define exti13_isr exti15_10_isr /**< isr for line 15 to 10 for pin 13 */
#define exti14_isr exti15_10_isr /**< isr for line 15 to 10 for pin 14 */
#define exti15_isr exti15_10_isr /**< isr for line 15 to 10 for pin 15 */
/** get USART based on USART identifier */
#define USART(x) CAT2(USART,x)
/** get RCC for USART based on USART identifier */
#define USART_RCC(x) CAT2(RCC_USART,x)
/** get NVIC IRQ for USART based on USART identifier */
#define USART_IRQ(x) CAT3(NVIC_USART,x,_IRQ)
/** get interrupt service routine for USART based on USART identifier */
#define USART_ISR(x) CAT3(usart,x,_isr)
/** get port for USART based on USART identifier */
#define USART_PORT(x) CAT2(USART_PORT,x)
#define USART_PORT1 GPIOA /**< USART 1 is on port A */
#define USART_PORT2 GPIOA /**< USART 2 is on port A */
#define USART_PORT3 GPIOB /**< USART 3 is on port B */
/** get RCC for USART port based on USART identifier */
#define USART_PORT_RCC(x) CAT2(RCC_USART_PORT,x)
#define RCC_USART_PORT1 RCC_GPIOA /**< USART 1 is on port A */
#define RCC_USART_PORT2 RCC_GPIOA /**< USART 2 is on port A */
#define RCC_USART_PORT3 RCC_GPIOB /**< USART 3 is on port B */
/** get transmit pin for USART based on USART identifier */
#define USART_PIN_TX(x) CAT3(GPIO_USART,x,_TX)
/** get receive pin for USART based on USART identifier */
#define USART_PIN_RX(x) CAT3(GPIO_USART,x,_RX)
/** @} */
/** @defgroup board_led board LED GPIO /** @defgroup board_led board LED GPIO
* @{ * @{
*/ */
#if defined(SYSTEM_BOARD) #if defined(SYSTEM_BOARD)
/* on system board LED is on pin 11/PA1 */ /* on system board LED is on pin 11/PA1 */
#define LED_RCC RCC_GPIOA /**< GPIO peripheral clock (port A on system board) */ #define LED_PORT A /**< GPIO port (port A on system board) */
#define LED_PORT GPIOA /**< GPIO port (port A on system board) */ #define LED_PIN 1 /**< GPIO pin (pin PA1 on system board) */
#define LED_PIN GPIO1 /**< GPIO pin (pin PA1 on system board) */
#elif defined(BLUE_PILL) #elif defined(BLUE_PILL)
/* on minimum system LED is on pin 2/PC13 */ /* on minimum system LED is on pin 2/PC13 */
#define LED_RCC RCC_GPIOC /**< GPIO peripheral clock (port C on blue pill) */ #define LED_PORT C /**< GPIO port (port C on blue pill) */
#define LED_PORT GPIOC /**< GPIO port (port C on blue pill) */ #define LED_PIN 13 /**< GPIO pin (pin PC13 on system board) */
#define LED_PIN GPIO13 /**< GPIO pin (pin PC13 on system board) */
#elif defined (MAPLE_MINI) #elif defined (MAPLE_MINI)
/* on maple mini LED is on pin 19/PB1 */ /* on maple mini LED is on pin 19/PB1 */
#define LED_RCC RCC_GPIOB /**< GPIO peripheral clock (port B on maple mini) */ #define LED_PORT B /**< GPIO port (port B on maple mini) */
#define LED_PORT GPIOB /**< GPIO port (port B on maple mini) */ #define LED_PIN 1 /**< GPIO pin (pin PB1 on maple mini) */
#define LED_PIN GPIO1 /**< GPIO pin (pin PB1 on maple mini) */
#endif #endif
/** @} */ /** @} */
@ -51,40 +120,16 @@
*/ */
#if defined(MAPLE_MINI) #if defined(MAPLE_MINI)
/* on maple mini user button is on 32/PB8 */ /* on maple mini user button is on 32/PB8 */
#define BUTTON_RCC RCC_GPIOB /**< GPIO peripheral clock */ #define BUTTON_PORT B /**< GPIO port (port B on maple mini) */
#define BUTTON_PORT GPIOB /**< GPIO port */ #define BUTTON_PIN 8 /**< GPIO pin (pin PB8 on maple mini) */
#define BUTTON_PIN GPIO8 /**< GPIO pin */
#define BUTTON_EXTI EXTI8 /**< GPIO external interrupt */
#define BUTTON_IRQ NVIC_EXTI9_5_IRQ /**< GPIO line interrupt (interrupt for line 9 to 5 for pin) */
#define BUTTON_ISR exti9_5_isr /**< GPIO line interrupt service routine (isr for line 9 to 5 for pin 8) */
#endif #endif
/** @} */ /** @} */
/** switch on board LED */ extern volatile bool button_flag; /**< flag set when board user button has been pressed/released */
inline void led_on(void)
{
#if defined(SYSTEM_BOARD) || defined(BLUE_PILL)
gpio_clear(LED_PORT, LED_PIN);
#elif defined(MAPLE_MINI)
gpio_set(LED_PORT, LED_PIN);
#endif
}
/** switch off board LED */
inline void led_off(void)
{
#if defined(SYSTEM_BOARD) || defined(BLUE_PILL)
gpio_set(LED_PORT, LED_PIN);
#elif defined(MAPLE_MINI)
gpio_clear(LED_PORT, LED_PIN);
#endif
}
/** toggle board LED */
inline void led_toggle(void)
{
gpio_toggle(LED_PORT, LED_PIN);
}
/** default printf output */ /** default printf output */
int _write(int file, char *ptr, int len); int _write(int file, char *ptr, int len);
/** get binary representation of a number /** get binary representation of a number
* @param[in] binary number to represent in binary * @param[in] binary number to represent in binary
* @param[in] rjust justify representation with leading zeros * @param[in] rjust justify representation with leading zeros
@ -92,3 +137,15 @@ int _write(int file, char *ptr, int len);
*/ */
char* b2s(uint64_t binary, uint8_t rjust); char* b2s(uint64_t binary, uint8_t rjust);
/** switch on board LED */
void led_on(void);
/** switch off board LED */
void led_off(void);
/** toggle board LED */
void led_toggle(void);
/** setup board peripherals */
void board_setup(void);

View File

@ -32,18 +32,12 @@
#include <libopencmsis/core_cm3.h> // Cortex M3 utilities #include <libopencmsis/core_cm3.h> // Cortex M3 utilities
#include "usart.h" // USART header and definitions #include "usart.h" // USART header and definitions
#include "global.h" // common methods
/** @defgroup usart USART peripheral used for UART communication /** @defgroup usart USART peripheral used for UART communication
* @{ * @{
*/ */
#define USART USART1 /**< USART peripheral */ #define USART_ID 1 /**< USART peripheral */
#define USART_RCC RCC_USART1 /**< USART peripheral clock */
#define USART_IRQ NVIC_USART1_IRQ /**< USART peripheral interrupt signal */
#define USART_ISR usart1_isr /**< USART interrupt service routine */
#define USART_PORT GPIOA /**< USART port */
#define USART_PORT_RCC RCC_GPIOA /**< USART port peripheral clock */
#define USART_PIN_TX GPIO_USART1_TX /**< USART transmit pin (PA9) */
#define USART_PIN_RX GPIO_USART1_RX /**< USART receive pin (PA10) */
/** @} */ /** @} */
#define USART_BAUDRATE 115200 /**< serial baudrate, in bits per second (with 8N1 8 bits, no parity bit, 1 stop bit settings) */ #define USART_BAUDRATE 115200 /**< serial baudrate, in bits per second (with 8N1 8 bits, no parity bit, 1 stop bit settings) */
@ -53,43 +47,45 @@ static uint8_t rx_buffer[USART_BUFFER] = {0}; /**< ring buffer for received data
static volatile uint8_t rx_i = 0; /**< current position of read received data */ static volatile uint8_t rx_i = 0; /**< current position of read received data */
static volatile uint8_t rx_used = 0; /**< how much data has been received and not red */ static volatile uint8_t rx_used = 0; /**< how much data has been received and not red */
static uint8_t tx_buffer[USART_BUFFER] = {0}; /**< ring buffer for data to transmit */ static uint8_t tx_buffer[USART_BUFFER] = {0}; /**< ring buffer for data to transmit */
static volatile uint8_t tx_i = 0; /**< current position if transmitted data */ static volatile uint8_t tx_i = 0; /**< current position of transmitted data */
static volatile uint8_t tx_used = 0; /**< how much data needs to be transmitted */ static volatile uint8_t tx_used = 0; /**< how much data needs to be transmitted */
volatile uint8_t usart_received = 0; // same as rx_used, but since the user can write this variable we don't rely on it
volatile bool usart_received = false;
void usart_setup(void) void usart_setup(void)
{ {
/* enable USART I/O peripheral */ /* enable USART I/O peripheral */
rcc_periph_clock_enable(USART_PORT_RCC); // enable clock for USART port peripheral rcc_periph_clock_enable(USART_PORT_RCC(USART_ID)); // enable clock for USART port peripheral
rcc_periph_clock_enable(USART_RCC); // enable clock for USART peripheral rcc_periph_clock_enable(USART_RCC(USART_ID)); // enable clock for USART peripheral
gpio_set_mode(USART_PORT, GPIO_MODE_OUTPUT_10_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USART_PIN_TX); // setup GPIO pin USART transmit rcc_periph_clock_enable(RCC_AFIO); // enable pin alternate function (USART)
gpio_set_mode(USART_PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, USART_PIN_RX); // setup GPIO pin USART receive gpio_set_mode(USART_PORT(USART_ID), GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USART_PIN_TX(USART_ID)); // setup GPIO pin USART transmit
gpio_set(USART_PORT, USART_PIN_RX); // pull up to avoid noise when not connected gpio_set_mode(USART_PORT(USART_ID), GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, USART_PIN_RX(USART_ID)); // setup GPIO pin USART receive
gpio_set(USART_PORT(USART_ID), USART_PIN_RX(USART_ID)); // pull up to avoid noise when not connected
/* setup USART parameters */ /* setup USART parameters */
usart_set_baudrate(USART, USART_BAUDRATE); usart_set_baudrate(USART(USART_ID), USART_BAUDRATE);
usart_set_databits(USART, 8); usart_set_databits(USART(USART_ID), 8);
usart_set_stopbits(USART, USART_STOPBITS_1); usart_set_stopbits(USART(USART_ID), USART_STOPBITS_1);
usart_set_mode(USART, USART_MODE_TX_RX); usart_set_mode(USART(USART_ID), USART_MODE_TX_RX);
usart_set_parity(USART, USART_PARITY_NONE); usart_set_parity(USART(USART_ID), USART_PARITY_NONE);
usart_set_flow_control(USART, USART_FLOWCONTROL_NONE); usart_set_flow_control(USART(USART_ID), USART_FLOWCONTROL_NONE);
nvic_enable_irq(USART_IRQ); // enable the USART interrupt nvic_enable_irq(USART_IRQ(USART_ID)); // enable the USART interrupt
usart_enable_rx_interrupt(USART); // enable receive interrupt usart_enable_rx_interrupt(USART(USART_ID)); // enable receive interrupt
usart_enable(USART); // enable USART usart_enable(USART(USART_ID)); // enable USART
/* reset buffer states */ /* reset buffer states */
tx_i = 0; tx_i = 0;
tx_used = 0; tx_used = 0;
rx_i = 0; rx_i = 0;
rx_used = 0; rx_used = 0;
usart_received = 0; usart_received = false;
} }
void usart_putchar_blocking(char c) void usart_putchar_blocking(char c)
{ {
usart_flush(); // empty buffer first usart_flush(); // empty buffer first
usart_send_blocking(USART, c); // send character usart_send_blocking(USART(USART_ID), c); // send character
} }
void usart_flush(void) void usart_flush(void)
@ -97,55 +93,55 @@ void usart_flush(void)
while (tx_used) { // idle until buffer is empty while (tx_used) { // idle until buffer is empty
__WFI(); // sleep until interrupt __WFI(); // sleep until interrupt
} }
usart_wait_send_ready(USART); // wait until transmit register is empty (transmission might not be complete) usart_wait_send_ready(USART(USART_ID)); // wait until transmit register is empty (transmission might not be complete)
} }
char usart_getchar(void) char usart_getchar(void)
{ {
while (!rx_used) { // idle until data is available while (!rx_used) { // idle until data is available
__WFI(); // sleep until interrupt; __WFI(); // sleep until interrupt
} }
char to_return = rx_buffer[rx_i]; // get the next available character char to_return = rx_buffer[rx_i]; // get the next available character
usart_disable_rx_interrupt(USART); // disable receive interrupt to prevent index corruption usart_disable_rx_interrupt(USART(USART_ID)); // disable receive interrupt to prevent index corruption
rx_i = (rx_i+1)%sizeof(rx_buffer); // update used buffer rx_i = (rx_i+1)%LENGTH(rx_buffer); // update used buffer
rx_used--; // update used buffer rx_used--; // update used buffer
usart_received = rx_used; // update available data usart_received = (rx_used!=0); // update available data
usart_enable_rx_interrupt(USART); // enable receive interrupt usart_enable_rx_interrupt(USART(USART_ID)); // enable receive interrupt
return to_return; return to_return;
} }
void usart_putchar_nonblocking(char c) void usart_putchar_nonblocking(char c)
{ {
while (tx_used>=sizeof(tx_buffer)) { // idle until buffer has some space while (tx_used>=LENGTH(tx_buffer)) { // idle until buffer has some space
usart_enable_tx_interrupt(USART); // enable transmit interrupt usart_enable_tx_interrupt(USART(USART_ID)); // enable transmit interrupt
__WFI(); // sleep until something happened __WFI(); // sleep until something happened
} }
usart_disable_tx_interrupt(USART); // disable transmit interrupt to prevent index corruption usart_disable_tx_interrupt(USART(USART_ID)); // disable transmit interrupt to prevent index corruption
tx_buffer[(tx_i+tx_used)%sizeof(tx_buffer)] = c; // put character in buffer tx_buffer[(tx_i+tx_used)%LENGTH(tx_buffer)] = c; // put character in buffer
tx_used++; // update used buffer tx_used++; // update used buffer
usart_enable_tx_interrupt(USART); // enable transmit interrupt usart_enable_tx_interrupt(USART(USART_ID)); // enable transmit interrupt
} }
/** USART interrupt service routine called when data has been transmitted or received */ /** USART interrupt service routine called when data has been transmitted or received */
void USART_ISR(void) void USART_ISR(USART_ID)(void)
{ {
if (usart_get_interrupt_source(USART, USART_SR_TXE)) { // data has been transmitted if (usart_get_interrupt_source(USART(USART_ID), USART_SR_TXE)) { // data has been transmitted
if (!tx_used) { // no data in the buffer to transmit if (!tx_used) { // no data in the buffer to transmit
usart_disable_tx_interrupt(USART); // disable transmit interrupt usart_disable_tx_interrupt(USART(USART_ID)); // disable transmit interrupt
} else { } else {
usart_send(USART,tx_buffer[tx_i]); // put data in transmit register usart_send(USART(USART_ID),tx_buffer[tx_i]); // put data in transmit register
tx_i = (tx_i+1)%sizeof(rx_buffer); // update location on buffer tx_i = (tx_i+1)%LENGTH(rx_buffer); // update location on buffer
tx_used--; // update used size tx_used--; // update used size
} }
} }
if (usart_get_interrupt_source(USART, USART_SR_RXNE)) { // data has been received if (usart_get_interrupt_source(USART(USART_ID), USART_SR_RXNE)) { // data has been received
// only save data if there is space in the buffer // only save data if there is space in the buffer
if (rx_used>=sizeof(rx_buffer)) { while (rx_used>=LENGTH(rx_buffer)) { // if buffer is full
usart_recv(USART); // read to clear interrupt rx_i = (rx_i+1)%LENGTH(rx_buffer); // drop oldest data
} else { rx_used--; // update used buffer information
rx_buffer[(rx_i+rx_used)%sizeof(rx_buffer)] = usart_recv(USART); // put character in buffer
rx_used++; // update used buffer
usart_received = rx_used; // update available data
} }
rx_buffer[(rx_i+rx_used)%LENGTH(rx_buffer)] = usart_recv(USART(USART_ID)); // put character in buffer
rx_used++; // update used buffer
usart_received = (rx_used!=0); // update available data
} }
} }

View File

@ -23,7 +23,7 @@
/** transmit and receive buffer sizes */ /** transmit and receive buffer sizes */
#define USART_BUFFER 128 #define USART_BUFFER 128
/** how many bytes available in the received buffer since last read */ /** how many bytes available in the received buffer since last read */
extern volatile uint8_t usart_received; extern volatile bool usart_received;
/** setup USART peripheral */ /** setup USART peripheral */
void usart_setup(void); void usart_setup(void);

122
main.c
View File

@ -23,36 +23,34 @@
#include <stdio.h> // standard I/O facilities #include <stdio.h> // standard I/O facilities
#include <stdlib.h> // standard utilities #include <stdlib.h> // standard utilities
#include <unistd.h> // standard streams #include <unistd.h> // standard streams
#include <errno.h> // error number utilities
#include <string.h> // string utilities #include <string.h> // string utilities
#include <math.h> // mathematical utilities #include <math.h> // mathematical utilities
/* STM32 (including CM3) libraries */ /* STM32 (including CM3) libraries */
#include <libopencm3/stm32/rcc.h> // real-time control clock library
#include <libopencm3/stm32/gpio.h> // general purpose input output library
#include <libopencm3/cm3/scb.h> // vector table definition
#include <libopencmsis/core_cm3.h> // Cortex M3 utilities #include <libopencmsis/core_cm3.h> // Cortex M3 utilities
#include <libopencm3/cm3/scb.h> // vector table definition
#include <libopencm3/cm3/nvic.h> // interrupt utilities #include <libopencm3/cm3/nvic.h> // interrupt utilities
#include <libopencm3/stm32/gpio.h> // general purpose input output library
#include <libopencm3/stm32/rcc.h> // real-time control clock library
#include <libopencm3/stm32/exti.h> // external interrupt utilities #include <libopencm3/stm32/exti.h> // external interrupt utilities
#include <libopencm3/stm32/rtc.h> // real time clock utilities #include <libopencm3/stm32/rtc.h> // real time clock utilities
#include <libopencm3/stm32/iwdg.h> // independent watchdog utilities
#include <libopencm3/stm32/dbgmcu.h> // debug utilities
#include <libopencm3/stm32/flash.h> // flash utilities
/* own libraries */ /* own libraries */
#include "global.h" // board definitions #include "global.h" // board definitions
#include "usart.h" // USART utilities #include "usart.h" // USART utilities
#include "usb_cdcacm.h" // USB CDC ACM utilities #include "usb_cdcacm.h" // USB CDC ACM utilities
#define WATCHDOG_PERIOD 10000 /**< watchdog period in ms */
/** @defgroup main_flags flag set in interrupts to be processed in main task /** @defgroup main_flags flag set in interrupts to be processed in main task
* @{ * @{
*/ */
volatile bool button_flag = false; /**< flag set when board user button has been pressed/released */
volatile bool rtc_internal_tick_flag = false; /**< flag set when internal RTC ticked */ volatile bool rtc_internal_tick_flag = false; /**< flag set when internal RTC ticked */
/** @} */ /** @} */
/** user input command */
char command[32] = {0};
/** user input command index */
uint8_t command_i = 0;
int _write(int file, char *ptr, int len) int _write(int file, char *ptr, int len)
{ {
int i; // how much data has been sent int i; // how much data has been sent
@ -79,31 +77,13 @@ int _write(int file, char *ptr, int len)
} }
return i; return i;
} }
errno = EIO;
return -1; return -1;
} }
char* b2s(uint64_t binary, uint8_t rjust) /** user input command */
{ static char command[32] = {0};
static char string[64+1] = {0}; // the string representation to return /** user input command index */
int8_t bit = LENGTH(string)-1; // the index of the bit to print uint8_t command_i = 0;
string[bit--] = 0; // terminate string
while (binary) {
if (binary & 1) {
string[bit--] = '1';
} else {
string[bit--] = '0';
}
binary >>= 1;
}
while (64-bit-1<rjust && bit>=0) {
string[bit--] = '0';
}
return &string[bit+1];
}
/** process user command /** process user command
* @param[in] str user command string (\0 ended) * @param[in] str user command string (\0 ended)
@ -154,41 +134,37 @@ static void process_command(char* str)
return; // command successfully processed return; // command successfully processed
error: error:
printf("command not recognized. enter help to list commands\n"); printf("command not recognized. enter help to list commands\n");
return;
} }
/** program entry point /** program entry point
* this is the firmware function started by the micro-controller * this is the firmware function started by the micro-controller
*/ */
int main(void) void main(void);
void main(void)
{ {
rcc_clock_setup_in_hse_8mhz_out_72mhz(); // use 8 MHz high speed external clock to generate 72 MHz internal clock rcc_clock_setup_in_hse_8mhz_out_72mhz(); // use 8 MHz high speed external clock to generate 72 MHz internal clock
// setup LED
rcc_periph_clock_enable(LED_RCC); // enable clock for LED
gpio_set_mode(LED_PORT, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, LED_PIN); // set LED pin to 'output push-pull'
led_off(); // switch off LED per default
#if DEBUG
DBGMCU_CR |= DBGMCU_CR_IWDG_STOP; // stop independent watchdog counter when code is halted
DBGMCU_CR |= DBGMCU_CR_WWDG_STOP; // stop window watchdog counter when code is halted
DBGMCU_CR |= DBGMCU_CR_STANDBY; // allow debug also in standby mode (keep digital part and clock powered)
DBGMCU_CR |= DBGMCU_CR_STOP; // allow debug also in stop mode (keep clock powered)
DBGMCU_CR |= DBGMCU_CR_SLEEP; // allow debug also in sleep mode (keep clock powered)
#endif
// setup board
board_setup();
// setup USART and USB for user communication // setup USART and USB for user communication
usart_setup(); // setup USART (for printing) usart_setup(); // setup USART (for printing)
cdcacm_setup(); // setup USB CDC ACM (for printing) cdcacm_setup(); // setup USB CDC ACM (for printing)
setbuf(stdout, NULL); // set standard out buffer to NULL to immediately print setbuf(stdout, NULL); // set standard out buffer to NULL to immediately print
setbuf(stderr, NULL); // set standard error buffer to NULL to immediately print setbuf(stderr, NULL); // set standard error buffer to NULL to immediately print
// minimal setup ready // minimal setup ready
printf("welcome to the STM32F1 CuVoodoo example code\n"); // print welcome message printf("welcome to the STM32F1 CuVoodoo example code\n"); // print welcome message
// setup button
#if defined(BUTTON_RCC) && defined(BUTTON_PORT) && defined(BUTTON_PIN) && defined(BUTTON_EXTI) && defined(BUTTON_IRQ)
rcc_periph_clock_enable(BUTTON_RCC); // enable clock for button
gpio_set_mode(BUTTON_PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, BUTTON_PIN); // set button pin to input
gpio_clear(BUTTON_PORT, BUTTON_PIN); // pull down to be able to detect button push (go high)
rcc_periph_clock_enable(RCC_AFIO); // enable alternate function clock for external interrupt
exti_select_source(BUTTON_EXTI, BUTTON_PORT); // mask external interrupt of this pin only for this port
exti_set_trigger(BUTTON_EXTI, EXTI_TRIGGER_RISING); // trigger when button is pressed
exti_enable_request(BUTTON_EXTI); // enable external interrupt
nvic_enable_irq(BUTTON_IRQ); // enable interrupt
#endif
// setup RTC // setup RTC
printf("setup internal RTC: "); printf("setup internal RTC: ");
rtc_auto_awake(RCC_LSE, 32768-1); // ensure internal RTC is on, uses the 32.678 kHz LSE, and the prescale is set to our tick speed, else update backup registers accordingly (power off the micro-controller for the change to take effect) rtc_auto_awake(RCC_LSE, 32768-1); // ensure internal RTC is on, uses the 32.678 kHz LSE, and the prescale is set to our tick speed, else update backup registers accordingly (power off the micro-controller for the change to take effect)
@ -196,18 +172,32 @@ int main(void)
nvic_enable_irq(NVIC_RTC_IRQ); // allow the RTC to interrupt nvic_enable_irq(NVIC_RTC_IRQ); // allow the RTC to interrupt
printf("OK\n"); printf("OK\n");
// get date and time uint32_t ticks_time = rtc_get_counter_val(); // get time from internal RTC (since first start/power up)
uint32_t ticks_time = 0; printf("uptime: %02lu:%02lu:%02lu\n", ticks_time/(60*60), (ticks_time%(60*60))/60, (ticks_time%60)); // display time
ticks_time = rtc_get_counter_val(); // get time/date from internal RTC
printf("current time: %02lu:%02lu:%02lu\n", ticks_time/(60*60), (ticks_time%(60*60))/60, (ticks_time%60)); // display time #if !(DEBUG)
//setup watchdog to reset in case we get stuck (i.e. when an error occurred)
printf("setup watchdog (%.2fs): ",WATCHDOG_PERIOD/1000.0);
iwdg_set_period_ms(WATCHDOG_PERIOD); // set independent watchdog period
iwdg_start(); // start independent watchdog
printf("OK\n");
if (FLASH_OBR&FLASH_OBR_OPTERR) {
printf("option bytes not set in flash: software wachtdog used (not started at reset)\n");
} else if (FLASH_OBR&FLASH_OBR_WDG_SW) {
printf("software wachtdog used (not started at reset)\n");
} else {
printf("hardware wachtdog used (started at reset)\n");
}
#endif
// main loop // main loop
printf("command input: ready\n"); printf("command input: ready\n");
bool action = false; // if an action has been performed don't go to sleep bool action = false; // if an action has been performed don't go to sleep
button_flag = false; // reset button flag button_flag = false; // reset button flag
char c = ' '; // to store received character char c = '\0'; // to store received character
bool char_flag = false; // a new character has been received bool char_flag = false; // a new character has been received
while (true) { // infinite loop while (true) { // infinite loop
iwdg_reset(); // kick the dog
while (usart_received) { // data received over UART while (usart_received) { // data received over UART
action = true; // action has been performed action = true; // action has been performed
led_toggle(); // toggle LED led_toggle(); // toggle LED
@ -248,10 +238,11 @@ int main(void)
} }
while (rtc_internal_tick_flag) { // the internal RTC ticked while (rtc_internal_tick_flag) { // the internal RTC ticked
rtc_internal_tick_flag = false; // reset flag rtc_internal_tick_flag = false; // reset flag
led_toggle(); // toggle LED (good to indicate if main function is stuck)
ticks_time = rtc_get_counter_val(); // copy time from internal RTC for processing ticks_time = rtc_get_counter_val(); // copy time from internal RTC for processing
action = true; // action has been performed action = true; // action has been performed
if ((ticks_time%(60*60))==0) { // one minute passed if ((ticks_time%(60))==0) { // one minute passed
printf("%02lu:%02lu:%02lu\n", ticks_time/(60*60), (ticks_time%(60*60))/60, (ticks_time%60)); // display external time printf("uptime: %02lu:%02lu:%02lu\n", ticks_time/(60*60), (ticks_time%(60*60))/60, (ticks_time%60)); // display external time
} }
} }
if (action) { // go to sleep if nothing had to be done, else recheck for activity if (action) { // go to sleep if nothing had to be done, else recheck for activity
@ -259,20 +250,9 @@ int main(void)
} else { } else {
__WFI(); // go to sleep __WFI(); // go to sleep
} }
} } // main loop
return 0;
} }
#if defined(BUTTON_ISR) && defined(BUTTON_EXTI)
/** interrupt service routine called when button is pressed */
void BUTTON_ISR(void)
{
exti_reset_request(BUTTON_EXTI); // reset interrupt
button_flag = true; // perform button action
}
#endif
/** @brief interrupt service routine called when tick passed on RTC */ /** @brief interrupt service routine called when tick passed on RTC */
void rtc_isr(void) void rtc_isr(void)
{ {