to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE = YES
+
+# 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
+# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
+# setting. When disabled, doxygen will generate a PHP script for searching and
+# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
+# and searching needs to be provided by external tools. See the section
+# "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH = NO
+
+# 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.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# 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
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. The package can be specified just
+# by its name or with the correct syntax as to be used with the LaTeX
+# \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.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# 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,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
+# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
+# string, for the replacement values of the other commands the user is referred
+# to HTML_HEADER.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER =
+
+# 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
+# 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!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+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
+# 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
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS = YES
+
+# 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
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX 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_LATEX is set to YES.
+
+LATEX_SOURCE_CODE = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+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
+#---------------------------------------------------------------------------
+
+# 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
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT = 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
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+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
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+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
+# 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
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# 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.
+# The default value is: NO.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT = xml
+
+# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+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
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
+# AutoGen Definitions (see http://autogen.sf.net) file that captures the
+# structure of the code including all documentation. Note that this feature is
+# still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# 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.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD = NO
+
+# 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
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX = NO
+
+# 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
+# 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
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING = YES
+
+# 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
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES, the include files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all references to function-like macros that are alone on a line, have
+# an all uppercase name, and do not end with a semicolon. Such function macros
+# are typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# 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
+# of tag files.
+# 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
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
+# the class index. If set to NO, only the inherited external classes will be
+# listed.
+# The default value is: NO.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS = YES
+
+# 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
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# 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
+# 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
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS = YES
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH =
+
+# 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.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS = 0
+
+# 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
+# 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
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS = YES
+
+# 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
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# 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
+# functions only using the \callgraph command. Disabling a call graph can be
+# accomplished by means of the command \hidecallgraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# 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
+# functions only using the \callergraph command. Disabling a caller graph can be
+# accomplished by means of the command \hidecallergraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# 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
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# 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.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+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 PLANTUML_CFG_FILE tag can be used to specify a
+# configuration file for plantuml.
+
+PLANTUML_CFG_FILE =
+
+# 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
+# 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
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT = NO
+
+# 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
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP = YES
diff --git a/clicks/magneto14/doc/image/click_icon.png b/clicks/magneto14/doc/image/click_icon.png
new file mode 100644
index 0000000000..ab235e2cd2
Binary files /dev/null and b/clicks/magneto14/doc/image/click_icon.png differ
diff --git a/clicks/magneto14/doc/package/manifest.json b/clicks/magneto14/doc/package/manifest.json
new file mode 100644
index 0000000000..d55221e5ef
--- /dev/null
+++ b/clicks/magneto14/doc/package/manifest.json
@@ -0,0 +1,35 @@
+{
+ "architecture": "ARM|PIC|PIC32|RISC-V|AVR",
+ "category": "Click Boards > Sensors > Magnetic",
+ "changelog": "Resources/CHANGELOG.md",
+ "contains": [
+ "libraries",
+ "hex_files",
+ "examples",
+ "source_files"
+ ],
+ "dependency_list": [],
+ "details": "Resources/DETAILS.md",
+ "display_name": "Magneto 14 click",
+ "example_list": [
+ {
+ "project_path": "Examples/example"
+ }
+ ],
+ "help": "Help/doc",
+ "icon": "Resources/click_icon.png",
+ "license": {
+ "file_path": "",
+ "id": "46"
+ },
+ "name": "mikroe.click.magneto14",
+ "product_link": "https://www.mikroe.com/magneto-14-click",
+ "short_description": "Magneto 14 Click is a compact add-on board with an accurate and reliable magnetic device. This board features the MA735, a contactless angle sensor with ABZ, and PWM output from Monolithic Power Systems. The MA735 sensor has a 9-bit to 13-bit resolution of the absolute angle encoder.",
+ "supported_compiler": "mikroC AI|GCC",
+ "type": "Library",
+ "_type":"mikroSDK Library",
+ "version": "2.1.0.1",
+ "cmake": true,
+ "alias": "Click.Magneto14",
+ "subdir_name": "lib_magneto14"
+}
diff --git a/clicks/magneto14/example/CMakeLists.txt b/clicks/magneto14/example/CMakeLists.txt
new file mode 100644
index 0000000000..1e8df8531a
--- /dev/null
+++ b/clicks/magneto14/example/CMakeLists.txt
@@ -0,0 +1,28 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(example_magneto14 LANGUAGES MikroC)
+else()
+ project(example_magneto14 LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_executable(example_magneto14
+ main.c
+
+)
+
+
+############################ example_magneto14 GENERATED CODE START ###########################
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(example_magneto14 PUBLIC MikroC.Core)
+find_package(MikroSDK.Board REQUIRED)
+target_link_libraries(example_magneto14 PUBLIC MikroSDK.Board)
+find_package(MikroSDK.Log REQUIRED)
+target_link_libraries(example_magneto14 PUBLIC MikroSDK.Log)
+add_subdirectory(lib_magneto14)
+target_link_libraries(example_magneto14 PUBLIC Click.Magneto14)
+############################ example_magneto14 GENERATED CODE END ###########################
+
diff --git a/clicks/magneto14/example/main.c b/clicks/magneto14/example/main.c
new file mode 100644
index 0000000000..a0d1ddd7f1
--- /dev/null
+++ b/clicks/magneto14/example/main.c
@@ -0,0 +1,97 @@
+/*!
+ * @file main.c
+ * @brief Magneto 14 Click example
+ *
+ * # Description
+ * This library contains API for the Magneto 14 Click driver.
+ * The demo application reads and displays
+ * the magnet's angular position in degrees.
+ *
+ * The demo application is composed of two sections :
+ *
+ * ## Application Init
+ * Initialization of SPI module and log UART.
+ * After driver initialization, the app executes a default configuration.
+ *
+ * ## Application Task
+ * This example demonstrates the use of the Magneto 14 Click board™.
+ * Reads and displays the magnet's angular position in degrees.
+ * Results are being sent to the UART Terminal, where you can track their changes.
+ *
+ * @author Nenad Filipovic
+ *
+ */
+
+#include "board.h"
+#include "log.h"
+#include "magneto14.h"
+
+static magneto14_t magneto14;
+static log_t logger;
+
+void application_init ( void )
+{
+ log_cfg_t log_cfg; /**< Logger config object. */
+ magneto14_cfg_t magneto14_cfg; /**< Click config object. */
+
+ /**
+ * Logger initialization.
+ * Default baud rate: 115200
+ * Default log level: LOG_LEVEL_DEBUG
+ * @note If USB_UART_RX and USB_UART_TX
+ * are defined as HAL_PIN_NC, you will
+ * need to define them manually for log to work.
+ * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
+ */
+ LOG_MAP_USB_UART( log_cfg );
+ log_init( &logger, &log_cfg );
+ log_info( &logger, " Application Init " );
+
+ // Click initialization.
+ magneto14_cfg_setup( &magneto14_cfg );
+ MAGNETO14_MAP_MIKROBUS( magneto14_cfg, MIKROBUS_1 );
+ if ( SPI_MASTER_ERROR == magneto14_init( &magneto14, &magneto14_cfg ) )
+ {
+ log_error( &logger, " Communication init." );
+ for ( ; ; );
+ }
+
+ if ( MAGNETO14_ERROR == magneto14_default_cfg ( &magneto14 ) )
+ {
+ log_error( &logger, " Default configuration." );
+ for ( ; ; );
+ }
+
+ log_info( &logger, " Application Task " );
+ log_printf( &logger, " -------------------- \r\n" );
+ Delay_ms( 100 );
+}
+
+void application_task ( void )
+{
+ static uint8_t field_strength = 0;
+ static float angle = 0;
+ if ( MAGNETO14_OK == magneto14_get_field_strength( &magneto14, &field_strength ) )
+ {
+ if ( ( MAGNETO14_FLD_ST_OK == field_strength ) &&
+ ( MAGNETO14_MGH_ST_OK == magneto14_get_mgh( &magneto14 ) ) &&
+ ( MAGNETO14_OK == magneto14_get_angle( &magneto14, &angle ) ) )
+ {
+ log_printf( &logger, " Angle: %.2f [deg]\r\n", angle );
+ log_printf( &logger, " -------------------- \r\n" );
+ Delay_ms( 1000 );
+ }
+ }
+}
+
+void main ( void )
+{
+ application_init( );
+
+ for ( ; ; )
+ {
+ application_task( );
+ }
+}
+
+// ------------------------------------------------------------------------ END
diff --git a/clicks/magneto14/example/manifest.exm b/clicks/magneto14/example/manifest.exm
new file mode 100644
index 0000000000..54d6d8567d
--- /dev/null
+++ b/clicks/magneto14/example/manifest.exm
@@ -0,0 +1,8 @@
+{
+ "name": "Magneto 14 Click",
+ "description": "Magneto 14 Click is a compact add-on board with an accurate and reliable magnetic device. This board features the MA735, a contactless angle sensor with ABZ, and PWM output from Monolithic Power Systems. The MA735 sensor has a 9-bit to 13-bit resolution of the absolute angle encoder.",
+ "image" : "../../Resources/click_icon.png",
+ "toolchain": ["mikrocarm","mikrocpic","mikrocpic32","gcc-riscv","mikrocavr"],
+ "hw" : ["click","MA735"],
+ "category" : ["Click Boards > Sensors > Magnetic"]
+}
diff --git a/clicks/magneto14/lib_magneto14/CMakeLists.txt b/clicks/magneto14/lib_magneto14/CMakeLists.txt
new file mode 100644
index 0000000000..88b324ba77
--- /dev/null
+++ b/clicks/magneto14/lib_magneto14/CMakeLists.txt
@@ -0,0 +1,35 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(lib_magneto14 LANGUAGES MikroC)
+else()
+ project(lib_magneto14 LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_library(lib_magneto14 STATIC
+ src/magneto14.c
+ include/magneto14.h
+)
+add_library(Click.Magneto14 ALIAS lib_magneto14)
+
+if (${MCU_NAME} MATCHES "(^PIC18F(.+)[KQ]4[23]$)|(^PIC32(.+)$)")
+ set(sample_mode_reg_case "SAMPLE_REG_CASE_1")
+else()
+ set(sample_mode_reg_case "SAMPLE_REG_CASE_2")
+endif()
+
+target_compile_definitions(lib_magneto14 PUBLIC ${sample_mode_reg_case})
+
+
+target_include_directories(lib_magneto14 PUBLIC
+ include
+)
+
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(lib_magneto14 PUBLIC MikroC.Core)
+find_package(MikroSDK.Driver REQUIRED)
+target_link_libraries(lib_magneto14 PUBLIC MikroSDK.Driver)
+
diff --git a/clicks/magneto14/lib_magneto14/include/Click.Magneto14 b/clicks/magneto14/lib_magneto14/include/Click.Magneto14
new file mode 100644
index 0000000000..8bdfca8e90
--- /dev/null
+++ b/clicks/magneto14/lib_magneto14/include/Click.Magneto14
@@ -0,0 +1 @@
+#include "magneto14.h"
diff --git a/clicks/magneto14/lib_magneto14/include/magneto14.h b/clicks/magneto14/lib_magneto14/include/magneto14.h
new file mode 100644
index 0000000000..b45f1bc335
--- /dev/null
+++ b/clicks/magneto14/lib_magneto14/include/magneto14.h
@@ -0,0 +1,417 @@
+/****************************************************************************
+** Copyright (C) 2020 MikroElektronika d.o.o.
+** Contact: https://www.mikroe.com/contact
+**
+** Permission is hereby granted, free of charge, to any person obtaining a copy
+** of this software and associated documentation files (the "Software"), to deal
+** in the Software without restriction, including without limitation the rights
+** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+** copies of the Software, and to permit persons to whom the Software is
+** furnished to do so, subject to the following conditions:
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
+** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+** USE OR OTHER DEALINGS IN THE SOFTWARE.
+****************************************************************************/
+
+/*!
+ * @file magneto14.h
+ * @brief This file contains API for Magneto 14 Click Driver.
+ */
+
+#ifndef MAGNETO14_H
+#define MAGNETO14_H
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#include "drv_digital_out.h"
+#include "drv_digital_in.h"
+#include "drv_spi_master.h"
+#include "spi_specifics.h"
+
+/*!
+ * @addtogroup magneto14 Magneto 14 Click Driver
+ * @brief API for configuring and manipulating Magneto 14 Click driver.
+ * @{
+ */
+
+/**
+ * @defgroup magneto14_reg Magneto 14 Registers List
+ * @brief List of registers of Magneto 14 Click driver.
+ */
+
+/**
+ * @addtogroup magneto14_reg
+ * @{
+ */
+
+/**
+ * @brief Magneto 14 description register.
+ * @details Specified register for description of Magneto 14 Click driver.
+ */
+#define MAGNETO14_REG_ZERO_0 0x00
+#define MAGNETO14_REG_ZERO_1 0x01
+#define MAGNETO14_REG_BCT 0x02
+#define MAGNETO14_REG_ET_YX 0x03
+#define MAGNETO14_REG_PPT_ILIP 0x04
+#define MAGNETO14_REG_PPT 0x05
+#define MAGNETO14_REG_MG_LT_HT_MG 0x06
+#define MAGNETO14_REG_RD 0x09
+#define MAGNETO14_REG_FW 0x0E
+#define MAGNETO14_REG_HYS 0x10
+#define MAGNETO14_REG_M_GH_GL 0x1B
+
+/*! @} */ // magneto14_reg
+
+/**
+ * @addtogroup magneto14_cmd
+ * @{
+ */
+
+/**
+ * @brief Magneto 14 description commands.
+ * @details Specified commands of Magneto 14 Click driver.
+ */
+#define MAGNETO14_CMD_READ_ANGLE 0x00
+#define MAGNETO14_CMD_READ_REGISTER 0x02
+#define MAGNETO14_CMD_WRITE_REGISTER 0x04
+#define MAGNETO14_CMD_RESTORE_ALL_NVM 0x05
+#define MAGNETO14_CMD_STORE_ALL_NVM 0x06
+#define MAGNETO14_CMD_STORE_SINGLE_NVM 0x07
+
+/*! @} */ // magneto14_cmd
+
+/**
+ * @defgroup magneto14_set Magneto 14 Registers Settings
+ * @brief Settings for registers of Magneto 14 Click driver.
+ */
+
+/**
+ * @addtogroup magneto14_set
+ * @{
+ */
+
+/**
+ * @brief Magneto 14 description of the command and register bit masks.
+ * @details Specified command and register bit masks of Magneto 14 Click driver.
+ */
+#define MAGNETO14_CMD_BIT_MASK 0x07
+#define MAGNETO14_REG_BIT_MASK 0x1F
+
+/**
+ * @brief Magneto 14 description of trimming settings.
+ * @details Specified trimming settings of Magneto 14 Click driver.
+ */
+#define MAGNETO14_TRIMMING_X_DIS 0x00
+#define MAGNETO14_TRIMMING_X_EN 0x01
+#define MAGNETO14_TRIMMING_Y_DIS 0x00
+#define MAGNETO14_TRIMMING_Y_EN 0x02
+
+/**
+ * @brief Magneto 14 description of magnetic field threshold settings.
+ * @details Specified magnetic field threshold settings of Magneto 14 Click driver.
+ */
+#define MAGNETO14_MG_LT_LVL_0 0x00
+#define MAGNETO14_MG_LT_LVL_1 0x20
+#define MAGNETO14_MG_LT_LVL_2 0x40
+#define MAGNETO14_MG_LT_LVL_3 0x60
+#define MAGNETO14_MG_LT_LVL_4 0x80
+#define MAGNETO14_MG_LT_LVL_5 0xA0
+#define MAGNETO14_MG_LT_LVL_6 0xC0
+#define MAGNETO14_MG_LT_LVL_7 0xE0
+#define MAGNETO14_MG_HT_LVL_0 0x00
+#define MAGNETO14_MG_HT_LVL_1 0x04
+#define MAGNETO14_MG_HT_LVL_2 0x08
+#define MAGNETO14_MG_HT_LVL_3 0x0C
+#define MAGNETO14_MG_HT_LVL_4 0x10
+#define MAGNETO14_MG_HT_LVL_5 0x14
+#define MAGNETO14_MG_HT_LVL_6 0x18
+#define MAGNETO14_MG_HT_LVL_7 0x1C
+#define MAGNETO14_MG_BIT_MASK 0xFC
+
+/**
+ * @brief Magneto 14 description of field strength level.
+ * @details Specified field strength level of Magneto 14 Click driver.
+ */
+#define MAGNETO14_MGH_ST_OK 0x00
+#define MAGNETO14_FLD_ST_OK 0x00
+#define MAGNETO14_FLD_ST_MGL 0x01
+#define MAGNETO14_FLD_ST_MGH 0x02
+#define MAGNETO14_FLD_ST_BIT_MASK 0x03
+
+/**
+ * @brief Data sample selection.
+ * @details This macro sets data samples for SPI modules.
+ * @note Available only on Microchip PIC family devices.
+ * This macro will set data sampling for all SPI modules on MCU.
+ * Can be overwritten with @b magneto14_init which will set
+ * @b SET_SPI_DATA_SAMPLE_MIDDLE by default on the mapped mikrobus.
+ */
+#define MAGNETO14_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
+#define MAGNETO14_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
+
+/*! @} */ // magneto14_set
+
+/**
+ * @defgroup magneto14_map Magneto 14 MikroBUS Map
+ * @brief MikroBUS pin mapping of Magneto 14 Click driver.
+ */
+
+/**
+ * @addtogroup magneto14_map
+ * @{
+ */
+
+/**
+ * @brief MikroBUS pin mapping.
+ * @details Mapping pins of Magneto 14 Click to the selected MikroBUS.
+ */
+#define MAGNETO14_MAP_MIKROBUS( cfg, mikrobus ) \
+ cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
+ cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
+ cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
+ cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
+ cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
+ cfg.mgh = MIKROBUS( mikrobus, MIKROBUS_INT )
+
+/*! @} */ // magneto14_map
+/*! @} */ // magneto14
+
+/**
+ * @brief Magneto 14 Click context object.
+ * @details Context object definition of Magneto 14 Click driver.
+ */
+typedef struct
+{
+ // Output pins
+ digital_out_t pwm; /**< Pulse-width modulation pin. */
+
+ // Input pins
+ digital_in_t mgh; /**< Field strength above the MGHT level. */
+
+ // Modules
+ spi_master_t spi; /**< SPI driver object. */
+
+ pin_name_t chip_select; /**< Chip select pin descriptor (used for SPI driver). */
+
+} magneto14_t;
+
+/**
+ * @brief Magneto 14 Click configuration object.
+ * @details Configuration object definition of Magneto 14 Click driver.
+ */
+typedef struct
+{
+ // Communication gpio pins
+ pin_name_t miso; /**< Master input - slave output pin descriptor for SPI driver. */
+ pin_name_t mosi; /**< Master output - slave input pin descriptor for SPI driver. */
+ pin_name_t sck; /**< Clock pin descriptor for SPI driver. */
+ pin_name_t cs; /**< Chip select pin descriptor for SPI driver. */
+
+ // Additional gpio pins
+ pin_name_t pwm; /**< Pulse-width modulation pin. */
+ pin_name_t mgh; /**< Field strength above the MGHT level. */
+
+ // static variable
+ uint32_t spi_speed; /**< SPI serial speed. */
+ spi_master_mode_t spi_mode; /**< SPI master mode. */
+ spi_master_chip_select_polarity_t cs_polarity; /**< Chip select pin polarity. */
+
+} magneto14_cfg_t;
+
+/**
+ * @brief Magneto 14 Click return value data.
+ * @details Predefined enum values for driver return values.
+ */
+typedef enum
+{
+ MAGNETO14_OK = 0,
+ MAGNETO14_ERROR = -1
+
+} magneto14_return_value_t;
+
+/*!
+ * @addtogroup magneto14 Magneto 14 Click Driver
+ * @brief API for configuring and manipulating Magneto 14 Click driver.
+ * @{
+ */
+
+/**
+ * @brief Magneto 14 configuration object setup function.
+ * @details This function initializes click configuration structure to initial
+ * values.
+ * @param[out] cfg : Click configuration structure.
+ * See #magneto14_cfg_t object definition for detailed explanation.
+ * @return Nothing.
+ * @note The all used pins will be set to unconnected state.
+ */
+void magneto14_cfg_setup ( magneto14_cfg_t *cfg );
+
+/**
+ * @brief Magneto 14 initialization function.
+ * @details This function initializes all necessary pins and peripherals used
+ * for this click board.
+ * @param[out] ctx : Click context object.
+ * See #magneto14_t object definition for detailed explanation.
+ * @param[in] cfg : Click configuration structure.
+ * See #magneto14_cfg_t object definition for detailed explanation.
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t magneto14_init ( magneto14_t *ctx, magneto14_cfg_t *cfg );
+
+/**
+ * @brief Magneto 14 default configuration function.
+ * @details This function executes a default configuration of Magneto 14
+ * click board.
+ * @param[in] ctx : Click context object.
+ * See #magneto14_t object definition for detailed explanation.
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note This function can consist any necessary configuration or setting to put
+ * device into operating mode.
+ */
+err_t magneto14_default_cfg ( magneto14_t *ctx );
+
+/**
+ * @brief Magneto 14 data writing function.
+ * @details This function writes a data byte to the selected register
+ * of the selected command by using SPI serial interface.
+ * @param[in] ctx : Click context object.
+ * See #magneto14_t object definition for detailed explanation.
+ * @param[in] cmd : Command.
+ * @param[in] reg : Register address.
+ * @param[in] data_in : Data to be written.
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t magneto14_write_reg ( magneto14_t *ctx, uint8_t cmd, uint8_t reg, uint8_t data_in );
+
+/**
+ * @brief Magneto 14 data reading function.
+ * @details This function reads a data byte from the selected register
+ * of the selected command by using SPI serial interface.
+ * @param[in] ctx : Click context object.
+ * See #magneto14_t object definition for detailed explanation.
+ * @param[in] cmd : Command.
+ * @param[in] reg : Register address.
+ * @param[out] data_out : Output read data.
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t magneto14_read_reg ( magneto14_t *ctx, uint8_t cmd, uint8_t reg, uint8_t *data_out );
+
+/**
+ * @brief Magneto 14 gets the angle raw data function.
+ * @details This function reads a 16-bit angle raw data
+ * of the MagAlpha MA735, Contactless Digital Angle Sensor
+ * on the Magneto 14 Click board™.
+ * @param[in] ctx : Click context object.
+ * See #magneto14_t object definition for detailed explanation.
+ * @param[out] raw_data : Angle raw data [0-65535].
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t magneto14_get_angle_raw_data ( magneto14_t *ctx, uint16_t *raw_data );
+
+/**
+ * @brief Magneto 14 gets the angular position function.
+ * @details This function reads an angular position in degrees
+ * of the MagAlpha MA735, Contactless Digital Angle Sensor
+ * on the Magneto 14 Click board™.
+ * @param[in] ctx : Click context object.
+ * See #magneto14_t object definition for detailed explanation.
+ * @param[out] angle : Angle data, degrees [0-360].
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t magneto14_get_angle ( magneto14_t *ctx, float *angle );
+
+/**
+ * @brief Magneto 14 sets the magnetic field threshold function.
+ * @details This function sets the magnetic field's high and low thresholds
+ * of the MagAlpha MA735, Contactless Digital Angle Sensor
+ * on the Magneto 14 Click board™.
+ * @param[in] ctx : Click context object.
+ * See #magneto14_t object definition for detailed explanation.
+ * @param[in] mglt : Sets the field strength low threshold.
+ * @param[in] mght : Sets the field strength high threshold.
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t magneto14_set_mag_field_thd ( magneto14_t *ctx, uint8_t mglt, uint8_t mght );
+
+/**
+ * @brief Magneto 14 gets the magnetic field strength function.
+ * @details This function reads a magnetic field strength detection
+ * of the MagAlpha MA735, Contactless Digital Angle Sensor
+ * on the Magneto 14 Click board™.
+ * @param[in] ctx : Click context object.
+ * See #magneto14_t object definition for detailed explanation.
+ * @param[out] field_strength :
+ * @li @c 0 - Magnetic field strength OK,
+ * @li @c 1 - Magnetic field strength below the MGLT level,
+ * @li @c 2 - Magnetic field strength above the MGHT level.
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t magneto14_get_field_strength ( magneto14_t *ctx, uint8_t *field_strength );
+
+/**
+ * @brief Magneto 14 set PWM pin function.
+ * @details This function sets the PWM pin logic state
+ * of the MagAlpha MA735, Contactless Digital Angle Sensor
+ * on the Magneto 14 Click board™.
+ * @param[in] ctx : Click context object.
+ * See #magneto14_t object definition for detailed explanation.
+ * @param[in] pwm_state : Logic state of the PWM pin.
+ * @return Nothing.
+ * @note None.
+ */
+void magneto14_set_pwm_pin ( magneto14_t *ctx, uint8_t pwm_state );
+
+/**
+ * @brief Magneto 14 gets the MGH function.
+ * @details This function gets states of the MGH ( INT ) pin
+ * to indicate the magnetic field strength
+ * of the MagAlpha MA735, Contactless Digital Angle Sensor
+ * on the Magneto 14 Click board™.
+ * @param[in] ctx : Click context object.
+ * See #magneto14_t object definition for detailed explanation.
+ * @return @li @c 0 - MGHT level OK,
+ * @li @c 1 - Magnetic field strength above the MGHT level.
+ * @note None.
+ */
+uint8_t magneto14_get_mgh ( magneto14_t *ctx );
+
+#ifdef __cplusplus
+}
+#endif
+#endif // MAGNETO14_H
+
+/*! @} */ // magneto14
+
+// ------------------------------------------------------------------------ END
diff --git a/clicks/magneto14/lib_magneto14/include/spi_specifics.h b/clicks/magneto14/lib_magneto14/include/spi_specifics.h
new file mode 100644
index 0000000000..0bba508c77
--- /dev/null
+++ b/clicks/magneto14/lib_magneto14/include/spi_specifics.h
@@ -0,0 +1,121 @@
+/****************************************************************************
+** Copyright (C) 2021 MikroElektronika d.o.o.
+** Contact: https://www.mikroe.com/contact
+**
+** Permission is hereby granted, free of charge, to any person obtaining a copy
+** of this software and associated documentation files (the "Software"), to deal
+** in the Software without restriction, including without limitation the rights
+** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+** copies of the Software, and to permit persons to whom the Software is
+** furnished to do so, subject to the following conditions:
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
+** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+** USE OR OTHER DEALINGS IN THE SOFTWARE.
+****************************************************************************/
+/*!
+ * @file spi_specifics.h
+ * @brief This file contains SPI specific macros, functions, etc.
+ */
+
+#ifndef _SPI_SPECIFICS_
+#define _SPI_SPECIFICS_
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#include "mcu_definitions.h"
+
+// mikroE toolchain specific
+#if defined(__MIKROC_AI_FOR_PIC__) || defined (__MIKROC_AI_FOR_DSPIC__) || \
+ defined(__MIKROC_AI_FOR_PIC32__)
+
+#ifdef __MIKROC_AI_FOR_PIC__
+ #define BIT_INDEX 7
+#elif defined(__MIKROC_AI_FOR_PIC32__)
+ #define BIT_INDEX 9
+#endif
+
+#ifdef SAMPLE_REG_CASE_1
+ #ifdef __MIKROC_AI_FOR_PIC32__
+ #define SAMPLE_REG_ADDRESS(index) HAL_LL_SPI ## index ## CON_ADDRESS
+ #else
+ #define SAMPLE_REG_ADDRESS(index) HAL_LL_SPI ## index ## CON1_ADDRESS
+ #endif
+#else
+ #define SAMPLE_REG_ADDRESS(index) HAL_LL_SSP ## index ## STAT_ADDRESS
+#endif
+
+#if defined(SPI_MODULE) || defined(SPI_MODULE_1)
+ #define SET_SPI_DATA_SAMPLE_MIDDLE1 clear_reg_bit(SAMPLE_REG_ADDRESS(1), BIT_INDEX);
+ #define SET_SPI_DATA_SAMPLE_EDGE1 set_reg_bit(SAMPLE_REG_ADDRESS(1), BIT_INDEX);
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE1
+ #define SET_SPI_DATA_SAMPLE_EDGE1
+#endif
+
+#ifdef SPI_MODULE_2
+ #define SET_SPI_DATA_SAMPLE_MIDDLE2 clear_reg_bit(SAMPLE_REG_ADDRESS(2), BIT_INDEX);
+ #define SET_SPI_DATA_SAMPLE_EDGE2 set_reg_bit(SAMPLE_REG_ADDRESS(2), BIT_INDEX);
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE2
+ #define SET_SPI_DATA_SAMPLE_EDGE2
+#endif
+
+#ifdef SPI_MODULE_3
+ #define SET_SPI_DATA_SAMPLE_MIDDLE3 clear_reg_bit(SAMPLE_REG_ADDRESS(3), BIT_INDEX);
+ #define SET_SPI_DATA_SAMPLE_EDGE3 set_reg_bit(SAMPLE_REG_ADDRESS(3), BIT_INDEX);
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE3
+ #define SET_SPI_DATA_SAMPLE_EDGE3
+#endif
+
+#ifdef SPI_MODULE_4
+ #define SET_SPI_DATA_SAMPLE_MIDDLE4 clear_reg_bit(SAMPLE_REG_ADDRESS(4), BIT_INDEX);
+ #define SET_SPI_DATA_SAMPLE_EDGE4 set_reg_bit(SAMPLE_REG_ADDRESS(4), BIT_INDEX);
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE4
+ #define SET_SPI_DATA_SAMPLE_EDGE4
+#endif
+
+#ifdef SPI_MODULE_5
+ #define SET_SPI_DATA_SAMPLE_MIDDLE5 clear_reg_bit(SAMPLE_REG_ADDRESS(5), BIT_INDEX);
+ #define SET_SPI_DATA_SAMPLE_EDGE5 set_reg_bit(SAMPLE_REG_ADDRESS(5), BIT_INDEX);
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE5
+ #define SET_SPI_DATA_SAMPLE_EDGE5
+#endif
+
+#ifdef SPI_MODULE_6
+ #define SET_SPI_DATA_SAMPLE_MIDDLE6 clear_reg_bit(SAMPLE_REG_ADDRESS(6), BIT_INDEX);
+ #define SET_SPI_DATA_SAMPLE_EDGE6 set_reg_bit(SAMPLE_REG_ADDRESS(6), BIT_INDEX);
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE6
+ #define SET_SPI_DATA_SAMPLE_EDGE6
+#endif
+
+
+#define SET_SPI_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE1 SET_SPI_DATA_SAMPLE_MIDDLE2 \
+ SET_SPI_DATA_SAMPLE_MIDDLE3 SET_SPI_DATA_SAMPLE_MIDDLE4 \
+ SET_SPI_DATA_SAMPLE_MIDDLE5 SET_SPI_DATA_SAMPLE_MIDDLE6
+#define SET_SPI_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE1 SET_SPI_DATA_SAMPLE_EDGE2 \
+ SET_SPI_DATA_SAMPLE_EDGE3 SET_SPI_DATA_SAMPLE_EDGE4 \
+ SET_SPI_DATA_SAMPLE_EDGE5 SET_SPI_DATA_SAMPLE_EDGE6
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE
+ #define SET_SPI_DATA_SAMPLE_EDGE
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif // _SPI_SPECIFICS_
+
+// ------------------------------------------------------------------------ END
diff --git a/clicks/magneto14/lib_magneto14/src/magneto14.c b/clicks/magneto14/lib_magneto14/src/magneto14.c
new file mode 100644
index 0000000000..98f23c952d
--- /dev/null
+++ b/clicks/magneto14/lib_magneto14/src/magneto14.c
@@ -0,0 +1,237 @@
+/****************************************************************************
+** Copyright (C) 2020 MikroElektronika d.o.o.
+** Contact: https://www.mikroe.com/contact
+**
+** Permission is hereby granted, free of charge, to any person obtaining a copy
+** of this software and associated documentation files (the "Software"), to deal
+** in the Software without restriction, including without limitation the rights
+** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+** copies of the Software, and to permit persons to whom the Software is
+** furnished to do so, subject to the following conditions:
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
+** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+** USE OR OTHER DEALINGS IN THE SOFTWARE.
+****************************************************************************/
+
+/*!
+ * @file magneto14.c
+ * @brief Magneto 14 Click Driver.
+ */
+
+#include "magneto14.h"
+
+/**
+ * @brief Dummy data.
+ * @details Definition of dummy data.
+ */
+#define DUMMY 0x00
+
+/**
+ * @brief Magneto 14 angle calculation values.
+ * @details Definition of angle calculation values.
+ */
+#define MAGNETO14_ANGLE_FULL_SCALE 65535.0
+#define MAGNETO14_ANGLE_MAX_DEGREES 360.0
+
+/**
+ * @brief Magneto 14 communication delay function.
+ * @details Idle time between two subsequent angle transmissions,
+ * before and after a register readout and before and after a register write.
+ * @return Nothing.
+ * @note None.
+ */
+static void magneto14_communication_delay ( void );
+
+/**
+ * @brief Magneto 14 store to the NVM delay function.
+ * @details Time required to store a single register to the NVM.
+ * @return Nothing.
+ * @note None.
+ */
+static void magneto14_store_nvm_delay ( void );
+
+void magneto14_cfg_setup ( magneto14_cfg_t *cfg )
+{
+ cfg->sck = HAL_PIN_NC;
+ cfg->miso = HAL_PIN_NC;
+ cfg->mosi = HAL_PIN_NC;
+ cfg->cs = HAL_PIN_NC;
+ cfg->pwm = HAL_PIN_NC;
+ cfg->mgh = HAL_PIN_NC;
+
+ cfg->spi_speed = 100000;
+ cfg->spi_mode = SPI_MASTER_MODE_0;
+ cfg->cs_polarity = SPI_MASTER_CHIP_SELECT_POLARITY_ACTIVE_LOW;
+}
+
+err_t magneto14_init ( magneto14_t *ctx, magneto14_cfg_t *cfg )
+{
+ spi_master_config_t spi_cfg;
+
+ spi_master_configure_default( &spi_cfg );
+
+ spi_cfg.sck = cfg->sck;
+ spi_cfg.miso = cfg->miso;
+ spi_cfg.mosi = cfg->mosi;
+
+ ctx->chip_select = cfg->cs;
+
+ if ( SPI_MASTER_ERROR == spi_master_open( &ctx->spi, &spi_cfg ) )
+ {
+ return SPI_MASTER_ERROR;
+ }
+
+ if ( SPI_MASTER_ERROR == spi_master_set_default_write_data( &ctx->spi, DUMMY ) )
+ {
+ return SPI_MASTER_ERROR;
+ }
+
+ if ( SPI_MASTER_ERROR == spi_master_set_mode( &ctx->spi, cfg->spi_mode ) )
+ {
+ return SPI_MASTER_ERROR;
+ }
+
+ if ( SPI_MASTER_ERROR == spi_master_set_speed( &ctx->spi, cfg->spi_speed ) )
+ {
+ return SPI_MASTER_ERROR;
+ }
+
+ spi_master_set_chip_select_polarity( cfg->cs_polarity );
+ spi_master_deselect_device( ctx->chip_select );
+
+ digital_out_init( &ctx->pwm, cfg->pwm );
+
+ digital_in_init( &ctx->mgh, cfg->mgh );
+
+ return SPI_MASTER_SUCCESS;
+}
+
+err_t magneto14_default_cfg ( magneto14_t *ctx )
+{
+ magneto14_communication_delay( );
+ return magneto14_set_mag_field_thd( ctx, MAGNETO14_MG_LT_LVL_0, MAGNETO14_MG_HT_LVL_3 );
+}
+
+err_t magneto14_write_reg ( magneto14_t *ctx, uint8_t cmd, uint8_t reg, uint8_t data_in )
+{
+ uint8_t data_buf[ 2 ] = { 0 };
+ data_buf[ 0 ] = ( cmd & MAGNETO14_CMD_BIT_MASK ) << 5;
+ data_buf[ 0 ] |= reg & MAGNETO14_REG_BIT_MASK;
+ data_buf[ 1 ] = data_in;
+ spi_master_select_device( ctx->chip_select );
+ err_t error_flag = spi_master_write( &ctx->spi, data_buf, 2 );
+ spi_master_deselect_device( ctx->chip_select );
+ if ( cmd == MAGNETO14_CMD_STORE_SINGLE_NVM )
+ {
+ magneto14_store_nvm_delay( );
+ }
+ else
+ {
+ magneto14_communication_delay( );
+ }
+ error_flag |= spi_master_set_default_write_data( &ctx->spi, DUMMY );
+ spi_master_select_device( ctx->chip_select );
+ error_flag |= spi_master_read( &ctx->spi, data_buf, 2 );
+ spi_master_deselect_device( ctx->chip_select );
+ if ( data_in != data_buf[ 0 ] )
+ {
+ error_flag = MAGNETO14_ERROR;
+ }
+ return error_flag;
+}
+
+err_t magneto14_read_reg ( magneto14_t *ctx, uint8_t cmd, uint8_t reg, uint8_t *data_out )
+{
+ uint8_t data_buf[ 2 ] = { 0 };
+ data_buf[ 0 ] = ( cmd & MAGNETO14_CMD_BIT_MASK ) << 5;
+ data_buf[ 0 ] |= reg & MAGNETO14_REG_BIT_MASK;
+ spi_master_select_device( ctx->chip_select );
+ err_t error_flag = spi_master_write( &ctx->spi, data_buf, 2 );
+ spi_master_deselect_device( ctx->chip_select );
+ if ( cmd == MAGNETO14_CMD_RESTORE_ALL_NVM )
+ {
+ magneto14_communication_delay( );
+ }
+ magneto14_communication_delay( );
+ error_flag |= spi_master_set_default_write_data( &ctx->spi, DUMMY );
+ spi_master_select_device( ctx->chip_select );
+ error_flag |= spi_master_read( &ctx->spi, data_buf, 2 );
+ spi_master_deselect_device( ctx->chip_select );
+ *data_out = data_buf[ 0 ];
+ return error_flag;
+}
+
+err_t magneto14_get_angle_raw_data ( magneto14_t *ctx, uint16_t *raw_data )
+{
+ uint8_t data_buf[ 2 ] = { 0 };
+ err_t error_flag = spi_master_set_default_write_data( &ctx->spi, DUMMY );
+ spi_master_select_device( ctx->chip_select );
+ error_flag |= spi_master_read( &ctx->spi, data_buf, 2 );
+ spi_master_deselect_device( ctx->chip_select );
+ *raw_data = data_buf[ 0 ];
+ *raw_data <<= 8;
+ *raw_data |= data_buf[ 1 ];
+ return error_flag;
+}
+
+err_t magneto14_get_angle ( magneto14_t *ctx, float *angle )
+{
+ uint16_t raw_data = DUMMY;
+ err_t error_flag = magneto14_get_angle_raw_data( ctx, &raw_data );
+ *angle = ( float ) raw_data;
+ *angle /= MAGNETO14_ANGLE_FULL_SCALE;
+ *angle *= MAGNETO14_ANGLE_MAX_DEGREES;
+ return error_flag;
+}
+
+err_t magneto14_set_mag_field_thd ( magneto14_t *ctx, uint8_t mglt, uint8_t mght )
+{
+ uint8_t data_buf = DUMMY;
+ err_t error_flag = magneto14_read_reg( ctx, MAGNETO14_CMD_READ_REGISTER, MAGNETO14_REG_MG_LT_HT_MG, &data_buf );
+ magneto14_communication_delay( );
+ data_buf &= MAGNETO14_MG_BIT_MASK;
+ data_buf |= mglt & MAGNETO14_MG_LT_LVL_7;
+ data_buf |= mght & MAGNETO14_MG_HT_LVL_7;
+ error_flag |= magneto14_write_reg( ctx, MAGNETO14_CMD_WRITE_REGISTER, MAGNETO14_REG_MG_LT_HT_MG, data_buf );
+ return error_flag;
+}
+
+err_t magneto14_get_field_strength ( magneto14_t *ctx, uint8_t *field_strength )
+{
+ uint8_t data_buf = DUMMY;
+ err_t error_flag = magneto14_read_reg( ctx, MAGNETO14_CMD_READ_REGISTER, MAGNETO14_REG_M_GH_GL, &data_buf );
+ *field_strength = ( data_buf >> 6 ) & MAGNETO14_FLD_ST_BIT_MASK;
+ return error_flag;
+}
+
+void magneto14_set_pwm_pin ( magneto14_t *ctx, uint8_t pwm_state )
+{
+ digital_out_write( &ctx->pwm, pwm_state );
+}
+
+uint8_t magneto14_get_mgh ( magneto14_t *ctx )
+{
+ return digital_in_read( &ctx->mgh );
+}
+
+static void magneto14_communication_delay ( void )
+{
+ Delay_10ms( );
+ Delay_10ms( );
+}
+
+static void magneto14_store_nvm_delay ( void )
+{
+ Delay_10ms( );
+ Delay_10ms( );
+ Delay_5ms( );
+}
+
+// ------------------------------------------------------------------------- END
diff --git a/clicks/mrangle/CMakeLists.txt b/clicks/mrangle/CMakeLists.txt
new file mode 100644
index 0000000000..75f7325eec
--- /dev/null
+++ b/clicks/mrangle/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(example_mrangle LANGUAGES MikroC)
+else()
+ project(example_mrangle LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_executable(example_mrangle
+ example/main.c
+
+)
+
+
+############################ example_mrangle GENERATED CODE START ###########################
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(example_mrangle PUBLIC MikroC.Core)
+find_package(MikroSDK.Board REQUIRED)
+target_link_libraries(example_mrangle PUBLIC MikroSDK.Board)
+find_package(MikroSDK.Log REQUIRED)
+target_link_libraries(example_mrangle PUBLIC MikroSDK.Log)
+add_subdirectory(lib_mrangle)
+target_link_libraries(example_mrangle PUBLIC Click.MrAngle)
+############################ example_mrangle GENERATED CODE END ###########################
diff --git a/clicks/mrangle/README.md b/clicks/mrangle/README.md
index 88dfbcf503..1fad736f79 100644
--- a/clicks/mrangle/README.md
+++ b/clicks/mrangle/README.md
@@ -3,7 +3,7 @@
---
# MR Angle click
-MR Angle Click is a compact add-on board that contains a magnetoresistive sensor with an integrated amplifier. This board features the KMZ60, a high precision sensor for magnetic angle measurement with single-ended cosine and sine outputs from NXP Semiconductors. The MR sensor element comes with two Wheatstone bridges for cosine and sine signals, supports functions for control circuit and signal amplification, and enables angular measurements with high accuracy by an excellent linearity and temperature drift behavior. The KMZ60 is fully automotive qualified as well as applicable for industrial and consumer applications.
+> MR Angle Click is a compact add-on board that contains a magnetoresistive sensor with an integrated amplifier. This board features the KMZ60, a high precision sensor for magnetic angle measurement with single-ended cosine and sine outputs from NXP Semiconductors. The MR sensor element comes with two Wheatstone bridges for cosine and sine signals, supports functions for control circuit and signal amplification, and enables angular measurements with high accuracy by an excellent linearity and temperature drift behavior. The KMZ60 is fully automotive qualified as well as applicable for industrial and consumer applications.
@@ -43,7 +43,7 @@ void mrangle_cfg_setup ( mrangle_cfg_t *cfg );
- `mrangle_init` Initialization function.
```c
-MRANGLE_RETVAL mrangle_init ( mrangle_t *ctx, mrangle_cfg_t *cfg );
+err_t mrangle_init ( mrangle_t *ctx, mrangle_cfg_t *cfg );
```
- `mrangle_default_cfg` Click Default Configuration function.
@@ -65,7 +65,7 @@ err_t mrangle_get_temperature ( mrangle_t *ctx, float *temperature );
- `mrangle_powerdown_mode` MR Angle powerdown mode function.
```c
-err_t mrangle_powerdown_mode ( mrangle_t *ctx, mrangle_powerdown_mode_value_t pd_mode );
+void mrangle_powerdown_mode ( mrangle_t *ctx, mrangle_powerdown_mode_value_t pd_mode );
```
## Example Description
@@ -82,7 +82,8 @@ err_t mrangle_powerdown_mode ( mrangle_t *ctx, mrangle_powerdown_mode_value_t pd
```c
-void application_init ( void ) {
+void application_init ( void )
+{
log_cfg_t log_cfg; /**< Logger config object. */
mrangle_cfg_t mrangle_cfg; /**< Click config object. */
@@ -97,25 +98,20 @@ void application_init ( void ) {
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
- log_printf( &logger, "\r\n" );
log_info( &logger, " Application Init " );
// Click initialization.
-
mrangle_cfg_setup( &mrangle_cfg );
MRANGLE_MAP_MIKROBUS( mrangle_cfg, MIKROBUS_1 );
- err_t init_flag = mrangle_init( &mrangle, &mrangle_cfg );
- if ( init_flag == SPI_MASTER_ERROR ) {
+ if ( SPI_MASTER_ERROR == mrangle_init( &mrangle, &mrangle_cfg ) )
+ {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
-
for ( ; ; );
}
mrangle_default_cfg ( &mrangle );
log_info( &logger, " Application Task " );
- log_printf( &logger, "-------------------------\r\n" );
- Delay_ms( 1000 );
}
```
@@ -128,10 +124,11 @@ void application_init ( void ) {
```c
-void application_task ( void ) {
+void application_task ( void )
+{
mrangle_get_angle( &mrangle, &angle );
- log_printf( &logger, " Angle : %.2f degree \r\n", angle );
- log_printf( &logger, "-------------------------\r\n" );
+ log_printf( &logger, " Angle: %.2f deg\r\n", angle );
+ log_printf( &logger, "------------------\r\n" );
Delay_ms( 1000 );
}
diff --git a/clicks/mrangle/changelog.md b/clicks/mrangle/changelog.md
index 8a902bbfaf..ca09ef759f 100644
--- a/clicks/mrangle/changelog.md
+++ b/clicks/mrangle/changelog.md
@@ -1,4 +1,4 @@
## Changelog
-### Version 2.0.0.4
+### Version 2.1.0.4
- Initial release
diff --git a/clicks/mrangle/details.md b/clicks/mrangle/details.md
index cec75de118..4d3e7944c8 100644
--- a/clicks/mrangle/details.md
+++ b/clicks/mrangle/details.md
@@ -2,7 +2,7 @@
---
# MR Angle click
-MR Angle Click is a compact add-on board that contains a magnetoresistive sensor with an integrated amplifier. This board features the KMZ60, a high precision sensor for magnetic angle measurement with single-ended cosine and sine outputs from NXP Semiconductors. The MR sensor element comes with two Wheatstone bridges for cosine and sine signals, supports functions for control circuit and signal amplification, and enables angular measurements with high accuracy by an excellent linearity and temperature drift behavior. The KMZ60 is fully automotive qualified as well as applicable for industrial and consumer applications.
+> MR Angle Click is a compact add-on board that contains a magnetoresistive sensor with an integrated amplifier. This board features the KMZ60, a high precision sensor for magnetic angle measurement with single-ended cosine and sine outputs from NXP Semiconductors. The MR sensor element comes with two Wheatstone bridges for cosine and sine signals, supports functions for control circuit and signal amplification, and enables angular measurements with high accuracy by an excellent linearity and temperature drift behavior. The KMZ60 is fully automotive qualified as well as applicable for industrial and consumer applications.
@@ -42,7 +42,7 @@ void mrangle_cfg_setup ( mrangle_cfg_t *cfg );
- `mrangle_init` Initialization function.
```c
-MRANGLE_RETVAL mrangle_init ( mrangle_t *ctx, mrangle_cfg_t *cfg );
+err_t mrangle_init ( mrangle_t *ctx, mrangle_cfg_t *cfg );
```
- `mrangle_default_cfg` Click Default Configuration function.
@@ -64,7 +64,7 @@ err_t mrangle_get_temperature ( mrangle_t *ctx, float *temperature );
- `mrangle_powerdown_mode` MR Angle powerdown mode function.
```c
-err_t mrangle_powerdown_mode ( mrangle_t *ctx, mrangle_powerdown_mode_value_t pd_mode );
+void mrangle_powerdown_mode ( mrangle_t *ctx, mrangle_powerdown_mode_value_t pd_mode );
```
## Example Description
@@ -81,7 +81,8 @@ err_t mrangle_powerdown_mode ( mrangle_t *ctx, mrangle_powerdown_mode_value_t pd
```c
-void application_init ( void ) {
+void application_init ( void )
+{
log_cfg_t log_cfg; /**< Logger config object. */
mrangle_cfg_t mrangle_cfg; /**< Click config object. */
@@ -96,25 +97,20 @@ void application_init ( void ) {
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
- log_printf( &logger, "\r\n" );
log_info( &logger, " Application Init " );
// Click initialization.
-
mrangle_cfg_setup( &mrangle_cfg );
MRANGLE_MAP_MIKROBUS( mrangle_cfg, MIKROBUS_1 );
- err_t init_flag = mrangle_init( &mrangle, &mrangle_cfg );
- if ( init_flag == SPI_MASTER_ERROR ) {
+ if ( SPI_MASTER_ERROR == mrangle_init( &mrangle, &mrangle_cfg ) )
+ {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
-
for ( ; ; );
}
mrangle_default_cfg ( &mrangle );
log_info( &logger, " Application Task " );
- log_printf( &logger, "-------------------------\r\n" );
- Delay_ms( 1000 );
}
```
@@ -127,10 +123,11 @@ void application_init ( void ) {
```c
-void application_task ( void ) {
+void application_task ( void )
+{
mrangle_get_angle( &mrangle, &angle );
- log_printf( &logger, " Angle : %.2f degree \r\n", angle );
- log_printf( &logger, "-------------------------\r\n" );
+ log_printf( &logger, " Angle: %.2f deg\r\n", angle );
+ log_printf( &logger, "------------------\r\n" );
Delay_ms( 1000 );
}
diff --git a/clicks/mrangle/doc/doxy/Doxyfile.doxy b/clicks/mrangle/doc/doxy/Doxyfile.doxy
index 1c73e04daa..05e1938670 100644
--- a/clicks/mrangle/doc/doxy/Doxyfile.doxy
+++ b/clicks/mrangle/doc/doxy/Doxyfile.doxy
@@ -44,21 +44,21 @@ PROJECT_NUMBER = 2.0.0.0
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
-PROJECT_BRIEF =
+PROJECT_BRIEF =
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
-PROJECT_LOGO =
+PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
-OUTPUT_DIRECTORY = ../clicks/mrangle/temp/Help/doc
+OUTPUT_DIRECTORY = ../cmake/mrangle/temp/Help/doc
# 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
@@ -162,7 +162,7 @@ FULL_PATH_NAMES = YES
# will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
-STRIP_FROM_PATH =
+STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which
@@ -171,7 +171,7 @@ STRIP_FROM_PATH =
# specify the list of include paths that are normally passed to the compiler
# using the -I flag.
-STRIP_FROM_INC_PATH =
+STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
# less readable) file names. This can be useful is your file systems doesn't
@@ -238,13 +238,13 @@ TAB_SIZE = 4
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines.
-ALIASES =
+ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
-TCL_SUBST =
+TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
@@ -291,7 +291,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
-EXTENSION_MAPPING =
+EXTENSION_MAPPING =
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
@@ -648,7 +648,7 @@ GENERATE_DEPRECATEDLIST= YES
# sections, marked by \if ... \endif and \cond
# ... \endcond blocks.
-ENABLED_SECTIONS =
+ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
# initial value of a variable or macro / define can have for it to appear in the
@@ -690,7 +690,7 @@ SHOW_NAMESPACES = YES
# by doxygen. Whatever the program writes to standard output is used as the file
# version. For an example see the documentation.
-FILE_VERSION_FILTER =
+FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
# by doxygen. The layout file controls the global structure of the generated
@@ -703,7 +703,7 @@ FILE_VERSION_FILTER =
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty.
-LAYOUT_FILE =
+LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
@@ -713,7 +713,7 @@ LAYOUT_FILE =
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. See also \cite for info how to create references.
-CITE_BIB_FILES =
+CITE_BIB_FILES =
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
@@ -778,7 +778,7 @@ WARN_FORMAT = "$file:$line: $text"
# messages should be written. If left blank the output is written to standard
# error (stderr).
-WARN_LOGFILE =
+WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
@@ -790,9 +790,9 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = ../clicks/mrangle/example \
- ../clicks/mrangle/lib/include \
- ../clicks/mrangle/README.md
+INPUT = ../cmake/mrangle/example \
+ ../cmake/mrangle/lib_mrangle/include \
+ ../cmake/mrangle/README.md
# 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
@@ -877,7 +877,7 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
-EXCLUDE =
+EXCLUDE =
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -893,7 +893,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
-EXCLUDE_PATTERNS =
+EXCLUDE_PATTERNS =
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@@ -904,13 +904,13 @@ EXCLUDE_PATTERNS =
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
-EXCLUDE_SYMBOLS =
+EXCLUDE_SYMBOLS =
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
# command).
-EXAMPLE_PATH = ../clicks/mrangle/example
+EXAMPLE_PATH = ../cmake/mrangle/example
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -930,7 +930,7 @@ EXAMPLE_RECURSIVE = YES
# that contain images that are to be included in the documentation (see the
# \image command).
-IMAGE_PATH =
+IMAGE_PATH =
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
@@ -951,7 +951,7 @@ IMAGE_PATH =
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
-INPUT_FILTER =
+INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis. Doxygen will compare the file name with each pattern and apply the
@@ -964,7 +964,7 @@ INPUT_FILTER =
# 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
# INPUT_FILTER) will also be used to filter the input files that are used for
@@ -979,14 +979,14 @@ FILTER_SOURCE_FILES = NO
# *.ext= (so without naming a filter).
# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
-FILTER_SOURCE_PATTERNS =
+FILTER_SOURCE_PATTERNS =
# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
# is part of the input, its contents will be placed on the main page
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.
-USE_MDFILE_AS_MAINPAGE =
+USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# Configuration options related to source browsing
@@ -1091,7 +1091,7 @@ CLANG_ASSISTED_PARSING = NO
# specified with INPUT and INCLUDE_PATH.
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
-CLANG_OPTIONS =
+CLANG_OPTIONS =
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
@@ -1117,7 +1117,7 @@ COLS_IN_ALPHA_INDEX = 5
# while generating the index headers.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-IGNORE_PREFIX =
+IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
@@ -1161,7 +1161,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_HEADER =
+HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
@@ -1171,7 +1171,7 @@ HTML_HEADER =
# that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_FOOTER =
+HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of
@@ -1183,7 +1183,7 @@ HTML_FOOTER =
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_STYLESHEET =
+HTML_STYLESHEET =
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
@@ -1196,7 +1196,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@@ -1206,7 +1206,7 @@ HTML_EXTRA_STYLESHEET =
# files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_FILES =
+HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
@@ -1335,7 +1335,7 @@ GENERATE_HTMLHELP = NO
# written to the html output directory.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-CHM_FILE =
+CHM_FILE =
# 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,
@@ -1343,7 +1343,7 @@ CHM_FILE =
# The file has to be specified with full path.
# 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
# (YES) or that it should be included in the master .chm file (NO).
@@ -1356,7 +1356,7 @@ GENERATE_CHI = NO
# and project file content.
# 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
# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
@@ -1387,7 +1387,7 @@ GENERATE_QHP = NO
# the HTML output folder.
# This tag requires that the tag GENERATE_QHP is set to YES.
-QCH_FILE =
+QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
@@ -1412,7 +1412,7 @@ QHP_VIRTUAL_FOLDER = ./temp/Help/doc
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
@@ -1420,21 +1420,21 @@ QHP_CUST_FILTER_NAME =
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_CUST_FILTER_ATTRS =
+QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_SECT_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
# The QHG_LOCATION tag can be used to specify the location of Qt's
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
# generated .qhp file.
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHG_LOCATION =
+QHG_LOCATION =
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
# generated, together with the HTML files, they form an Eclipse help plugin. To
@@ -1567,7 +1567,7 @@ MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_EXTENSIONS =
+MATHJAX_EXTENSIONS =
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
# of code that will be used on startup of the MathJax code. See the MathJax site
@@ -1575,7 +1575,7 @@ MATHJAX_EXTENSIONS =
# example see the documentation.
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_CODEFILE =
+MATHJAX_CODEFILE =
# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
# the HTML output. The underlying search engine uses javascript and DHTML and
@@ -1635,7 +1635,7 @@ EXTERNAL_SEARCH = NO
# Searching" for details.
# This tag requires that the tag SEARCHENGINE is set to YES.
-SEARCHENGINE_URL =
+SEARCHENGINE_URL =
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
# search data is written to a file for indexing by an external tool. With the
@@ -1651,7 +1651,7 @@ SEARCHDATA_FILE = searchdata.xml
# projects and redirect the results back to the right project.
# This tag requires that the tag SEARCHENGINE is set to YES.
-EXTERNAL_SEARCH_ID =
+EXTERNAL_SEARCH_ID =
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
# projects other than the one defined by this configuration file, but that are
@@ -1661,7 +1661,7 @@ EXTERNAL_SEARCH_ID =
# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
# This tag requires that the tag SEARCHENGINE is set to YES.
-EXTRA_SEARCH_MAPPINGS =
+EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
@@ -1725,7 +1725,7 @@ PAPER_TYPE = a4
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-EXTRA_PACKAGES =
+EXTRA_PACKAGES =
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
# generated LaTeX document. The header should contain everything until the first
@@ -1741,7 +1741,7 @@ EXTRA_PACKAGES =
# to HTML_HEADER.
# 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
# generated LaTeX document. The footer should contain everything after the last
@@ -1752,7 +1752,7 @@ LATEX_HEADER =
# 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.
-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
@@ -1763,7 +1763,7 @@ LATEX_FOOTER =
# list).
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_STYLESHEET =
# 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
@@ -1771,7 +1771,7 @@ LATEX_EXTRA_STYLESHEET =
# markers available.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_EXTRA_FILES =
+LATEX_EXTRA_FILES =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
@@ -1879,14 +1879,14 @@ RTF_HYPERLINKS = NO
# default style sheet that doxygen normally uses.
# This tag requires that the tag GENERATE_RTF is set to YES.
-RTF_STYLESHEET_FILE =
+RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an RTF document. Syntax is
# similar to doxygen's config file. A template extensions file can be generated
# using doxygen -e rtf extensionFile.
# This tag requires that the tag GENERATE_RTF is set to YES.
-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.
@@ -1931,7 +1931,7 @@ MAN_EXTENSION = .3
# MAN_EXTENSION with the initial . removed.
# This tag requires that the tag GENERATE_MAN is set to YES.
-MAN_SUBDIR =
+MAN_SUBDIR =
# 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
@@ -2044,7 +2044,7 @@ PERLMOD_PRETTY = YES
# overwrite each other's variables.
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-PERLMOD_MAKEVAR_PREFIX =
+PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
@@ -2085,7 +2085,7 @@ SEARCH_INCLUDES = YES
# preprocessor.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-INCLUDE_PATH =
+INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
@@ -2093,7 +2093,7 @@ INCLUDE_PATH =
# used.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-INCLUDE_FILE_PATTERNS =
+INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that are
# defined before the preprocessor is started (similar to the -D option of e.g.
@@ -2103,7 +2103,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-PREDEFINED =
+PREDEFINED =
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
@@ -2112,7 +2112,7 @@ PREDEFINED =
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-EXPAND_AS_DEFINED =
+EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
@@ -2141,13 +2141,13 @@ SKIP_FUNCTION_MACROS = YES
# 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.
-TAGFILES =
+TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
# tag file that is based on the input files it reads. See section "Linking to
# external documentation" for more information about the usage of tag files.
-GENERATE_TAGFILE =
+GENERATE_TAGFILE =
# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
# the class index. If set to NO, only the inherited external classes will be
@@ -2188,7 +2188,7 @@ CLASS_DIAGRAMS = YES
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
# If left empty dia is assumed to be found in the default search path.
-DIA_PATH =
+DIA_PATH =
# 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.
@@ -2237,7 +2237,7 @@ DOT_FONTSIZE = 10
# the path where dot can find it using this tag.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_FONTPATH =
+DOT_FONTPATH =
# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
# each documented class showing the direct and indirect inheritance relations.
@@ -2381,26 +2381,26 @@ INTERACTIVE_SVG = NO
# found. If left blank, it is assumed the dot tool can be found in the path.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_PATH =
+DOT_PATH =
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the \dotfile
# command).
# This tag requires that the tag HAVE_DOT is set to YES.
-DOTFILE_DIRS =
+DOTFILE_DIRS =
# The MSCFILE_DIRS tag can be used to specify one or more directories that
# contain msc files that are included in the documentation (see the \mscfile
# command).
-MSCFILE_DIRS =
+MSCFILE_DIRS =
# The DIAFILE_DIRS tag can be used to specify one or more directories that
# contain dia files that are included in the documentation (see the \diafile
# command).
-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
@@ -2408,17 +2408,17 @@ DIAFILE_DIRS =
# generate a warning when it encounters a \startuml command in this case and
# will not generate output for the diagram.
-PLANTUML_JAR_PATH =
+PLANTUML_JAR_PATH =
# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
# configuration file for plantuml.
-PLANTUML_CFG_FILE =
+PLANTUML_CFG_FILE =
# When using plantuml, the specified paths are searched for files specified by
# the !include statement in a plantuml block.
-PLANTUML_INCLUDE_PATH =
+PLANTUML_INCLUDE_PATH =
# 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
diff --git a/clicks/mrangle/doc/package/manifest.json b/clicks/mrangle/doc/package/manifest.json
index 7217ce8673..5f851a61ba 100644
--- a/clicks/mrangle/doc/package/manifest.json
+++ b/clicks/mrangle/doc/package/manifest.json
@@ -1,6 +1,6 @@
{
- "architecture": "ARM|PIC|PIC32",
- "category": "Magnetic",
+ "architecture": "ARM|PIC|PIC32|RISC-V|AVR",
+ "category": "Click Boards > Sensors > Magnetic",
"changelog": "Resources/CHANGELOG.md",
"contains": [
"libraries",
@@ -8,8 +8,7 @@
"examples",
"source_files"
],
- "dependency_list": [
- ],
+ "dependency_list": [],
"details": "Resources/DETAILS.md",
"display_name": "MR Angle click",
"example_list": [
@@ -26,11 +25,11 @@
"name": "mikroe.click.mrangle",
"product_link": "https://www.mikroe.com/mr-angle-click",
"short_description": "MR Angle Click is a compact add-on board that contains a magnetoresistive sensor with an integrated amplifier. This board features the KMZ60, a high precision sensor for magnetic angle measurement with single-ended cosine and sine outputs from NXP Semiconductors. The MR sensor element comes with two Wheatstone bridges for cosine and sine signals, supports functions for control circuit and signal amplification, and enables angular measurements with high accuracy by an excellent linearity and temperature drift behavior. The KMZ60 is fully automotive qualified as well as applicable for industrial and consumer applications. This Click board™ is suitable for rotor position detection for BLDC motors and Electronic Power Steering (EPS) applications, steering angle measurement, window wiper position detection, and general contactless angular measurement (e.g., throttle valves or actuators).",
- "supported_compiler": "mikroC AI",
+ "supported_compiler": "mikroC AI|GCC",
"type": "Library",
- "_type":"mikroSDK Library",
- "version": "2.0.0.4"
+ "_type": "mikroSDK Library",
+ "version": "2.1.0.4",
+ "cmake": true,
+ "alias": "Click.MrAngle",
+ "subdir_name": "lib_mrangle"
}
-
-
-
diff --git a/clicks/mrangle/example/CMakeLists.txt b/clicks/mrangle/example/CMakeLists.txt
new file mode 100644
index 0000000000..1320f1c694
--- /dev/null
+++ b/clicks/mrangle/example/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(example_mrangle LANGUAGES MikroC)
+else()
+ project(example_mrangle LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_executable(example_mrangle
+ main.c
+
+)
+
+
+############################ example_mrangle GENERATED CODE START ###########################
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(example_mrangle PUBLIC MikroC.Core)
+find_package(MikroSDK.Board REQUIRED)
+target_link_libraries(example_mrangle PUBLIC MikroSDK.Board)
+find_package(MikroSDK.Log REQUIRED)
+target_link_libraries(example_mrangle PUBLIC MikroSDK.Log)
+add_subdirectory(lib_mrangle)
+target_link_libraries(example_mrangle PUBLIC Click.MrAngle)
+############################ example_mrangle GENERATED CODE END ###########################
diff --git a/clicks/mrangle/example/main.c b/clicks/mrangle/example/main.c
index 60b87d2ea3..f4edcabb7c 100644
--- a/clicks/mrangle/example/main.c
+++ b/clicks/mrangle/example/main.c
@@ -29,7 +29,8 @@ static mrangle_t mrangle;
static log_t logger;
static float angle;
-void application_init ( void ) {
+void application_init ( void )
+{
log_cfg_t log_cfg; /**< Logger config object. */
mrangle_cfg_t mrangle_cfg; /**< Click config object. */
@@ -44,38 +45,36 @@ void application_init ( void ) {
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
- log_printf( &logger, "\r\n" );
log_info( &logger, " Application Init " );
// Click initialization.
-
mrangle_cfg_setup( &mrangle_cfg );
MRANGLE_MAP_MIKROBUS( mrangle_cfg, MIKROBUS_1 );
- err_t init_flag = mrangle_init( &mrangle, &mrangle_cfg );
- if ( init_flag == SPI_MASTER_ERROR ) {
+ if ( SPI_MASTER_ERROR == mrangle_init( &mrangle, &mrangle_cfg ) )
+ {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
-
for ( ; ; );
}
mrangle_default_cfg ( &mrangle );
log_info( &logger, " Application Task " );
- log_printf( &logger, "-------------------------\r\n" );
- Delay_ms( 1000 );
}
-void application_task ( void ) {
+void application_task ( void )
+{
mrangle_get_angle( &mrangle, &angle );
- log_printf( &logger, " Angle : %.2f degree \r\n", angle );
- log_printf( &logger, "-------------------------\r\n" );
+ log_printf( &logger, " Angle: %.2f deg\r\n", angle );
+ log_printf( &logger, "------------------\r\n" );
Delay_ms( 1000 );
}
-void main ( void ) {
+void main ( void )
+{
application_init( );
- for ( ; ; ) {
+ for ( ; ; )
+ {
application_task( );
}
}
diff --git a/clicks/mrangle/example/manifest.exm b/clicks/mrangle/example/manifest.exm
index 7c42fe8d42..0130a42961 100644
--- a/clicks/mrangle/example/manifest.exm
+++ b/clicks/mrangle/example/manifest.exm
@@ -2,7 +2,7 @@
"name": "MR Angle Click",
"description": "MR Angle Click is a compact add-on board that contains a magnetoresistive sensor with an integrated amplifier. This board features the KMZ60, a high precision sensor for magnetic angle measurement with single-ended cosine and sine outputs from NXP Semiconductors. The MR sensor element comes with two Wheatstone bridges for cosine and sine signals, supports functions for control circuit and signal amplification, and enables angular measurements with high accuracy by an excellent linearity and temperature drift behavior. The KMZ60 is fully automotive qualified as well as applicable for industrial and consumer applications.",
"image" : "../../Resources/click_icon.png",
- "toolchain": ["mikrocarm","mikrocpic","mikrocpic32"],
+ "toolchain": ["mikrocarm","mikrocpic","mikrocpic32","gcc-riscv","mikrocavr"],
"hw" : ["click","KMZ60"],
"category" : ["Magnetic"]
}
diff --git a/clicks/mrangle/example/memake.txt b/clicks/mrangle/example/memake.txt
deleted file mode 100644
index 769303290f..0000000000
--- a/clicks/mrangle/example/memake.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-type: executable
-target: example_mrangle
-
-depends: {
- MikroC.Core
- MikroSDK.Board
- MikroSDK.Log
- Click.MrAngle
-}
-
-sources: {
- main.c
-}
diff --git a/clicks/mrangle/lib/memake.txt b/clicks/mrangle/lib/memake.txt
deleted file mode 100644
index e34fceae91..0000000000
--- a/clicks/mrangle/lib/memake.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-type: library
-
-target: lib_mrangle
-
-sources: {
- src/mrangle.c
-}
-
-headers: {
- include/mrangle.h
-}
-
-include: {
- include
-}
-
-install: {
- src(include/mrangle.h) dst(include/mrangle.h)
-}
-
-expInclude: {
- include
-}
-
-depends: {
- MikroC.Core
- MikroSDK.Driver
-}
-
-others: {
- ../README.md
- ../DETAILS.md
- ../CHANGELOG.md
-}
-
-alias: Click.MrAngle
diff --git a/clicks/mrangle/lib_mrangle/CMakeLists.txt b/clicks/mrangle/lib_mrangle/CMakeLists.txt
new file mode 100644
index 0000000000..35b389d4de
--- /dev/null
+++ b/clicks/mrangle/lib_mrangle/CMakeLists.txt
@@ -0,0 +1,30 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(lib_mrangle LANGUAGES MikroC)
+else()
+ project(lib_mrangle LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_library(lib_mrangle STATIC
+ src/mrangle.c
+ include/mrangle.h
+)
+add_library(Click.MrAngle ALIAS lib_mrangle)
+
+
+
+target_include_directories(lib_mrangle PUBLIC
+ include
+)
+
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(lib_mrangle PUBLIC MikroC.Core)
+find_package(MikroSDK.Driver REQUIRED)
+target_link_libraries(lib_mrangle PUBLIC MikroSDK.Driver)
+
+include(mikroeUtils)
+math_check_target(${PROJECT_NAME})
diff --git a/clicks/mrangle/lib_mrangle/include/Click.MrAngle b/clicks/mrangle/lib_mrangle/include/Click.MrAngle
new file mode 100644
index 0000000000..c0f6b2831d
--- /dev/null
+++ b/clicks/mrangle/lib_mrangle/include/Click.MrAngle
@@ -0,0 +1 @@
+#include "mrangle.h"
diff --git a/clicks/mrangle/lib/include/mrangle.h b/clicks/mrangle/lib_mrangle/include/mrangle.h
similarity index 95%
rename from clicks/mrangle/lib/include/mrangle.h
rename to clicks/mrangle/lib_mrangle/include/mrangle.h
index a94ffbb792..7e5902e3fc 100644
--- a/clicks/mrangle/lib/include/mrangle.h
+++ b/clicks/mrangle/lib_mrangle/include/mrangle.h
@@ -75,12 +75,10 @@ extern "C"{
typedef struct
{
// Output pins
-
digital_out_t tce; /**< Temperature coefficient compensation enable pin. */
digital_out_t pdn; /**< Power-down mode enable pin. */
// Modules
-
spi_master_t spi; /**< SPI driver object. */
pin_name_t chip_select; /**< Chip select pin descriptor (used for SPI driver). */
@@ -96,19 +94,16 @@ typedef struct
typedef struct
{
// Communication gpio pins
-
pin_name_t miso; /**< Master input - slave output pin descriptor for SPI driver. */
pin_name_t mosi; /**< Master output - slave input pin descriptor for SPI driver. */
pin_name_t sck; /**< Clock pin descriptor for SPI driver. */
pin_name_t cs; /**< Chip select pin descriptor for SPI driver. */
// Additional gpio pins
-
pin_name_t tce; /**< Temperature coefficient compensation enable pin. */
pin_name_t pdn; /**< Power-down mode enable pin. */
// static variable
-
uint32_t spi_speed; /**< SPI serial speed. */
spi_master_mode_t spi_mode; /**< SPI master mode. */
spi_master_chip_select_polarity_t cs_polarity; /**< Chip select pin polarity. */
@@ -177,7 +172,6 @@ void mrangle_cfg_setup ( mrangle_cfg_t *cfg );
* See #mrangle_cfg_t object definition for detailed explanation.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
- *
* See #err_t definition for detailed explanation.
* @note None.
*/
@@ -189,14 +183,11 @@ err_t mrangle_init ( mrangle_t *ctx, mrangle_cfg_t *cfg );
* click board™.
* @param[in] ctx : Click context object.
* See #mrangle_t object definition for detailed explanation.
- * @return @li @c 0 - Success,
- * @li @c -1 - Error.
- *
- * See #err_t definition for detailed explanation.
+ * @return None.
* @note This function can consist any necessary configuration or setting to put
* device into operating mode.
*/
-err_t mrangle_default_cfg ( mrangle_t *ctx );
+void mrangle_default_cfg ( mrangle_t *ctx );
/**
* @brief MR Angle powerdown mode function.
@@ -206,13 +197,10 @@ err_t mrangle_default_cfg ( mrangle_t *ctx );
* @param[in] ctx : Click context object.
* See #mrangle_t object definition for detailed explanation.
* @param[in] pd_mode : Enum values for powerdown mode.
- * @return @li @c 0 - Success,
- * @li @c -1 - Error.
- *
- * See #err_t definition for detailed explanation.
+ * @return None.
* @note None.
*/
-err_t mrangle_powerdown_mode ( mrangle_t *ctx, mrangle_powerdown_mode_value_t pd_mode );
+void mrangle_powerdown_mode ( mrangle_t *ctx, mrangle_powerdown_mode_value_t pd_mode );
/**
* @brief MR Angle output mode function.
@@ -223,13 +211,10 @@ err_t mrangle_powerdown_mode ( mrangle_t *ctx, mrangle_powerdown_mode_value_t pd
* @param[in] ctx : Click context object.
* See #mrangle_t object definition for detailed explanation.
* @param[in] output_mode : Enum values for data output mode.
- * @return @li @c 0 - Success,
- * @li @c -1 - Error.
- *
- * See #err_t definition for detailed explanation.
+ * @return None.
* @note None.
*/
-err_t mrangle_output_mode ( mrangle_t *ctx, mrangle_output_mode_value_t output_mode );
+void mrangle_output_mode ( mrangle_t *ctx, mrangle_output_mode_value_t output_mode );
/**
* @brief MR Angle data writing function.
@@ -242,7 +227,6 @@ err_t mrangle_output_mode ( mrangle_t *ctx, mrangle_output_mode_value_t output_m
* @param[in] len : Number of bytes to be written.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
- *
* See #err_t definition for detailed explanation.
* @note None.
*/
@@ -259,7 +243,6 @@ err_t mrangle_generic_write ( mrangle_t *ctx, uint8_t reg, uint8_t *data_in, uin
* @param[in] len : Number of bytes to be read.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
- *
* See #err_t definition for detailed explanation.
* @note None.
*/
@@ -275,7 +258,6 @@ err_t mrangle_generic_read ( mrangle_t *ctx, uint8_t reg, uint8_t *data_out, uin
* @param[out] sin_adc : Pointer to the memory location of the structure where data be stored.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
- *
* See #err_t definition for detailed explanation.
* @note None.
*/
@@ -292,7 +274,6 @@ err_t mrangle_get_adc_sin ( mrangle_t *ctx, uint16_t *sin_adc );
* @param[out] sin : Pointer to the memory location of the structure where data be stored.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
- *
* See #err_t definition for detailed explanation.
* @note None.
*/
@@ -308,7 +289,6 @@ err_t mrangle_get_sin ( mrangle_t *ctx, float *sin );
* @param[out] cos_adc : Pointer to the memory location of the structure where data be stored.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
- *
* See #err_t definition for detailed explanation.
* @note None.
*/
@@ -325,7 +305,6 @@ err_t mrangle_get_adc_cos ( mrangle_t *ctx, uint16_t *cos_adc );
* @param[out] cos : Pointer to the memory location of the structure where data be stored.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
- *
* See #err_t definition for detailed explanation.
* @note None.
*/
@@ -341,7 +320,6 @@ err_t mrangle_get_cos ( mrangle_t *ctx, float *cos );
* @param[out] temp_adc : Pointer to the memory location of the structure where data be stored.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
- *
* See #err_t definition for detailed explanation.
* @note None.
*/
@@ -357,7 +335,6 @@ err_t mrangle_get_adc_temp ( mrangle_t *ctx, uint16_t *temp_adc );
* @param[out] temperature : Pointer to the memory location of the structure where data be stored.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
- *
* See #err_t definition for detailed explanation.
* @note None.
*/
@@ -373,15 +350,11 @@ err_t mrangle_get_temperature ( mrangle_t *ctx, float *temperature );
* @param[out] angle : Pointer to the memory location of the structure where data be stored.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
- *
* See #err_t definition for detailed explanation.
* @note None.
*/
err_t mrangle_get_angle ( mrangle_t *ctx, float *angle );
-float mrangle_angle_readaaa ( mrangle_t *ctx );
-
-
#ifdef __cplusplus
}
#endif
diff --git a/clicks/mrangle/lib/src/mrangle.c b/clicks/mrangle/lib_mrangle/src/mrangle.c
similarity index 64%
rename from clicks/mrangle/lib/src/mrangle.c
rename to clicks/mrangle/lib_mrangle/src/mrangle.c
index 638487f565..a005222a61 100644
--- a/clicks/mrangle/lib/src/mrangle.c
+++ b/clicks/mrangle/lib_mrangle/src/mrangle.c
@@ -33,53 +33,47 @@
* @brief Dummy data.
* @details Definition of dummy data.
*/
-#define DUMMY 0x00
+#define DUMMY 0x00
/**
* @brief SPI start bit.
* @details Definition of SPI start bit.
*/
-#define START_BIT 0x06
+#define START_BIT 0x06
/**
* @brief ADC resolution.
* @details Resolution of adc.
*/
-#define ADC_RESOLUTION 4095
+#define ADC_RESOLUTION 4095
/**
* @brief ADC power supply value.
* @details Power supply voltage value of adc.
*/
-#define ADC_VREF_3300_mV 3.3
-#define ADC_VREF_5000_mV 5.0
+#define ADC_VREF_3300_mV 3.3
+#define ADC_VREF_5000_mV 5.0
/**
* @brief Degrees range constant.
* @details Conversion constant from radian to degrees.
*/
-#define ADC_CONV_DEG 180
-
-/**
- * @brief Pi value constant.
- * @details Conversion constant from radian to degrees.
- */
-#define ADC_CONV_PI 3.14159265
+#define ADC_CONV_DEG 180
/**
* @brief Degrees range constant.
* @details Conversion constant from radian to degrees.
*/
-#define LIN_FUN_COEFF_GRADIENT 0.00325
-#define LIN_FUN_COEFF_VERTICAL_INTERCEPT 0.22
+#define LIN_FUN_COEFF_GRADIENT 0.00325
+#define LIN_FUN_COEFF_VERTICAL_INTERCEPT 0.22
/**
* @brief ADC channel constant.
* @details ADC channel constant reads a desired ADC channel function.
*/
-#define MRANGLE_ADC_CH0 0x00
-#define MRANGLE_ADC_CH1 0x40
-#define MRANGLE_ADC_CH2 0x80
+#define MRANGLE_ADC_CH0 0x00
+#define MRANGLE_ADC_CH1 0x40
+#define MRANGLE_ADC_CH2 0x80
// ---------------------------------------------- PRIVATE FUNCTION DECLARATIONS
@@ -97,7 +91,8 @@ static void dev_reset_delay ( void );
// ------------------------------------------------ PUBLIC FUNCTION DEFINITIONS
-void mrangle_cfg_setup ( mrangle_cfg_t *cfg ) {
+void mrangle_cfg_setup ( mrangle_cfg_t *cfg )
+{
cfg->sck = HAL_PIN_NC;
cfg->miso = HAL_PIN_NC;
cfg->mosi = HAL_PIN_NC;
@@ -112,7 +107,8 @@ void mrangle_cfg_setup ( mrangle_cfg_t *cfg ) {
cfg->vref = ADC_VREF_3300_mV;
}
-err_t mrangle_init ( mrangle_t *ctx, mrangle_cfg_t *cfg ) {
+err_t mrangle_init ( mrangle_t *ctx, mrangle_cfg_t *cfg )
+{
spi_master_config_t spi_cfg;
spi_master_configure_default( &spi_cfg );
@@ -123,27 +119,29 @@ err_t mrangle_init ( mrangle_t *ctx, mrangle_cfg_t *cfg ) {
ctx->chip_select = cfg->cs;
- if ( spi_master_open( &ctx->spi, &spi_cfg ) == SPI_MASTER_ERROR ) {
+ if ( SPI_MASTER_ERROR == spi_master_open( &ctx->spi, &spi_cfg ) )
+ {
return SPI_MASTER_ERROR;
}
- if ( spi_master_set_default_write_data( &ctx->spi, DUMMY ) == SPI_MASTER_ERROR ) {
+ if ( SPI_MASTER_ERROR == spi_master_set_default_write_data( &ctx->spi, DUMMY ) )
+ {
return SPI_MASTER_ERROR;
}
- if ( spi_master_set_mode( &ctx->spi, cfg->spi_mode ) == SPI_MASTER_ERROR ) {
+ if ( SPI_MASTER_ERROR == spi_master_set_mode( &ctx->spi, cfg->spi_mode ) )
+ {
return SPI_MASTER_ERROR;
}
- if ( spi_master_set_speed( &ctx->spi, cfg->spi_speed ) == SPI_MASTER_ERROR ) {
+ if ( SPI_MASTER_ERROR == spi_master_set_speed( &ctx->spi, cfg->spi_speed ) )
+ {
return SPI_MASTER_ERROR;
}
spi_master_set_chip_select_polarity( cfg->cs_polarity );
spi_master_deselect_device( ctx->chip_select );
- // It should contain the error status checking for every pin init.
-
digital_out_init( &ctx->tce, cfg->tce );
digital_out_init( &ctx->pdn, cfg->pdn );
@@ -152,172 +150,136 @@ err_t mrangle_init ( mrangle_t *ctx, mrangle_cfg_t *cfg ) {
return SPI_MASTER_SUCCESS;
}
-err_t mrangle_default_cfg ( mrangle_t *ctx ) {
- // Click default configuration.
-
+void mrangle_default_cfg ( mrangle_t *ctx )
+{
mrangle_powerdown_mode( ctx, POWERDOWN_MODE_DISABLE );
dev_reset_delay( );
mrangle_output_mode( ctx, OUTPUT_MODE_VOUT_SIN_COS );
dev_reset_delay( );
-
- return MRANGLE_OK;
}
-err_t mrangle_powerdown_mode ( mrangle_t *ctx, mrangle_powerdown_mode_value_t pd_mode ) {
-
+void mrangle_powerdown_mode ( mrangle_t *ctx, mrangle_powerdown_mode_value_t pd_mode )
+{
digital_out_write( &ctx->pdn, pd_mode );
-
- return MRANGLE_OK;
}
-err_t mrangle_output_mode ( mrangle_t *ctx, mrangle_output_mode_value_t output_mode ) {
-
+void mrangle_output_mode ( mrangle_t *ctx, mrangle_output_mode_value_t output_mode )
+{
digital_out_write( &ctx->tce, output_mode );
-
- return MRANGLE_OK;
}
-err_t mrangle_generic_write ( mrangle_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len ) {
- uint8_t tx_buf[ 257 ];
- uint8_t cnt;
-
- tx_buf[ 0 ] = reg;
- for ( cnt = 1; cnt <= len; cnt++ ) {
- tx_buf[ cnt ] = data_in[ cnt - 1 ];
- }
-
+err_t mrangle_generic_write ( mrangle_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len )
+{
+ err_t error_flag = MRANGLE_OK;
spi_master_select_device( ctx->chip_select );
dev_conv_delay( );
- err_t error_flag = spi_master_write( &ctx->spi, tx_buf, len + 1 );
+ error_flag |= spi_master_write( &ctx->spi, ®, 1 );
+ error_flag |= spi_master_write( &ctx->spi, data_in, len );
spi_master_deselect_device( ctx->chip_select );
-
return error_flag;
}
-err_t mrangle_generic_read ( mrangle_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len ) {
-
+err_t mrangle_generic_read ( mrangle_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len )
+{
+ err_t error_flag = MRANGLE_OK;
spi_master_select_device( ctx->chip_select );
dev_conv_delay( );
- err_t error_flag = spi_master_write_then_read( &ctx->spi, ®, 1, data_out, len );
+ error_flag |= spi_master_write_then_read( &ctx->spi, ®, 1, data_out, len );
spi_master_deselect_device( ctx->chip_select );
-
return error_flag;
}
-err_t mrangle_get_adc_sin ( mrangle_t *ctx, uint16_t *sin_adc ) {
- uint8_t tx_data;
- uint8_t rx_data[ 2 ];
- uint16_t tmp;
+err_t mrangle_get_adc_sin ( mrangle_t *ctx, uint16_t *sin_adc )
+{
+ err_t error_flag = MRANGLE_OK;
+ uint8_t tx_data = 0;
+ uint8_t rx_data[ 2 ] = { 0 };
tx_data = START_BIT;
spi_master_select_device( ctx->chip_select );
dev_conv_delay( );
- err_t error_flag = spi_master_write( &ctx->spi, &tx_data, 1 );
+ error_flag |= spi_master_write( &ctx->spi, &tx_data, 1 );
error_flag |= spi_master_set_default_write_data( &ctx->spi, MRANGLE_ADC_CH0 );
error_flag |= spi_master_read( &ctx->spi, rx_data, 2 );
spi_master_deselect_device( ctx->chip_select );
dev_conv_delay( );
- tmp = rx_data[ 0 ];
- tmp <<= 8;
- tmp |= rx_data[ 1 ];
-
- *sin_adc = tmp;
+ *sin_adc = ( ( uint16_t ) rx_data[ 0 ] << 8 ) | rx_data[ 1 ];
return error_flag;
}
-err_t mrangle_get_sin ( mrangle_t *ctx, float *sin ) {
- uint8_t tx_data;
- uint8_t rx_data[ 2 ];
- uint16_t sin_adc;
- float v_sin;
+err_t mrangle_get_sin ( mrangle_t *ctx, float *sin )
+{
+ uint16_t sin_adc = 0;
err_t error_flag = mrangle_get_adc_sin( ctx, &sin_adc );
- v_sin = ( float ) sin_adc;
- v_sin /= ADC_RESOLUTION;
- v_sin *= ctx->vref;
- v_sin -= ctx->vref / 2;
-
- *sin = v_sin;
+ *sin = ( ( float ) sin_adc / ADC_RESOLUTION ) * ctx->vref - ctx->vref / 2;
return error_flag;
}
-err_t mrangle_get_adc_cos ( mrangle_t *ctx, uint16_t *cos_adc ) {
- uint8_t tx_data;
- uint8_t rx_data[ 2 ];
- uint16_t tmp;
-
+err_t mrangle_get_adc_cos ( mrangle_t *ctx, uint16_t *cos_adc )
+{
+ err_t error_flag = MRANGLE_OK;
+ uint8_t tx_data = 0;
+ uint8_t rx_data[ 2 ] = { 0 };
+
tx_data = START_BIT;
spi_master_select_device( ctx->chip_select );
dev_conv_delay( );
- err_t error_flag = spi_master_write( &ctx->spi, &tx_data, 1 );
+ error_flag |= spi_master_write( &ctx->spi, &tx_data, 1 );
error_flag |= spi_master_set_default_write_data( &ctx->spi, MRANGLE_ADC_CH1 );
error_flag |= spi_master_read( &ctx->spi, rx_data, 2 );
spi_master_deselect_device( ctx->chip_select );
dev_conv_delay( );
- tmp = rx_data[ 0 ];
- tmp <<= 8;
- tmp |= rx_data[ 1 ];
-
- *cos_adc = tmp;
+ *cos_adc = ( ( uint16_t ) rx_data[ 0 ] << 8 ) | rx_data[ 1 ];
return error_flag;
}
-err_t mrangle_get_cos ( mrangle_t *ctx, float *cos ) {
- uint8_t tx_data;
- uint8_t rx_data[ 2 ];
- uint16_t cos_adc;
- float v_cos;
+err_t mrangle_get_cos ( mrangle_t *ctx, float *cos )
+{
+ uint16_t cos_adc = 0;
err_t error_flag = mrangle_get_adc_cos( ctx, &cos_adc );
- v_cos = ( float ) cos_adc;
- v_cos /= ADC_RESOLUTION;
- v_cos *= ctx->vref;
- v_cos -= ctx->vref / 2;
-
- *cos = v_cos;
+ *cos = ( ( float ) cos_adc / ADC_RESOLUTION ) * ctx->vref - ctx->vref / 2;
return error_flag;
}
-err_t mrangle_get_adc_temp ( mrangle_t *ctx, uint16_t *temp_adc ) {
- uint8_t tx_data;
- uint8_t rx_data[ 2 ];
- uint16_t tmp;
-
- spi_master_set_default_write_data( &ctx->spi, MRANGLE_ADC_CH2 );
+err_t mrangle_get_adc_temp ( mrangle_t *ctx, uint16_t *temp_adc )
+{
+ err_t error_flag = MRANGLE_OK;
+ uint8_t tx_data = 0;
+ uint8_t rx_data[ 2 ] = { 0 };
tx_data = START_BIT;
spi_master_select_device( ctx->chip_select );
dev_conv_delay( );
- err_t error_flag = spi_master_write( &ctx->spi, &tx_data, 1 );
+ error_flag |= spi_master_write( &ctx->spi, &tx_data, 1 );
+ error_flag |= spi_master_set_default_write_data( &ctx->spi, MRANGLE_ADC_CH2 );
error_flag |= spi_master_read( &ctx->spi, rx_data, 2 );
spi_master_deselect_device( ctx->chip_select );
dev_conv_delay( );
- tmp = rx_data[ 0 ];
- tmp <<= 8;
- tmp |= rx_data[ 1 ];
-
- *temp_adc = tmp;
+ *temp_adc = ( ( uint16_t ) rx_data[ 0 ] << 8 ) | rx_data[ 1 ];
return error_flag;
}
-err_t mrangle_get_temperature ( mrangle_t *ctx, float *temperature ) {
- uint16_t temp_adc;
- float tmp;
- float v_temp;
+err_t mrangle_get_temperature ( mrangle_t *ctx, float *temperature )
+{
+ uint16_t temp_adc = 0;
+ float tmp = 0;
+ float v_temp = 0;
mrangle_output_mode( ctx, OUTPUT_MODE_VOUT_TEMP );
dev_conv_delay( );
@@ -342,25 +304,23 @@ err_t mrangle_get_temperature ( mrangle_t *ctx, float *temperature ) {
return error_flag;
}
-err_t mrangle_get_angle ( mrangle_t *ctx, float *angle ) {
- uint16_t sin_adc;
- uint16_t cos_adc;
- float v_sin;
- float v_cos;
- float tmp;
+err_t mrangle_get_angle ( mrangle_t *ctx, float *angle )
+{
+ err_t error_flag = MRANGLE_OK;
+ float v_sin = 0;
+ float v_cos = 0;
+ float tmp = 0;
- err_t error_flag = mrangle_get_adc_sin( ctx, &sin_adc );
error_flag |= mrangle_get_sin( ctx, &v_sin );
- error_flag |= mrangle_get_adc_cos( ctx, &cos_adc );
-
error_flag |= mrangle_get_cos( ctx, &v_cos );
tmp = atan2( v_cos, v_sin );
tmp *= ADC_CONV_DEG;
- tmp /= 2 * ADC_CONV_PI;
+ tmp /= TWO_PI;
- if ( tmp < 0 ) {
+ if ( tmp < 0 )
+ {
tmp += ADC_CONV_DEG;
}
@@ -369,14 +329,15 @@ err_t mrangle_get_angle ( mrangle_t *ctx, float *angle ) {
return error_flag;
}
-
// ----------------------------------------------- PRIVATE FUNCTION DEFINITIONS
-static void dev_conv_delay ( void ) {
+static void dev_conv_delay ( void )
+{
Delay_1ms( );
}
-static void dev_reset_delay ( void ) {
+static void dev_reset_delay ( void )
+{
Delay_100ms( );
}
diff --git a/clicks/mrangle/memake.txt b/clicks/mrangle/memake.txt
deleted file mode 100644
index 8b2d5283db..0000000000
--- a/clicks/mrangle/memake.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-type: subdirs
-project: MrAngle
-
-subdirs: {
- lib
- example
-}
diff --git a/clicks/smartsens/CHANGELOG.md b/clicks/smartsens/CHANGELOG.md
index 34c1de4c45..ca09ef759f 100644
--- a/clicks/smartsens/CHANGELOG.md
+++ b/clicks/smartsens/CHANGELOG.md
@@ -1,4 +1,4 @@
## Changelog
-### Version 2.0.0.2
+### Version 2.1.0.4
- Initial release
diff --git a/clicks/smartsens/CMakeLists.txt b/clicks/smartsens/CMakeLists.txt
new file mode 100644
index 0000000000..004906a296
--- /dev/null
+++ b/clicks/smartsens/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(example_smartsens LANGUAGES MikroC)
+else()
+ project(example_smartsens LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_executable(example_smartsens
+ example/main.c
+
+)
+
+
+############################ example_smartsens GENERATED CODE START ###########################
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(example_smartsens PUBLIC MikroC.Core)
+find_package(MikroSDK.Board REQUIRED)
+target_link_libraries(example_smartsens PUBLIC MikroSDK.Board)
+find_package(MikroSDK.Log REQUIRED)
+target_link_libraries(example_smartsens PUBLIC MikroSDK.Log)
+add_subdirectory(lib_smartsens)
+target_link_libraries(example_smartsens PUBLIC Click.SmartSens)
+############################ example_smartsens GENERATED CODE END ###########################
diff --git a/clicks/smartsens/README.md b/clicks/smartsens/README.md
index 77c4be3959..16988edf5f 100644
--- a/clicks/smartsens/README.md
+++ b/clicks/smartsens/README.md
@@ -1,6 +1,5 @@
\mainpage Main Page
-
---
# Smart Sens click
@@ -17,7 +16,7 @@
#### Click library
-- **Author** : Luka Filipovic
+- **Author** : MikroE Team
- **Date** : Oct 2021.
- **Type** : I2C/SPI type
@@ -61,8 +60,7 @@ err_t smartsens_cmd_write ( smartsens_t *ctx, uint16_t cmd, uint8_t *cmd_buf, ui
- `smartsens_get_parameter` Get command parameters resposne.
```c
-err_t smartsens_get_parameter ( smartsens_t *ctx, uint16_t parameter,
- uint8_t *parameter_buf, uint16_t *parameter_len );
+err_t smartsens_get_parameter ( smartsens_t *ctx, uint16_t parameter, uint8_t *parameter_buf, uint16_t *parameter_len );
```
- `smartsens_power_on_device` Power on device boot/upload firmware to device.
@@ -74,17 +72,17 @@ err_t smartsens_power_on_device( smartsens_t *ctx );
> This example showcases the ability of the Smart Sens click board.
It has multiple examples that you can easily select with the
-defines at top of the main. There are 5 examples Euler, Quaternion,
-and Vector examples for Accelerometer, Gyroscope, and Magnetometer.
+defines at the top of the main. There are 5 examples: Euler, Quaternion,
+and Vector (Accelerometer, Gyroscope, Magnetometer).
**The demo application is composed of two sections :**
### Application Init
-> Initialization of communication modules(SPI/I2C, UART) and additional
-pins(int_pin, rst). Then after going through reset sequence and checking
+> Initialization of communication modules (SPI/I2C) and additional
+pins(int_pin, rst). After that going through reset sequence and checking
device and product IDs, interrupt mask, and host control is set to 0, so
-every interrupt enabled. IF boot status is OK boot sequence is initiated,
+every interrupt enabled. If boot status is OK boot sequence is initiated,
depending on the defines from the library header it will use RAM or Flash type
of the boot. If RAM is selected firmware image first needs to be uploaded to RAM
and then it will be booted. If Flash example is selected it will try to boot
@@ -92,7 +90,7 @@ firmware first if it fails it will then write firmware image to flash and then
try to boot it again. When firmware boot is finished Kernel version and Feature
registers will be read to check if the firmware is loaded. Then all the callback function
will be registered(meta event callback and whatever type of example parser you set),
-and driver will update its the list of virtual sensors present, and finally will configure
+and driver will update the list of virtual sensors present, and finally will configure
virtual sensor that will be used in the selected example.
```c
@@ -118,105 +116,87 @@ void application_init ( void )
// Click initialization.
smartsens_cfg_setup( &smartsens_cfg );
SMARTSENS_MAP_MIKROBUS( smartsens_cfg, MIKROBUS_1 );
- err_t init_flag = smartsens_init( &smartsens, &smartsens_cfg );
- SMARTSENS_SET_DATA_SAMPLE_EDGE
+ err_t init_flag = smartsens_init( &smartsens, &smartsens_cfg );
if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
- /* It can take a few seconds to configure and boot device*/
+ /* It can take a few seconds to configure and boot device */
log_info( &logger, " Configuring device..." );
if ( SMARTSENS_ERROR == smartsens_default_cfg ( &smartsens ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
+
log_info( &logger, " Setting callbacks..." );
- /*Set callbacks*/
+ /* Set callbacks */
if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SYS_ID_META_EVENT,
- parse_meta_event, (void*)&accuracy ) )
+ parse_meta_event, &accuracy ) )
{
log_error( &logger, " FIFO sys meta event." );
- for( ; ; );
+ for ( ; ; );
}
if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SYS_ID_META_EVENT_WU,
- parse_meta_event, ( void* )&accuracy ) )
+ parse_meta_event, &accuracy ) )
{
log_error( &logger, " FIFO sys meta event wu." );
- for( ; ; );
+ for ( ; ; );
}
-#if EULAR
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_ORI_WU,
- parse_euler, ( void* )&accuracy ) )
+ uint8_t sensor_id;
+ smartsens_fifo_parse_callback_t callback;
+ void *callback_ref;
+#if EULER
+ sensor_id = SMARTSENS_SENSOR_ID_ORI;
+ callback = parse_euler;
+ callback_ref = &accuracy;
#elif QUATERNION
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_RV_WU,
- parse_quaternion, NULL ) )
+ sensor_id = SMARTSENS_SENSOR_ID_RV;
+ callback = parse_quaternion;
+ callback_ref = NULL;
#elif VECTOR
-
-
#if ACCELEROMETER
- parse_table.sensor[SMARTSENS_SENSOR_ID_ACC].scaling_factor = 1.0f / 4096.0f;
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_ACC,
- parse_3axis_s16, &parse_table ) )
+ parse_table.sensor[ SMARTSENS_SENSOR_ID_ACC ].scaling_factor = 1.0f / 4096.0f;
+ sensor_id = SMARTSENS_SENSOR_ID_ACC;
#elif GYROSCOPE
- parse_table.sensor[SMARTSENS_SENSOR_ID_GYRO].scaling_factor = 1.0f;
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_GYRO,
- parse_3axis_s16, &parse_table ) )
- #elif MAGNOMETER
- parse_table.sensor[SMARTSENS_SENSOR_ID_MAG].scaling_factor = 1.0f;
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_MAG,
- parse_3axis_s16, &parse_table ) )
+ parse_table.sensor[ SMARTSENS_SENSOR_ID_GYRO ].scaling_factor = 1.0f;
+ sensor_id = SMARTSENS_SENSOR_ID_GYRO;
+ #elif MAGNETOMETER
+ parse_table.sensor[ SMARTSENS_SENSOR_ID_MAG ].scaling_factor = 1.0f;
+ sensor_id = SMARTSENS_SENSOR_ID_MAG;
#else
#error NO_VECTOR_EXAMPLE_DEFINED
#endif
+ callback = parse_vector_s16;
+ callback_ref = &parse_table;
#else
#error NO_EXAMPLE_DEFINED
#endif
+ if ( smartsens_register_fifo_parse_callback( &smartsens, sensor_id, callback, callback_ref ) )
{
log_error( &logger, " FIFO sensor id." );
- for( ; ; );
+ for ( ; ; );
}
- /*Go through fifo process*/
+ /* Go through fifo process */
if ( smartsens_get_and_process_fifo( &smartsens, work_buffer, WORK_BUFFER_SIZE ) )
{
log_error( &logger, " FIFO get and process." );
- for( ; ; );
+ for ( ; ; );
}
- /*Update virtual sensor list in context object*/
+ /* Update virtual sensor list in context object */
if ( smartsens_update_virtual_sensor_list( &smartsens ) )
{
log_error( &logger, " Update virtual sensor list." );
- for( ; ; );
+ for ( ; ; );
}
- /*Set virtual sensor configuration*/
- float sample_rate = 100.0; /* Read out data measured at 100Hz */
+ /* Set virtual sensor configuration */
+ float sample_rate = 10.0; /* Read out data at 10Hz */
uint32_t report_latency_ms = 0; /* Report immediately */
-#if EULAR
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_ORI_WU,
- sample_rate, report_latency_ms ) )
-#elif QUATERNION
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_RV_WU,
- sample_rate, report_latency_ms ) )
-#elif VECTOR
- #if ACCELEROMETER
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_ACC,
- sample_rate, report_latency_ms ) )
- #elif GYROSCOPE
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_GYRO,
- sample_rate, report_latency_ms ) )
- #elif MAGNOMETER
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_MAG,
- sample_rate, report_latency_ms ) )
- #else
- #error NO_VECTOR_EXAMPLE_DEFINED
- #endif
-#else
- #error NO_EXAMPLE_DEFINED
-#endif
+ if ( smartsens_set_virt_sensor_cfg( &smartsens, sensor_id, sample_rate, report_latency_ms ) )
{
log_error( &logger, " Set virtual sensor configuration." );
- for( ; ; );
+ for ( ; ; );
}
log_info( &logger, " Application Task " );
@@ -226,20 +206,20 @@ void application_init ( void )
### Application Task
-> Wait for an interrupt to occur. When occurred read wake-up, non-weak-up, and status FIFO.
-Parse received that and run the callback parsers to show received data.
+> Wait for an interrupt to occur, then read wake-up, non-weak-up, and status FIFO.
+Parse received data and run the callback parsers to show data on the USB UART.
```c
void application_task ( void )
{
- /*Check interrupt and get and process fifo buffer*/
+ /* Check interrupt and get and process fifo buffer */
if ( smartsens_get_interrupt( &smartsens ) )
{
/* Data from the FIFO is read and the relevant callbacks if registered are called */
if ( smartsens_get_and_process_fifo( &smartsens, work_buffer, WORK_BUFFER_SIZE ) )
{
log_error( &logger, " Get and process fifo." );
- for( ; ; );
+ for ( ; ; );
}
}
}
@@ -247,9 +227,9 @@ void application_task ( void )
## Note
-> You need to select one of the examples to use this application. You can choose one of 3
-type of parsers: Eular, Quaternion, Vector. If Vector example is selected you need to
-choose one of the 3 sensors to show x,y,z values: Accelerometer, Gyroscope, or Magnetometer.
+> Select one of the examples with macros at the top of the main file. Euler example is selected by default.
+You can choose one of 3 type of parsers: Euler, Quaternion, Vector. If Vector example is selected
+you choose one of the 3 sensors to show X, Y, and Z values: Accelerometer, Gyroscope, or Magnetometer.
The full application code, and ready to use projects can be installed directly from *NECTO Studio Package Manager*(recommended way), downloaded from our [LibStock™](https://libstock.mikroe.com) or found on [Mikroe github account](https://github.com/MikroElektronika/mikrosdk_click_v2/tree/master/clicks).
diff --git a/clicks/smartsens/details.md b/clicks/smartsens/details.md
index 0ab34a2138..7f4456c662 100644
--- a/clicks/smartsens/details.md
+++ b/clicks/smartsens/details.md
@@ -15,7 +15,7 @@
#### Click library
-- **Author** : Luka Filipovic
+- **Author** : MikroE Team
- **Date** : Oct 2021.
- **Type** : I2C/SPI type
@@ -59,8 +59,7 @@ err_t smartsens_cmd_write ( smartsens_t *ctx, uint16_t cmd, uint8_t *cmd_buf, ui
- `smartsens_get_parameter` Get command parameters resposne.
```c
-err_t smartsens_get_parameter ( smartsens_t *ctx, uint16_t parameter,
- uint8_t *parameter_buf, uint16_t *parameter_len );
+err_t smartsens_get_parameter ( smartsens_t *ctx, uint16_t parameter, uint8_t *parameter_buf, uint16_t *parameter_len );
```
- `smartsens_power_on_device` Power on device boot/upload firmware to device.
@@ -72,17 +71,17 @@ err_t smartsens_power_on_device( smartsens_t *ctx );
> This example showcases the ability of the Smart Sens click board.
It has multiple examples that you can easily select with the
-defines at top of the main. There are 5 examples Euler, Quaternion,
-and Vector examples for Accelerometer, Gyroscope, and Magnetometer.
+defines at the top of the main. There are 5 examples: Euler, Quaternion,
+and Vector (Accelerometer, Gyroscope, Magnetometer).
**The demo application is composed of two sections :**
### Application Init
-> Initialization of communication modules(SPI/I2C, UART) and additional
-pins(int_pin, rst). Then after going through reset sequence and checking
+> Initialization of communication modules (SPI/I2C) and additional
+pins(int_pin, rst). After that going through reset sequence and checking
device and product IDs, interrupt mask, and host control is set to 0, so
-every interrupt enabled. IF boot status is OK boot sequence is initiated,
+every interrupt enabled. If boot status is OK boot sequence is initiated,
depending on the defines from the library header it will use RAM or Flash type
of the boot. If RAM is selected firmware image first needs to be uploaded to RAM
and then it will be booted. If Flash example is selected it will try to boot
@@ -90,7 +89,7 @@ firmware first if it fails it will then write firmware image to flash and then
try to boot it again. When firmware boot is finished Kernel version and Feature
registers will be read to check if the firmware is loaded. Then all the callback function
will be registered(meta event callback and whatever type of example parser you set),
-and driver will update its the list of virtual sensors present, and finally will configure
+and driver will update the list of virtual sensors present, and finally will configure
virtual sensor that will be used in the selected example.
```c
@@ -116,105 +115,87 @@ void application_init ( void )
// Click initialization.
smartsens_cfg_setup( &smartsens_cfg );
SMARTSENS_MAP_MIKROBUS( smartsens_cfg, MIKROBUS_1 );
- err_t init_flag = smartsens_init( &smartsens, &smartsens_cfg );
- SMARTSENS_SET_DATA_SAMPLE_EDGE
+ err_t init_flag = smartsens_init( &smartsens, &smartsens_cfg );
if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
- /* It can take a few seconds to configure and boot device*/
+ /* It can take a few seconds to configure and boot device */
log_info( &logger, " Configuring device..." );
if ( SMARTSENS_ERROR == smartsens_default_cfg ( &smartsens ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
+
log_info( &logger, " Setting callbacks..." );
- /*Set callbacks*/
+ /* Set callbacks */
if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SYS_ID_META_EVENT,
- parse_meta_event, (void*)&accuracy ) )
+ parse_meta_event, &accuracy ) )
{
log_error( &logger, " FIFO sys meta event." );
- for( ; ; );
+ for ( ; ; );
}
if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SYS_ID_META_EVENT_WU,
- parse_meta_event, ( void* )&accuracy ) )
+ parse_meta_event, &accuracy ) )
{
log_error( &logger, " FIFO sys meta event wu." );
- for( ; ; );
+ for ( ; ; );
}
-#if EULAR
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_ORI_WU,
- parse_euler, ( void* )&accuracy ) )
+ uint8_t sensor_id;
+ smartsens_fifo_parse_callback_t callback;
+ void *callback_ref;
+#if EULER
+ sensor_id = SMARTSENS_SENSOR_ID_ORI;
+ callback = parse_euler;
+ callback_ref = &accuracy;
#elif QUATERNION
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_RV_WU,
- parse_quaternion, NULL ) )
+ sensor_id = SMARTSENS_SENSOR_ID_RV;
+ callback = parse_quaternion;
+ callback_ref = NULL;
#elif VECTOR
-
-
#if ACCELEROMETER
- parse_table.sensor[SMARTSENS_SENSOR_ID_ACC].scaling_factor = 1.0f / 4096.0f;
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_ACC,
- parse_3axis_s16, &parse_table ) )
+ parse_table.sensor[ SMARTSENS_SENSOR_ID_ACC ].scaling_factor = 1.0f / 4096.0f;
+ sensor_id = SMARTSENS_SENSOR_ID_ACC;
#elif GYROSCOPE
- parse_table.sensor[SMARTSENS_SENSOR_ID_GYRO].scaling_factor = 1.0f;
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_GYRO,
- parse_3axis_s16, &parse_table ) )
- #elif MAGNOMETER
- parse_table.sensor[SMARTSENS_SENSOR_ID_MAG].scaling_factor = 1.0f;
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_MAG,
- parse_3axis_s16, &parse_table ) )
+ parse_table.sensor[ SMARTSENS_SENSOR_ID_GYRO ].scaling_factor = 1.0f;
+ sensor_id = SMARTSENS_SENSOR_ID_GYRO;
+ #elif MAGNETOMETER
+ parse_table.sensor[ SMARTSENS_SENSOR_ID_MAG ].scaling_factor = 1.0f;
+ sensor_id = SMARTSENS_SENSOR_ID_MAG;
#else
#error NO_VECTOR_EXAMPLE_DEFINED
#endif
+ callback = parse_vector_s16;
+ callback_ref = &parse_table;
#else
#error NO_EXAMPLE_DEFINED
#endif
+ if ( smartsens_register_fifo_parse_callback( &smartsens, sensor_id, callback, callback_ref ) )
{
log_error( &logger, " FIFO sensor id." );
- for( ; ; );
+ for ( ; ; );
}
- /*Go through fifo process*/
+ /* Go through fifo process */
if ( smartsens_get_and_process_fifo( &smartsens, work_buffer, WORK_BUFFER_SIZE ) )
{
log_error( &logger, " FIFO get and process." );
- for( ; ; );
+ for ( ; ; );
}
- /*Update virtual sensor list in context object*/
+ /* Update virtual sensor list in context object */
if ( smartsens_update_virtual_sensor_list( &smartsens ) )
{
log_error( &logger, " Update virtual sensor list." );
- for( ; ; );
+ for ( ; ; );
}
- /*Set virtual sensor configuration*/
- float sample_rate = 100.0; /* Read out data measured at 100Hz */
+ /* Set virtual sensor configuration */
+ float sample_rate = 10.0; /* Read out data at 10Hz */
uint32_t report_latency_ms = 0; /* Report immediately */
-#if EULAR
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_ORI_WU,
- sample_rate, report_latency_ms ) )
-#elif QUATERNION
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_RV_WU,
- sample_rate, report_latency_ms ) )
-#elif VECTOR
- #if ACCELEROMETER
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_ACC,
- sample_rate, report_latency_ms ) )
- #elif GYROSCOPE
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_GYRO,
- sample_rate, report_latency_ms ) )
- #elif MAGNOMETER
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_MAG,
- sample_rate, report_latency_ms ) )
- #else
- #error NO_VECTOR_EXAMPLE_DEFINED
- #endif
-#else
- #error NO_EXAMPLE_DEFINED
-#endif
+ if ( smartsens_set_virt_sensor_cfg( &smartsens, sensor_id, sample_rate, report_latency_ms ) )
{
log_error( &logger, " Set virtual sensor configuration." );
- for( ; ; );
+ for ( ; ; );
}
log_info( &logger, " Application Task " );
@@ -224,20 +205,20 @@ void application_init ( void )
### Application Task
-> Wait for an interrupt to occur. When occurred read wake-up, non-weak-up, and status FIFO.
-Parse received that and run the callback parsers to show received data.
+> Wait for an interrupt to occur, then read wake-up, non-weak-up, and status FIFO.
+Parse received data and run the callback parsers to show data on the USB UART.
```c
void application_task ( void )
{
- /*Check interrupt and get and process fifo buffer*/
+ /* Check interrupt and get and process fifo buffer */
if ( smartsens_get_interrupt( &smartsens ) )
{
/* Data from the FIFO is read and the relevant callbacks if registered are called */
if ( smartsens_get_and_process_fifo( &smartsens, work_buffer, WORK_BUFFER_SIZE ) )
{
log_error( &logger, " Get and process fifo." );
- for( ; ; );
+ for ( ; ; );
}
}
}
@@ -245,9 +226,9 @@ void application_task ( void )
## Note
-> You need to select one of the examples to use this application. You can choose one of 3
-type of parsers: Eular, Quaternion, Vector. If Vector example is selected you need to
-choose one of the 3 sensors to show x,y,z values: Accelerometer, Gyroscope, or Magnetometer.
+> Select one of the examples with macros at the top of the main file. Euler example is selected by default.
+You can choose one of 3 type of parsers: Euler, Quaternion, Vector. If Vector example is selected
+you choose one of the 3 sensors to show X, Y, and Z values: Accelerometer, Gyroscope, or Magnetometer.
The full application code, and ready to use projects can be installed directly from *NECTO Studio Package Manager*(recommended way), downloaded from our [LibStock™](https://libstock.mikroe.com) or found on [Mikroe github account](https://github.com/MikroElektronika/mikrosdk_click_v2/tree/master/clicks).
diff --git a/clicks/smartsens/doc/doxy/Doxyfile.doxy b/clicks/smartsens/doc/doxy/Doxyfile.doxy
index 9db683c173..7b40b78aba 100644
--- a/clicks/smartsens/doc/doxy/Doxyfile.doxy
+++ b/clicks/smartsens/doc/doxy/Doxyfile.doxy
@@ -44,21 +44,21 @@ PROJECT_NUMBER = 2.0.0.0
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
-PROJECT_BRIEF =
+PROJECT_BRIEF =
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
-PROJECT_LOGO =
+PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
-OUTPUT_DIRECTORY = ../clicks/smartsens/temp/Help/doc
+OUTPUT_DIRECTORY = ../cmake/smartsens/temp/Help/doc
# 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
@@ -162,7 +162,7 @@ FULL_PATH_NAMES = YES
# will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
-STRIP_FROM_PATH =
+STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which
@@ -171,7 +171,7 @@ STRIP_FROM_PATH =
# specify the list of include paths that are normally passed to the compiler
# using the -I flag.
-STRIP_FROM_INC_PATH =
+STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
# less readable) file names. This can be useful is your file systems doesn't
@@ -238,13 +238,13 @@ TAB_SIZE = 4
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines.
-ALIASES =
+ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
-TCL_SUBST =
+TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
@@ -291,7 +291,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
-EXTENSION_MAPPING =
+EXTENSION_MAPPING =
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
@@ -648,7 +648,7 @@ GENERATE_DEPRECATEDLIST= YES
# sections, marked by \if ... \endif and \cond
# ... \endcond blocks.
-ENABLED_SECTIONS =
+ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
# initial value of a variable or macro / define can have for it to appear in the
@@ -690,7 +690,7 @@ SHOW_NAMESPACES = YES
# by doxygen. Whatever the program writes to standard output is used as the file
# version. For an example see the documentation.
-FILE_VERSION_FILTER =
+FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
# by doxygen. The layout file controls the global structure of the generated
@@ -703,7 +703,7 @@ FILE_VERSION_FILTER =
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty.
-LAYOUT_FILE =
+LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
@@ -713,7 +713,7 @@ LAYOUT_FILE =
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. See also \cite for info how to create references.
-CITE_BIB_FILES =
+CITE_BIB_FILES =
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
@@ -778,7 +778,7 @@ WARN_FORMAT = "$file:$line: $text"
# messages should be written. If left blank the output is written to standard
# error (stderr).
-WARN_LOGFILE =
+WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
@@ -790,9 +790,9 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = ../clicks/smartsens/example \
- ../clicks/smartsens/lib/include \
- ../clicks/smartsens/README.md
+INPUT = ../cmake/smartsens/example \
+ ../cmake/smartsens/lib_smartsens/include \
+ ../cmake/smartsens/README.md
# 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
@@ -877,7 +877,7 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
-EXCLUDE =
+EXCLUDE =
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -893,7 +893,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
-EXCLUDE_PATTERNS =
+EXCLUDE_PATTERNS =
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@@ -904,13 +904,13 @@ EXCLUDE_PATTERNS =
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
-EXCLUDE_SYMBOLS =
+EXCLUDE_SYMBOLS =
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
# command).
-EXAMPLE_PATH = ../clicks/smartsens/example
+EXAMPLE_PATH = ../cmake/smartsens/example
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -930,7 +930,7 @@ EXAMPLE_RECURSIVE = YES
# that contain images that are to be included in the documentation (see the
# \image command).
-IMAGE_PATH =
+IMAGE_PATH =
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
@@ -951,7 +951,7 @@ IMAGE_PATH =
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
-INPUT_FILTER =
+INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis. Doxygen will compare the file name with each pattern and apply the
@@ -964,7 +964,7 @@ INPUT_FILTER =
# 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
# INPUT_FILTER) will also be used to filter the input files that are used for
@@ -979,14 +979,14 @@ FILTER_SOURCE_FILES = NO
# *.ext= (so without naming a filter).
# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
-FILTER_SOURCE_PATTERNS =
+FILTER_SOURCE_PATTERNS =
# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
# is part of the input, its contents will be placed on the main page
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.
-USE_MDFILE_AS_MAINPAGE =
+USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# Configuration options related to source browsing
@@ -1091,7 +1091,7 @@ CLANG_ASSISTED_PARSING = NO
# specified with INPUT and INCLUDE_PATH.
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
-CLANG_OPTIONS =
+CLANG_OPTIONS =
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
@@ -1117,7 +1117,7 @@ COLS_IN_ALPHA_INDEX = 5
# while generating the index headers.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-IGNORE_PREFIX =
+IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
@@ -1161,7 +1161,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_HEADER =
+HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
@@ -1171,7 +1171,7 @@ HTML_HEADER =
# that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_FOOTER =
+HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of
@@ -1183,7 +1183,7 @@ HTML_FOOTER =
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_STYLESHEET =
+HTML_STYLESHEET =
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
@@ -1196,7 +1196,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@@ -1206,7 +1206,7 @@ HTML_EXTRA_STYLESHEET =
# files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_FILES =
+HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
@@ -1335,7 +1335,7 @@ GENERATE_HTMLHELP = NO
# written to the html output directory.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-CHM_FILE =
+CHM_FILE =
# 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,
@@ -1343,7 +1343,7 @@ CHM_FILE =
# The file has to be specified with full path.
# 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
# (YES) or that it should be included in the master .chm file (NO).
@@ -1356,7 +1356,7 @@ GENERATE_CHI = NO
# and project file content.
# 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
# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
@@ -1387,7 +1387,7 @@ GENERATE_QHP = NO
# the HTML output folder.
# This tag requires that the tag GENERATE_QHP is set to YES.
-QCH_FILE =
+QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
@@ -1412,7 +1412,7 @@ QHP_VIRTUAL_FOLDER = ./temp/Help/doc
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
@@ -1420,21 +1420,21 @@ QHP_CUST_FILTER_NAME =
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_CUST_FILTER_ATTRS =
+QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_SECT_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
# The QHG_LOCATION tag can be used to specify the location of Qt's
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
# generated .qhp file.
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHG_LOCATION =
+QHG_LOCATION =
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
# generated, together with the HTML files, they form an Eclipse help plugin. To
@@ -1567,7 +1567,7 @@ MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_EXTENSIONS =
+MATHJAX_EXTENSIONS =
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
# of code that will be used on startup of the MathJax code. See the MathJax site
@@ -1575,7 +1575,7 @@ MATHJAX_EXTENSIONS =
# example see the documentation.
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_CODEFILE =
+MATHJAX_CODEFILE =
# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
# the HTML output. The underlying search engine uses javascript and DHTML and
@@ -1635,7 +1635,7 @@ EXTERNAL_SEARCH = NO
# Searching" for details.
# This tag requires that the tag SEARCHENGINE is set to YES.
-SEARCHENGINE_URL =
+SEARCHENGINE_URL =
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
# search data is written to a file for indexing by an external tool. With the
@@ -1651,7 +1651,7 @@ SEARCHDATA_FILE = searchdata.xml
# projects and redirect the results back to the right project.
# This tag requires that the tag SEARCHENGINE is set to YES.
-EXTERNAL_SEARCH_ID =
+EXTERNAL_SEARCH_ID =
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
# projects other than the one defined by this configuration file, but that are
@@ -1661,7 +1661,7 @@ EXTERNAL_SEARCH_ID =
# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
# This tag requires that the tag SEARCHENGINE is set to YES.
-EXTRA_SEARCH_MAPPINGS =
+EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
@@ -1725,7 +1725,7 @@ PAPER_TYPE = a4
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-EXTRA_PACKAGES =
+EXTRA_PACKAGES =
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
# generated LaTeX document. The header should contain everything until the first
@@ -1741,7 +1741,7 @@ EXTRA_PACKAGES =
# to HTML_HEADER.
# 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
# generated LaTeX document. The footer should contain everything after the last
@@ -1752,7 +1752,7 @@ LATEX_HEADER =
# 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.
-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
@@ -1763,7 +1763,7 @@ LATEX_FOOTER =
# list).
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_STYLESHEET =
# 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
@@ -1771,7 +1771,7 @@ LATEX_EXTRA_STYLESHEET =
# markers available.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_EXTRA_FILES =
+LATEX_EXTRA_FILES =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
@@ -1879,14 +1879,14 @@ RTF_HYPERLINKS = NO
# default style sheet that doxygen normally uses.
# This tag requires that the tag GENERATE_RTF is set to YES.
-RTF_STYLESHEET_FILE =
+RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an RTF document. Syntax is
# similar to doxygen's config file. A template extensions file can be generated
# using doxygen -e rtf extensionFile.
# This tag requires that the tag GENERATE_RTF is set to YES.
-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.
@@ -1931,7 +1931,7 @@ MAN_EXTENSION = .3
# MAN_EXTENSION with the initial . removed.
# This tag requires that the tag GENERATE_MAN is set to YES.
-MAN_SUBDIR =
+MAN_SUBDIR =
# 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
@@ -2044,7 +2044,7 @@ PERLMOD_PRETTY = YES
# overwrite each other's variables.
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-PERLMOD_MAKEVAR_PREFIX =
+PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
@@ -2085,7 +2085,7 @@ SEARCH_INCLUDES = YES
# preprocessor.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-INCLUDE_PATH =
+INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
@@ -2093,7 +2093,7 @@ INCLUDE_PATH =
# used.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-INCLUDE_FILE_PATTERNS =
+INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that are
# defined before the preprocessor is started (similar to the -D option of e.g.
@@ -2103,7 +2103,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-PREDEFINED =
+PREDEFINED =
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
@@ -2112,7 +2112,7 @@ PREDEFINED =
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-EXPAND_AS_DEFINED =
+EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
@@ -2141,13 +2141,13 @@ SKIP_FUNCTION_MACROS = YES
# 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.
-TAGFILES =
+TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
# tag file that is based on the input files it reads. See section "Linking to
# external documentation" for more information about the usage of tag files.
-GENERATE_TAGFILE =
+GENERATE_TAGFILE =
# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
# the class index. If set to NO, only the inherited external classes will be
@@ -2188,7 +2188,7 @@ CLASS_DIAGRAMS = YES
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
# If left empty dia is assumed to be found in the default search path.
-DIA_PATH =
+DIA_PATH =
# 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.
@@ -2237,7 +2237,7 @@ DOT_FONTSIZE = 10
# the path where dot can find it using this tag.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_FONTPATH =
+DOT_FONTPATH =
# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
# each documented class showing the direct and indirect inheritance relations.
@@ -2381,26 +2381,26 @@ INTERACTIVE_SVG = NO
# found. If left blank, it is assumed the dot tool can be found in the path.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_PATH =
+DOT_PATH =
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the \dotfile
# command).
# This tag requires that the tag HAVE_DOT is set to YES.
-DOTFILE_DIRS =
+DOTFILE_DIRS =
# The MSCFILE_DIRS tag can be used to specify one or more directories that
# contain msc files that are included in the documentation (see the \mscfile
# command).
-MSCFILE_DIRS =
+MSCFILE_DIRS =
# The DIAFILE_DIRS tag can be used to specify one or more directories that
# contain dia files that are included in the documentation (see the \diafile
# command).
-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
@@ -2408,17 +2408,17 @@ DIAFILE_DIRS =
# generate a warning when it encounters a \startuml command in this case and
# will not generate output for the diagram.
-PLANTUML_JAR_PATH =
+PLANTUML_JAR_PATH =
# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
# configuration file for plantuml.
-PLANTUML_CFG_FILE =
+PLANTUML_CFG_FILE =
# When using plantuml, the specified paths are searched for files specified by
# the !include statement in a plantuml block.
-PLANTUML_INCLUDE_PATH =
+PLANTUML_INCLUDE_PATH =
# 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
diff --git a/clicks/smartsens/doc/package/manifest.json b/clicks/smartsens/doc/package/manifest.json
index 9b5f7b65ad..ecfd6d921e 100644
--- a/clicks/smartsens/doc/package/manifest.json
+++ b/clicks/smartsens/doc/package/manifest.json
@@ -1,6 +1,6 @@
{
- "architecture": "ARM|PIC32",
- "category": "Motion",
+ "architecture": "ARM|PIC32|RISC-V",
+ "category": "Click Boards > Sensors > Environmental",
"changelog": "Resources/CHANGELOG.md",
"contains": [
"libraries",
@@ -8,8 +8,7 @@
"examples",
"source_files"
],
- "dependency_list": [
- ],
+ "dependency_list": [],
"details": "Resources/DETAILS.md",
"display_name": "Smart Sens click",
"example_list": [
@@ -26,10 +25,12 @@
"name": "mikroe.click.smartsens",
"product_link": "https://www.mikroe.com/smart-sens-click",
"short_description": "Smart Sens Click is a compact add-on board that contains an intelligent sensor hub with an integrated IMU sensor. This board utilizes the BHI260 and BMM150, an environmental sensor and magnetometer from Bosch Sensortech. The BHI260 includes a programmable and powerful 32-bit MCU, a 6-axis IMU, and a robust software framework. In addition to its internal functions, it also performs signal data processing from the BMM150 that performs measurements of the magnetic field in three perpendicular axes.",
- "supported_compiler": "mikroC AI",
+ "supported_compiler": "mikroC AI|GCC",
"type": "Library",
- "_type":"mikroSDK Library",
- "version": "2.0.0.2"
+ "_type": "mikroSDK Library",
+ "version": "2.1.0.4",
+ "cmake": true,
+ "alias": "Click.SmartSens",
+ "subdir_name": "lib_smartsens"
}
-
diff --git a/clicks/smartsens/example/CMakeLists.txt b/clicks/smartsens/example/CMakeLists.txt
new file mode 100644
index 0000000000..9b4137ec4b
--- /dev/null
+++ b/clicks/smartsens/example/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(example_smartsens LANGUAGES MikroC)
+else()
+ project(example_smartsens LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_executable(example_smartsens
+ main.c
+
+)
+
+
+############################ example_smartsens GENERATED CODE START ###########################
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(example_smartsens PUBLIC MikroC.Core)
+find_package(MikroSDK.Board REQUIRED)
+target_link_libraries(example_smartsens PUBLIC MikroSDK.Board)
+find_package(MikroSDK.Log REQUIRED)
+target_link_libraries(example_smartsens PUBLIC MikroSDK.Log)
+add_subdirectory(lib_smartsens)
+target_link_libraries(example_smartsens PUBLIC Click.SmartSens)
+############################ example_smartsens GENERATED CODE END ###########################
diff --git a/clicks/smartsens/example/main.c b/clicks/smartsens/example/main.c
index 93a6ba5df7..c74a9c70b0 100644
--- a/clicks/smartsens/example/main.c
+++ b/clicks/smartsens/example/main.c
@@ -1,20 +1,20 @@
/*!
* @file main.c
- * @brief SmartSens Click example
+ * @brief Smart Sens Click example
*
* # Description
* This example showcases the ability of the Smart Sens click board.
* It has multiple examples that you can easily select with the
- * defines at top of the main. There are 5 examples Euler, Quaternion,
- * and Vector examples for Accelerometer, Gyroscope, and Magnetometer.
+ * defines at the top of the main. There are 5 examples: Euler, Quaternion,
+ * and Vector (Accelerometer, Gyroscope, Magnetometer).
*
* The demo application is composed of two sections :
*
* ## Application Init
- * Initialization of communication modules(SPI/I2C, UART) and additional
- * pins(int_pin, rst). Then after going through reset sequence and checking
+ * Initialization of communication modules (SPI/I2C) and additional
+ * pins(int_pin, rst). After that going through reset sequence and checking
* device and product IDs, interrupt mask, and host control is set to 0, so
- * every interrupt enabled. IF boot status is OK boot sequence is initiated,
+ * every interrupt enabled. If boot status is OK boot sequence is initiated,
* depending on the defines from the library header it will use RAM or Flash type
* of the boot. If RAM is selected firmware image first needs to be uploaded to RAM
* and then it will be booted. If Flash example is selected it will try to boot
@@ -22,19 +22,19 @@
* try to boot it again. When firmware boot is finished Kernel version and Feature
* registers will be read to check if the firmware is loaded. Then all the callback function
* will be registered(meta event callback and whatever type of example parser you set),
- * and driver will update its the list of virtual sensors present, and finally will configure
+ * and driver will update the list of virtual sensors present, and finally will configure
* virtual sensor that will be used in the selected example.
*
* ## Application Task
- * Wait for an interrupt to occur. When occurred read wake-up, non-weak-up, and status FIFO.
- * Parse received that and run the callback parsers to show received data.
+ * Wait for an interrupt to occur, then read wake-up, non-weak-up, and status FIFO.
+ * Parse received data and run the callback parsers to show data on the USB UART.
*
* @note
- * You need to select one of the examples to use this application. You can choose one of 3
- * type of parsers: Eular, Quaternion, Vector. If Vector example is selected you need to
- * choose one of the 3 sensors to show x,y,z values: Accelerometer, Gyroscope, or Magnetometer.
+ * Select one of the examples with macros at the top of the main file. Euler example is selected by default.
+ * You can choose one of 3 type of parsers: Euler, Quaternion, Vector. If Vector example is selected
+ * you choose one of the 3 sensors to show X, Y, and Z values: Accelerometer, Gyroscope, or Magnetometer.
*
- * @author Luka Filipovic
+ * @author MikroE Team
*
*/
@@ -44,31 +44,30 @@
/**
* @brief Example parser selector.
- * @details Macros for selecting example and it's parser.
+ * @details Macros for selecting example and its parser.
*/
-#define EULAR 0
-#define QUATERNION 0
-#define VECTOR 1
+#define EULER 1
+#define QUATERNION 0
+#define VECTOR 0
/**
- * @brief Vector3 sensor selector.
- * @details Macros for selecting vector3's sensor.
+ * @brief Vector sensor selector.
+ * @details Macros for selecting vector's sensor.
*/
-#define ACCELEROMETER 1
-#define GYROSCOPE 0
-#define MAGNOMETER 0
+#define ACCELEROMETER 1
+#define GYROSCOPE 0
+#define MAGNETOMETER 0
-#define WORK_BUFFER_SIZE 2048
+#define WORK_BUFFER_SIZE 2048
uint8_t work_buffer[ WORK_BUFFER_SIZE ] = { 0 };
-uint16_t work_buffer_fill;
-uint16_t cmd;
-uint8_t status;
-static uint8_t verbose;
+static smartsens_t smartsens;
+static log_t logger;
+uint8_t accuracy; /* Accuracy is reported as a meta event. It is being printed alongside the data */
-#if EULAR
+#if EULER
/**
- * @brief Eular data.
- * @details Struct for eular data of the Smart Sens Click example.
+ * @brief Euler data.
+ * @details Struct for euler data of the Smart Sens Click example.
*/
struct smartsens_data_orientation
{
@@ -78,25 +77,13 @@ struct smartsens_data_orientation
};
/**
- * @brief Euler callback prasing function.
+ * @brief Euler callback parsing function.
* @details Callback function to parse euler data.
- * @param[in] ctx : Click context object.
- * See #smartsens_t object definition for detailed explanation.
* @param[in] callback_info : Callback data.
* @param[in] callback_ref : Callback reference.
* @return Nothing
*/
-static void parse_euler ( struct smartsens_fifo_parse_data_info *callback_info,
- void *callback_ref );
-
-/**
- * @brief Parse FIFO frame data into orientation
- * @details Function to parse FIFO frame data into orientation
- * @param[in] data : Reference to the data buffer storing data from the FIFO
- * @param[out] orientation : Reference to the data buffer to store orientation
- */
-static void smartsens_parse_orientation ( uint8_t *data_val,
- struct smartsens_data_orientation *orientation );
+static void parse_euler ( struct smartsens_fifo_parse_data_info *callback_info, void *callback_ref );
#elif QUATERNION
/**
* @brief Quaternion data.
@@ -111,30 +98,17 @@ struct smartsens_data_quaternion
uint16_t accuracy;
};
-/**
- * @brief Quaternion callback prasing function.
- * @details Callback function to parse quaternion data.
- * @param[in] ctx : Click context object.
- * See #smartsens_t object definition for detailed explanation.
- * @param[in] callback_info : Callback data.
- * @param[in] callback_ref : Callback reference.
- * @return Nothing
- */
-static void smartsens_parse_quaternion ( uint8_t *data_val,
- struct smartsens_data_quaternion *quaternion );
-
/**
* @brief Parse FIFO frame data into quaternion
* @details Function to parse FIFO frame data into quaternion
- * @param[in] data : Reference to the data buffer storing data from the FIFO
- * @param[out] quaternion : Reference to the data buffer to store quaternion
+ * @param[in] callback_info : Callback data.
+ * @param[in] callback_ref : Callback reference.
*/
-static void parse_quaternion ( struct smartsens_fifo_parse_data_info *callback_info,
- void *callback_ref );
+static void parse_quaternion ( struct smartsens_fifo_parse_data_info *callback_info, void *callback_ref );
#elif VECTOR
/**
- * @brief Vector3 data.
- * @details Struct for vector3 data of the Smart Sens Click example.
+ * @brief Vector data.
+ * @details Struct for vector data of the Smart Sens Click example.
*/
struct smartsens_data_xyz
{
@@ -160,66 +134,34 @@ struct parse_ref
struct parse_ref parse_table;
/**
- * @brief Vector3 callback prasing function.
- * @details Callback function to parse vector3 data.
- * @param[in] ctx : Click context object.
- * See #smartsens_t object definition for detailed explanation.
+ * @brief Vector callback parsing function.
+ * @details Callback function to parse vector data.
* @param[in] callback_info : Callback data.
* @param[in] callback_ref : Callback reference.
* @return Nothing
*/
-static void parse_3axis_s16 ( struct smartsens_fifo_parse_data_info *callback_info,
- void *callback_ref );
-
-/**
- * @brief Parse FIFO frame data into 3 axes vector
- * @details Function to parse FIFO frame data into 3 axes vector
- * @param[in] data : Reference to the data buffer storing data from the FIFO
- * @param[out] vector : Reference to the data buffer to store vector
- */
-static void smartsens_parse_xyz ( uint8_t *data_val, struct smartsens_data_xyz *vector );
+static void parse_vector_s16 ( struct smartsens_fifo_parse_data_info *callback_info, void *callback_ref );
#else
#error NO_EXAMPLE_DEFINED
#endif
-static smartsens_t smartsens;
-static log_t logger;
-static uint8_t read_data = 0;
-static uint8_t error_flag = 0;
-static uint8_t int_flag = 0;
-static uint8_t write_data = 0;
-uint8_t accuracy; /* Accuracy is reported as a meta event. It is being printed alongside the data */
-
/**
- * @brief Meta event callback prasing function.
+ * @brief Meta event callback parsing function.
* @details Callback function to parse meta event data.
- * @param[in] ctx : Click context object.
- * See #smartsens_t object definition for detailed explanation.
* @param[in] callback_info : Callback data.
* @param[in] callback_ref : Callback reference.
* @return Nothing
*/
-static void parse_meta_event ( struct smartsens_fifo_parse_data_info *callback_info,
- void *callback_ref );
+static void parse_meta_event ( struct smartsens_fifo_parse_data_info *callback_info, void *callback_ref );
/**
- * @brief Get name of the virtual senosr by ID.
- * @details Function return name of the virutal senosr by it's ID.
- * @param[in] sensor_id : Virutal sensor ID.
+ * @brief Get name of the virtual sensor by ID.
+ * @details Function return name of the virutal sensor by its ID.
+ * @param[in] sensor_id : Virtual sensor ID.
* @return Virtual sensor name.
*/
static char* get_sensor_name ( uint8_t sensor_id );
-/**
- * @brief Get real time from timestamp.
- * @details Function outputs time from timestamp.
- * @param[in] time_ticks : Timestamp.
- * @param[out] s : Seconds.
- * @param[out] ns : Nano seconds.
- * @return Nothing
- */
-static void time_to_s_ns ( uint32_t time_ticks, uint32_t *s, uint32_t *ns );
-
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
@@ -241,105 +183,87 @@ void application_init ( void )
// Click initialization.
smartsens_cfg_setup( &smartsens_cfg );
SMARTSENS_MAP_MIKROBUS( smartsens_cfg, MIKROBUS_1 );
- err_t init_flag = smartsens_init( &smartsens, &smartsens_cfg );
- SMARTSENS_SET_DATA_SAMPLE_EDGE
+ err_t init_flag = smartsens_init( &smartsens, &smartsens_cfg );
if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
- /* It can take a few seconds to configure and boot device*/
+ /* It can take a few seconds to configure and boot device */
log_info( &logger, " Configuring device..." );
if ( SMARTSENS_ERROR == smartsens_default_cfg ( &smartsens ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
+
log_info( &logger, " Setting callbacks..." );
- /*Set callbacks*/
+ /* Set callbacks */
if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SYS_ID_META_EVENT,
- parse_meta_event, (void*)&accuracy ) )
+ parse_meta_event, &accuracy ) )
{
log_error( &logger, " FIFO sys meta event." );
- for( ; ; );
+ for ( ; ; );
}
if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SYS_ID_META_EVENT_WU,
- parse_meta_event, ( void* )&accuracy ) )
+ parse_meta_event, &accuracy ) )
{
log_error( &logger, " FIFO sys meta event wu." );
- for( ; ; );
+ for ( ; ; );
}
-#if EULAR
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_ORI_WU,
- parse_euler, ( void* )&accuracy ) )
+ uint8_t sensor_id;
+ smartsens_fifo_parse_callback_t callback;
+ void *callback_ref;
+#if EULER
+ sensor_id = SMARTSENS_SENSOR_ID_ORI;
+ callback = parse_euler;
+ callback_ref = &accuracy;
#elif QUATERNION
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_RV_WU,
- parse_quaternion, NULL ) )
+ sensor_id = SMARTSENS_SENSOR_ID_RV;
+ callback = parse_quaternion;
+ callback_ref = NULL;
#elif VECTOR
-
-
#if ACCELEROMETER
- parse_table.sensor[SMARTSENS_SENSOR_ID_ACC].scaling_factor = 1.0f / 4096.0f;
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_ACC,
- parse_3axis_s16, &parse_table ) )
+ parse_table.sensor[ SMARTSENS_SENSOR_ID_ACC ].scaling_factor = 1.0f / 4096.0f;
+ sensor_id = SMARTSENS_SENSOR_ID_ACC;
#elif GYROSCOPE
- parse_table.sensor[SMARTSENS_SENSOR_ID_GYRO].scaling_factor = 1.0f;
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_GYRO,
- parse_3axis_s16, &parse_table ) )
- #elif MAGNOMETER
- parse_table.sensor[SMARTSENS_SENSOR_ID_MAG].scaling_factor = 1.0f;
- if ( smartsens_register_fifo_parse_callback( &smartsens, SMARTSENS_SENSOR_ID_MAG,
- parse_3axis_s16, &parse_table ) )
+ parse_table.sensor[ SMARTSENS_SENSOR_ID_GYRO ].scaling_factor = 1.0f;
+ sensor_id = SMARTSENS_SENSOR_ID_GYRO;
+ #elif MAGNETOMETER
+ parse_table.sensor[ SMARTSENS_SENSOR_ID_MAG ].scaling_factor = 1.0f;
+ sensor_id = SMARTSENS_SENSOR_ID_MAG;
#else
#error NO_VECTOR_EXAMPLE_DEFINED
#endif
+ callback = parse_vector_s16;
+ callback_ref = &parse_table;
#else
#error NO_EXAMPLE_DEFINED
#endif
+ if ( smartsens_register_fifo_parse_callback( &smartsens, sensor_id, callback, callback_ref ) )
{
log_error( &logger, " FIFO sensor id." );
- for( ; ; );
+ for ( ; ; );
}
- /*Go through fifo process*/
+ /* Go through fifo process */
if ( smartsens_get_and_process_fifo( &smartsens, work_buffer, WORK_BUFFER_SIZE ) )
{
log_error( &logger, " FIFO get and process." );
- for( ; ; );
+ for ( ; ; );
}
- /*Update virtual sensor list in context object*/
+ /* Update virtual sensor list in context object */
if ( smartsens_update_virtual_sensor_list( &smartsens ) )
{
log_error( &logger, " Update virtual sensor list." );
- for( ; ; );
+ for ( ; ; );
}
- /*Set virtual sensor configuration*/
- float sample_rate = 100.0; /* Read out data measured at 100Hz */
+ /* Set virtual sensor configuration */
+ float sample_rate = 10.0; /* Read out data at 10Hz */
uint32_t report_latency_ms = 0; /* Report immediately */
-#if EULAR
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_ORI_WU,
- sample_rate, report_latency_ms ) )
-#elif QUATERNION
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_RV_WU,
- sample_rate, report_latency_ms ) )
-#elif VECTOR
- #if ACCELEROMETER
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_ACC,
- sample_rate, report_latency_ms ) )
- #elif GYROSCOPE
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_GYRO,
- sample_rate, report_latency_ms ) )
- #elif MAGNOMETER
- if ( smartsens_set_virt_sensor_cfg( &smartsens, SMARTSENS_SENSOR_ID_MAG,
- sample_rate, report_latency_ms ) )
- #else
- #error NO_VECTOR_EXAMPLE_DEFINED
- #endif
-#else
- #error NO_EXAMPLE_DEFINED
-#endif
+ if ( smartsens_set_virt_sensor_cfg( &smartsens, sensor_id, sample_rate, report_latency_ms ) )
{
log_error( &logger, " Set virtual sensor configuration." );
- for( ; ; );
+ for ( ; ; );
}
log_info( &logger, " Application Task " );
@@ -347,14 +271,14 @@ void application_init ( void )
void application_task ( void )
{
- /*Check interrupt and get and process fifo buffer*/
+ /* Check interrupt and get and process fifo buffer */
if ( smartsens_get_interrupt( &smartsens ) )
{
/* Data from the FIFO is read and the relevant callbacks if registered are called */
if ( smartsens_get_and_process_fifo( &smartsens, work_buffer, WORK_BUFFER_SIZE ) )
{
log_error( &logger, " Get and process fifo." );
- for( ; ; );
+ for ( ; ; );
}
}
}
@@ -369,21 +293,121 @@ void main ( void )
}
}
-static void parse_meta_event ( struct smartsens_fifo_parse_data_info *callback_info,
- void *callback_ref )
+#if EULER
+static void parse_euler ( struct smartsens_fifo_parse_data_info *callback_info, void *callback_ref )
+{
+ struct smartsens_data_orientation data_val;
+ uint8_t *accuracy = ( uint8_t* ) callback_ref;
+ if ( callback_info->data_size != 7 ) /* Check for a valid payload size. Includes sensor ID */
+ {
+ return;
+ }
+ data_val.heading = SMARTSENS_LE2S16( callback_info->data_ptr );
+ data_val.pitch = SMARTSENS_LE2S16( callback_info->data_ptr + 2 );
+ data_val.roll = SMARTSENS_LE2S16( callback_info->data_ptr + 4 );
+ if ( accuracy )
+ {
+ log_printf( &logger, "SID: %s; H: %.3f, P: %.3f, R: %.3f; acc: %u; Time: %lus\r\n",
+ get_sensor_name( callback_info->sensor_id ),
+ ( float ) ( data_val.heading * 360.0f / 32768.0f ),
+ ( float ) ( data_val.pitch * 360.0f / 32768.0f ),
+ ( float ) ( data_val.roll * 360.0f / 32768.0f ),
+ ( uint16_t ) ( *accuracy ),
+ SMARTSENS_TIMESTAMP_TO_SEC( *callback_info->time_stamp ) );
+ }
+ else
+ {
+ log_printf( &logger, "SID: %s; H: %.3f, P: %.3f, R: %.3f; Time: %lus\r\n",
+ get_sensor_name( callback_info->sensor_id ),
+ ( float ) ( data_val.heading * 360.0f / 32768.0f ),
+ ( float ) ( data_val.pitch * 360.0f / 32768.0f ),
+ ( float ) ( data_val.roll * 360.0f / 32768.0f ),
+ SMARTSENS_TIMESTAMP_TO_SEC( *callback_info->time_stamp ) );
+ }
+}
+#elif QUATERNION
+static void parse_quaternion ( struct smartsens_fifo_parse_data_info *callback_info, void *callback_ref )
+{
+ struct smartsens_data_quaternion data_val;
+ if ( callback_info->data_size != 11 ) /* Check for a valid payload size. Includes sensor ID */
+ {
+ return;
+ }
+ data_val.x = SMARTSENS_LE2S16( callback_info->data_ptr );
+ data_val.y = SMARTSENS_LE2S16( callback_info->data_ptr + 2 );
+ data_val.z = SMARTSENS_LE2S16( callback_info->data_ptr + 4 );
+ data_val.w = SMARTSENS_LE2S16( callback_info->data_ptr + 6 );
+ data_val.accuracy = SMARTSENS_LE2U16( callback_info->data_ptr + 8 );
+ log_printf( &logger, "SID: %s; X: %.3f, Y: %.3f, Z: %.3f, W: %.3f; acc: %.2f; Time: %lus\r\n",
+ get_sensor_name( callback_info->sensor_id ),
+ ( float ) ( data_val.x / 16384.0f ),
+ ( float ) ( data_val.y / 16384.0f ),
+ ( float ) ( data_val.z / 16384.0f ),
+ ( float ) ( data_val.w / 16384.0f ),
+ ( float ) ( ( ( data_val.accuracy * 180.0f ) / 16384.0f ) / 3.141592653589793f ),
+ SMARTSENS_TIMESTAMP_TO_SEC( *callback_info->time_stamp ) );
+}
+#elif VECTOR
+static void parse_vector_s16 ( struct smartsens_fifo_parse_data_info *callback_info, void *callback_ref )
+{
+ struct smartsens_data_xyz data_value;
+ if ( callback_ref )
+ {
+ struct parse_ref *parse_table = ( struct parse_ref* ) callback_ref;
+ float scaling_factor = parse_table->sensor[ callback_info->sensor_id ].scaling_factor;
+ data_value.x = SMARTSENS_LE2S16( callback_info->data_ptr );
+ data_value.y = SMARTSENS_LE2S16( callback_info->data_ptr + 2 );
+ data_value.z = SMARTSENS_LE2S16( callback_info->data_ptr + 4 );
+ #if ACCELEROMETER
+ log_printf( &logger, "SID: %s; X: %.3f, Y: %.3f, Z: %.3f; acc: %u; Time: %lus\r\n",
+ get_sensor_name( callback_info->sensor_id ),
+ ( float ) ( data_value.x * scaling_factor ),
+ ( float ) ( data_value.y * scaling_factor ),
+ ( float ) ( data_value.z * scaling_factor ),
+ ( uint16_t ) parse_table->sensor[ callback_info->sensor_id ].accuracy,
+ SMARTSENS_TIMESTAMP_TO_SEC( *callback_info->time_stamp ) );
+ #elif GYROSCOPE
+ log_printf( &logger, "SID: %s; X: %d, Y: %d, Z: %d; acc: %u; Time: %lus\r\n",
+ get_sensor_name( callback_info->sensor_id ),
+ ( int16_t ) ( data_value.x * scaling_factor ),
+ ( int16_t ) ( data_value.y * scaling_factor ),
+ ( int16_t ) ( data_value.z * scaling_factor ),
+ ( uint16_t ) parse_table->sensor[ callback_info->sensor_id ].accuracy,
+ SMARTSENS_TIMESTAMP_TO_SEC( *callback_info->time_stamp ) );
+ #elif MAGNETOMETER
+ log_printf( &logger, "SID: %s; X: %d, Y: %d, Z: %d; acc: %u; Time: %lus\r\n",
+ get_sensor_name( callback_info->sensor_id ),
+ ( int16_t ) ( data_value.x * scaling_factor ),
+ ( int16_t ) ( data_value.y * scaling_factor ),
+ ( int16_t ) ( data_value.z * scaling_factor ),
+ ( uint16_t ) parse_table->sensor[ callback_info->sensor_id ].accuracy,
+ SMARTSENS_TIMESTAMP_TO_SEC( *callback_info->time_stamp ) );
+ #else
+ #error NO_VECTOR_EXAMPLE_DEFINED
+ #endif
+ }
+ else
+ {
+ log_error( &logger, "Null reference" );
+ }
+}
+#else
+ #error NO_EXAMPLE_DEFINED
+#endif
+
+static void parse_meta_event ( struct smartsens_fifo_parse_data_info *callback_info, void *callback_ref )
{
- ( void )callback_ref;
uint8_t meta_event_type = callback_info->data_ptr[ 0 ];
uint8_t byte1 = callback_info->data_ptr[ 1 ];
uint8_t byte2 = callback_info->data_ptr[ 2 ];
- uint8_t *accuracy = ( uint8_t* )callback_ref;
+ uint8_t *accuracy = ( uint8_t* ) callback_ref;
char *event_text;
- if ( callback_info->sensor_id == SMARTSENS_SYS_ID_META_EVENT )
+ if ( SMARTSENS_SYS_ID_META_EVENT == callback_info->sensor_id )
{
event_text = "[META EVENT]";
}
- else if ( callback_info->sensor_id == SMARTSENS_SYS_ID_META_EVENT_WU )
+ else if ( SMARTSENS_SYS_ID_META_EVENT_WU == callback_info->sensor_id )
{
event_text = "[META EVENT WAKE UP]";
}
@@ -666,7 +690,8 @@ static char* get_sensor_name ( uint8_t sensor_id )
}
case SMARTSENS_SENSOR_ID_STC:
{
-
+ ret = "Step counter";
+ break;
}
case SMARTSENS_SENSOR_ID_STC_WU:
{
@@ -869,129 +894,4 @@ static char* get_sensor_name ( uint8_t sensor_id )
return ret;
}
-static void time_to_s_ns ( uint32_t time_ticks, uint32_t *s, uint32_t *ns )
-{
- uint32_t timestamp = time_ticks; /* Store the last timestamp */
-
- timestamp = timestamp * 15625; /* timestamp is now in nanoseconds */
- *s = ( uint32_t )( timestamp / UINT32_C( 1000000000 ) );
- *ns = ( uint32_t )( timestamp - ( ( *s ) * UINT32_C( 1000000000 ) ) );
-}
-
-#if EULAR
-static void parse_euler ( struct smartsens_fifo_parse_data_info *callback_info,
- void *callback_ref )
-{
- ( void )callback_ref;
- struct smartsens_data_orientation data_val;
- uint32_t s, ns;
- uint8_t *accuracy = ( uint8_t* )callback_ref;
- if ( callback_info->data_size != 7 ) /* Check for a valid payload size. Includes sensor ID */
- {
- return;
- }
-
- smartsens_parse_orientation( callback_info->data_ptr, &data_val );
- time_to_s_ns( *callback_info->time_stamp, &s, &ns );
-
- if ( accuracy )
- {
- log_printf( &logger, "SID: %s; T: %u; h: %f, p: %f, r: %f; acc: %u\r\n",
- get_sensor_name( callback_info->sensor_id ),
- s,
- data_val.heading * 360.0f / 32768.0f,
- data_val.pitch * 360.0f / 32768.0f,
- data_val.roll * 360.0f / 32768.0f,
- *accuracy );
- }
- else
- {
- log_printf( &logger, "SID: %s; T: %u; h: %f, p: %f, r: %f\r\n",
- get_sensor_name( callback_info->sensor_id ),
- s,
- data_val.heading * 360.0f / 32768.0f,
- data_val.pitch * 360.0f / 32768.0f,
- data_val.roll * 360.0f / 32768.0f );
- }
-}
-
-static void smartsens_parse_orientation ( uint8_t *data_val, struct smartsens_data_orientation *orientation )
-{
- orientation->heading = SMARTSENS_LE2S16( data_val );
- orientation->pitch = SMARTSENS_LE2S16( data_val + 2 );
- orientation->roll = SMARTSENS_LE2S16( data_val + 4 );
-}
-#elif QUATERNION
-static void parse_quaternion ( struct smartsens_fifo_parse_data_info *callback_info, void *callback_ref )
-{
- ( void )callback_ref;
- struct smartsens_data_quaternion data_val;
- uint32_t s, ns;
- if ( callback_info->data_size != 11 ) /* Check for a valid payload size. Includes sensor ID */
- {
- return;
- }
-
- smartsens_parse_quaternion(callback_info->data_ptr, &data_val);
- time_to_s_ns( *callback_info->time_stamp, &s, &ns );
-
- log_printf( &logger, "SID: %s; T: %u; x: %f, y: %f, z: %f, w: %f; acc: %.2f\r\n",
- get_sensor_name( callback_info->sensor_id ),
- s,
- data_val.x / 16384.0f,
- data_val.y / 16384.0f,
- data_val.z / 16384.0f,
- data_val.w / 16384.0f,
- ( ( data_val.accuracy * 180.0f ) / 16384.0f ) / 3.141592653589793f );
-}
-
-static void smartsens_parse_quaternion ( uint8_t *data_val, struct smartsens_data_quaternion *quaternion )
-{
- quaternion->x = SMARTSENS_LE2S16( data_val );
- quaternion->y = SMARTSENS_LE2S16( data_val + 2 );
- quaternion->z = SMARTSENS_LE2S16( data_val + 4 );
- quaternion->w = SMARTSENS_LE2S16( data_val + 6 );
- quaternion->accuracy = SMARTSENS_LE2S16( data_val + 8 );
-}
-#elif VECTOR
-static void parse_3axis_s16 ( struct smartsens_fifo_parse_data_info *callback_info, void *callback_ref )
-{
- struct smartsens_data_xyz data_value;
- uint32_t s, ns;
-
- if ( callback_ref )
- {
- struct parse_ref *parse_table = (struct parse_ref*)callback_ref;
- verbose = *(parse_table->verbose);
- float scaling_factor;
-
- scaling_factor = parse_table->sensor[ callback_info->sensor_id ].scaling_factor;
-
- smartsens_parse_xyz( callback_info->data_ptr, &data_value );
- time_to_s_ns( *callback_info->time_stamp, &s, &ns );
-
- log_printf( &logger, "SID: %s; T: %u; x: %f, y: %f, z: %f; acc: %u\r\n",
- get_sensor_name( callback_info->sensor_id ),
- s,
- data_value.x * scaling_factor,
- data_value.y * scaling_factor,
- data_value.z * scaling_factor,
- parse_table->sensor[callback_info->sensor_id].accuracy);
- }
- else
- {
- log_error( &logger, "Null reference" );
- }
-}
-
-static void smartsens_parse_xyz ( uint8_t *data_val, struct smartsens_data_xyz *vector )
-{
- vector->x = SMARTSENS_LE2S16( data_val );
- vector->y = SMARTSENS_LE2S16( data_val + 2 );
- vector->z = SMARTSENS_LE2S16( data_val + 4 );
-}
-#else
- #error NO_EXAMPLE_DEFINED
-#endif
-
// ------------------------------------------------------------------------ END
diff --git a/clicks/smartsens/example/manifest.exm b/clicks/smartsens/example/manifest.exm
index 9df21e48f7..bced9a7deb 100644
--- a/clicks/smartsens/example/manifest.exm
+++ b/clicks/smartsens/example/manifest.exm
@@ -2,7 +2,7 @@
"name": "Smart Sens Click",
"description": "Smart Sens Click is a compact add-on board that contains an intelligent sensor hub with an integrated IMU sensor. This board utilizes the BHI260 and BMM150, an environmental sensor and magnetometer from Bosch Sensortech. The BHI260 includes a programmable and powerful 32-bit MCU, a 6-axis IMU, and a robust software framework. In addition to its internal functions, it also performs signal data processing from the BMM150 that performs measurements of the magnetic field in three perpendicular axes.",
"image" : "../../Resources/click_icon.png",
- "toolchain": ["mikrocarm","mikrocpic32"],
+ "toolchain": ["mikrocarm","mikrocpic32","gcc-riscv"],
"hw" : ["click","BHI260","BMM150"],
- "category" : ["Motion"]
+ "category" : ["Click Boards > Sensors > Environmental"]
}
diff --git a/clicks/smartsens/example/memake.txt b/clicks/smartsens/example/memake.txt
deleted file mode 100644
index ec223269c1..0000000000
--- a/clicks/smartsens/example/memake.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-type: executable
-target: example_smartsens
-
-depends: {
- MikroC.Core
- MikroSDK.Board
- MikroSDK.Log
- Click.SmartSens
-}
-
-sources: {
- main.c
-}
diff --git a/clicks/smartsens/lib/memake.txt b/clicks/smartsens/lib/memake.txt
deleted file mode 100644
index 0662a8a24c..0000000000
--- a/clicks/smartsens/lib/memake.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-type: library
-target: lib_smartsens
-
-#begin python
-import re
-
-if ( re.match("(^PIC18F(.+)[KQ]4[23]$)|(^PIC32(.+)$)",MEMAKE_MCU_NAME) ):
- sample_mode_reg_case = "SAMPLE_REG_CASE_1"
-else:
- sample_mode_reg_case = "SAMPLE_REG_CASE_2"
-#end python
-
-defines: {
- <[sample_mode_reg_case]>
-}
-
-sources: {
- src/smartsens.c
-}
-
-headers: {
- include/smartsens.h
-}
-
-include: {
- include
-}
-
-install: {
- src(include/smartsens.h) dst(include/smartsens.h)
- src(include/spi_specifics.h) dst(include/spi_specifics.h)
- src(include/BHI260AP_BMM150_aux.h) dst(include/BHI260AP_BMM150_aux.h)
- src(include/BHI260AP_BMM150_aux-flash.h) dst(include/BHI260AP_BMM150_aux-flash.h)
-}
-
-expInclude: {
- include
-}
-
-depends: {
- MikroC.Core
- MikroSDK.Driver
-}
-
-others: {
- ../README.md
- ../DETAILS.md
- ../CHANGELOG.md
-}
-
-alias: Click.SmartSens
diff --git a/clicks/smartsens/lib_smartsens/CMakeLists.txt b/clicks/smartsens/lib_smartsens/CMakeLists.txt
new file mode 100644
index 0000000000..511a94f125
--- /dev/null
+++ b/clicks/smartsens/lib_smartsens/CMakeLists.txt
@@ -0,0 +1,34 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(lib_smartsens LANGUAGES MikroC)
+else()
+ project(lib_smartsens LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_library(lib_smartsens STATIC
+ src/smartsens.c
+ include/smartsens.h
+)
+add_library(Click.SmartSens ALIAS lib_smartsens)
+
+if (${MCU_NAME} MATCHES "(^PIC18F(.+)[KQ]4[23]$)|(^PIC32(.+)$)")
+ set(sample_mode_reg_case "SAMPLE_REG_CASE_1")
+else()
+ set(sample_mode_reg_case "SAMPLE_REG_CASE_2")
+endif()
+
+target_compile_definitions(lib_smartsens PUBLIC ${sample_mode_reg_case})
+
+
+target_include_directories(lib_smartsens PUBLIC
+ include
+)
+
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(lib_smartsens PUBLIC MikroC.Core)
+find_package(MikroSDK.Driver REQUIRED)
+target_link_libraries(lib_smartsens PUBLIC MikroSDK.Driver)
diff --git a/clicks/smartsens/lib_smartsens/include/Click.SmartSens b/clicks/smartsens/lib_smartsens/include/Click.SmartSens
new file mode 100644
index 0000000000..c9d4ca5e71
--- /dev/null
+++ b/clicks/smartsens/lib_smartsens/include/Click.SmartSens
@@ -0,0 +1 @@
+#include "smartsens.h"
diff --git a/clicks/smartsens/lib/include/BHI260AP_BMM150_aux.h b/clicks/smartsens/lib_smartsens/include/bhi260ap_bmm150.h
similarity index 99%
rename from clicks/smartsens/lib/include/BHI260AP_BMM150_aux.h
rename to clicks/smartsens/lib_smartsens/include/bhi260ap_bmm150.h
index 412c956e7a..2ec6017dc7 100644
--- a/clicks/smartsens/lib/include/BHI260AP_BMM150_aux.h
+++ b/clicks/smartsens/lib_smartsens/include/bhi260ap_bmm150.h
@@ -1,7 +1,5 @@
-#define FIRMWARE_IMAGE_SIZE 111436
-
-
-const unsigned char smartsens_firmware_image[FIRMWARE_IMAGE_SIZE] = {
+const unsigned char smartsens_firmware_image[ ] =
+{
0x2b, 0x66, 0x0, 0x0, 0x0, 0x0, 0x5a, 0x17, 0x50, 0x84, 0xbf, 0xb3,
0xc9, 0xa2, 0x12, 0x2a, 0xd, 0xea, 0x28, 0xfa, 0x75, 0x9f, 0x6d, 0x3d,
0xa8, 0x8e, 0xd2, 0xbb, 0xfb, 0x95, 0xea, 0xee, 0x81, 0xa0, 0x8f, 0x52,
diff --git a/clicks/smartsens/lib/include/BHI260AP_BMM150_aux-flash.h b/clicks/smartsens/lib_smartsens/include/bhi260ap_bmm150_flash.h
similarity index 99%
rename from clicks/smartsens/lib/include/BHI260AP_BMM150_aux-flash.h
rename to clicks/smartsens/lib_smartsens/include/bhi260ap_bmm150_flash.h
index 098be34dcf..fcff0a1f8b 100644
--- a/clicks/smartsens/lib/include/BHI260AP_BMM150_aux-flash.h
+++ b/clicks/smartsens/lib_smartsens/include/bhi260ap_bmm150_flash.h
@@ -1,7 +1,5 @@
-#define FIRMWARE_IMAGE_SIZE 118684
-
-
-const unsigned char smartsens_firmware_image[FIRMWARE_IMAGE_SIZE] = {
+const unsigned char smartsens_firmware_image[ ] =
+{
0x2b, 0x66, 0x8, 0x0, 0x0, 0x0, 0x5a, 0x17, 0x19, 0x45, 0x66, 0xcc,
0xfb, 0x9, 0x94, 0x57, 0x90, 0xcf, 0x9, 0x50, 0xbf, 0x93, 0x2, 0x7b,
0x18, 0xa4, 0xe0, 0x1b, 0xc6, 0x24, 0x83, 0xa6, 0x9a, 0x59, 0xb6, 0xbb,
diff --git a/clicks/smartsens/lib/include/smartsens.h b/clicks/smartsens/lib_smartsens/include/smartsens.h
similarity index 90%
rename from clicks/smartsens/lib/include/smartsens.h
rename to clicks/smartsens/lib_smartsens/include/smartsens.h
index f43fe291ff..56ce51c9ce 100644
--- a/clicks/smartsens/lib/include/smartsens.h
+++ b/clicks/smartsens/lib_smartsens/include/smartsens.h
@@ -62,13 +62,13 @@ extern "C"{
* @note If you want to use RAM example you need to set flash selectors
* to 0. When RAM selector is being used it will include firmware image
* because it needs to be booted every time on the start of the application.
- * When Flash selector is slected and you already have flash image in your
+ * When Flash selector is selected and you already have flash image in your
* devices flash you can disable flash image slector because you don't need
* to include it in your project.
*/
-#define SMARTSENS_FLASHIMG 0/*< Firmware image for flash include*/
-#define SMARTSENS_FLASH 1/*< Boot firmware from flash*/
-#define SMARTSENS_RAM 0/*< Upload and boot firmware from RAM */
+#define SMARTSENS_FLASHIMG 0 /*< Firmware image for flash include */
+#define SMARTSENS_FLASH 1 /*< Boot firmware from flash */
+#define SMARTSENS_RAM 0 /*< Upload and boot firmware from RAM */
/**
* @brief Smart Sens description register.
@@ -93,7 +93,7 @@ extern "C"{
#define SMARTSENS_REG_USER_VERSION 0x2223
#define SMARTSENS_REG_FEATURE_STATUS 0x24
#define SMARTSENS_REG_BOOT_STATUS 0x25
-#define SMARTSENS_REG_HOST_INTERRUPT_TIMESTAMP 0x26//Start of interrupt state. Length 5 Bytes. [0x26..0x2A]
+#define SMARTSENS_REG_HOST_INTERRUPT_TIMESTAMP 0x26 // Start of interrupt state. Length 5 Bytes. [0x26..0x2A]
#define SMARTSENS_REG_CHIP_ID 0x2B
#define SMARTSENS_REG_INTERRUPT_STATUS 0x2D
#define SMARTSENS_REG_ERROR_VALUE 0x2E
@@ -134,8 +134,8 @@ extern "C"{
* 0x0800..0x0DFF -> Costumer Defined
* 0x0E00..0x0EFF -> Physical Sensor Control Parameters
*/
-//System Parameters
-#define SMARSENS_SYSTEM_PARAMETERS_READ_MASK 0x1000
+// System Parameters
+#define SMARTSENS_CMD_SYSTEM_PARAMETERS_READ_MASK 0x1000
#define SMARTSENS_CMD_META_EVENT_CTRL_NON_WAKE_UP_FIFO 0x0101
#define SMARTSENS_CMD_META_EVENT_CTRL_WAKE_UP_FIFO 0x0102
#define SMARTSENS_CMD_META_EVENT_CTRL_FIFO_CTRL 0x0103
@@ -144,14 +144,14 @@ extern "C"{
#define SMARTSENS_CMD_META_EVENT_CTRL_FRAMEWORK_STATUS 0x0106
#define SMARTSENS_CMD_META_EVENT_CTRL_VIRUAL_SENSOR_PRESENT 0x011F
#define SMARTSENS_CMD_META_EVENT_CTRL_PHYSICAL_SENSOR_PRESENT 0x0120
-#define SMARTSENS_CMD_META_EVENT_CTRL_PHYSICAL_SENSOR_INFO 0x0121//0x0121..0x0160
-//BSX Algorithm Parameters
+#define SMARTSENS_CMD_META_EVENT_CTRL_PHYSICAL_SENSOR_INFO 0x0121 //0x0121..0x0160
+// BSX Algorithm Parameters
#define SMARTSENS_CMD_CALIBRATION_STATE_ACCELEROMETER 0x0201
#define SMARTSENS_CMD_CALIBRATION_STATE_GYROSCOPE 0x0203
#define SMARTSENS_CMD_CALIBRATION_STATE_MAGNETOMETER 0x0205
#define SMARTSENS_CMD_SIC_MATRIX 0x027D
#define SMARTSENS_CMD_BSX_VERSION 0x027E
-
+// Virual Sensor Information Parameters
#define SMARTSENS_CMD_VIRTUAL_SENSOR_INFO 0x0300
/**
@@ -173,7 +173,7 @@ extern "C"{
*/
/**
- * @brief Smart Sens virtual sensor ID's.
+ * @brief Smart Sens virtual sensor IDs.
* @details IDs of the virtual sensors of Smart Sens firmware image.
*/
#define SMARTSENS_SENSOR_ID_CUSTOM_START 160
@@ -250,7 +250,7 @@ extern "C"{
#define SMARTSENS_SENSOR_ID_PROX 147 /* Proximity */
#define SMARTSENS_SENSOR_ID_LIGHT_WU 148 /* Light wake up */
#define SMARTSENS_SENSOR_ID_PROX_WU 149 /* Proximity wake up */
-#define SMARTSENS_IS_SYS_ID ( sid ) ( ( sid ) >= 224 )
+#define SMARTSENS_IS_SYS_ID( sid ) ( ( sid ) >= 224 )
#define SMARTSENS_SYS_ID_PADDING 0
#define SMARTSENS_SYS_ID_TS_SMALL_DELTA 251
#define SMARTSENS_SYS_ID_TS_LARGE_DELTA 252
@@ -264,8 +264,8 @@ extern "C"{
#define SMARTSENS_SYS_ID_DEBUG_MSG 250
#define SMARTSENS_SYS_ID_SMARTSENS_LOG_UPDATE_SUB 243
#define SMARTSENS_SYS_ID_SMARTSENS_LOG_DOSTEP 244
-#define SMARTSENS_N_VIRTUAL_SENSOR_MAX 256/*! Maximum no of available virtual sensor */
-#define SMARTSENS_SPECIAL_SENSOR_ID_OFFSET 245/* Special & debug virtual sensor id starts at 245 */
+#define SMARTSENS_N_VIRTUAL_SENSOR_MAX 256 /* Maximum no of available virtual sensor */
+#define SMARTSENS_SPECIAL_SENSOR_ID_OFFSET 245 /* Special & debug virtual sensor id starts at 245 */
/**
* @brief Smart Sens meta event definitions.
@@ -302,14 +302,14 @@ extern "C"{
* @brief Boot status
* @details Boot status masks of the Smart Sens.
*/
-#define SMARTSENS_BOOTSTATUTS_FLASH_DETECTED 0x01
-#define SMARTSENS_BOOTSTATUTS_FLASH_VERIFY_DONE 0x02
-#define SMARTSENS_BOOTSTATUTS_FLASH_VERIFY_ERROR 0x04
-#define SMARTSENS_BOOTSTATUTS_NO_FLASH 0x08
-#define SMARTSENS_BOOTSTATUTS_HOST_INTERFACE_READY 0x10
-#define SMARTSENS_BOOTSTATUTS_HOST_FW_VERIFY_DONE 0x20
-#define SMARTSENS_BOOTSTATUTS_HOST_FW_VERIFY_ERROR 0x40
-#define SMARTSENS_BOOTSTATUTS_HOST_FW_IDLE 0x80
+#define SMARTSENS_BOOTSTATUS_FLASH_DETECTED 0x01
+#define SMARTSENS_BOOTSTATUS_FLASH_VERIFY_DONE 0x02
+#define SMARTSENS_BOOTSTATUS_FLASH_VERIFY_ERROR 0x04
+#define SMARTSENS_BOOTSTATUS_NO_FLASH 0x08
+#define SMARTSENS_BOOTSTATUS_HOST_INTERFACE_READY 0x10
+#define SMARTSENS_BOOTSTATUS_HOST_FW_VERIFY_DONE 0x20
+#define SMARTSENS_BOOTSTATUS_HOST_FW_VERIFY_ERROR 0x40
+#define SMARTSENS_BOOTSTATUS_HOST_FW_IDLE 0x80
/**
* @brief Host status
@@ -343,7 +343,7 @@ extern "C"{
#define SMARTSENS_IS_INT_STATUS( status ) ( status & SMARTSENS_IST_MASK_STATUS )
#define SMARTSENS_IS_INT_ASYNC_STATUS( status ) ( status & SMARTSENS_IST_MASK_DEBUG )
#define SMARTSENS_IS_INT_RESET( status ) ( status & SMARTSENS_IST_MASK_RESET_FAULT )
-#define SMARTSENS_IST_MASK_FIFO (SMARTSENS_IST_MASK_FIFO_W | SMARTSENS_IST_MASK_FIFO_NW )
+#define SMARTSENS_IST_MASK_FIFO ( SMARTSENS_IST_MASK_FIFO_W | SMARTSENS_IST_MASK_FIFO_NW )
#define SMARTSENS_IS_INT_FIFO( status ) ( status & SMARTSENS_IST_MASK_FIFO )
/**
@@ -386,6 +386,7 @@ extern "C"{
( uint32_t )( x )[ 3 ] << 24 ) )
#define SMARTSENS_LE2S32( x ) ( ( int32_t )SMARTSENS_LE2U32( x ) )
#define SMARTSENS_LE2U40( x ) ( SMARTSENS_LE2U32( x ) | ( uint32_t )( x )[ 4 ] << 32 )
+#define SMARTSENS_TIMESTAMP_TO_SEC( x ) ( ( uint32_t ) ( x * ( 15625.0 / UINT32_C( 1000000000 ) ) ) )
/**
* @brief Smart Sens device address setting.
@@ -394,7 +395,6 @@ extern "C"{
*/
#define SMARTSENS_SLAVE_ADDRESS_1 0x29
#define SMARTSENS_SLAVE_ADDRESS_0 0x28
-#define SMARTSENS_SET_DEV_ADDR SMARTSENS_SLAVE_ADDRESS_0
/**
* @brief Data sample selection.
@@ -404,8 +404,8 @@ extern "C"{
* Can be overwritten with @b smartsens_init which will set
* @b SET_SPI_DATA_SAMPLE_MIDDLE by default on the mapped mikrobus.
*/
-#define SMARTSENS_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
-#define SMARTSENS_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
+#define SMARTSENS_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
+#define SMARTSENS_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
/*! @} */ // smartsens_set
@@ -430,7 +430,7 @@ extern "C"{
cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
- cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
+ cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
/*! @} */ // smartsens_map
@@ -476,8 +476,10 @@ struct smartsens_fifo_parse_data_info
* @brief Smart Sens Click driver interface.
* @details Definition of driver interface of Smart Sens Click driver.
*/
-typedef err_t ( *smartsens_master_io_t )( struct smartsens_s*, uint8_t, uint8_t*, uint8_t ); /**< Driver serial interface. */
-typedef void ( *smartsens_fifo_parse_callback_t )( struct smartsens_fifo_parse_data_info *callback_info, void *private_data) ;/**< Driver callback interface. */
+/**< Driver serial interface. */
+typedef err_t ( *smartsens_master_io_t )( struct smartsens_s*, uint8_t, uint8_t*, uint8_t );
+/**< Driver callback interface. */
+typedef void ( *smartsens_fifo_parse_callback_t )( struct smartsens_fifo_parse_data_info *callback_info, void *private_data );
/**
* @brief U16 converter union
@@ -559,20 +561,20 @@ struct smartsens_fifo_buffer
*/
typedef struct smartsens_s
{
- digital_out_t rst; /**< Reset. */
+ digital_out_t rst; /**< Reset pin. */
- digital_in_t int_pin; /**< Interrupt. */
+ digital_in_t int_pin; /**< Interrupt pin. */
- i2c_master_t i2c; /**< I2C driver object. */
- spi_master_t spi; /**< SPI driver object. */
+ i2c_master_t i2c; /**< I2C driver object. */
+ spi_master_t spi; /**< SPI driver object. */
- uint8_t slave_address; /**< Device slave address (used for I2C driver). */
- pin_name_t chip_select; /**< Chip select pin descriptor (used for SPI driver). */
- smartsens_drv_t drv_sel; /**< Master driver interface selector. */
+ uint8_t slave_address; /**< Device slave address (used for I2C driver). */
+ pin_name_t chip_select; /**< Chip select pin descriptor (used for SPI driver). */
+ smartsens_drv_t drv_sel; /**< Master driver interface selector. */
+
+ smartsens_master_io_t write_f; /**< Master write function. */
+ smartsens_master_io_t read_f; /**< Master read function. */
- smartsens_master_io_t write_f; /**< Master write function. */
- smartsens_master_io_t read_f; /**< Master read function. */
-
struct smartsens_fifo_parse_callback_table table[ SMARTSENS_N_VIRTUAL_SENSOR_MAX ];
uint32_t last_time_stamp[ SMARTSENS_FIFO_TYPE_MAX ];
@@ -584,23 +586,23 @@ typedef struct smartsens_s
*/
typedef struct
{
- pin_name_t scl; /**< Clock pin descriptor for I2C driver. */
- pin_name_t sda; /**< Bidirectional data pin descriptor for I2C driver. */
- pin_name_t miso; /**< Master input - slave output pin descriptor for SPI driver. */
- pin_name_t mosi; /**< Master output - slave input pin descriptor for SPI driver. */
- pin_name_t sck; /**< Clock pin descriptor for SPI driver. */
- pin_name_t cs; /**< Chip select pin descriptor for SPI driver. */
- pin_name_t rst; /**< Reset. */
- pin_name_t int_pin; /**< Interrupt. */
+ pin_name_t scl; /**< Clock pin descriptor for I2C driver. */
+ pin_name_t sda; /**< Bidirectional data pin descriptor for I2C driver. */
+ pin_name_t miso; /**< Master input - slave output pin descriptor for SPI driver. */
+ pin_name_t mosi; /**< Master output - slave input pin descriptor for SPI driver. */
+ pin_name_t sck; /**< Clock pin descriptor for SPI driver. */
+ pin_name_t cs; /**< Chip select pin descriptor for SPI driver. */
+ pin_name_t rst; /**< Reset pin. */
+ pin_name_t int_pin; /**< Interrupt pin. */
- uint32_t i2c_speed; /**< I2C serial speed. */
- uint8_t i2c_address; /**< I2C slave address. */
+ uint32_t i2c_speed; /**< I2C serial speed. */
+ uint8_t i2c_address; /**< I2C slave address. */
- uint32_t spi_speed; /**< SPI serial speed. */
- spi_master_mode_t spi_mode; /**< SPI master mode. */
- spi_master_chip_select_polarity_t cs_polarity; /**< Chip select pin polarity. */
+ uint32_t spi_speed; /**< SPI serial speed. */
+ spi_master_mode_t spi_mode; /**< SPI master mode. */
+ spi_master_chip_select_polarity_t cs_polarity; /**< Chip select pin polarity. */
- smartsens_drv_t drv_sel; /**< Master driver interface selector. */
+ smartsens_drv_t drv_sel; /**< Master driver interface selector. */
} smartsens_cfg_t;
@@ -659,6 +661,7 @@ void smartsens_drv_interface_selection ( smartsens_cfg_t *cfg, smartsens_drv_t d
* See #smartsens_cfg_t object definition for detailed explanation.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
+ *
* See #err_t definition for detailed explanation.
* @note None.
*/
@@ -672,6 +675,7 @@ err_t smartsens_init ( smartsens_t *ctx, smartsens_cfg_t *cfg );
* See #smartsens_t object definition for detailed explanation.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
+ *
* See #err_t definition for detailed explanation.
* @note This function can consist any necessary configuration or setting to put
* device into operating mode.
@@ -679,7 +683,7 @@ err_t smartsens_init ( smartsens_t *ctx, smartsens_cfg_t *cfg );
err_t smartsens_default_cfg ( smartsens_t *ctx );
/**
- * @brief Data writing function.
+ * @brief Smart Sens data writing function.
* @details This function writes a desired number of data bytes starting from
* the selected register.
* @param[in] ctx : Click context object.
@@ -689,13 +693,14 @@ err_t smartsens_default_cfg ( smartsens_t *ctx );
* @param[in] len : Number of bytes to be written.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
+ *
* See #err_t definition for detailed explanation.
* @note None.
*/
err_t smartsens_generic_write ( smartsens_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len );
/**
- * @brief Data reading function.
+ * @brief Smart Sens data reading function.
* @details This function reads a desired number of data bytes starting from
* the selected register.
* @param[in] ctx : Click context object.
@@ -705,6 +710,7 @@ err_t smartsens_generic_write ( smartsens_t *ctx, uint8_t reg, uint8_t *data_in,
* @param[in] len : Number of bytes to be read.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
+ *
* See #err_t definition for detailed explanation.
* @note None.
*/
@@ -779,7 +785,7 @@ err_t smartsens_cmd_write ( smartsens_t *ctx, uint16_t cmd, uint8_t *cmd_buf, ui
err_t smartsens_status_read ( smartsens_t *ctx, uint16_t *cmd, uint8_t *cmd_buf, uint16_t *cmd_len );
/**
- * @brief Get command parameters resposne.
+ * @brief Get command parameters response.
* @details This function sends command and awaits response from status and debug FIFO.
* @param[in] ctx : Click context object.
* See #smartsens_t object definition for detailed explanation.
@@ -803,7 +809,7 @@ err_t smartsens_get_parameter ( smartsens_t *ctx, uint16_t parameter,
void smartsens_reset ( smartsens_t *ctx );
/**
- * @brief Reset device.
+ * @brief SW Reset device.
* @details This function software resets device by setting reset bit
* in Reset Request register(0x14).
* @param[in] ctx : Click context object.
@@ -847,7 +853,7 @@ err_t smartsens_boot_firmware( smartsens_t *ctx );
/**
* @brief Power on device boot/upload firmware to device.
- * @details This function sends command and it's parameters to the device.
+ * @details This function sends command and its parameters to the device.
* @param[in] ctx : Click context object.
* See #smartsens_t object definition for detailed explanation.
* @return @li @c 0 - Success,
@@ -895,8 +901,7 @@ err_t smartsens_get_virt_sensor_list ( smartsens_t *ctx, uint8_t *sensor_list );
* @li @c -1 - Error.
* See #err_t definition for detailed explanation.
*/
-err_t smartsens_set_virt_sensor_cfg( smartsens_t *ctx, uint8_t sensor_id,
- float sample_rate, uint32_t latency );
+err_t smartsens_set_virt_sensor_cfg( smartsens_t *ctx, uint8_t sensor_id, float sample_rate, uint32_t latency );
/**
* @brief Get and process the FIFO.
@@ -913,7 +918,7 @@ err_t smartsens_get_and_process_fifo ( smartsens_t *ctx, uint8_t *work_buffer, u
/**
* @brief Link a callback to virtual sensor.
* @details Function to link a callback and relevant reference when the
- * sensor event is available in teh FIFO.
+ * sensor event is available in the FIFO.
* @param[in] sensor_id : Sensor ID of the virtal sensor
* @param[in] callback : Reference of the callback function
* @param[in] callback_ref : Reference needed inside the callback function. Can be NULL.
@@ -922,8 +927,8 @@ err_t smartsens_get_and_process_fifo ( smartsens_t *ctx, uint8_t *work_buffer, u
* See #err_t definition for detailed explanation.
*/
err_t smartsens_register_fifo_parse_callback ( smartsens_t *ctx, uint8_t sensor_id,
- smartsens_fifo_parse_callback_t callback,
- void *callback_ref );
+ smartsens_fifo_parse_callback_t callback, void *callback_ref );
+
#ifdef __cplusplus
}
#endif
diff --git a/clicks/smartsens/lib_smartsens/include/spi_specifics.h b/clicks/smartsens/lib_smartsens/include/spi_specifics.h
new file mode 100644
index 0000000000..0bba508c77
--- /dev/null
+++ b/clicks/smartsens/lib_smartsens/include/spi_specifics.h
@@ -0,0 +1,121 @@
+/****************************************************************************
+** Copyright (C) 2021 MikroElektronika d.o.o.
+** Contact: https://www.mikroe.com/contact
+**
+** Permission is hereby granted, free of charge, to any person obtaining a copy
+** of this software and associated documentation files (the "Software"), to deal
+** in the Software without restriction, including without limitation the rights
+** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+** copies of the Software, and to permit persons to whom the Software is
+** furnished to do so, subject to the following conditions:
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
+** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+** USE OR OTHER DEALINGS IN THE SOFTWARE.
+****************************************************************************/
+/*!
+ * @file spi_specifics.h
+ * @brief This file contains SPI specific macros, functions, etc.
+ */
+
+#ifndef _SPI_SPECIFICS_
+#define _SPI_SPECIFICS_
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#include "mcu_definitions.h"
+
+// mikroE toolchain specific
+#if defined(__MIKROC_AI_FOR_PIC__) || defined (__MIKROC_AI_FOR_DSPIC__) || \
+ defined(__MIKROC_AI_FOR_PIC32__)
+
+#ifdef __MIKROC_AI_FOR_PIC__
+ #define BIT_INDEX 7
+#elif defined(__MIKROC_AI_FOR_PIC32__)
+ #define BIT_INDEX 9
+#endif
+
+#ifdef SAMPLE_REG_CASE_1
+ #ifdef __MIKROC_AI_FOR_PIC32__
+ #define SAMPLE_REG_ADDRESS(index) HAL_LL_SPI ## index ## CON_ADDRESS
+ #else
+ #define SAMPLE_REG_ADDRESS(index) HAL_LL_SPI ## index ## CON1_ADDRESS
+ #endif
+#else
+ #define SAMPLE_REG_ADDRESS(index) HAL_LL_SSP ## index ## STAT_ADDRESS
+#endif
+
+#if defined(SPI_MODULE) || defined(SPI_MODULE_1)
+ #define SET_SPI_DATA_SAMPLE_MIDDLE1 clear_reg_bit(SAMPLE_REG_ADDRESS(1), BIT_INDEX);
+ #define SET_SPI_DATA_SAMPLE_EDGE1 set_reg_bit(SAMPLE_REG_ADDRESS(1), BIT_INDEX);
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE1
+ #define SET_SPI_DATA_SAMPLE_EDGE1
+#endif
+
+#ifdef SPI_MODULE_2
+ #define SET_SPI_DATA_SAMPLE_MIDDLE2 clear_reg_bit(SAMPLE_REG_ADDRESS(2), BIT_INDEX);
+ #define SET_SPI_DATA_SAMPLE_EDGE2 set_reg_bit(SAMPLE_REG_ADDRESS(2), BIT_INDEX);
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE2
+ #define SET_SPI_DATA_SAMPLE_EDGE2
+#endif
+
+#ifdef SPI_MODULE_3
+ #define SET_SPI_DATA_SAMPLE_MIDDLE3 clear_reg_bit(SAMPLE_REG_ADDRESS(3), BIT_INDEX);
+ #define SET_SPI_DATA_SAMPLE_EDGE3 set_reg_bit(SAMPLE_REG_ADDRESS(3), BIT_INDEX);
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE3
+ #define SET_SPI_DATA_SAMPLE_EDGE3
+#endif
+
+#ifdef SPI_MODULE_4
+ #define SET_SPI_DATA_SAMPLE_MIDDLE4 clear_reg_bit(SAMPLE_REG_ADDRESS(4), BIT_INDEX);
+ #define SET_SPI_DATA_SAMPLE_EDGE4 set_reg_bit(SAMPLE_REG_ADDRESS(4), BIT_INDEX);
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE4
+ #define SET_SPI_DATA_SAMPLE_EDGE4
+#endif
+
+#ifdef SPI_MODULE_5
+ #define SET_SPI_DATA_SAMPLE_MIDDLE5 clear_reg_bit(SAMPLE_REG_ADDRESS(5), BIT_INDEX);
+ #define SET_SPI_DATA_SAMPLE_EDGE5 set_reg_bit(SAMPLE_REG_ADDRESS(5), BIT_INDEX);
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE5
+ #define SET_SPI_DATA_SAMPLE_EDGE5
+#endif
+
+#ifdef SPI_MODULE_6
+ #define SET_SPI_DATA_SAMPLE_MIDDLE6 clear_reg_bit(SAMPLE_REG_ADDRESS(6), BIT_INDEX);
+ #define SET_SPI_DATA_SAMPLE_EDGE6 set_reg_bit(SAMPLE_REG_ADDRESS(6), BIT_INDEX);
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE6
+ #define SET_SPI_DATA_SAMPLE_EDGE6
+#endif
+
+
+#define SET_SPI_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE1 SET_SPI_DATA_SAMPLE_MIDDLE2 \
+ SET_SPI_DATA_SAMPLE_MIDDLE3 SET_SPI_DATA_SAMPLE_MIDDLE4 \
+ SET_SPI_DATA_SAMPLE_MIDDLE5 SET_SPI_DATA_SAMPLE_MIDDLE6
+#define SET_SPI_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE1 SET_SPI_DATA_SAMPLE_EDGE2 \
+ SET_SPI_DATA_SAMPLE_EDGE3 SET_SPI_DATA_SAMPLE_EDGE4 \
+ SET_SPI_DATA_SAMPLE_EDGE5 SET_SPI_DATA_SAMPLE_EDGE6
+#else
+ #define SET_SPI_DATA_SAMPLE_MIDDLE
+ #define SET_SPI_DATA_SAMPLE_EDGE
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif // _SPI_SPECIFICS_
+
+// ------------------------------------------------------------------------ END
diff --git a/clicks/smartsens/lib/src/smartsens.c b/clicks/smartsens/lib_smartsens/src/smartsens.c
similarity index 81%
rename from clicks/smartsens/lib/src/smartsens.c
rename to clicks/smartsens/lib_smartsens/src/smartsens.c
index 25ee5161f6..b6fe2ccd10 100644
--- a/clicks/smartsens/lib/src/smartsens.c
+++ b/clicks/smartsens/lib_smartsens/src/smartsens.c
@@ -28,11 +28,11 @@
#include "smartsens.h"
#if SMARTSENS_FLASH && SMARTSENS_FLASHIMG
-#include "BHI260AP_BMM150_aux-flash.h"
+#include "bhi260ap_bmm150_flash.h"
#elif SMARTSENS_FLASH
const unsigned char smartsens_firmware_image[ ] = { 0 };
#elif SMARTSENS_RAM
-#include "BHI260AP_BMM150_aux.h"
+#include "bhi260ap_bmm150.h"
#else
#error FIRMWARE_SOURCE_DEFINED
#endif
@@ -86,7 +86,9 @@ static const uint8_t smartsens_sysid_event_size[ 11 ] = { 2, 3, 6, 4, 0, 18, 2,
* @param[in] len : Number of bytes to be written.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
+ *
* See #err_t definition for detailed explanation.
+ * @note None.
*/
static err_t smartsens_i2c_write ( smartsens_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len );
@@ -101,7 +103,9 @@ static err_t smartsens_i2c_write ( smartsens_t *ctx, uint8_t reg, uint8_t *data_
* @param[in] len : Number of bytes to be read.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
+ *
* See #err_t definition for detailed explanation.
+ * @note None.
*/
static err_t smartsens_i2c_read ( smartsens_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len );
@@ -116,7 +120,9 @@ static err_t smartsens_i2c_read ( smartsens_t *ctx, uint8_t reg, uint8_t *data_o
* @param[in] len : Number of bytes to be written.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
+ *
* See #err_t definition for detailed explanation.
+ * @note None.
*/
static err_t smartsens_spi_write ( smartsens_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len );
@@ -131,7 +137,9 @@ static err_t smartsens_spi_write ( smartsens_t *ctx, uint8_t reg, uint8_t *data_
* @param[in] len : Number of bytes to be read.
* @return @li @c 0 - Success,
* @li @c -1 - Error.
+ *
* See #err_t definition for detailed explanation.
+ * @note None.
*/
static err_t smartsens_spi_read ( smartsens_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len );
@@ -147,7 +155,7 @@ static err_t smartsens_spi_read ( smartsens_t *ctx, uint8_t reg, uint8_t *data_o
* See #err_t definition for detailed explanation.
*/
static err_t smartsens_hif_get_sensor_info ( smartsens_t *ctx, uint8_t sensor_id,
- struct smartsens_sensor_info *info );
+ struct smartsens_sensor_info *info );
/**
* @brief Configure a virtual sensor.
@@ -162,7 +170,7 @@ static err_t smartsens_hif_get_sensor_info ( smartsens_t *ctx, uint8_t sensor_id
* See #err_t definition for detailed explanation.
*/
static err_t smartsens_hif_exec_sensor_conf_cmd ( smartsens_t *ctx, uint8_t sensor_id,
- float sample_rate, uint32_t latency );
+ float sample_rate, uint32_t latency );
/**
* @brief Get data from the Non-wake-up/wake-up FIFO
@@ -190,7 +198,7 @@ static err_t smartsens_hif_get_fifo ( smartsens_t *ctx, uint8_t reg, uint8_t *fi
* See #err_t definition for detailed explanation.
*/
static err_t parse_fifo ( smartsens_t *ctx, enum smartsens_fifo_type source,
- struct smartsens_fifo_buffer *fifo_p );
+ struct smartsens_fifo_buffer *fifo_p );
/**
* @brief Get callback information.
@@ -203,8 +211,8 @@ static err_t parse_fifo ( smartsens_t *ctx, enum smartsens_fifo_type source,
* @li @c -1 - Error.
* See #err_t definition for detailed explanation.
*/
-static err_t get_callback_info ( smartsens_t *ctx, uint8_t sensor_id,
- struct smartsens_fifo_parse_callback_table *info );
+static err_t get_callback_info ( smartsens_t *ctx, uint8_t sensor_id,
+ struct smartsens_fifo_parse_callback_table *info );
/**
* @brief Get buffer status.
@@ -218,8 +226,7 @@ static err_t get_callback_info ( smartsens_t *ctx, uint8_t sensor_id,
* @li @c -1 - Error.
* See #err_t definition for detailed explanation.
*/
-static err_t get_buffer_status ( struct smartsens_fifo_buffer *fifo_p, uint8_t event_size,
- buffer_status_t *status );
+static err_t get_buffer_status ( struct smartsens_fifo_buffer *fifo_p, uint8_t event_size, buffer_status_t *status );
/**
* @brief Get time stamp.
@@ -242,11 +249,11 @@ void smartsens_cfg_setup ( smartsens_cfg_t *cfg )
cfg->miso = HAL_PIN_NC;
cfg->mosi = HAL_PIN_NC;
cfg->cs = HAL_PIN_NC;
- cfg->rst = HAL_PIN_NC;
+ cfg->rst = HAL_PIN_NC;
cfg->int_pin = HAL_PIN_NC;
cfg->i2c_speed = I2C_MASTER_SPEED_STANDARD;
- cfg->i2c_address = SMARTSENS_SET_DEV_ADDR;
+ cfg->i2c_address = SMARTSENS_SLAVE_ADDRESS_0;
cfg->spi_speed = 100000;
cfg->spi_mode = SPI_MASTER_MODE_0;
@@ -293,7 +300,7 @@ err_t smartsens_init ( smartsens_t *ctx, smartsens_cfg_t *cfg )
ctx->read_f = smartsens_i2c_read;
ctx->write_f = smartsens_i2c_write;
- digital_out_t chip_select;
+ digital_out_t chip_select;
digital_out_init( &chip_select, cfg->cs );
digital_out_high( &chip_select );
}
@@ -340,81 +347,69 @@ err_t smartsens_init ( smartsens_t *ctx, smartsens_cfg_t *cfg )
digital_in_init( &ctx->int_pin, cfg->int_pin );
- return 0;
+ return SMARTSENS_OK;
}
err_t smartsens_default_cfg ( smartsens_t *ctx )
{
- err_t error_flag = SMARTSENS_OK;
uint8_t read_data = 0;
uint8_t work_buffer[ 2 ] = { 0 };
- /*HW reset*/
+ /* HW reset */
smartsens_reset( ctx );
+ /* Chip ID */
+ smartsens_byte_read( ctx, SMARTSENS_REG_CHIP_ID, &read_data );
+ if ( SMARTSENS_CHIP_ID_VALUE != read_data )
+ {
+ return SMARTSENS_ERROR;
+ }
+ /* Product ID */
+ smartsens_byte_read( ctx, SMARTSENS_REG_FUSER2_PRODUCT_ID, &read_data );
+ if ( SMARTSENS_FUSER2_PRODUCT_ID_VALUE != read_data )
+ {
+ return SMARTSENS_ERROR;
+ }
+ /* SW Reset */
+ smartsens_sw_reset( ctx );
+ /* Set host interrupt */
+ smartsens_byte_write( ctx, SMARTSENS_REG_HOST_INTERRUPT_CTRL, 0 );
+ /* Set host intefrace */
+ smartsens_byte_write( ctx, SMARTSENS_REG_HOST_INTERFACE_CTRL, 0 );
+ /* Check Boot Status */
+ smartsens_byte_read( ctx, SMARTSENS_REG_BOOT_STATUS, &read_data );
+ if ( !(read_data & SMARTSENS_BOOTSTATUS_HOST_INTERFACE_READY) )
+ {
+ return SMARTSENS_ERROR;
+ }
+ /* Load FW */
+ if ( smartsens_power_on_device( ctx ) )
+ {
+ return SMARTSENS_ERROR;
+ }
+ /* Check Error */
+ smartsens_byte_read( ctx, SMARTSENS_REG_ERROR_VALUE, &read_data );
+ if ( read_data )
+ {
+ return SMARTSENS_ERROR;
+ }
+ /* Wait until host intefrace is ready */
do
{
- /*Chip ID*/
- smartsens_byte_read( ctx, SMARTSENS_REG_CHIP_ID, &read_data );
- if ( SMARTSENS_CHIP_ID_VALUE != read_data )
- {
- error_flag = SMARTSENS_ERROR;
- break;
- }
- /*Product ID*/
- smartsens_byte_read( ctx, SMARTSENS_REG_FUSER2_PRODUCT_ID, &read_data );
- if ( SMARTSENS_FUSER2_PRODUCT_ID_VALUE != read_data )
- {
- error_flag = SMARTSENS_ERROR;
- break;
- }
- /*SW Reset*/
- smartsens_sw_reset( ctx );
- /*Set host interrupt*/
- smartsens_byte_write( ctx, SMARTSENS_REG_HOST_INTERRUPT_CTRL, 0 );
- /*Set host intefrace*/
- smartsens_byte_write( ctx, SMARTSENS_REG_HOST_INTERFACE_CTRL, 0 );
- /*Check Boot Status*/
+ Delay_10ms( );
smartsens_byte_read( ctx, SMARTSENS_REG_BOOT_STATUS, &read_data );
- if ( !(read_data & SMARTSENS_BOOTSTATUTS_HOST_INTERFACE_READY) )
- {
- error_flag = SMARTSENS_ERROR;
- break;
- }
- /*Load FW*/
- if ( smartsens_power_on_device( ctx ) )
- {
- error_flag = SMARTSENS_ERROR;
- break;
- }
- /*Check Error*/
- smartsens_byte_read( ctx, SMARTSENS_REG_ERROR_VALUE, &read_data );
- if ( read_data )
- {
- error_flag = SMARTSENS_ERROR;
- break;
- }
- /*Wait until host intefrace is ready*/
- do
- {
- Delay_10ms( );
- smartsens_byte_read( ctx, SMARTSENS_REG_BOOT_STATUS, &read_data );
- } while ( !( read_data & SMARTSENS_BOOTSTATUTS_HOST_INTERFACE_READY ) );
- /*Check Kernel Vesion*/
- smartsens_generic_read( ctx, SMARTSENS_REG_KERNEL_VERSION, work_buffer, 2 );
- if ( !( work_buffer[ 0 ] | ( ( uint16_t )work_buffer[ 1 ] << 8 ) ) )
- {
- error_flag = SMARTSENS_ERROR;
- break;
- }
- /*Check Featrue Status*/
- smartsens_byte_read( ctx, SMARTSENS_REG_FEATURE_STATUS, &read_data );
- if ( !read_data )
- {
- error_flag = SMARTSENS_ERROR;
- break;
- }
- } while ( 0 );
-
- return error_flag;
+ } while ( !( read_data & SMARTSENS_BOOTSTATUS_HOST_INTERFACE_READY ) );
+ /* Check Kernel Vesion */
+ smartsens_generic_read( ctx, SMARTSENS_REG_KERNEL_VERSION, work_buffer, 2 );
+ if ( !( work_buffer[ 0 ] | ( ( uint16_t )work_buffer[ 1 ] << 8 ) ) )
+ {
+ return SMARTSENS_ERROR;
+ }
+ /* Check Feature Status */
+ smartsens_byte_read( ctx, SMARTSENS_REG_FEATURE_STATUS, &read_data );
+ if ( !read_data )
+ {
+ return SMARTSENS_ERROR;
+ }
+ return SMARTSENS_OK;
}
err_t smartsens_generic_write ( smartsens_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len )
@@ -450,13 +445,13 @@ err_t smartsens_cmd_write ( smartsens_t *ctx, uint16_t cmd, uint8_t *cmd_buf, ui
while( cmd_size % 4 )
{
- cmd_size = ((cmd_size >> 2) + 1) << 2;
+ cmd_size = ( ( cmd_size >> 2 ) + 1 ) << 2;
}
- write_buf[ 0 ] = ( uint8_t )cmd;
- write_buf[ 1 ] = ( uint8_t )( cmd >> 8 );
- write_buf[ 2 ] = ( uint8_t )cmd_len;
- write_buf[ 3 ] = ( uint8_t )( cmd_len >> 8 );
+ write_buf[ 0 ] = ( uint8_t ) cmd;
+ write_buf[ 1 ] = ( uint8_t ) ( cmd >> 8 );
+ write_buf[ 2 ] = ( uint8_t ) cmd_len;
+ write_buf[ 3 ] = ( uint8_t ) ( cmd_len >> 8 );
for ( uint32_t cnt = 4; cnt < cmd_len + 4; cnt++ )
{
@@ -475,7 +470,7 @@ err_t smartsens_status_read ( smartsens_t *ctx, uint16_t *cmd, uint8_t *cmd_buf,
*cmd_len = temp_buf[ 2 ] | ( ( uint16_t )temp_buf[ 3 ] << 8 );
if ( *cmd_len )
{
- ret_val = smartsens_generic_read( ctx, SMARTSENS_REG_STATUS_DEBUG_FIFO, cmd_buf, *cmd_len );
+ ret_val |= smartsens_generic_read( ctx, SMARTSENS_REG_STATUS_DEBUG_FIFO, cmd_buf, *cmd_len );
}
return ret_val;
@@ -483,55 +478,47 @@ err_t smartsens_status_read ( smartsens_t *ctx, uint16_t *cmd, uint8_t *cmd_buf,
err_t smartsens_get_parameter ( smartsens_t *ctx, uint16_t parameter, uint8_t *parameter_buf, uint16_t *parameter_len )
{
- err_t ret_val;
int16_t timeout = 1000;
uint16_t parameter_cpy = parameter;
uint8_t intefrace_ctrl = 0;
uint8_t intefrace_ctrl_save = 0;
- do
+ if ( smartsens_byte_read( ctx, SMARTSENS_REG_HOST_INTERFACE_CTRL, &intefrace_ctrl_save ) )
{
- if ( smartsens_byte_read( ctx, SMARTSENS_REG_HOST_INTERFACE_CTRL, &intefrace_ctrl_save ) )
- {
- ret_val = SMARTSENS_ERROR;
- break;
- }
- else
- {
- intefrace_ctrl &= (uint8_t)(~(SMARTSENS_HIF_CTRL_ASYNC_STATUS_CHANNEL));
- if ( smartsens_byte_write( ctx, SMARTSENS_REG_HOST_INTERFACE_CTRL, intefrace_ctrl ) )
- {
- ret_val = SMARTSENS_ERROR;
- break;
- }
- }
-
- ret_val = smartsens_cmd_write( ctx, parameter | SMARSENS_SYSTEM_PARAMETERS_READ_MASK, NULL, 0 );
- while ( timeout-- && !ret_val )
+ return SMARTSENS_ERROR;
+ }
+ else
+ {
+ intefrace_ctrl &= (uint8_t)(~(SMARTSENS_HIF_CTRL_ASYNC_STATUS_CHANNEL));
+ if ( smartsens_byte_write( ctx, SMARTSENS_REG_HOST_INTERFACE_CTRL, intefrace_ctrl ) )
{
- uint8_t int_status;
- ret_val |= smartsens_byte_read( ctx, SMARTSENS_REG_INTERRUPT_STATUS, &int_status );
- if ( ret_val || ( int_status & SMARTSENS_IST_MASK_STATUS ) )
- {
- break;
- }
- Delay_10ms( );
+ return SMARTSENS_ERROR;
}
- if ( ( timeout < 0 ) || ret_val )
+ }
+
+ err_t ret_val = smartsens_cmd_write( ctx, parameter | SMARTSENS_CMD_SYSTEM_PARAMETERS_READ_MASK, NULL, 0 );
+ while ( timeout-- && !ret_val )
+ {
+ uint8_t int_status;
+ ret_val |= smartsens_byte_read( ctx, SMARTSENS_REG_INTERRUPT_STATUS, &int_status );
+ if ( ret_val || ( int_status & SMARTSENS_IST_MASK_STATUS ) )
{
- ret_val = SMARTSENS_ERROR;
break;
}
-
- ret_val |= smartsens_status_read( ctx, ¶meter_cpy, parameter_buf, parameter_len );
-
- if ( parameter_cpy != parameter )
- {
- ret_val = SMARTSENS_ERROR;
- }
-
- ret_val = smartsens_byte_write( ctx, SMARTSENS_REG_HOST_INTERFACE_CTRL, intefrace_ctrl_save );
-
- } while ( 0 );
+ Delay_10ms( );
+ }
+ if ( ( timeout < 0 ) || ret_val )
+ {
+ return SMARTSENS_ERROR;
+ }
+
+ ret_val |= smartsens_status_read( ctx, ¶meter_cpy, parameter_buf, parameter_len );
+
+ if ( parameter_cpy != parameter )
+ {
+ return SMARTSENS_ERROR;
+ }
+
+ ret_val |= smartsens_byte_write( ctx, SMARTSENS_REG_HOST_INTERFACE_CTRL, intefrace_ctrl_save );
return ret_val;
}
@@ -583,8 +570,10 @@ err_t smartsens_update_firmware ( smartsens_t *ctx )
do
{
smartsens_byte_read( ctx, SMARTSENS_REG_ERROR_VALUE, &status );
- if (status)
+ if ( status )
+ {
return status;
+ }
smartsens_byte_read( ctx, SMARTSENS_REG_INTERRUPT_STATUS, &status );
Delay_10ms( );
} while ( !( status & 0x20 ) );
@@ -592,7 +581,7 @@ err_t smartsens_update_firmware ( smartsens_t *ctx )
volatile uint16_t cmd_len;
volatile uint8_t cmd_buf[ 0xFF ] = { 0 };
smartsens_status_read( ctx, &cmd, cmd_buf, &cmd_len );
- if ( cmd == 0x000F )
+ if ( 0x000F == cmd )
{
return SMARTSENS_ERROR;
}
@@ -632,7 +621,7 @@ err_t smartsens_update_firmware ( smartsens_t *ctx )
smartsens_status_read( ctx, &cmd, cmd_buf, &cmd_len );
- if ( cmd == 0x000F )
+ if ( 0x000F == cmd )
{
ret_val = SMARTSENS_ERROR;
break;
@@ -683,7 +672,7 @@ err_t smartsens_update_firmware ( smartsens_t *ctx )
Delay_10ms( );
smartsens_byte_read( ctx, SMARTSENS_REG_BOOT_STATUS, &status );
- } while ( !( status & SMARTSENS_BOOTSTATUTS_HOST_FW_VERIFY_DONE ) );
+ } while ( !( status & SMARTSENS_BOOTSTATUS_HOST_FW_VERIFY_DONE ) );
#endif
return ret_val;
@@ -709,11 +698,11 @@ err_t smartsens_boot_firmware( smartsens_t *ctx )
Delay_10ms( );
Delay_10ms( );
smartsens_byte_read( ctx, SMARTSENS_REG_BOOT_STATUS, &status );
- }while ( !( status & SMARTSENS_BOOTSTATUTS_FLASH_VERIFY_DONE ) &&
- !( status & SMARTSENS_BOOTSTATUTS_FLASH_VERIFY_ERROR ) &&
- !( status & SMARTSENS_BOOTSTATUTS_HOST_INTERFACE_READY ) );
+ } while ( !( status & SMARTSENS_BOOTSTATUS_FLASH_VERIFY_DONE ) &&
+ !( status & SMARTSENS_BOOTSTATUS_FLASH_VERIFY_ERROR ) &&
+ !( status & SMARTSENS_BOOTSTATUS_HOST_INTERFACE_READY ) );
- if ( status & SMARTSENS_BOOTSTATUTS_FLASH_VERIFY_ERROR )
+ if ( status & SMARTSENS_BOOTSTATUS_FLASH_VERIFY_ERROR )
{
smartsens_reset( ctx );
smartsens_sw_reset( ctx );
@@ -737,7 +726,7 @@ err_t smartsens_boot_firmware( smartsens_t *ctx )
ret_val = SMARTSENS_ERROR;
}
- else if ( status & SMARTSENS_BOOTSTATUTS_FLASH_VERIFY_DONE )
+ else if ( status & SMARTSENS_BOOTSTATUS_FLASH_VERIFY_DONE )
{
ret_val = SMARTSENS_OK;
}
@@ -750,40 +739,32 @@ err_t smartsens_boot_firmware( smartsens_t *ctx )
err_t smartsens_power_on_device( smartsens_t *ctx )
{
err_t ret_val = SMARTSENS_ERROR;
- do
+ if ( smartsens_sw_reset( ctx ) )
{
- if ( smartsens_sw_reset( ctx ) )
+ return SMARTSENS_ERROR;
+ }
+#if ( SMARTSENS_FLASH == 1 ) && ( SMARTSENS_FLASHIMG == 0 )
+ if ( smartsens_boot_firmware( ctx ) )
+#endif
+ {
+ if ( smartsens_update_firmware( ctx ) )
{
- break;
+ return SMARTSENS_ERROR;
}
- #if SMARTSENS_FLASH
- if ( smartsens_boot_firmware( ctx ) )
- #endif
+ else
{
- if ( smartsens_update_firmware( ctx ) )
+ if ( smartsens_boot_firmware( ctx ) )
{
- break;
- }
- else
- {
- if ( smartsens_boot_firmware( ctx ) )
- {
- break;
- }
+ return SMARTSENS_ERROR;
}
}
-
- ret_val = SMARTSENS_OK;
-
- } while ( 0 );
-
- return ret_val;
+ }
+ return SMARTSENS_OK;
}
err_t smartsens_update_virtual_sensor_list ( smartsens_t *ctx )
{
err_t ret_val = SMARTSENS_OK;
-
uint8_t sensor_id;
struct smartsens_sensor_info info;
uint8_t present_buff[ 32 ];
@@ -792,13 +773,13 @@ err_t smartsens_update_virtual_sensor_list ( smartsens_t *ctx )
/* Each bit corresponds to presence of Virtual sensor */
ret_val |= smartsens_get_virt_sensor_list( ctx, present_buff );
- if (ret_val == SMARTSENS_OK)
+ if ( SMARTSENS_OK == ret_val )
{
/* Padding: Sensor id*/
ctx->table[ 0 ].event_size = 1;
for ( sensor_id = 1;
- ( sensor_id < SMARTSENS_SPECIAL_SENSOR_ID_OFFSET ) && ( ret_val == SMARTSENS_OK );
+ ( sensor_id < SMARTSENS_SPECIAL_SENSOR_ID_OFFSET ) && ( SMARTSENS_OK == ret_val );
sensor_id++ )
{
sensor_index = ( uint8_t )( sensor_id / 8.0 );
@@ -807,9 +788,9 @@ err_t smartsens_update_virtual_sensor_list ( smartsens_t *ctx )
if ( present_buff[ sensor_index ] & bit_mask )
{
ret_val = smartsens_hif_get_sensor_info( ctx, sensor_id, &info );
- if ( ret_val == SMARTSENS_OK )
+ if ( SMARTSENS_OK == ret_val )
{
- if ( info.event_size == 0 )
+ if ( 0 == info.event_size )
{
ret_val = SMARTSENS_ERROR;
break;
@@ -837,8 +818,7 @@ err_t smartsens_get_virt_sensor_list ( smartsens_t *ctx, uint8_t *sensor_list )
return smartsens_get_parameter( ctx, SMARTSENS_CMD_META_EVENT_CTRL_VIRUAL_SENSOR_PRESENT, sensor_list, &sensor_len );
}
-err_t smartsens_set_virt_sensor_cfg( smartsens_t *ctx, uint8_t sensor_id,
- float sample_rate, uint32_t latency )
+err_t smartsens_set_virt_sensor_cfg( smartsens_t *ctx, uint8_t sensor_id, float sample_rate, uint32_t latency )
{
return smartsens_hif_exec_sensor_conf_cmd( ctx, sensor_id, sample_rate, latency );
}
@@ -850,12 +830,12 @@ err_t smartsens_get_and_process_fifo( smartsens_t *ctx, uint8_t *work_buffer, ui
err_t rslt;
struct smartsens_fifo_buffer fifos;
- if ( ( ctx == NULL ) || ( work_buffer == NULL ) )
+ if ( ( NULL == ctx ) || ( NULL == work_buffer ) )
{
return SMARTSENS_ERROR;
}
- if ( buffer_size == 0 )
+ if ( 0 == buffer_size )
{
return SMARTSENS_ERROR;
}
@@ -867,7 +847,7 @@ err_t smartsens_get_and_process_fifo( smartsens_t *ctx, uint8_t *work_buffer, ui
fifos.buffer_size = buffer_size;
rslt = smartsens_byte_read( ctx, SMARTSENS_REG_INTERRUPT_STATUS, &int_status_bak );
- if ( rslt != SMARTSENS_OK )
+ if ( SMARTSENS_OK != rslt )
{
return rslt;
}
@@ -875,7 +855,7 @@ err_t smartsens_get_and_process_fifo( smartsens_t *ctx, uint8_t *work_buffer, ui
/* Get and process the Wake up FIFO */
fifos.read_length = 0;
int_status = int_status_bak;
- while ( ( int_status || fifos.remain_length ) && ( rslt == SMARTSENS_OK ) )
+ while ( ( int_status || fifos.remain_length ) && ( SMARTSENS_OK == rslt ) )
{
if ( ( ( SMARTSENS_IS_INT_FIFO_W( int_status ) ) == SMARTSENS_IST_FIFO_W_DRDY ) ||
( ( SMARTSENS_IS_INT_FIFO_W( int_status ) ) == SMARTSENS_IST_FIFO_W_LTCY ) ||
@@ -887,8 +867,8 @@ err_t smartsens_get_and_process_fifo( smartsens_t *ctx, uint8_t *work_buffer, ui
/* Append data into the work_buffer linked through fifos */
rslt = smartsens_hif_get_fifo( ctx, SMARTSENS_REG_WAKE_UP_FIFO,
- &fifos.buffer[ fifos.read_length ], &bytes_read );
- if ( rslt != SMARTSENS_OK )
+ &fifos.buffer[ fifos.read_length ], &bytes_read );
+ if ( SMARTSENS_OK != rslt )
{
return rslt;
}
@@ -913,9 +893,9 @@ err_t smartsens_get_and_process_fifo( smartsens_t *ctx, uint8_t *work_buffer, ui
/* Append data into the work_buffer linked through fifos */
rslt = smartsens_hif_get_fifo( ctx, SMARTSENS_REG_NON_WAKE_UP_FIFO,
- &fifos.buffer[ fifos.read_length ], &bytes_read );
+ &fifos.buffer[ fifos.read_length ], &bytes_read );
- if ( rslt != SMARTSENS_OK )
+ if ( SMARTSENS_OK != rslt )
{
return rslt;
}
@@ -929,14 +909,14 @@ err_t smartsens_get_and_process_fifo( smartsens_t *ctx, uint8_t *work_buffer, ui
/* Get and process the Status fifo */
fifos.read_length = 0;
int_status = int_status_bak;
- while ( ( int_status || fifos.remain_length ) && ( rslt == SMARTSENS_OK ) )
+ while ( ( int_status || fifos.remain_length ) && ( SMARTSENS_OK == rslt ) )
{
if ( ( ( ( SMARTSENS_IS_INT_ASYNC_STATUS( int_status ) ) == SMARTSENS_IST_MASK_DEBUG ) || ( fifos.remain_length ) ) )
{
fifos.read_pos = 0;
rslt = smartsens_hif_get_fifo( ctx, SMARTSENS_REG_STATUS_DEBUG_FIFO,
- &fifos.buffer[fifos.read_length], &bytes_read );
- if ( rslt != SMARTSENS_OK )
+ &fifos.buffer[fifos.read_length], &bytes_read );
+ if ( SMARTSENS_OK != rslt )
{
return rslt;
}
@@ -946,7 +926,6 @@ err_t smartsens_get_and_process_fifo( smartsens_t *ctx, uint8_t *work_buffer, ui
rslt = parse_fifo( ctx, SMARTSENS_FIFO_TYPE_STATUS, &fifos );
int_status = 0;
}
-
return rslt;
}
@@ -954,22 +933,18 @@ err_t smartsens_register_fifo_parse_callback( smartsens_t *ctx, uint8_t sensor_i
smartsens_fifo_parse_callback_t callback,
void *callback_ref )
{
- int8_t rslt = SMARTSENS_OK;
-
- if ( ( ctx == NULL ) || ( callback == NULL ) )
+ if ( ( NULL == ctx ) || ( NULL == callback ) )
{
- rslt = SMARTSENS_ERROR;
+ return SMARTSENS_ERROR;
}
else
{
ctx->table[ sensor_id ].callback = callback;
ctx->table[ sensor_id ].callback_ref = callback_ref;
}
-
- return rslt;
+ return SMARTSENS_OK;
}
-
static err_t smartsens_i2c_write ( smartsens_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len )
{
uint8_t tx_buf[ 257 ] = { 0 };
@@ -1017,9 +992,8 @@ static err_t smartsens_spi_read ( smartsens_t *ctx, uint8_t reg, uint8_t *data_o
}
static err_t smartsens_hif_get_sensor_info ( smartsens_t *ctx, uint8_t sensor_id,
- struct smartsens_sensor_info *info )
+ struct smartsens_sensor_info *info )
{
- err_t rslt;
volatile uint16_t length = 0;
uint8_t bytes[ 28 ];
@@ -1028,16 +1002,16 @@ static err_t smartsens_hif_get_sensor_info ( smartsens_t *ctx, uint8_t sensor_id
/* Checking for a valid sensor ID */
if ( sensor_id > SMARTSENS_SPECIAL_SENSOR_ID_OFFSET )
{
- rslt = SMARTSENS_ERROR;
+ return SMARTSENS_ERROR;
}
else
{
- rslt = smartsens_get_parameter( ctx, ( uint16_t )( SMARTSENS_CMD_VIRTUAL_SENSOR_INFO + sensor_id ), bytes, &length );
- if ( rslt == SMARTSENS_OK )
+ if ( SMARTSENS_OK == smartsens_get_parameter( ctx, ( uint16_t )( SMARTSENS_CMD_VIRTUAL_SENSOR_INFO + sensor_id ),
+ bytes, &length ) )
{
if ( length != 28 )
{
- rslt = SMARTSENS_ERROR;
+ return SMARTSENS_ERROR;
}
else
{
@@ -1072,20 +1046,16 @@ static err_t smartsens_hif_get_sensor_info ( smartsens_t *ctx, uint8_t sensor_id
info->fifo_reserved.u32_val = SMARTSENS_LE2U32( info->fifo_reserved.bytes );
info->fifo_max.u32_val = SMARTSENS_LE2U32( info->fifo_max.bytes );
info->min_rate.u32_val = SMARTSENS_LE2U32( info->min_rate.bytes );
+ return SMARTSENS_OK;
}
}
}
}
- else
- {
- rslt = SMARTSENS_ERROR;
- }
-
- return rslt;
+ return SMARTSENS_ERROR;
}
static err_t smartsens_hif_exec_sensor_conf_cmd ( smartsens_t *ctx, uint8_t sensor_id,
- float sample_rate, uint32_t latency )
+ float sample_rate, uint32_t latency )
{
uint8_t tmp_buf[ 8 ];
union smartsens_hif_float_u32 sample_rate_u;
@@ -1107,19 +1077,19 @@ static err_t smartsens_hif_exec_sensor_conf_cmd ( smartsens_t *ctx, uint8_t sens
static err_t smartsens_hif_get_fifo ( smartsens_t *ctx, uint8_t reg, uint8_t *fifo, uint16_t *bytes_read )
{
- int8_t rslt = SMARTSENS_OK;
+ err_t rslt = SMARTSENS_OK;
uint8_t n_bytes[ 2 ];
uint32_t read_len;
- uint32_t read_write_len;
+ uint32_t read_write_len = 64;
uint32_t offset;
uint32_t bytes_remain;
- if ( ( ctx != NULL ) && ( fifo != NULL ) && ( bytes_read != NULL ) )
+ if ( ( NULL != ctx ) && ( NULL != fifo ) && ( NULL != bytes_read ) )
{
- rslt = smartsens_generic_read( ctx, reg, n_bytes, 2 ); /* Read the the available size */
+ rslt = smartsens_generic_read( ctx, reg, n_bytes, 2 ); /* Read the available size */
bytes_remain = SMARTSENS_LE2U16(n_bytes);
- if ( ( bytes_remain != 0 ) && ( rslt == SMARTSENS_OK ) )
+ if ( bytes_remain && ( SMARTSENS_OK == rslt ) )
{
*bytes_read = bytes_remain;
read_len = *bytes_read;
@@ -1127,7 +1097,7 @@ static err_t smartsens_hif_get_fifo ( smartsens_t *ctx, uint8_t reg, uint8_t *fi
while ( read_len > read_write_len )
{
rslt = smartsens_generic_read( ctx, reg, &fifo[offset], read_write_len );
- if ( rslt != SMARTSENS_OK )
+ if ( SMARTSENS_OK != rslt )
{
break;
}
@@ -1135,7 +1105,7 @@ static err_t smartsens_hif_get_fifo ( smartsens_t *ctx, uint8_t reg, uint8_t *fi
offset += read_write_len;
}
- if ( read_len != 0 )
+ if ( read_len )
{
rslt = smartsens_generic_read( ctx, reg, &fifo[offset], read_len );
}
@@ -1150,25 +1120,23 @@ static err_t smartsens_hif_get_fifo ( smartsens_t *ctx, uint8_t reg, uint8_t *fi
return rslt;
}
-static err_t parse_fifo ( smartsens_t *ctx, enum smartsens_fifo_type source,
- struct smartsens_fifo_buffer *fifo_p )
+static err_t parse_fifo ( smartsens_t *ctx, enum smartsens_fifo_type source, struct smartsens_fifo_buffer *fifo_p )
{
uint8_t tmp_sensor_id = 0;
err_t rslt = SMARTSENS_OK;
- uint16_t i = 0;
uint32_t tmp_read_pos;
struct smartsens_fifo_parse_data_info data_info;
uint32_t *time_stamp;
struct smartsens_fifo_parse_callback_table info;
buffer_status_t status = SMARTSENS_BUFFER_STATUS_OK;
- for ( ; ( fifo_p->read_pos < fifo_p->read_length ) && ( status == SMARTSENS_BUFFER_STATUS_OK ); )
+ for ( ; ( fifo_p->read_pos < fifo_p->read_length ) && ( SMARTSENS_BUFFER_STATUS_OK == status ); )
{
tmp_read_pos = fifo_p->read_pos;
tmp_sensor_id = fifo_p->buffer[tmp_read_pos];
rslt = get_time_stamp( ctx, source, &time_stamp );
- if ( rslt != SMARTSENS_OK )
+ if ( SMARTSENS_OK != rslt )
{
return rslt;
}
@@ -1181,11 +1149,11 @@ static err_t parse_fifo ( smartsens_t *ctx, enum smartsens_fifo_type source,
case SMARTSENS_SYS_ID_TS_SMALL_DELTA_WU:
case SMARTSENS_SYS_ID_TS_SMALL_DELTA:
rslt = get_buffer_status( fifo_p, 2, &status );
- if ( rslt != SMARTSENS_OK )
+ if ( SMARTSENS_OK != rslt )
{
return rslt;
}
- if ( status != SMARTSENS_BUFFER_STATUS_OK )
+ if ( SMARTSENS_BUFFER_STATUS_OK != status )
{
break;
}
@@ -1195,11 +1163,11 @@ static err_t parse_fifo ( smartsens_t *ctx, enum smartsens_fifo_type source,
case SMARTSENS_SYS_ID_TS_LARGE_DELTA:
case SMARTSENS_SYS_ID_TS_LARGE_DELTA_WU:
rslt = get_buffer_status( fifo_p, 3, &status );
- if ( rslt != SMARTSENS_OK )
+ if ( SMARTSENS_OK != rslt )
{
return rslt;
}
- if ( status != SMARTSENS_BUFFER_STATUS_OK )
+ if ( SMARTSENS_BUFFER_STATUS_OK != status )
{
break;
}
@@ -1209,11 +1177,11 @@ static err_t parse_fifo ( smartsens_t *ctx, enum smartsens_fifo_type source,
case SMARTSENS_SYS_ID_TS_FULL:
case SMARTSENS_SYS_ID_TS_FULL_WU:
rslt = get_buffer_status( fifo_p, 6, &status );
- if ( rslt != SMARTSENS_OK )
+ if ( SMARTSENS_OK != rslt )
{
return rslt;
}
- if ( status != SMARTSENS_BUFFER_STATUS_OK )
+ if ( SMARTSENS_BUFFER_STATUS_OK != status )
{
break;
}
@@ -1224,20 +1192,20 @@ static err_t parse_fifo ( smartsens_t *ctx, enum smartsens_fifo_type source,
rslt = get_callback_info( ctx, tmp_sensor_id, &info );
- if ( rslt != SMARTSENS_OK )
+ if ( SMARTSENS_OK != rslt )
{
return rslt;
}
rslt = get_buffer_status( fifo_p, info.event_size, &status );
- if ( rslt != SMARTSENS_OK )
+ if ( SMARTSENS_OK != rslt )
{
return rslt;
}
- if ( status != SMARTSENS_BUFFER_STATUS_OK )
+ if ( SMARTSENS_BUFFER_STATUS_OK != status )
{
break;
}
- if ( info.callback != NULL )
+ if ( NULL != info.callback )
{
/* Read position is incremented by 1 to exclude sensor id */
data_info.data_ptr = &fifo_p->buffer[ tmp_read_pos + 1 ];
@@ -1260,9 +1228,9 @@ static err_t parse_fifo ( smartsens_t *ctx, enum smartsens_fifo_type source,
fifo_p->read_length -= fifo_p->read_pos;
if ( fifo_p->read_length )
{
- for ( i = 0; i < fifo_p->read_length; i++ )
+ for ( uint32_t cnt = 0; cnt < fifo_p->read_length; cnt++ )
{
- fifo_p->buffer[ i ] = fifo_p->buffer[ fifo_p->read_pos + i ];
+ fifo_p->buffer[ cnt ] = fifo_p->buffer[ fifo_p->read_pos + cnt ];
}
}
}
@@ -1271,20 +1239,20 @@ static err_t parse_fifo ( smartsens_t *ctx, enum smartsens_fifo_type source,
}
static err_t get_callback_info ( smartsens_t *ctx, uint8_t sensor_id,
- struct smartsens_fifo_parse_callback_table *info )
+ struct smartsens_fifo_parse_callback_table *info )
{
err_t rslt = SMARTSENS_OK;
- if ( ( ctx != NULL ) && ( info != NULL ) )
+ if ( ( NULL != ctx ) && ( NULL != info ) )
{
*info = ctx->table[ sensor_id ];
- if ( ( sensor_id >= SMARTSENS_SPECIAL_SENSOR_ID_OFFSET ) && ( info->event_size == 0 ) )
+ if ( ( sensor_id >= SMARTSENS_SPECIAL_SENSOR_ID_OFFSET ) && ( 0 == info->event_size ) )
{
info->callback = NULL;
info->callback_ref = NULL;
info->event_size = smartsens_sysid_event_size[ sensor_id - SMARTSENS_SPECIAL_SENSOR_ID_OFFSET ];
}
- if ( ( sensor_id == 0 ) && ( info->event_size == 0 ) )
+ if ( ( 0 == sensor_id ) && ( 0 == info->event_size ) )
{
info->callback = NULL;
info->callback_ref = NULL;
@@ -1309,7 +1277,6 @@ static err_t get_buffer_status ( struct smartsens_fifo_buffer *fifo_p, uint8_t e
{
*status = SMARTSENS_BUFFER_STATUS_RELOAD;
}
-
return SMARTSENS_OK;
}
@@ -1325,7 +1292,6 @@ static err_t get_time_stamp ( smartsens_t *ctx, enum smartsens_fifo_type source,
{
rslt = SMARTSENS_ERROR;
}
-
return rslt;
}
diff --git a/clicks/smartsens/memake.txt b/clicks/smartsens/memake.txt
deleted file mode 100644
index 6e5546b2b0..0000000000
--- a/clicks/smartsens/memake.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-type: subdirs
-
-project: SmartSens
-
-subdirs: {
- lib
- example
-}
diff --git a/clicks/temphum21/CMakeLists.txt b/clicks/temphum21/CMakeLists.txt
new file mode 100644
index 0000000000..ce33678c53
--- /dev/null
+++ b/clicks/temphum21/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(example_temphum21 LANGUAGES MikroC)
+else()
+ project(example_temphum21 LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_executable(example_temphum21
+ example/main.c
+
+)
+
+
+############################ example_temphum21 GENERATED CODE START ###########################
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(example_temphum21 PUBLIC MikroC.Core)
+find_package(MikroSDK.Board REQUIRED)
+target_link_libraries(example_temphum21 PUBLIC MikroSDK.Board)
+find_package(MikroSDK.Log REQUIRED)
+target_link_libraries(example_temphum21 PUBLIC MikroSDK.Log)
+add_subdirectory(lib_temphum21)
+target_link_libraries(example_temphum21 PUBLIC Click.TempHum21)
+############################ example_temphum21 GENERATED CODE END ###########################
diff --git a/clicks/temphum21/README.md b/clicks/temphum21/README.md
index f6b93f89d1..eed1ce5bdb 100644
--- a/clicks/temphum21/README.md
+++ b/clicks/temphum21/README.md
@@ -71,7 +71,7 @@ uint8_t temphum21_get_alh_pin ( temphum21_t *ctx );
### Application Init
-> Initializes the driver and logger.
+> Initializes the driver and performs the click default configuration.
```c
@@ -102,6 +102,12 @@ void application_init ( void )
for ( ; ; );
}
+ if ( TEMPHUM21_ERROR == temphum21_default_cfg ( &temphum21 ) )
+ {
+ log_error( &logger, " Default configuration." );
+ for ( ; ; );
+ }
+
log_info( &logger, " Application Task " );
}
@@ -110,15 +116,27 @@ void application_init ( void )
### Application Task
> Reads the temperature (Celsius) and humidity (Percents) data and displays the results on the USB UART approximately once per second.
+It also checks if any alarm is detected on the humidity measurement.
```c
void application_task ( void )
{
- float temperature, humidity;
+ float temperature = 0;
+ float humidity = 0;
if ( TEMPHUM21_STATUS_NORMAL_OP == temphum21_read_measurement ( &temphum21, &temperature, &humidity ) )
{
+ if ( temphum21_get_all_pin ( &temphum21 ) )
+ {
+ log_info ( &logger, " Alarm LOW detected " );
+ }
+ else if ( temphum21_get_alh_pin ( &temphum21 ) )
+ {
+ log_info ( &logger, " Alarm HIGH detected " );
+ }
+
log_printf ( &logger, " Temperature: %.2f C\r\n", temperature );
log_printf ( &logger, " Humidity: %.2f %%\r\n\n", humidity );
+
Delay_ms ( 1000 );
}
}
diff --git a/clicks/temphum21/changelog.md b/clicks/temphum21/changelog.md
index fb1dd95ea8..086189320b 100644
--- a/clicks/temphum21/changelog.md
+++ b/clicks/temphum21/changelog.md
@@ -1,4 +1,4 @@
## Changelog
-### Version 2.0.0.1
+### Version 2.1.0.1
- Initial release
diff --git a/clicks/temphum21/details.md b/clicks/temphum21/details.md
index 6541061f5d..2757b46fc1 100644
--- a/clicks/temphum21/details.md
+++ b/clicks/temphum21/details.md
@@ -70,7 +70,7 @@ uint8_t temphum21_get_alh_pin ( temphum21_t *ctx );
### Application Init
-> Initializes the driver and logger.
+> Initializes the driver and performs the click default configuration.
```c
@@ -101,6 +101,12 @@ void application_init ( void )
for ( ; ; );
}
+ if ( TEMPHUM21_ERROR == temphum21_default_cfg ( &temphum21 ) )
+ {
+ log_error( &logger, " Default configuration." );
+ for ( ; ; );
+ }
+
log_info( &logger, " Application Task " );
}
@@ -109,15 +115,27 @@ void application_init ( void )
### Application Task
> Reads the temperature (Celsius) and humidity (Percents) data and displays the results on the USB UART approximately once per second.
+It also checks if any alarm is detected on the humidity measurement.
```c
void application_task ( void )
{
- float temperature, humidity;
+ float temperature = 0;
+ float humidity = 0;
if ( TEMPHUM21_STATUS_NORMAL_OP == temphum21_read_measurement ( &temphum21, &temperature, &humidity ) )
{
+ if ( temphum21_get_all_pin ( &temphum21 ) )
+ {
+ log_info ( &logger, " Alarm LOW detected " );
+ }
+ else if ( temphum21_get_alh_pin ( &temphum21 ) )
+ {
+ log_info ( &logger, " Alarm HIGH detected " );
+ }
+
log_printf ( &logger, " Temperature: %.2f C\r\n", temperature );
log_printf ( &logger, " Humidity: %.2f %%\r\n\n", humidity );
+
Delay_ms ( 1000 );
}
}
diff --git a/clicks/temphum21/doc/doxy/Doxyfile.doxy b/clicks/temphum21/doc/doxy/Doxyfile.doxy
index 907550cdfe..0e278e6a18 100644
--- a/clicks/temphum21/doc/doxy/Doxyfile.doxy
+++ b/clicks/temphum21/doc/doxy/Doxyfile.doxy
@@ -58,7 +58,7 @@ PROJECT_LOGO =
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
-OUTPUT_DIRECTORY = ../clicks/temphum21/temp/Help/doc
+OUTPUT_DIRECTORY = ../cmake/temphum21/temp/Help/doc
# 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
@@ -790,9 +790,9 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = ../clicks/temphum21/example \
- ../clicks/temphum21/lib/include \
- ../clicks/temphum21/README.md
+INPUT = ../cmake/temphum21/example \
+ ../cmake/temphum21/lib_temphum21/include \
+ ../cmake/temphum21/README.md
# 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
@@ -910,7 +910,7 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include
# command).
-EXAMPLE_PATH = ../clicks/temphum21/example
+EXAMPLE_PATH = ../cmake/temphum21/example
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
diff --git a/clicks/temphum21/doc/package/manifest.json b/clicks/temphum21/doc/package/manifest.json
index 452ee51eeb..0fb6d51714 100644
--- a/clicks/temphum21/doc/package/manifest.json
+++ b/clicks/temphum21/doc/package/manifest.json
@@ -1,5 +1,5 @@
{
- "architecture": "ARM|PIC|PIC32",
+ "architecture": "ARM|PIC|PIC32|RISC-V|AVR",
"category": "Click Boards > Sensors > Temperature & humidity",
"changelog": "Resources/CHANGELOG.md",
"contains": [
@@ -8,8 +8,7 @@
"examples",
"source_files"
],
- "dependency_list": [
- ],
+ "dependency_list": [],
"details": "Resources/DETAILS.md",
"display_name": "TempHum 21 click",
"example_list": [
@@ -26,9 +25,11 @@
"name": "mikroe.click.temphum21",
"product_link": "https://www.mikroe.com/temphum-21-click",
"short_description": "Temp&Hum 21 Click is a compact add-on board representing temperature and humidity sensing solution. This board features the HIH8130-021-001, a highly accurate, fully-calibrated digital humidity and temperature sensor from Honeywell Sensing and Productivity Solutions. This sensor, characterized by its high accuracy (±2% RH and ±0.5°C over a wide operating temperature range) and high resolution, provides factory-calibrated 14-bit data to the host controller with a configurable I2C interface. It also comes with alarm features with selectable alarm thresholds by an MCU or externally.",
- "supported_compiler": "mikroC AI",
+ "supported_compiler": "mikroC AI|GCC",
"type": "Library",
- "_type":"mikroSDK Library",
- "version": "2.0.0.1"
+ "_type": "mikroSDK Library",
+ "version": "2.1.0.1",
+ "cmake": true,
+ "alias": "Click.TempHum21",
+ "subdir_name": "lib_temphum21"
}
-
diff --git a/clicks/temphum21/example/CMakeLists.txt b/clicks/temphum21/example/CMakeLists.txt
new file mode 100644
index 0000000000..aaa1847d15
--- /dev/null
+++ b/clicks/temphum21/example/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(example_temphum21 LANGUAGES MikroC)
+else()
+ project(example_temphum21 LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_executable(example_temphum21
+ main.c
+
+)
+
+
+############################ example_temphum21 GENERATED CODE START ###########################
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(example_temphum21 PUBLIC MikroC.Core)
+find_package(MikroSDK.Board REQUIRED)
+target_link_libraries(example_temphum21 PUBLIC MikroSDK.Board)
+find_package(MikroSDK.Log REQUIRED)
+target_link_libraries(example_temphum21 PUBLIC MikroSDK.Log)
+add_subdirectory(lib_temphum21)
+target_link_libraries(example_temphum21 PUBLIC Click.TempHum21)
+############################ example_temphum21 GENERATED CODE END ###########################
diff --git a/clicks/temphum21/example/main.c b/clicks/temphum21/example/main.c
index 67e458eea7..6eb8a790d3 100644
--- a/clicks/temphum21/example/main.c
+++ b/clicks/temphum21/example/main.c
@@ -9,11 +9,12 @@
* The demo application is composed of two sections :
*
* ## Application Init
- * Initializes the driver and logger.
+ * Initializes the driver and performs the click default configuration.
*
* ## Application Task
* Reads the temperature (Celsius) and humidity (Percents) data and displays the
- * results on the USB UART approximately once per second.
+ * results on the USB UART approximately once per second. It also checks if any alarm
+ * is detected on the humidity measurement.
*
* @author Stefan Filipovic
*
@@ -53,16 +54,33 @@ void application_init ( void )
for ( ; ; );
}
+ if ( TEMPHUM21_ERROR == temphum21_default_cfg ( &temphum21 ) )
+ {
+ log_error( &logger, " Default configuration." );
+ for ( ; ; );
+ }
+
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
- float temperature, humidity;
+ float temperature = 0;
+ float humidity = 0;
if ( TEMPHUM21_STATUS_NORMAL_OP == temphum21_read_measurement ( &temphum21, &temperature, &humidity ) )
{
+ if ( temphum21_get_all_pin ( &temphum21 ) )
+ {
+ log_info ( &logger, " Alarm LOW detected " );
+ }
+ else if ( temphum21_get_alh_pin ( &temphum21 ) )
+ {
+ log_info ( &logger, " Alarm HIGH detected " );
+ }
+
log_printf ( &logger, " Temperature: %.2f C\r\n", temperature );
log_printf ( &logger, " Humidity: %.2f %%\r\n\n", humidity );
+
Delay_ms ( 1000 );
}
}
diff --git a/clicks/temphum21/example/manifest.exm b/clicks/temphum21/example/manifest.exm
index 0e10d70569..9cf12c0aab 100644
--- a/clicks/temphum21/example/manifest.exm
+++ b/clicks/temphum21/example/manifest.exm
@@ -2,7 +2,7 @@
"name": "TempHum 21 Click",
"description": "Temp&Hum 21 Click is a compact add-on board representing temperature and humidity sensing solution. This board features the HIH8130-021-001, a highly accurate, fully-calibrated digital humidity and temperature sensor from Honeywell Sensing and Productivity Solutions. This sensor, characterized by its high accuracy (±2% RH and ±0.5°C over a wide operating temperature range) and high resolution, provides factory-calibrated 14-bit data to the host controller with a configurable I2C interface. It also comes with alarm features with selectable alarm thresholds by an MCU or externally.",
"image" : "../../Resources/click_icon.png",
- "toolchain": ["mikrocarm","mikrocpic","mikrocpic32"],
+ "toolchain": ["mikrocarm","mikrocpic","mikrocpic32","gcc-riscv","mikrocavr"],
"hw" : ["click","HIH8130-021-001"],
"category" : ["Click Boards > Sensors > Temperature & humidity"]
}
diff --git a/clicks/temphum21/example/memake.txt b/clicks/temphum21/example/memake.txt
deleted file mode 100644
index 61b44f4594..0000000000
--- a/clicks/temphum21/example/memake.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-type: executable
-target: example_temphum21
-
-depends: {
- MikroC.Core
- MikroSDK.Board
- MikroSDK.Log
- Click.TempHum21
-}
-
-sources: {
- main.c
-}
diff --git a/clicks/temphum21/lib/memake.txt b/clicks/temphum21/lib/memake.txt
deleted file mode 100644
index 1c21ccf8d6..0000000000
--- a/clicks/temphum21/lib/memake.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-type: library
-
-target: lib_temphum21
-
-sources: {
- src/temphum21.c
-}
-
-headers: {
- include/temphum21.h
-}
-
-include: {
- include
-}
-
-install: {
- src(include/temphum21.h) dst(include/temphum21.h)
-}
-
-expInclude: {
- include
-}
-
-depends: {
- MikroC.Core
- MikroSDK.Driver
-}
-
-others: {
- ../README.md
- ../DETAILS.md
- ../CHANGELOG.md
-}
-
-alias: Click.TempHum21
diff --git a/clicks/temphum21/lib/src/temphum21.c b/clicks/temphum21/lib/src/temphum21.c
deleted file mode 100644
index 0f8715f246..0000000000
--- a/clicks/temphum21/lib/src/temphum21.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-** Copyright (C) 2020 MikroElektronika d.o.o.
-** Contact: https://www.mikroe.com/contact
-**
-** Permission is hereby granted, free of charge, to any person obtaining a copy
-** of this software and associated documentation files (the "Software"), to deal
-** in the Software without restriction, including without limitation the rights
-** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-** copies of the Software, and to permit persons to whom the Software is
-** furnished to do so, subject to the following conditions:
-** The above copyright notice and this permission notice shall be
-** included in all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
-** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-** USE OR OTHER DEALINGS IN THE SOFTWARE.
-****************************************************************************/
-
-/*!
- * @file temphum21.c
- * @brief TempHum 21 Click Driver.
- */
-
-#include "temphum21.h"
-
-void temphum21_cfg_setup ( temphum21_cfg_t *cfg )
-{
- // Communication gpio pins
- cfg->scl = HAL_PIN_NC;
- cfg->sda = HAL_PIN_NC;
-
- // Additional gpio pins
- cfg->all = HAL_PIN_NC;
- cfg->alh = HAL_PIN_NC;
-
- cfg->i2c_speed = I2C_MASTER_SPEED_STANDARD;
- cfg->i2c_address = TEMPHUM21_SET_DEV_ADDR;
-}
-
-err_t temphum21_init ( temphum21_t *ctx, temphum21_cfg_t *cfg )
-{
- i2c_master_config_t i2c_cfg;
-
- i2c_master_configure_default( &i2c_cfg );
-
- i2c_cfg.scl = cfg->scl;
- i2c_cfg.sda = cfg->sda;
-
- ctx->slave_address = cfg->i2c_address;
-
- if ( I2C_MASTER_ERROR == i2c_master_open( &ctx->i2c, &i2c_cfg ) )
- {
- return I2C_MASTER_ERROR;
- }
-
- if ( I2C_MASTER_ERROR == i2c_master_set_slave_address( &ctx->i2c, ctx->slave_address ) )
- {
- return I2C_MASTER_ERROR;
- }
-
- if ( I2C_MASTER_ERROR == i2c_master_set_speed( &ctx->i2c, cfg->i2c_speed ) )
- {
- return I2C_MASTER_ERROR;
- }
-
- digital_in_init( &ctx->all, cfg->all );
- digital_in_init( &ctx->alh, cfg->alh );
-
- return I2C_MASTER_SUCCESS;
-}
-
-err_t temphum21_request_measurement ( temphum21_t *ctx )
-{
- uint8_t dummy = 0;
- return i2c_master_write( &ctx->i2c, &dummy, 1 );
-}
-
-err_t temphum21_read_measurement ( temphum21_t *ctx, float *temperature, float *humidity )
-{
- uint8_t data_buf[ 4 ];
- err_t error_flag = temphum21_request_measurement ( ctx );
- // The measurement cycle duration is typically 36.65ms for temperature and humidity readings.
- Delay_10ms ( );
- Delay_10ms ( );
- Delay_10ms ( );
- Delay_10ms ( );
- error_flag |= i2c_master_read ( &ctx->i2c, data_buf, 4 );
- uint16_t raw_data = ( ( ( uint16_t ) data_buf[ 0 ] << 8 ) | data_buf[ 1 ] ) & TEMPHUM21_DATA_RES;
- *humidity = ( float ) raw_data / TEMPHUM21_DATA_RES * TEMPHUM21_HUM_RES;
- raw_data = ( ( ( uint16_t ) data_buf[ 2 ] << 6 ) | ( data_buf[ 3 ] >> 2 ) ) & TEMPHUM21_DATA_RES;
- *temperature = ( float ) raw_data / TEMPHUM21_DATA_RES * TEMPHUM21_TEMP_RES - TEMPHUM21_TEMP_OFFSET;
- if ( TEMPHUM21_OK == error_flag )
- {
- error_flag = ( data_buf[ 0 ] >> 6 ) & TEMPHUM21_STATUS_BIT_MASK; // status bits
- }
- return error_flag;
-}
-
-uint8_t temphum21_get_all_pin ( temphum21_t *ctx )
-{
- return digital_in_read ( &ctx->all );
-}
-
-uint8_t temphum21_get_alh_pin ( temphum21_t *ctx )
-{
- return digital_in_read ( &ctx->alh );
-}
-
-// ------------------------------------------------------------------------- END
diff --git a/clicks/temphum21/lib_temphum21/CMakeLists.txt b/clicks/temphum21/lib_temphum21/CMakeLists.txt
new file mode 100644
index 0000000000..2e07ae201c
--- /dev/null
+++ b/clicks/temphum21/lib_temphum21/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(lib_temphum21 LANGUAGES MikroC)
+else()
+ project(lib_temphum21 LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_library(lib_temphum21 STATIC
+ src/temphum21.c
+ include/temphum21.h
+)
+add_library(Click.TempHum21 ALIAS lib_temphum21)
+
+
+
+target_include_directories(lib_temphum21 PUBLIC
+ include
+)
+
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(lib_temphum21 PUBLIC MikroC.Core)
+find_package(MikroSDK.Driver REQUIRED)
+target_link_libraries(lib_temphum21 PUBLIC MikroSDK.Driver)
diff --git a/clicks/temphum21/lib_temphum21/include/Click.TempHum21 b/clicks/temphum21/lib_temphum21/include/Click.TempHum21
new file mode 100644
index 0000000000..87ca0b185b
--- /dev/null
+++ b/clicks/temphum21/lib_temphum21/include/Click.TempHum21
@@ -0,0 +1 @@
+#include "temphum21.h"
diff --git a/clicks/temphum21/lib/include/temphum21.h b/clicks/temphum21/lib_temphum21/include/temphum21.h
similarity index 56%
rename from clicks/temphum21/lib/include/temphum21.h
rename to clicks/temphum21/lib_temphum21/include/temphum21.h
index a6c1efa604..43329f68f2 100644
--- a/clicks/temphum21/lib/include/temphum21.h
+++ b/clicks/temphum21/lib_temphum21/include/temphum21.h
@@ -42,6 +42,33 @@ extern "C"{
* @{
*/
+/**
+ * @defgroup temphum21_reg TempHum 21 Registers List
+ * @brief List of registers of TempHum 21 Click driver.
+ */
+
+/**
+ * @addtogroup temphum21_reg
+ * @{
+ */
+
+/**
+ * @brief TempHum 21 register list.
+ * @details Specified register for description of TempHum 21 Click driver.
+ */
+#define TEMPHUM21_REG_ALARM_HIGH_ON 0x18
+#define TEMPHUM21_REG_ALARM_HIGH_OFF 0x19
+#define TEMPHUM21_REG_ALARM_LOW_ON 0x1A
+#define TEMPHUM21_REG_ALARM_LOW_OFF 0x1B
+#define TEMPHUM21_REG_CUST_CONFIG 0x1C
+#define TEMPHUM21_REG_CUST_ID2 0x1E
+#define TEMPHUM21_REG_CUST_ID3 0x1F
+#define TEMPHUM21_CMD_WRITE_EEPROM 0x40
+#define TEMPHUM21_CMD_START_NOM 0x80
+#define TEMPHUM21_CMD_START_CM 0xA0
+
+/*! @} */ // temphum21_reg
+
/**
* @defgroup temphum21_set TempHum 21 Registers Settings
* @brief Settings for registers of TempHum 21 Click driver.
@@ -53,13 +80,22 @@ extern "C"{
*/
/**
- * @brief TempHum 21 status bits.
- * @details Specified status bits description of TempHum 21 Click driver.
+ * @brief TempHum 21 status/diagnostic/response bits.
+ * @details Specified status/diagnostic/response bits description of TempHum 21 Click driver.
*/
#define TEMPHUM21_STATUS_NORMAL_OP 0x00
-#define TEMPHUM21_STATUS_STALE_DATA 0x01
-#define TEMPHUM21_STATUS_COMMAND_MODE 0x02
-#define TEMPHUM21_STATUS_BIT_MASK 0x03
+#define TEMPHUM21_STATUS_STALE_DATA 0x40
+#define TEMPHUM21_STATUS_COMMAND_MODE 0x80
+#define TEMPHUM21_STATUS_BIT_MASK 0xC0
+#define TEMPHUM21_DIAGNOSTIC_CORR_EP_ERR 0x04
+#define TEMPHUM21_DIAGNOSTIC_UNCORR_EP_ERR 0x08
+#define TEMPHUM21_DIAGNOSTIC_RAM_PAR_ERR 0x10
+#define TEMPHUM21_DIAGNOSTIC_CONFIG_ERR 0x20
+#define TEMPHUM21_DIAGNOSTIC_BIT_MASK 0x3C
+#define TEMPHUM21_RESPONSE_BUSY 0x00
+#define TEMPHUM21_RESPONSE_ACK 0x01
+#define TEMPHUM21_RESPONSE_NACK 0x02
+#define TEMPHUM21_RESPONSE_BIT_MASK 0x03
/**
* @brief TempHum 21 measurement calculation values.
@@ -70,6 +106,15 @@ extern "C"{
#define TEMPHUM21_TEMP_OFFSET 40.0
#define TEMPHUM21_HUM_RES 100.0
+/**
+ * @brief TempHum 21 alarm configuration values.
+ * @details Specified alarm configuration values of TempHum 21 Click driver.
+ */
+#define TEMPHUM21_ALARM_HIGH_ON_80PCT 0x3333
+#define TEMPHUM21_ALARM_HIGH_OFF_75PCT 0x3000
+#define TEMPHUM21_ALARM_LOW_ON_20PCT 0x0CCD
+#define TEMPHUM21_ALARM_LOW_OFF_25PCT 0x1000
+
/**
* @brief TempHum 21 device address setting.
* @details Specified setting for device slave address selection of
@@ -96,6 +141,7 @@ extern "C"{
#define TEMPHUM21_MAP_MIKROBUS( cfg, mikrobus ) \
cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
+ cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
cfg.all = MIKROBUS( mikrobus, MIKROBUS_AN ); \
cfg.alh = MIKROBUS( mikrobus, MIKROBUS_INT )
@@ -108,6 +154,9 @@ extern "C"{
*/
typedef struct
{
+ // Output pins
+ digital_out_t en; /**< Enable device pin. */
+
// Input pins
digital_in_t all; /**< Alarm low. */
digital_in_t alh; /**< Alarm high. */
@@ -129,6 +178,7 @@ typedef struct
pin_name_t scl; /**< Clock pin descriptor for I2C driver. */
pin_name_t sda; /**< Bidirectional data pin descriptor for I2C driver. */
+ pin_name_t en; /**< Enable device pin. */
pin_name_t all; /**< Alarm low. */
pin_name_t alh; /**< Alarm high. */
@@ -180,6 +230,20 @@ void temphum21_cfg_setup ( temphum21_cfg_t *cfg );
*/
err_t temphum21_init ( temphum21_t *ctx, temphum21_cfg_t *cfg );
+/**
+ * @brief TempHum 21 default configuration function.
+ * @details This function executes a default configuration of TempHum 21
+ * click board.
+ * @param[in] ctx : Click context object.
+ * See #temphum21_t object definition for detailed explanation.
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note This function can consist any necessary configuration or setting to put
+ * device into operating mode.
+ */
+err_t temphum21_default_cfg ( temphum21_t *ctx );
+
/**
* @brief TempHum 21 request measurement function.
* @details This function sends a request mesurement command.
@@ -200,11 +264,11 @@ err_t temphum21_request_measurement ( temphum21_t *ctx );
* See #temphum21_t object definition for detailed explanation.
* @param[out] temperature : Temperature in Celsius.
* @param[out] humidity : Relative humidity in Percents.
- * @return @li @c 2 - Device in Command Mode - Command Mode is used for programming the sensor.
- * @li @c 1 - Stale Data: Data that has already been fetched since the last measurement cycle, or
- * data fetched before the first measurement has been completed.
- * @li @c 0 - Normal Operation, Valid Data that has not been fetched since the last measurement cycle.
- * @li @c -1 - Error.
+ * @return @li @c 0x80 - Device in Command Mode - Command Mode is used for programming the sensor.
+ * @li @c 0x40 - Stale Data: Data that has already been fetched since the last measurement cycle, or
+ * data fetched before the first measurement has been completed.
+ * @li @c 0x00 - Normal Operation, Valid Data that has not been fetched since the last measurement cycle.
+ * @li @c -1 - Error.
* See #err_t definition for detailed explanation.
* @note None.
*/
@@ -230,6 +294,79 @@ uint8_t temphum21_get_all_pin ( temphum21_t *ctx );
*/
uint8_t temphum21_get_alh_pin ( temphum21_t *ctx );
+/**
+ * @brief TempHum 21 enable device function.
+ * @details This function enables the device by setting the EN pin to HIGH logic state.
+ * @param[in] ctx : Click context object.
+ * See #temphum21_t object definition for detailed explanation.
+ * @return None.
+ * @note None.
+ */
+void temphum21_enable_device ( temphum21_t *ctx );
+
+/**
+ * @brief TempHum 21 disable device function.
+ * @details This function disables the device by setting the EN pin to LOW logic state.
+ * @param[in] ctx : Click context object.
+ * See #temphum21_t object definition for detailed explanation.
+ * @return None.
+ * @note None.
+ */
+void temphum21_disable_device ( temphum21_t *ctx );
+
+/**
+ * @brief TempHum 21 enter command mode function.
+ * @details This function enters the command mode.
+ * @param[in] ctx : Click context object.
+ * See #temphum21_t object definition for detailed explanation.
+ * @return @li @c 0 - Success.
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t temphum21_enter_command_mode ( temphum21_t *ctx );
+
+/**
+ * @brief TempHum 21 exit command mode function.
+ * @details This function exits the command mode and enters the normal operating mode.
+ * @param[in] ctx : Click context object.
+ * See #temphum21_t object definition for detailed explanation.
+ * @return @li @c 0 - Success.
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t temphum21_exit_command_mode ( temphum21_t *ctx );
+
+/**
+ * @brief TempHum 21 eeprom read function.
+ * @details This function reads data from a desired eeprom address.
+ * @param[in] ctx : Click context object.
+ * See #temphum21_t object definition for detailed explanation.
+ * @param[in] address : Address to read data from.
+ * @param[out] status : Status byte read (Status-Diagnostic-Response bits: SS-DDDD-RR).
+ * @param[out] data_out : Output data read.
+ * @return @li @c 0 - Success.
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t temphum21_eeprom_read ( temphum21_t *ctx, uint8_t address, uint8_t *status, uint16_t *data_out );
+
+/**
+ * @brief TempHum 21 eeprom write function.
+ * @details This function writes data to a desired eeprom address.
+ * @param[in] ctx : Click context object.
+ * See #temphum21_t object definition for detailed explanation.
+ * @param[in] address : Address to write data to.
+ * @param[in] data_in : Data to be written.
+ * @return @li @c 0 - Success.
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t temphum21_eeprom_write ( temphum21_t *ctx, uint8_t address, uint16_t data_in );
+
#ifdef __cplusplus
}
#endif
diff --git a/clicks/temphum21/lib_temphum21/src/temphum21.c b/clicks/temphum21/lib_temphum21/src/temphum21.c
new file mode 100644
index 0000000000..dff1c288d0
--- /dev/null
+++ b/clicks/temphum21/lib_temphum21/src/temphum21.c
@@ -0,0 +1,239 @@
+/****************************************************************************
+** Copyright (C) 2020 MikroElektronika d.o.o.
+** Contact: https://www.mikroe.com/contact
+**
+** Permission is hereby granted, free of charge, to any person obtaining a copy
+** of this software and associated documentation files (the "Software"), to deal
+** in the Software without restriction, including without limitation the rights
+** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+** copies of the Software, and to permit persons to whom the Software is
+** furnished to do so, subject to the following conditions:
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
+** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+** USE OR OTHER DEALINGS IN THE SOFTWARE.
+****************************************************************************/
+
+/*!
+ * @file temphum21.c
+ * @brief TempHum 21 Click Driver.
+ */
+
+#include "temphum21.h"
+
+void temphum21_cfg_setup ( temphum21_cfg_t *cfg )
+{
+ // Communication gpio pins
+ cfg->scl = HAL_PIN_NC;
+ cfg->sda = HAL_PIN_NC;
+
+ // Additional gpio pins
+ cfg->all = HAL_PIN_NC;
+ cfg->alh = HAL_PIN_NC;
+ cfg->en = HAL_PIN_NC;
+
+ cfg->i2c_speed = I2C_MASTER_SPEED_STANDARD;
+ cfg->i2c_address = TEMPHUM21_SET_DEV_ADDR;
+}
+
+err_t temphum21_init ( temphum21_t *ctx, temphum21_cfg_t *cfg )
+{
+ i2c_master_config_t i2c_cfg;
+
+ i2c_master_configure_default( &i2c_cfg );
+
+ i2c_cfg.scl = cfg->scl;
+ i2c_cfg.sda = cfg->sda;
+
+ ctx->slave_address = cfg->i2c_address;
+
+ if ( I2C_MASTER_ERROR == i2c_master_open( &ctx->i2c, &i2c_cfg ) )
+ {
+ return I2C_MASTER_ERROR;
+ }
+
+ if ( I2C_MASTER_ERROR == i2c_master_set_slave_address( &ctx->i2c, ctx->slave_address ) )
+ {
+ return I2C_MASTER_ERROR;
+ }
+
+ if ( I2C_MASTER_ERROR == i2c_master_set_speed( &ctx->i2c, cfg->i2c_speed ) )
+ {
+ return I2C_MASTER_ERROR;
+ }
+
+ digital_out_init( &ctx->en, cfg->en );
+
+ digital_in_init( &ctx->all, cfg->all );
+ digital_in_init( &ctx->alh, cfg->alh );
+
+ temphum21_enable_device ( ctx );
+ Delay_100ms ( );
+
+ return I2C_MASTER_SUCCESS;
+}
+
+err_t temphum21_default_cfg ( temphum21_t *ctx )
+{
+ err_t error_flag = TEMPHUM21_OK;
+
+ error_flag |= temphum21_enter_command_mode ( ctx );
+ uint8_t status = 0;
+ uint16_t eeprom_write = 0;
+ uint16_t eeprom_read = 0;
+
+ eeprom_write = TEMPHUM21_ALARM_HIGH_ON_80PCT;
+ error_flag |= temphum21_eeprom_write ( ctx, TEMPHUM21_REG_ALARM_HIGH_ON, eeprom_write );
+ error_flag |= temphum21_eeprom_read ( ctx, TEMPHUM21_REG_ALARM_HIGH_ON, &status, &eeprom_read );
+ if ( ( eeprom_read != eeprom_write ) ||
+ ( status != ( TEMPHUM21_STATUS_COMMAND_MODE | TEMPHUM21_RESPONSE_ACK ) ) )
+ {
+ error_flag |= TEMPHUM21_ERROR;
+ }
+
+ eeprom_write = TEMPHUM21_ALARM_HIGH_OFF_75PCT;
+ error_flag |= temphum21_eeprom_write ( ctx, TEMPHUM21_REG_ALARM_HIGH_OFF, eeprom_write );
+ error_flag |= temphum21_eeprom_read ( ctx, TEMPHUM21_REG_ALARM_HIGH_OFF, &status, &eeprom_read );
+ if ( ( eeprom_read != eeprom_write ) ||
+ ( status != ( TEMPHUM21_STATUS_COMMAND_MODE | TEMPHUM21_RESPONSE_ACK ) ) )
+ {
+ error_flag |= TEMPHUM21_ERROR;
+ }
+
+ eeprom_write = TEMPHUM21_ALARM_LOW_ON_20PCT;
+ error_flag |= temphum21_eeprom_write ( ctx, TEMPHUM21_REG_ALARM_LOW_ON, eeprom_write );
+ error_flag |= temphum21_eeprom_read ( ctx, TEMPHUM21_REG_ALARM_LOW_ON, &status, &eeprom_read );
+ if ( ( eeprom_read != eeprom_write ) ||
+ ( status != ( TEMPHUM21_STATUS_COMMAND_MODE | TEMPHUM21_RESPONSE_ACK ) ) )
+ {
+ error_flag |= TEMPHUM21_ERROR;
+ }
+
+ eeprom_write = TEMPHUM21_ALARM_LOW_OFF_25PCT;
+ error_flag |= temphum21_eeprom_write ( ctx, TEMPHUM21_REG_ALARM_LOW_OFF, eeprom_write );
+ error_flag |= temphum21_eeprom_read ( ctx, TEMPHUM21_REG_ALARM_LOW_OFF, &status, &eeprom_read );
+ if ( ( eeprom_read != eeprom_write ) ||
+ ( status != ( TEMPHUM21_STATUS_COMMAND_MODE | TEMPHUM21_RESPONSE_ACK ) ) )
+ {
+ error_flag |= TEMPHUM21_ERROR;
+ }
+
+ error_flag |= temphum21_exit_command_mode ( ctx );
+ Delay_100ms ( );
+
+ return error_flag;
+}
+
+err_t temphum21_request_measurement ( temphum21_t *ctx )
+{
+ uint8_t dummy = 0;
+ return i2c_master_write( &ctx->i2c, &dummy, 1 );
+}
+
+err_t temphum21_read_measurement ( temphum21_t *ctx, float *temperature, float *humidity )
+{
+ uint8_t data_buf[ 4 ] = { 0 };
+ uint16_t raw_data = 0;
+ err_t error_flag = temphum21_request_measurement ( ctx );
+ // The measurement cycle duration is typically 36.65ms for temperature and humidity readings.
+ Delay_10ms ( );
+ Delay_10ms ( );
+ Delay_10ms ( );
+ Delay_10ms ( );
+ error_flag |= i2c_master_read ( &ctx->i2c, data_buf, 4 );
+ raw_data = ( ( ( uint16_t ) data_buf[ 0 ] << 8 ) | data_buf[ 1 ] ) & TEMPHUM21_DATA_RES;
+ *humidity = ( float ) raw_data / TEMPHUM21_DATA_RES * TEMPHUM21_HUM_RES;
+ raw_data = ( ( ( uint16_t ) data_buf[ 2 ] << 6 ) | ( data_buf[ 3 ] >> 2 ) ) & TEMPHUM21_DATA_RES;
+ *temperature = ( float ) raw_data / TEMPHUM21_DATA_RES * TEMPHUM21_TEMP_RES - TEMPHUM21_TEMP_OFFSET;
+ if ( TEMPHUM21_OK == error_flag )
+ {
+ error_flag = data_buf[ 0 ] & TEMPHUM21_STATUS_BIT_MASK; // status bits
+ }
+ return error_flag;
+}
+
+uint8_t temphum21_get_all_pin ( temphum21_t *ctx )
+{
+ return digital_in_read ( &ctx->all );
+}
+
+uint8_t temphum21_get_alh_pin ( temphum21_t *ctx )
+{
+ return digital_in_read ( &ctx->alh );
+}
+
+void temphum21_enable_device ( temphum21_t *ctx )
+{
+ digital_out_high ( &ctx->en );
+}
+
+void temphum21_disable_device ( temphum21_t *ctx )
+{
+ digital_out_low ( &ctx->en );
+}
+
+err_t temphum21_eeprom_read ( temphum21_t *ctx, uint8_t address, uint8_t *status, uint16_t *data_out )
+{
+ if ( address > 0x1F )
+ {
+ return TEMPHUM21_ERROR;
+ }
+ err_t error_flag = TEMPHUM21_OK;
+ uint8_t data_buf[ 3 ] = { 0 };
+ data_buf[ 0 ] = address;
+ error_flag |= i2c_master_write( &ctx->i2c, data_buf, 3 );
+ Delay_1ms ( );
+ error_flag |= i2c_master_read( &ctx->i2c, data_buf, 3 );
+ *status = data_buf[ 0 ];
+ *data_out = ( ( uint16_t ) data_buf[ 1 ] << 8 ) | data_buf[ 2 ];
+ return error_flag;
+}
+
+err_t temphum21_eeprom_write ( temphum21_t *ctx, uint8_t address, uint16_t data_in )
+{
+ if ( address > 0x1F )
+ {
+ return TEMPHUM21_ERROR;
+ }
+ err_t error_flag = TEMPHUM21_OK;
+ uint8_t data_buf[ 3 ] = { 0 };
+ data_buf[ 0 ] = address | TEMPHUM21_CMD_WRITE_EEPROM;
+ data_buf[ 1 ] = ( uint8_t ) ( ( data_in >> 8 ) & 0xFF );
+ data_buf[ 2 ] = ( uint8_t ) ( data_in & 0xFF );
+ error_flag |= i2c_master_write( &ctx->i2c, data_buf, 3 );
+ Delay_10ms ( );
+ Delay_10ms ( );
+ return error_flag;
+}
+
+err_t temphum21_enter_command_mode ( temphum21_t *ctx )
+{
+ err_t error_flag = TEMPHUM21_OK;
+ uint8_t data_buf[ 3 ] = { 0 };
+ data_buf[ 0 ] = TEMPHUM21_CMD_START_CM;
+ temphum21_disable_device ( ctx );
+ Delay_1sec ( );
+ temphum21_enable_device ( ctx );
+ Delay_1ms ( );
+ error_flag |= i2c_master_write( &ctx->i2c, data_buf, 3 );
+ Delay_1ms ( );
+ return error_flag;
+}
+
+err_t temphum21_exit_command_mode ( temphum21_t *ctx )
+{
+ err_t error_flag = TEMPHUM21_OK;
+ uint8_t data_buf[ 3 ] = { 0 };
+ data_buf[ 0 ] = TEMPHUM21_CMD_START_NOM;
+ error_flag |= i2c_master_write( &ctx->i2c, data_buf, 3 );
+ Delay_100ms ( );
+ return error_flag;
+}
+
+// ------------------------------------------------------------------------- END
diff --git a/clicks/temphum21/memake.txt b/clicks/temphum21/memake.txt
deleted file mode 100644
index dc79ec4f1d..0000000000
--- a/clicks/temphum21/memake.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-type: subdirs
-project: TempHum21
-
-subdirs: {
- lib
- example
-}
diff --git a/clicks/vreg2/CHANGELOG.md b/clicks/vreg2/CHANGELOG.md
index b586d72846..5d4bb42ec0 100644
--- a/clicks/vreg2/CHANGELOG.md
+++ b/clicks/vreg2/CHANGELOG.md
@@ -1,4 +1,4 @@
## Changelog
-### Version 2.0.0.7
+### Version 2.1.0.8
- Initial release
diff --git a/clicks/vreg2/CMakeLists.txt b/clicks/vreg2/CMakeLists.txt
new file mode 100644
index 0000000000..53bf28e4fb
--- /dev/null
+++ b/clicks/vreg2/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(example_vreg2 LANGUAGES MikroC)
+else()
+ project(example_vreg2 LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_executable(example_vreg2
+ example/main.c
+
+)
+
+
+############################ example_vreg2 GENERATED CODE START ###########################
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(example_vreg2 PUBLIC MikroC.Core)
+find_package(MikroSDK.Board REQUIRED)
+target_link_libraries(example_vreg2 PUBLIC MikroSDK.Board)
+find_package(MikroSDK.Log REQUIRED)
+target_link_libraries(example_vreg2 PUBLIC MikroSDK.Log)
+add_subdirectory(lib_vreg2)
+target_link_libraries(example_vreg2 PUBLIC Click.Vreg2)
+############################ example_vreg2 GENERATED CODE END ###########################
diff --git a/clicks/vreg2/DETAILS.md b/clicks/vreg2/DETAILS.md
index 8d92919960..4ddbc0ce6d 100644
--- a/clicks/vreg2/DETAILS.md
+++ b/clicks/vreg2/DETAILS.md
@@ -2,7 +2,7 @@
---
# VREG 2 click
-VREG 2 click is a voltage regulator click, with outstanding performances.
+> VREG 2 click is a voltage regulator click, with outstanding performances.
@@ -15,8 +15,8 @@ VREG 2 click is a voltage regulator click, with outstanding performances.
#### Click library
-- **Author** : MikroE Team
-- **Date** : Jan 2020.
+- **Author** : Stefan Filipovic
+- **Date** : Jun 2023.
- **Type** : PWM type
@@ -35,44 +35,54 @@ Package can be downloaded/installed directly form compilers IDE(recommended way)
#### Standard key functions :
-- Config Object Initialization function.
-> void vreg2_cfg_setup ( vreg2_cfg_t *cfg );
-
-- Initialization function.
-> VREG2_RETVAL vreg2_init ( vreg2_t *ctx, vreg2_cfg_t *cfg );
+- `vreg2_cfg_setup` Config Object Initialization function.
+```c
+void vreg2_cfg_setup ( vreg2_cfg_t *cfg );
+```
-- Click Default Configuration function.
-> void vreg2_default_cfg ( vreg2_t *ctx );
+- `vreg2_init` Initialization function.
+```c
+err_t vreg2_init ( vreg2_t *ctx, vreg2_cfg_t *cfg );
+```
+- `vreg2_default_cfg` Click Default Configuration function.
+```c
+err_t vreg2_default_cfg ( vreg2_t *ctx );
+```
#### Example key functions :
-- This function starts PWM module.
-> void vreg2_pwm_start ( vreg2_t *ctx );
-
-- This function stops PWM module.
-> void vreg2_pwm_stop ( vreg2_t *ctx );
+- `vreg2_set_duty_cycle` This function sets the PWM duty cycle in percentages ( Range[ 0..1 ] ).
+```c
+err_t vreg2_set_duty_cycle ( vreg2_t *ctx, float duty_cycle );
+```
-- This function sets the PWM duty cycle.
-> void vreg2_set_duty_cycle ( vreg2_t *ctx, pwm_data_t duty_cycle );
+- `vreg2_pwm_start` This function starts the PWM module output.
+```c
+err_t vreg2_pwm_start ( vreg2_t *ctx );
+```
+
+- `vreg2_pwm_stop` This function stops the PWM module output.
+```c
+err_t vreg2_pwm_stop ( vreg2_t *ctx );
+```
## Examples Description
-> This application enables voltage regulation.
+> This example demonstrates the use of the VREG 2 Click board by changing the voltage output every 5 seconds.
**The demo application is composed of two sections :**
### Application Init
-> Initializes the GPIO driver and configures the PWM
-> peripheral for controlling VREG2 voltage output.
+> Initializes the driver and performs the click default configuration.
```c
void application_init ( void )
{
- log_cfg_t log_cfg;
- vreg2_cfg_t cfg;
+ log_cfg_t log_cfg; /**< Logger config object. */
+ vreg2_cfg_t vreg2_cfg; /**< Click config object. */
/**
* Logger initialization.
@@ -85,93 +95,50 @@ void application_init ( void )
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
- log_info( &logger, "---- Application Init ----" );
-
- // Click initialization.
+ log_info( &logger, " Application Init " );
- vreg2_cfg_setup( &cfg );
- cfg.pwm = (0x3C) ; cfg.an = (0x03) ;
- vreg2_init( &vreg2, &cfg );
-
- vreg2_set_duty_cycle( &vreg2, duty_cycle );
- vreg2_pwm_start( &vreg2 );
+ // Click initialization.
+ vreg2_cfg_setup( &vreg2_cfg );
+ VREG2_MAP_MIKROBUS( vreg2_cfg, MIKROBUS_1 );
+ if ( PWM_ERROR == vreg2_init( &vreg2, &vreg2_cfg ) )
+ {
+ log_error( &logger, " Communication init." );
+ for ( ; ; );
+ }
+
+ if ( VREG2_ERROR == vreg2_default_cfg ( &vreg2 ) )
+ {
+ log_error( &logger, " Default configuration." );
+ for ( ; ; );
+ }
+
+ log_info( &logger, " Application Task " );
}
```
### Application Task
-> Based on the data received from the uart the voltage output will be increased or decreased.
+> Controls the voltage output by changing the PWM duty cycle every 5 seconds.
+The duty cycle ranges from 10% to 50%. Each step will be logged on the USB UART where you can track the program flow.
```c
void application_task ( void )
{
- // Task implementation.
-
- switch ( ctrl_flag )
+ static int8_t duty_pct = 10;
+ static int8_t duty_step = 10;
+ if ( VREG2_OK == vreg2_set_duty_cycle ( &vreg2, ( float ) duty_pct / 100 ) )
{
- case 0:
- {
- duty_cycle = (uint32_t)vreg2.pwm_period * 20 / 100;
- log_printf( &logger, "Volatage set to : %d %%\r\n", duty_cycle );
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 1;
- break;
- }
-
- case 1:
- {
- duty_cycle = (uint32_t)vreg2.pwm_period * 50 / 100;
- log_printf( &logger, "Volatage set to : %d %%\r\n", duty_cycle );
-
- if ( ctrl_pre_flag == 0 )
- {
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 2;
- }
- else if ( ctrl_pre_flag == 2 )
- {
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 0;
- }
- break;
- }
- case 2:
- {
- duty_cycle = (uint32_t)vreg2.pwm_period * 70 / 100;
- log_printf( &logger, "Volatage set to : %d %%\r\n", duty_cycle );
-
- if ( ctrl_pre_flag == 1 )
- {
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 3;
- }
- else if ( ctrl_pre_flag == 3 )
- {
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 1;
- }
- break;
- }
- case 3:
- {
- duty_cycle = (uint32_t)vreg2.pwm_period * 95 / 100;
- log_printf( &logger, "Volatage set to : %d %%\r\n", duty_cycle );
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 2;
- break;
-
- }
- default:
- {
- log_printf( &logger, "Something broke\r\n");
- }
+ log_printf( &logger, "\r\n Duty: %u%%\r\n", ( uint16_t ) duty_pct );
}
-
- vreg2_set_duty_cycle( &vreg2, duty_cycle );
- Delay_ms( 1500 );
- Delay_100ms();
+ duty_pct += duty_step;
+ if ( ( duty_pct > 50 ) || ( duty_pct < 10 ) )
+ {
+ duty_step = -duty_step;
+ duty_pct += ( duty_step * 2 );
+ }
+ Delay_ms( 5000 );
}
```
diff --git a/clicks/vreg2/README.md b/clicks/vreg2/README.md
index 99ec568a88..6f9a5e1dfb 100644
--- a/clicks/vreg2/README.md
+++ b/clicks/vreg2/README.md
@@ -1,9 +1,9 @@
\mainpage Main Page
-
+
---
# VREG 2 click
-VREG 2 click is a voltage regulator click, with outstanding performances.
+> VREG 2 click is a voltage regulator click, with outstanding performances.
@@ -16,8 +16,8 @@ VREG 2 click is a voltage regulator click, with outstanding performances.
#### Click library
-- **Author** : MikroE Team
-- **Date** : Jan 2020.
+- **Author** : Stefan Filipovic
+- **Date** : Jun 2023.
- **Type** : PWM type
@@ -36,44 +36,54 @@ Package can be downloaded/installed directly form compilers IDE(recommended way)
#### Standard key functions :
-- Config Object Initialization function.
-> void vreg2_cfg_setup ( vreg2_cfg_t *cfg );
-
-- Initialization function.
-> VREG2_RETVAL vreg2_init ( vreg2_t *ctx, vreg2_cfg_t *cfg );
+- `vreg2_cfg_setup` Config Object Initialization function.
+```c
+void vreg2_cfg_setup ( vreg2_cfg_t *cfg );
+```
-- Click Default Configuration function.
-> void vreg2_default_cfg ( vreg2_t *ctx );
+- `vreg2_init` Initialization function.
+```c
+err_t vreg2_init ( vreg2_t *ctx, vreg2_cfg_t *cfg );
+```
+- `vreg2_default_cfg` Click Default Configuration function.
+```c
+err_t vreg2_default_cfg ( vreg2_t *ctx );
+```
#### Example key functions :
-- This function starts PWM module.
-> void vreg2_pwm_start ( vreg2_t *ctx );
-
-- This function stops PWM module.
-> void vreg2_pwm_stop ( vreg2_t *ctx );
+- `vreg2_set_duty_cycle` This function sets the PWM duty cycle in percentages ( Range[ 0..1 ] ).
+```c
+err_t vreg2_set_duty_cycle ( vreg2_t *ctx, float duty_cycle );
+```
+
+- `vreg2_pwm_start` This function starts the PWM module output.
+```c
+err_t vreg2_pwm_start ( vreg2_t *ctx );
+```
-- This function sets the PWM duty cycle.
-> void vreg2_set_duty_cycle ( vreg2_t *ctx, pwm_data_t duty_cycle );
+- `vreg2_pwm_stop` This function stops the PWM module output.
+```c
+err_t vreg2_pwm_stop ( vreg2_t *ctx );
+```
## Examples Description
-> This application enables voltage regulation.
+> This example demonstrates the use of the VREG 2 Click board by changing the voltage output every 5 seconds.
**The demo application is composed of two sections :**
### Application Init
-> Initializes the GPIO driver and configures the PWM
-> peripheral for controlling VREG2 voltage output.
+> Initializes the driver and performs the click default configuration.
```c
void application_init ( void )
{
- log_cfg_t log_cfg;
- vreg2_cfg_t cfg;
+ log_cfg_t log_cfg; /**< Logger config object. */
+ vreg2_cfg_t vreg2_cfg; /**< Click config object. */
/**
* Logger initialization.
@@ -86,93 +96,50 @@ void application_init ( void )
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
- log_info( &logger, "---- Application Init ----" );
-
- // Click initialization.
+ log_info( &logger, " Application Init " );
- vreg2_cfg_setup( &cfg );
- cfg.pwm = (0x3C) ; cfg.an = (0x03) ;
- vreg2_init( &vreg2, &cfg );
-
- vreg2_set_duty_cycle( &vreg2, duty_cycle );
- vreg2_pwm_start( &vreg2 );
+ // Click initialization.
+ vreg2_cfg_setup( &vreg2_cfg );
+ VREG2_MAP_MIKROBUS( vreg2_cfg, MIKROBUS_1 );
+ if ( PWM_ERROR == vreg2_init( &vreg2, &vreg2_cfg ) )
+ {
+ log_error( &logger, " Communication init." );
+ for ( ; ; );
+ }
+
+ if ( VREG2_ERROR == vreg2_default_cfg ( &vreg2 ) )
+ {
+ log_error( &logger, " Default configuration." );
+ for ( ; ; );
+ }
+
+ log_info( &logger, " Application Task " );
}
```
### Application Task
-> Based on the data received from the uart the voltage output will be increased or decreased.
+> Controls the voltage output by changing the PWM duty cycle every 5 seconds.
+The duty cycle ranges from 10% to 50%. Each step will be logged on the USB UART where you can track the program flow.
```c
void application_task ( void )
{
- // Task implementation.
-
- switch ( ctrl_flag )
+ static int8_t duty_pct = 10;
+ static int8_t duty_step = 10;
+ if ( VREG2_OK == vreg2_set_duty_cycle ( &vreg2, ( float ) duty_pct / 100 ) )
{
- case 0:
- {
- duty_cycle = (uint32_t)vreg2.pwm_period * 20 / 100;
- log_printf( &logger, "Volatage set to : %d %%\r\n", duty_cycle );
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 1;
- break;
- }
-
- case 1:
- {
- duty_cycle = (uint32_t)vreg2.pwm_period * 50 / 100;
- log_printf( &logger, "Volatage set to : %d %%\r\n", duty_cycle );
-
- if ( ctrl_pre_flag == 0 )
- {
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 2;
- }
- else if ( ctrl_pre_flag == 2 )
- {
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 0;
- }
- break;
- }
- case 2:
- {
- duty_cycle = (uint32_t)vreg2.pwm_period * 70 / 100;
- log_printf( &logger, "Volatage set to : %d %%\r\n", duty_cycle );
-
- if ( ctrl_pre_flag == 1 )
- {
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 3;
- }
- else if ( ctrl_pre_flag == 3 )
- {
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 1;
- }
- break;
- }
- case 3:
- {
- duty_cycle = (uint32_t)vreg2.pwm_period * 95 / 100;
- log_printf( &logger, "Volatage set to : %d %%\r\n", duty_cycle );
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 2;
- break;
-
- }
- default:
- {
- log_printf( &logger, "Something broke\r\n");
- }
+ log_printf( &logger, "\r\n Duty: %u%%\r\n", ( uint16_t ) duty_pct );
}
-
- vreg2_set_duty_cycle( &vreg2, duty_cycle );
- Delay_ms( 1500 );
- Delay_100ms();
+ duty_pct += duty_step;
+ if ( ( duty_pct > 50 ) || ( duty_pct < 10 ) )
+ {
+ duty_step = -duty_step;
+ duty_pct += ( duty_step * 2 );
+ }
+ Delay_ms( 5000 );
}
```
diff --git a/clicks/vreg2/doc/doxy/Doxyfile.doxy b/clicks/vreg2/doc/doxy/Doxyfile.doxy
index 939e067dfd..4bf6dc51ab 100644
--- a/clicks/vreg2/doc/doxy/Doxyfile.doxy
+++ b/clicks/vreg2/doc/doxy/Doxyfile.doxy
@@ -44,21 +44,21 @@ PROJECT_NUMBER = 2.0.0.0
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
-PROJECT_BRIEF =
+PROJECT_BRIEF =
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
-PROJECT_LOGO =
+PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
-OUTPUT_DIRECTORY = ../clicks/vreg2/temp/Help/doc
+OUTPUT_DIRECTORY = ../cmake/vreg2/temp/Help/doc
# 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
@@ -162,7 +162,7 @@ FULL_PATH_NAMES = YES
# will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
-STRIP_FROM_PATH =
+STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which
@@ -171,7 +171,7 @@ STRIP_FROM_PATH =
# specify the list of include paths that are normally passed to the compiler
# using the -I flag.
-STRIP_FROM_INC_PATH =
+STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
# less readable) file names. This can be useful is your file systems doesn't
@@ -238,13 +238,13 @@ TAB_SIZE = 4
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines.
-ALIASES =
+ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
-TCL_SUBST =
+TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
@@ -291,7 +291,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
-EXTENSION_MAPPING =
+EXTENSION_MAPPING =
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
@@ -648,7 +648,7 @@ GENERATE_DEPRECATEDLIST= YES
# sections, marked by \if ... \endif and \cond
# ... \endcond blocks.
-ENABLED_SECTIONS =
+ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
# initial value of a variable or macro / define can have for it to appear in the
@@ -690,7 +690,7 @@ SHOW_NAMESPACES = YES
# by doxygen. Whatever the program writes to standard output is used as the file
# version. For an example see the documentation.
-FILE_VERSION_FILTER =
+FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
# by doxygen. The layout file controls the global structure of the generated
@@ -703,7 +703,7 @@ FILE_VERSION_FILTER =
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty.
-LAYOUT_FILE =
+LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
@@ -713,7 +713,7 @@ LAYOUT_FILE =
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. See also \cite for info how to create references.
-CITE_BIB_FILES =
+CITE_BIB_FILES =
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
@@ -778,7 +778,7 @@ WARN_FORMAT = "$file:$line: $text"
# messages should be written. If left blank the output is written to standard
# error (stderr).
-WARN_LOGFILE =
+WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
@@ -790,9 +790,9 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = ../clicks/vreg2/example \
- ../clicks/vreg2/lib/include \
- ../clicks/vreg2/README.md
+INPUT = ../cmake/vreg2/example \
+ ../cmake/vreg2/lib_vreg2/include \
+ ../cmake/vreg2/README.md
# 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
@@ -877,7 +877,7 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
-EXCLUDE =
+EXCLUDE =
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -893,7 +893,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
-EXCLUDE_PATTERNS =
+EXCLUDE_PATTERNS =
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@@ -904,13 +904,13 @@ EXCLUDE_PATTERNS =
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
-EXCLUDE_SYMBOLS =
+EXCLUDE_SYMBOLS =
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
# command).
-EXAMPLE_PATH = ../clicks/vreg2/example
+EXAMPLE_PATH = ../cmake/vreg2/example
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -930,7 +930,7 @@ EXAMPLE_RECURSIVE = YES
# that contain images that are to be included in the documentation (see the
# \image command).
-IMAGE_PATH =
+IMAGE_PATH =
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
@@ -951,7 +951,7 @@ IMAGE_PATH =
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
-INPUT_FILTER =
+INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis. Doxygen will compare the file name with each pattern and apply the
@@ -964,7 +964,7 @@ INPUT_FILTER =
# 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
# INPUT_FILTER) will also be used to filter the input files that are used for
@@ -979,14 +979,14 @@ FILTER_SOURCE_FILES = NO
# *.ext= (so without naming a filter).
# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
-FILTER_SOURCE_PATTERNS =
+FILTER_SOURCE_PATTERNS =
# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
# is part of the input, its contents will be placed on the main page
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.
-USE_MDFILE_AS_MAINPAGE =
+USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# Configuration options related to source browsing
@@ -1091,7 +1091,7 @@ CLANG_ASSISTED_PARSING = NO
# specified with INPUT and INCLUDE_PATH.
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
-CLANG_OPTIONS =
+CLANG_OPTIONS =
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
@@ -1117,7 +1117,7 @@ COLS_IN_ALPHA_INDEX = 5
# while generating the index headers.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-IGNORE_PREFIX =
+IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
@@ -1161,7 +1161,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_HEADER =
+HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
@@ -1171,7 +1171,7 @@ HTML_HEADER =
# that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_FOOTER =
+HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of
@@ -1183,7 +1183,7 @@ HTML_FOOTER =
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_STYLESHEET =
+HTML_STYLESHEET =
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
@@ -1196,7 +1196,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@@ -1206,7 +1206,7 @@ HTML_EXTRA_STYLESHEET =
# files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_FILES =
+HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
@@ -1335,7 +1335,7 @@ GENERATE_HTMLHELP = YES
# written to the html output directory.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-CHM_FILE =
+CHM_FILE =
# 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,
@@ -1343,7 +1343,7 @@ CHM_FILE =
# The file has to be specified with full path.
# 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
# (YES) or that it should be included in the master .chm file (NO).
@@ -1356,7 +1356,7 @@ GENERATE_CHI = NO
# and project file content.
# 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
# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
@@ -1387,7 +1387,7 @@ GENERATE_QHP = NO
# the HTML output folder.
# This tag requires that the tag GENERATE_QHP is set to YES.
-QCH_FILE =
+QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
@@ -1412,7 +1412,7 @@ QHP_VIRTUAL_FOLDER = ./temp/Help/doc
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
@@ -1420,21 +1420,21 @@ QHP_CUST_FILTER_NAME =
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_CUST_FILTER_ATTRS =
+QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
# https://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_SECT_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
# The QHG_LOCATION tag can be used to specify the location of Qt's
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
# generated .qhp file.
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHG_LOCATION =
+QHG_LOCATION =
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
# generated, together with the HTML files, they form an Eclipse help plugin. To
@@ -1567,7 +1567,7 @@ MATHJAX_RELPATH = https://cdn.mathjax.org/mathjax/latest
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_EXTENSIONS =
+MATHJAX_EXTENSIONS =
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
# of code that will be used on startup of the MathJax code. See the MathJax site
@@ -1575,7 +1575,7 @@ MATHJAX_EXTENSIONS =
# example see the documentation.
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_CODEFILE =
+MATHJAX_CODEFILE =
# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
# the HTML output. The underlying search engine uses javascript and DHTML and
@@ -1635,7 +1635,7 @@ EXTERNAL_SEARCH = NO
# Searching" for details.
# This tag requires that the tag SEARCHENGINE is set to YES.
-SEARCHENGINE_URL =
+SEARCHENGINE_URL =
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
# search data is written to a file for indexing by an external tool. With the
@@ -1651,7 +1651,7 @@ SEARCHDATA_FILE = searchdata.xml
# projects and redirect the results back to the right project.
# This tag requires that the tag SEARCHENGINE is set to YES.
-EXTERNAL_SEARCH_ID =
+EXTERNAL_SEARCH_ID =
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
# projects other than the one defined by this configuration file, but that are
@@ -1661,7 +1661,7 @@ EXTERNAL_SEARCH_ID =
# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
# This tag requires that the tag SEARCHENGINE is set to YES.
-EXTRA_SEARCH_MAPPINGS =
+EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
@@ -1725,7 +1725,7 @@ PAPER_TYPE = a4
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-EXTRA_PACKAGES =
+EXTRA_PACKAGES =
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
# generated LaTeX document. The header should contain everything until the first
@@ -1741,7 +1741,7 @@ EXTRA_PACKAGES =
# to HTML_HEADER.
# 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
# generated LaTeX document. The footer should contain everything after the last
@@ -1752,7 +1752,7 @@ LATEX_HEADER =
# 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.
-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
@@ -1763,7 +1763,7 @@ LATEX_FOOTER =
# list).
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_STYLESHEET =
# 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
@@ -1771,7 +1771,7 @@ LATEX_EXTRA_STYLESHEET =
# markers available.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_EXTRA_FILES =
+LATEX_EXTRA_FILES =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
@@ -1879,14 +1879,14 @@ RTF_HYPERLINKS = NO
# default style sheet that doxygen normally uses.
# This tag requires that the tag GENERATE_RTF is set to YES.
-RTF_STYLESHEET_FILE =
+RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an RTF document. Syntax is
# similar to doxygen's config file. A template extensions file can be generated
# using doxygen -e rtf extensionFile.
# This tag requires that the tag GENERATE_RTF is set to YES.
-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.
@@ -1931,7 +1931,7 @@ MAN_EXTENSION = .3
# MAN_EXTENSION with the initial . removed.
# This tag requires that the tag GENERATE_MAN is set to YES.
-MAN_SUBDIR =
+MAN_SUBDIR =
# 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
@@ -2044,7 +2044,7 @@ PERLMOD_PRETTY = YES
# overwrite each other's variables.
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-PERLMOD_MAKEVAR_PREFIX =
+PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
@@ -2085,7 +2085,7 @@ SEARCH_INCLUDES = YES
# preprocessor.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-INCLUDE_PATH =
+INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
@@ -2093,7 +2093,7 @@ INCLUDE_PATH =
# used.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-INCLUDE_FILE_PATTERNS =
+INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that are
# defined before the preprocessor is started (similar to the -D option of e.g.
@@ -2103,7 +2103,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-PREDEFINED =
+PREDEFINED =
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
@@ -2112,7 +2112,7 @@ PREDEFINED =
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-EXPAND_AS_DEFINED =
+EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
@@ -2141,13 +2141,13 @@ SKIP_FUNCTION_MACROS = YES
# 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.
-TAGFILES =
+TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
# tag file that is based on the input files it reads. See section "Linking to
# external documentation" for more information about the usage of tag files.
-GENERATE_TAGFILE =
+GENERATE_TAGFILE =
# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
# the class index. If set to NO, only the inherited external classes will be
@@ -2196,14 +2196,14 @@ CLASS_DIAGRAMS = YES
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
-MSCGEN_PATH =
+MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
# If left empty dia is assumed to be found in the default search path.
-DIA_PATH =
+DIA_PATH =
# 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.
@@ -2252,7 +2252,7 @@ DOT_FONTSIZE = 10
# the path where dot can find it using this tag.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_FONTPATH =
+DOT_FONTPATH =
# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
# each documented class showing the direct and indirect inheritance relations.
@@ -2396,26 +2396,26 @@ INTERACTIVE_SVG = NO
# found. If left blank, it is assumed the dot tool can be found in the path.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_PATH =
+DOT_PATH =
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the \dotfile
# command).
# This tag requires that the tag HAVE_DOT is set to YES.
-DOTFILE_DIRS =
+DOTFILE_DIRS =
# The MSCFILE_DIRS tag can be used to specify one or more directories that
# contain msc files that are included in the documentation (see the \mscfile
# command).
-MSCFILE_DIRS =
+MSCFILE_DIRS =
# The DIAFILE_DIRS tag can be used to specify one or more directories that
# contain dia files that are included in the documentation (see the \diafile
# command).
-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
@@ -2423,17 +2423,17 @@ DIAFILE_DIRS =
# generate a warning when it encounters a \startuml command in this case and
# will not generate output for the diagram.
-PLANTUML_JAR_PATH =
+PLANTUML_JAR_PATH =
# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
# configuration file for plantuml.
-PLANTUML_CFG_FILE =
+PLANTUML_CFG_FILE =
# When using plantuml, the specified paths are searched for files specified by
# the !include statement in a plantuml block.
-PLANTUML_INCLUDE_PATH =
+PLANTUML_INCLUDE_PATH =
# 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
@@ -2494,7 +2494,3 @@ GENERATE_LEGEND = YES
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_CLEANUP = YES
-
-
-
-
diff --git a/clicks/vreg2/doc/package/manifest.json b/clicks/vreg2/doc/package/manifest.json
index 9586b373a4..bafacb283b 100644
--- a/clicks/vreg2/doc/package/manifest.json
+++ b/clicks/vreg2/doc/package/manifest.json
@@ -1,6 +1,6 @@
{
- "architecture": "ARM|PIC|PIC32",
- "category": "Buck",
+ "architecture": "ARM|PIC|PIC32|RISC-V|AVR",
+ "category": "Click Boards > Power management > Buck",
"changelog": "Resources/CHANGELOG.md",
"contains": [
"libraries",
@@ -8,8 +8,7 @@
"examples",
"source_files"
],
- "dependency_list": [
- ],
+ "dependency_list": [],
"details": "Resources/DETAILS.md",
"display_name": "VREG 2 click",
"example_list": [
@@ -26,19 +25,15 @@
"name": "mikroe.click.vreg2",
"product_link": "https://www.mikroe.com/vreg-2-click",
"short_description": "VREG 2 click is a voltage regulator click, with outstanding performances.",
- "supported_compiler": "mikroC AI",
+ "supported_compiler": "mikroC AI|GCC",
"type": "Library",
- "_type":"mikroSDK Library",
- "related_projects":[
+ "_type": "mikroSDK Library",
+ "related_projects": [
2414
],
- "_type": "mikroSDK Library",
- "version": "2.0.0.7"
+ "version": "2.1.0.8",
+ "cmake": true,
+ "alias": "Click.Vreg2",
+ "subdir_name": "lib_vreg2"
}
-
-
-
-
-
-
diff --git a/clicks/vreg2/example/CMakeLists.txt b/clicks/vreg2/example/CMakeLists.txt
new file mode 100644
index 0000000000..c33c8ad896
--- /dev/null
+++ b/clicks/vreg2/example/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(example_vreg2 LANGUAGES MikroC)
+else()
+ project(example_vreg2 LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_executable(example_vreg2
+ main.c
+
+)
+
+
+############################ example_vreg2 GENERATED CODE START ###########################
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(example_vreg2 PUBLIC MikroC.Core)
+find_package(MikroSDK.Board REQUIRED)
+target_link_libraries(example_vreg2 PUBLIC MikroSDK.Board)
+find_package(MikroSDK.Log REQUIRED)
+target_link_libraries(example_vreg2 PUBLIC MikroSDK.Log)
+add_subdirectory(lib_vreg2)
+target_link_libraries(example_vreg2 PUBLIC Click.Vreg2)
+############################ example_vreg2 GENERATED CODE END ###########################
diff --git a/clicks/vreg2/example/main.c b/clicks/vreg2/example/main.c
index 3651fb4c43..aa7fb24cfe 100644
--- a/clicks/vreg2/example/main.c
+++ b/clicks/vreg2/example/main.c
@@ -1,44 +1,36 @@
/*!
- * \file
- * \brief Vreg2 Click example
+ * @file main.c
+ * @brief VREG 2 Click example
*
* # Description
- * This application enables voltage regulation.
+ * This example demonstrates the use of the VREG 2 Click board by changing
+ * the voltage output every 5 seconds.
*
* The demo application is composed of two sections :
+ *
+ * ## Application Init
+ * Initializes the driver and performs the click default configuration.
+ *
+ * ## Application Task
+ * Controls the voltage output by changing the PWM duty cycle every 5 seconds.
+ * The duty cycle ranges from 10% to 50%. Each step will be logged on
+ * the USB UART where you can track the program flow.
*
- * ## Application Init
- * Initializes the GPIO driver and configures the PWM
- * peripheral for controlling VREG2 voltage output.
- *
- * ## Application Task
- * Based on the data received from the uart the voltage output will be increased or decreased.
- *
- *
- * \author MikroE Team
+ * @author Stefan Filipovic
*
*/
-// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "vreg2.h"
-// ------------------------------------------------------------------ VARIABLES
-
static vreg2_t vreg2;
static log_t logger;
-static float duty_cycle = 0.5;
-static uint8_t ctrl_flag = 0;
-static uint8_t ctrl_pre_flag = 0;
-
-// ------------------------------------------------------ APPLICATION FUNCTIONS
-
void application_init ( void )
{
- log_cfg_t log_cfg;
- vreg2_cfg_t cfg;
+ log_cfg_t log_cfg; /**< Logger config object. */
+ vreg2_cfg_t vreg2_cfg; /**< Click config object. */
/**
* Logger initialization.
@@ -51,84 +43,41 @@ void application_init ( void )
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
- log_info( &logger, "---- Application Init ----" );
-
- // Click initialization.
+ log_info( &logger, " Application Init " );
- vreg2_cfg_setup( &cfg );
- vreg2_init( &vreg2, &cfg );
-
- vreg2_set_duty_cycle( &vreg2, duty_cycle );
- vreg2_pwm_start( &vreg2 );
+ // Click initialization.
+ vreg2_cfg_setup( &vreg2_cfg );
+ VREG2_MAP_MIKROBUS( vreg2_cfg, MIKROBUS_1 );
+ if ( PWM_ERROR == vreg2_init( &vreg2, &vreg2_cfg ) )
+ {
+ log_error( &logger, " Communication init." );
+ for ( ; ; );
+ }
+
+ if ( VREG2_ERROR == vreg2_default_cfg ( &vreg2 ) )
+ {
+ log_error( &logger, " Default configuration." );
+ for ( ; ; );
+ }
+
+ log_info( &logger, " Application Task " );
}
void application_task ( void )
{
- // Task implementation.
-
- switch ( ctrl_flag )
+ static int8_t duty_pct = 10;
+ static int8_t duty_step = 10;
+ if ( VREG2_OK == vreg2_set_duty_cycle ( &vreg2, ( float ) duty_pct / 100 ) )
{
- case 0:
- {
- duty_cycle = 0.2;
- log_printf( &logger, "Volatage set to : %d %%\r\n", duty_cycle );
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 1;
- break;
- }
-
- case 1:
- {
- duty_cycle = 0.5;
- log_printf( &logger, "Volatage set to : %d %%\r\n", duty_cycle );
-
- if ( ctrl_pre_flag == 0 )
- {
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 2;
- }
- else if ( ctrl_pre_flag == 2 )
- {
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 0;
- }
- break;
- }
- case 2:
- {
- duty_cycle = 0.7;
- log_printf( &logger, "Volatage set to : %d %%\r\n", duty_cycle );
-
- if ( ctrl_pre_flag == 1 )
- {
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 3;
- }
- else if ( ctrl_pre_flag == 3 )
- {
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 1;
- }
- break;
- }
- case 3:
- {
- duty_cycle = 0.95;
- log_printf( &logger, "Volatage set to : %d %%\r\n", duty_cycle );
- ctrl_pre_flag = ctrl_flag;
- ctrl_flag = 2;
- break;
-
- }
- default:
- {
- log_printf( &logger, "Something broke\r\n");
- }
+ log_printf( &logger, "\r\n Duty: %u%%\r\n", ( uint16_t ) duty_pct );
}
-
- vreg2_set_duty_cycle( &vreg2, duty_cycle );
- Delay_ms( 1500 );
- Delay_100ms();
+ duty_pct += duty_step;
+ if ( ( duty_pct > 50 ) || ( duty_pct < 10 ) )
+ {
+ duty_step = -duty_step;
+ duty_pct += ( duty_step * 2 );
+ }
+ Delay_ms( 5000 );
}
void main ( void )
diff --git a/clicks/vreg2/example/manifest.exm b/clicks/vreg2/example/manifest.exm
index 3d27e02bea..99b8b4ad81 100644
--- a/clicks/vreg2/example/manifest.exm
+++ b/clicks/vreg2/example/manifest.exm
@@ -1,8 +1,8 @@
{
"name": "VREG 2 Click",
- "description": "VREG 2 click is a voltage regulator click, with outstanding performances. ",
+ "description": "VREG 2 click is a voltage regulator click, with outstanding performances.",
"image" : "../../Resources/click_icon.png",
- "toolchain": ["mikrocarm","mikrocpic","mikrocpic32"],
+ "toolchain": ["mikrocarm","mikrocpic","mikrocpic32","gcc-riscv","mikrocavr"],
"hw" : ["click","LM2596","LM317","LM358"],
"category" : ["Buck"]
}
diff --git a/clicks/vreg2/example/memake.txt b/clicks/vreg2/example/memake.txt
deleted file mode 100644
index 7ea17191cc..0000000000
--- a/clicks/vreg2/example/memake.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-type: executable
-target: example_vreg2
-
-depends: {
- MikroC.Core
- MikroSDK.Board
- MikroSDK.Log
- Click.Vreg2
-}
-
-uses: {
- MikroC.Core
-}
-
-sources: {
- main.c
-}
diff --git a/clicks/vreg2/lib/include/vreg2.h b/clicks/vreg2/lib/include/vreg2.h
deleted file mode 100644
index 61d8c8aef2..0000000000
--- a/clicks/vreg2/lib/include/vreg2.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * MikroSDK - MikroE Software Development Kit
- * Copyright© 2020 MikroElektronika d.o.o.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
- * OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*!
- * \file
- *
- * \brief This file contains API for VREG 2 Click driver.
- *
- * \addtogroup vreg2 VREG 2 Click Driver
- * @{
- */
-// ----------------------------------------------------------------------------
-
-#ifndef VREG2_H
-#define VREG2_H
-
-#include "drv_digital_out.h"
-#include "drv_digital_in.h"
-#include "drv_pwm.h"
-
-// -------------------------------------------------------------- PUBLIC MACROS
-/**
- * \defgroup macros Macros
- * \{
- */
-
-/**
- * \defgroup map_mikrobus MikroBUS
- * \{
- */
-#define VREG2_MAP_MIKROBUS( cfg, mikrobus ) \
- cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
- cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN )
-/** \} */
-
-/**
- * \defgroup error_code Error Code
- * \{
- */
-#define VREG2_RETVAL uint8_t
-
-#define VREG2_OK 0x00
-#define VREG2_INIT_ERROR 0xFF
-/** \} */
-
-/**
- * \defgroup default_freq Default frequency value
- * \{
- */
-#define VREG2_DEF_FREQ 20000
-/** \} */
-
-/** \} */ // End group macro
-// --------------------------------------------------------------- PUBLIC TYPES
-/**
- * \defgroup type Types
- * \{
- */
-
-/**
- * @brief Click ctx object definition.
- */
-typedef struct
-{
- // Input pins
-
- digital_in_t an;
-
- // Modules
-
- pwm_t pwm;
-
- // ctx variable
-
- uint16_t pwm_period;
- uint32_t pwm_freq;
-
-} vreg2_t;
-
-/**
- * @brief Click configuration structure definition.
- */
-typedef struct
-{
- // Communication gpio pins
-
- pin_name_t pwm;
-
- // Additional gpio pins
-
- pin_name_t an;
-
- // static variable
-
- uint32_t dev_pwm_freq;
-
-} vreg2_cfg_t;
-
-/** \} */ // End types group
-// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
-
-/**
- * \defgroup public_function Public function
- * \{
- */
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-/**
- * @brief Config Object Initialization function.
- *
- * @param cfg Click configuration structure.
- *
- * @description This function initializes click configuration structure to init state.
- * @note All used pins will be set to unconnected state.
- */
-void vreg2_cfg_setup ( vreg2_cfg_t *cfg );
-
-/**
- * @brief Initialization function.
- * @param vreg2 Click object.
- * @param cfg Click configuration structure.
- *
- * @description This function initializes all necessary pins and peripherals used for this click.
- */
-VREG2_RETVAL vreg2_init ( vreg2_t *ctx, vreg2_cfg_t *cfg );
-
-/**
- * @brief Click Default Configuration function.
- *
- * @param ctx Click object.
- *
- * @description This function executes default configuration for Vreg2 click.
- */
-void vreg2_default_cfg ( vreg2_t *ctx );
-
-/**
- * @brief Generic sets PWM duty cycle.
- *
- *
- * @param ctx Click object.
- * @param duty_cycle Duty cycle.
- *
- * @description This function sets the PWM duty cycle.
- */
-void vreg2_set_duty_cycle ( vreg2_t *ctx, float duty_cycle );
-
-/**
- * @brief Stop PWM module.
- *
- * @param ctx Click object.
- *
- * @description This function stops PWM module.
- */
-void vreg2_pwm_stop ( vreg2_t *ctx );
-
-/**
- * @brief Start PWM module.
- *
- * @param ctx Click object.
- *
- * @description This function starts PWM module.
- */
-void vreg2_pwm_start ( vreg2_t *ctx );
-
-#ifdef __cplusplus
-}
-#endif
-#endif // _VREG2_H_
-
-/** \} */ // End public_function group
-/// \} // End click Driver group
-/*! @} */
-// ------------------------------------------------------------------------- END
diff --git a/clicks/vreg2/lib/memake.txt b/clicks/vreg2/lib/memake.txt
deleted file mode 100644
index 0f91e6dfac..0000000000
--- a/clicks/vreg2/lib/memake.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-type: library
-
-target: lib_vreg2
-
-alias: Click.Vreg2
-
-sources: {
- src/vreg2.c
-}
-
-headers: {
- include/vreg2.h
-}
-
-include: {
- include
-}
-
-install: {
- src(include/vreg2.h) dst(include/vreg2.h)
-}
-
-expInclude: {
- include
-}
-
-depends: {
- MikroC.Core
- MikroSDK.Driver
-}
-
-uses: {
- MikroC.Core
-}
-
-others: {
- ../README.md
- ../DETAILS.md
- ../CHANGELOG.md
-}
diff --git a/clicks/vreg2/lib_vreg2/CMakeLists.txt b/clicks/vreg2/lib_vreg2/CMakeLists.txt
new file mode 100644
index 0000000000..4c571e8fb9
--- /dev/null
+++ b/clicks/vreg2/lib_vreg2/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(lib_vreg2 LANGUAGES MikroC)
+else()
+ project(lib_vreg2 LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_library(lib_vreg2 STATIC
+ src/vreg2.c
+ include/vreg2.h
+)
+add_library(Click.Vreg2 ALIAS lib_vreg2)
+
+
+
+target_include_directories(lib_vreg2 PUBLIC
+ include
+)
+
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(lib_vreg2 PUBLIC MikroC.Core)
+find_package(MikroSDK.Driver REQUIRED)
+target_link_libraries(lib_vreg2 PUBLIC MikroSDK.Driver)
diff --git a/clicks/vreg2/lib_vreg2/include/Click.Vreg2 b/clicks/vreg2/lib_vreg2/include/Click.Vreg2
new file mode 100644
index 0000000000..8d6a166750
--- /dev/null
+++ b/clicks/vreg2/lib_vreg2/include/Click.Vreg2
@@ -0,0 +1 @@
+#include "vreg2.h"
diff --git a/clicks/vreg2/lib_vreg2/include/vreg2.h b/clicks/vreg2/lib_vreg2/include/vreg2.h
new file mode 100644
index 0000000000..a18a81735d
--- /dev/null
+++ b/clicks/vreg2/lib_vreg2/include/vreg2.h
@@ -0,0 +1,212 @@
+/****************************************************************************
+** Copyright (C) 2020 MikroElektronika d.o.o.
+** Contact: https://www.mikroe.com/contact
+**
+** Permission is hereby granted, free of charge, to any person obtaining a copy
+** of this software and associated documentation files (the "Software"), to deal
+** in the Software without restriction, including without limitation the rights
+** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+** copies of the Software, and to permit persons to whom the Software is
+** furnished to do so, subject to the following conditions:
+** The above copyright notice and this permission notice shall be
+** included in all copies or substantial portions of the Software.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
+** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+** USE OR OTHER DEALINGS IN THE SOFTWARE.
+****************************************************************************/
+
+/*!
+ * @file vreg2.h
+ * @brief This file contains API for VREG 2 Click Driver.
+ */
+
+#ifndef VREG2_H
+#define VREG2_H
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#include "drv_digital_out.h"
+#include "drv_digital_in.h"
+#include "drv_pwm.h"
+
+/*!
+ * @addtogroup vreg2 VREG 2 Click Driver
+ * @brief API for configuring and manipulating VREG 2 Click driver.
+ * @{
+ */
+
+/**
+ * @defgroup vreg2_cfg VREG 2 PWM Settings
+ * @brief Settings for configuration of VREG 2 Click driver.
+ */
+
+/**
+ * @addtogroup vreg2_cfg
+ * @{
+ */
+
+/**
+ * @brief VREG 2 default PWM frequency.
+ * @details Specified setting for default PWM frequency of VREG 2 Click driver.
+ */
+#define VREG2_DEF_FREQ 5000
+
+/*! @} */ // vreg2_cfg
+
+/**
+ * @defgroup vreg2_map VREG 2 MikroBUS Map
+ * @brief MikroBUS pin mapping of VREG 2 Click driver.
+ */
+
+/**
+ * @addtogroup vreg2_map
+ * @{
+ */
+
+/**
+ * @brief MikroBUS pin mapping.
+ * @details Mapping pins of VREG 2 Click to the selected MikroBUS.
+ */
+#define VREG2_MAP_MIKROBUS( cfg, mikrobus ) \
+ cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM );
+
+/*! @} */ // vreg2_map
+/*! @} */ // vreg2
+
+/**
+ * @brief VREG 2 Click context object.
+ * @details Context object definition of VREG 2 Click driver.
+ */
+typedef struct
+{
+ // Modules
+ pwm_t pwm; /**< PWM driver object. */
+
+ // ctx variable
+ uint32_t pwm_freq; /**< PWM frequency value. */
+
+} vreg2_t;
+
+/**
+ * @brief VREG 2 Click configuration object.
+ * @details Configuration object definition of VREG 2 Click driver.
+ */
+typedef struct
+{
+ // Communication gpio pins
+ pin_name_t pwm; /**< PWM pin. */
+
+ // Static variable
+ uint32_t dev_pwm_freq; /**< PWM frequency value. */
+
+} vreg2_cfg_t;
+
+/**
+ * @brief VREG 2 Click return value data.
+ * @details Predefined enum values for driver return values.
+ */
+typedef enum
+{
+ VREG2_OK = 0,
+ VREG2_ERROR = -1
+
+} vreg2_return_value_t;
+
+/*!
+ * @addtogroup vreg2 VREG 2 Click Driver
+ * @brief API for configuring and manipulating VREG 2 Click driver.
+ * @{
+ */
+
+/**
+ * @brief VREG 2 configuration object setup function.
+ * @details This function initializes click configuration structure to initial
+ * values.
+ * @param[out] cfg : Click configuration structure.
+ * See #vreg2_cfg_t object definition for detailed explanation.
+ * @return Nothing.
+ * @note The all used pins will be set to unconnected state.
+ */
+void vreg2_cfg_setup ( vreg2_cfg_t *cfg );
+
+/**
+ * @brief VREG 2 initialization function.
+ * @details This function initializes all necessary pins and peripherals used
+ * for this click board.
+ * @param[out] ctx : Click context object.
+ * See #vreg2_t object definition for detailed explanation.
+ * @param[in] cfg : Click configuration structure.
+ * See #vreg2_cfg_t object definition for detailed explanation.
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t vreg2_init ( vreg2_t *ctx, vreg2_cfg_t *cfg );
+
+/**
+ * @brief VREG 2 default configuration function.
+ * @details This function executes a default configuration of VREG 2
+ * click board.
+ * @param[in] ctx : Click context object.
+ * See #vreg2_t object definition for detailed explanation.
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note This function can consist any necessary configuration or setting to put
+ * device into operating mode.
+ */
+err_t vreg2_default_cfg ( vreg2_t *ctx );
+
+/**
+ * @brief VREG 2 sets PWM duty cycle.
+ * @details This function sets the PWM duty cycle in percentages ( Range[ 0..1 ] ).
+ * @param[in] ctx : Click context object.
+ * See #vreg2_t object definition for detailed explanation.
+ * @param[in] duty_cycle : PWM duty cycle.
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t vreg2_set_duty_cycle ( vreg2_t *ctx, float duty_cycle );
+
+/**
+ * @brief VREG 2 stop PWM module.
+ * @details This function stops the PWM module output.
+ * @param[in] ctx : Click context object.
+ * See #vreg2_t object definition for detailed explanation.
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t vreg2_pwm_stop ( vreg2_t *ctx );
+
+/**
+ * @brief VREG 2 start PWM module.
+ * @details This function starts the PWM module output.
+ * @param[in] ctx : Click context object.
+ * See #vreg2_t object definition for detailed explanation.
+ * @return @li @c 0 - Success,
+ * @li @c -1 - Error.
+ * See #err_t definition for detailed explanation.
+ * @note None.
+ */
+err_t vreg2_pwm_start ( vreg2_t *ctx );
+
+#ifdef __cplusplus
+}
+#endif
+#endif // VREG2_H
+
+/*! @} */ // vreg2
+
+// ------------------------------------------------------------------------ END
diff --git a/clicks/vreg2/lib/src/vreg2.c b/clicks/vreg2/lib_vreg2/src/vreg2.c
similarity index 70%
rename from clicks/vreg2/lib/src/vreg2.c
rename to clicks/vreg2/lib_vreg2/src/vreg2.c
index 62221904d6..70d228ea12 100644
--- a/clicks/vreg2/lib/src/vreg2.c
+++ b/clicks/vreg2/lib_vreg2/src/vreg2.c
@@ -29,59 +29,59 @@
#include "vreg2.h"
-// ------------------------------------------------------------- PRIVATE MACROS
-
-#define PWM_PERIOD_ERROR 0
-
// ------------------------------------------------ PUBLIC FUNCTION DEFINITIONS
void vreg2_cfg_setup ( vreg2_cfg_t *cfg )
{
// Communication gpio pins
-
cfg->pwm = HAL_PIN_NC;
- // Additional gpio pins
-
- cfg->an = HAL_PIN_NC;
-
- cfg->dev_pwm_freq = 5000;
+ cfg->dev_pwm_freq = VREG2_DEF_FREQ;
}
-VREG2_RETVAL vreg2_init ( vreg2_t *ctx, vreg2_cfg_t *cfg )
+err_t vreg2_init ( vreg2_t *ctx, vreg2_cfg_t *cfg )
{
pwm_config_t pwm_cfg;
-
+
pwm_configure_default( &pwm_cfg );
- pwm_cfg.pin = cfg->pwm;
- pwm_cfg.freq_hz = cfg->dev_pwm_freq;
+ pwm_cfg.pin = cfg->pwm;
+ pwm_cfg.freq_hz = cfg->dev_pwm_freq;
ctx->pwm_freq = cfg->dev_pwm_freq;
- pwm_open( &ctx->pwm, &pwm_cfg );
- pwm_set_freq( &ctx->pwm, pwm_cfg.freq_hz );
-
- // Input pins
- digital_in_init( &ctx->an, cfg->an );
+ if ( PWM_ERROR == pwm_open( &ctx->pwm, &pwm_cfg ) )
+ {
+ return PWM_ERROR;
+ }
+ pwm_set_freq( &ctx->pwm, pwm_cfg.freq_hz );
return VREG2_OK;
+}
+
+err_t vreg2_default_cfg ( vreg2_t *ctx )
+{
+ err_t error_flag = VREG2_OK;
+
+ error_flag |= vreg2_set_duty_cycle ( ctx, 0.0 );
+ error_flag |= vreg2_pwm_start( ctx );
+ return error_flag;
}
-void vreg2_set_duty_cycle ( vreg2_t *ctx, float duty_cycle )
+err_t vreg2_set_duty_cycle ( vreg2_t *ctx, float duty_cycle )
{
- pwm_set_duty( &ctx->pwm, duty_cycle );
+ return pwm_set_duty( &ctx->pwm, duty_cycle );
}
-void vreg2_pwm_stop ( vreg2_t *ctx )
+err_t vreg2_pwm_stop ( vreg2_t *ctx )
{
- pwm_stop( &ctx->pwm );
+ return pwm_stop( &ctx->pwm );
}
-void vreg2_pwm_start ( vreg2_t *ctx )
+err_t vreg2_pwm_start ( vreg2_t *ctx )
{
- pwm_start( &ctx->pwm );
+ return pwm_start( &ctx->pwm );
}
// ------------------------------------------------------------------------- END
diff --git a/clicks/vreg2/memake.txt b/clicks/vreg2/memake.txt
deleted file mode 100644
index 8dffb0f0ab..0000000000
--- a/clicks/vreg2/memake.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-type: subdirs
-project: Vreg2
-
-subdirs: {
- lib
- example
-}
diff --git a/clicks/vtohz2/CHANGELOG.md b/clicks/vtohz2/CHANGELOG.md
index fcfecd1843..dae6081f37 100644
--- a/clicks/vtohz2/CHANGELOG.md
+++ b/clicks/vtohz2/CHANGELOG.md
@@ -1,4 +1,4 @@
## Changelog
-### Version 2.0.0.6
+### Version 2.1.0.6
- Initial release
diff --git a/clicks/vtohz2/CMakeLists.txt b/clicks/vtohz2/CMakeLists.txt
new file mode 100644
index 0000000000..24076be1d7
--- /dev/null
+++ b/clicks/vtohz2/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(example_vtohz2 LANGUAGES MikroC)
+else()
+ project(example_vtohz2 LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_executable(example_vtohz2
+ example/main.c
+
+)
+
+
+############################ example_vtohz2 GENERATED CODE START ###########################
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(example_vtohz2 PUBLIC MikroC.Core)
+find_package(MikroSDK.Board REQUIRED)
+target_link_libraries(example_vtohz2 PUBLIC MikroSDK.Board)
+find_package(MikroSDK.Log REQUIRED)
+target_link_libraries(example_vtohz2 PUBLIC MikroSDK.Log)
+add_subdirectory(lib_vtohz2)
+target_link_libraries(example_vtohz2 PUBLIC Click.VToHz2)
+############################ example_vtohz2 GENERATED CODE END ###########################
diff --git a/clicks/vtohz2/doc/doxy/Doxyfile.doxy b/clicks/vtohz2/doc/doxy/Doxyfile.doxy
index a2f1eb3891..eb5f8d0dde 100644
--- a/clicks/vtohz2/doc/doxy/Doxyfile.doxy
+++ b/clicks/vtohz2/doc/doxy/Doxyfile.doxy
@@ -44,21 +44,21 @@ PROJECT_NUMBER = 2.0.0.0
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
-PROJECT_BRIEF =
+PROJECT_BRIEF =
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
-PROJECT_LOGO =
+PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
-OUTPUT_DIRECTORY = ../clicks/vtohz2/temp/Help/doc
+OUTPUT_DIRECTORY = ../cmake/vtohz2/temp/Help/doc
# 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
@@ -162,7 +162,7 @@ FULL_PATH_NAMES = YES
# will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
-STRIP_FROM_PATH =
+STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which
@@ -171,7 +171,7 @@ STRIP_FROM_PATH =
# specify the list of include paths that are normally passed to the compiler
# using the -I flag.
-STRIP_FROM_INC_PATH =
+STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
# less readable) file names. This can be useful is your file systems doesn't
@@ -238,13 +238,13 @@ TAB_SIZE = 4
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines.
-ALIASES =
+ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
-TCL_SUBST =
+TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
@@ -291,7 +291,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
-EXTENSION_MAPPING =
+EXTENSION_MAPPING =
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
@@ -648,7 +648,7 @@ GENERATE_DEPRECATEDLIST= YES
# sections, marked by \if ... \endif and \cond
# ... \endcond blocks.
-ENABLED_SECTIONS =
+ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
# initial value of a variable or macro / define can have for it to appear in the
@@ -690,7 +690,7 @@ SHOW_NAMESPACES = YES
# by doxygen. Whatever the program writes to standard output is used as the file
# version. For an example see the documentation.
-FILE_VERSION_FILTER =
+FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
# by doxygen. The layout file controls the global structure of the generated
@@ -703,7 +703,7 @@ FILE_VERSION_FILTER =
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty.
-LAYOUT_FILE =
+LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
@@ -713,7 +713,7 @@ LAYOUT_FILE =
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. See also \cite for info how to create references.
-CITE_BIB_FILES =
+CITE_BIB_FILES =
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
@@ -778,7 +778,7 @@ WARN_FORMAT = "$file:$line: $text"
# messages should be written. If left blank the output is written to standard
# error (stderr).
-WARN_LOGFILE =
+WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
@@ -790,9 +790,9 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = ../clicks/vtohz2/example \
- ../clicks/vtohz2/lib/include \
- ../clicks/vtohz2/README.md
+INPUT = ../cmake/vtohz2/example \
+ ../cmake/vtohz2/lib_vtohz2/include \
+ ../cmake/vtohz2/README.md
# 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
@@ -877,7 +877,7 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
-EXCLUDE =
+EXCLUDE =
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -893,7 +893,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
-EXCLUDE_PATTERNS =
+EXCLUDE_PATTERNS =
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@@ -904,13 +904,13 @@ EXCLUDE_PATTERNS =
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
-EXCLUDE_SYMBOLS =
+EXCLUDE_SYMBOLS =
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
# command).
-EXAMPLE_PATH = ../clicks/vtohz2/example
+EXAMPLE_PATH = ../cmake/vtohz2/example
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -930,7 +930,7 @@ EXAMPLE_RECURSIVE = YES
# that contain images that are to be included in the documentation (see the
# \image command).
-IMAGE_PATH =
+IMAGE_PATH =
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
@@ -951,7 +951,7 @@ IMAGE_PATH =
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
-INPUT_FILTER =
+INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis. Doxygen will compare the file name with each pattern and apply the
@@ -964,7 +964,7 @@ INPUT_FILTER =
# 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
# INPUT_FILTER) will also be used to filter the input files that are used for
@@ -979,14 +979,14 @@ FILTER_SOURCE_FILES = NO
# *.ext= (so without naming a filter).
# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
-FILTER_SOURCE_PATTERNS =
+FILTER_SOURCE_PATTERNS =
# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
# is part of the input, its contents will be placed on the main page
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.
-USE_MDFILE_AS_MAINPAGE =
+USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# Configuration options related to source browsing
@@ -1091,7 +1091,7 @@ CLANG_ASSISTED_PARSING = NO
# specified with INPUT and INCLUDE_PATH.
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
-CLANG_OPTIONS =
+CLANG_OPTIONS =
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
@@ -1117,7 +1117,7 @@ COLS_IN_ALPHA_INDEX = 5
# while generating the index headers.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-IGNORE_PREFIX =
+IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
@@ -1161,7 +1161,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_HEADER =
+HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
@@ -1171,7 +1171,7 @@ HTML_HEADER =
# that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_FOOTER =
+HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of
@@ -1183,7 +1183,7 @@ HTML_FOOTER =
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_STYLESHEET =
+HTML_STYLESHEET =
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
@@ -1196,7 +1196,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@@ -1206,7 +1206,7 @@ HTML_EXTRA_STYLESHEET =
# files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_FILES =
+HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
@@ -1335,7 +1335,7 @@ GENERATE_HTMLHELP = YES
# written to the html output directory.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-CHM_FILE =
+CHM_FILE =
# 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,
@@ -1343,7 +1343,7 @@ CHM_FILE =
# The file has to be specified with full path.
# 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
# (YES) or that it should be included in the master .chm file (NO).
@@ -1356,7 +1356,7 @@ GENERATE_CHI = NO
# and project file content.
# 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
# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
@@ -1387,7 +1387,7 @@ GENERATE_QHP = NO
# the HTML output folder.
# This tag requires that the tag GENERATE_QHP is set to YES.
-QCH_FILE =
+QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
@@ -1412,7 +1412,7 @@ QHP_VIRTUAL_FOLDER = ./temp/Help/doc
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
@@ -1420,21 +1420,21 @@ QHP_CUST_FILTER_NAME =
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_CUST_FILTER_ATTRS =
+QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
# https://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_SECT_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
# The QHG_LOCATION tag can be used to specify the location of Qt's
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
# generated .qhp file.
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHG_LOCATION =
+QHG_LOCATION =
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
# generated, together with the HTML files, they form an Eclipse help plugin. To
@@ -1567,7 +1567,7 @@ MATHJAX_RELPATH = https://cdn.mathjax.org/mathjax/latest
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_EXTENSIONS =
+MATHJAX_EXTENSIONS =
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
# of code that will be used on startup of the MathJax code. See the MathJax site
@@ -1575,7 +1575,7 @@ MATHJAX_EXTENSIONS =
# example see the documentation.
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_CODEFILE =
+MATHJAX_CODEFILE =
# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
# the HTML output. The underlying search engine uses javascript and DHTML and
@@ -1635,7 +1635,7 @@ EXTERNAL_SEARCH = NO
# Searching" for details.
# This tag requires that the tag SEARCHENGINE is set to YES.
-SEARCHENGINE_URL =
+SEARCHENGINE_URL =
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
# search data is written to a file for indexing by an external tool. With the
@@ -1651,7 +1651,7 @@ SEARCHDATA_FILE = searchdata.xml
# projects and redirect the results back to the right project.
# This tag requires that the tag SEARCHENGINE is set to YES.
-EXTERNAL_SEARCH_ID =
+EXTERNAL_SEARCH_ID =
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
# projects other than the one defined by this configuration file, but that are
@@ -1661,7 +1661,7 @@ EXTERNAL_SEARCH_ID =
# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
# This tag requires that the tag SEARCHENGINE is set to YES.
-EXTRA_SEARCH_MAPPINGS =
+EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
@@ -1725,7 +1725,7 @@ PAPER_TYPE = a4
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-EXTRA_PACKAGES =
+EXTRA_PACKAGES =
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
# generated LaTeX document. The header should contain everything until the first
@@ -1741,7 +1741,7 @@ EXTRA_PACKAGES =
# to HTML_HEADER.
# 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
# generated LaTeX document. The footer should contain everything after the last
@@ -1752,7 +1752,7 @@ LATEX_HEADER =
# 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.
-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
@@ -1763,7 +1763,7 @@ LATEX_FOOTER =
# list).
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_STYLESHEET =
# 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
@@ -1771,7 +1771,7 @@ LATEX_EXTRA_STYLESHEET =
# markers available.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_EXTRA_FILES =
+LATEX_EXTRA_FILES =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
@@ -1879,14 +1879,14 @@ RTF_HYPERLINKS = NO
# default style sheet that doxygen normally uses.
# This tag requires that the tag GENERATE_RTF is set to YES.
-RTF_STYLESHEET_FILE =
+RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an RTF document. Syntax is
# similar to doxygen's config file. A template extensions file can be generated
# using doxygen -e rtf extensionFile.
# This tag requires that the tag GENERATE_RTF is set to YES.
-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.
@@ -1931,7 +1931,7 @@ MAN_EXTENSION = .3
# MAN_EXTENSION with the initial . removed.
# This tag requires that the tag GENERATE_MAN is set to YES.
-MAN_SUBDIR =
+MAN_SUBDIR =
# 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
@@ -2044,7 +2044,7 @@ PERLMOD_PRETTY = YES
# overwrite each other's variables.
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-PERLMOD_MAKEVAR_PREFIX =
+PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
@@ -2085,7 +2085,7 @@ SEARCH_INCLUDES = YES
# preprocessor.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-INCLUDE_PATH =
+INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
@@ -2093,7 +2093,7 @@ INCLUDE_PATH =
# used.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-INCLUDE_FILE_PATTERNS =
+INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that are
# defined before the preprocessor is started (similar to the -D option of e.g.
@@ -2103,7 +2103,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-PREDEFINED =
+PREDEFINED =
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
@@ -2112,7 +2112,7 @@ PREDEFINED =
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-EXPAND_AS_DEFINED =
+EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
@@ -2141,13 +2141,13 @@ SKIP_FUNCTION_MACROS = YES
# 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.
-TAGFILES =
+TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
# tag file that is based on the input files it reads. See section "Linking to
# external documentation" for more information about the usage of tag files.
-GENERATE_TAGFILE =
+GENERATE_TAGFILE =
# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
# the class index. If set to NO, only the inherited external classes will be
@@ -2196,14 +2196,14 @@ CLASS_DIAGRAMS = YES
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
-MSCGEN_PATH =
+MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
# If left empty dia is assumed to be found in the default search path.
-DIA_PATH =
+DIA_PATH =
# 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.
@@ -2252,7 +2252,7 @@ DOT_FONTSIZE = 10
# the path where dot can find it using this tag.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_FONTPATH =
+DOT_FONTPATH =
# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
# each documented class showing the direct and indirect inheritance relations.
@@ -2396,26 +2396,26 @@ INTERACTIVE_SVG = NO
# found. If left blank, it is assumed the dot tool can be found in the path.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_PATH =
+DOT_PATH =
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the \dotfile
# command).
# This tag requires that the tag HAVE_DOT is set to YES.
-DOTFILE_DIRS =
+DOTFILE_DIRS =
# The MSCFILE_DIRS tag can be used to specify one or more directories that
# contain msc files that are included in the documentation (see the \mscfile
# command).
-MSCFILE_DIRS =
+MSCFILE_DIRS =
# The DIAFILE_DIRS tag can be used to specify one or more directories that
# contain dia files that are included in the documentation (see the \diafile
# command).
-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
@@ -2423,17 +2423,17 @@ DIAFILE_DIRS =
# generate a warning when it encounters a \startuml command in this case and
# will not generate output for the diagram.
-PLANTUML_JAR_PATH =
+PLANTUML_JAR_PATH =
# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
# configuration file for plantuml.
-PLANTUML_CFG_FILE =
+PLANTUML_CFG_FILE =
# When using plantuml, the specified paths are searched for files specified by
# the !include statement in a plantuml block.
-PLANTUML_INCLUDE_PATH =
+PLANTUML_INCLUDE_PATH =
# 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
@@ -2494,7 +2494,3 @@ GENERATE_LEGEND = YES
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_CLEANUP = YES
-
-
-
-
diff --git a/clicks/vtohz2/doc/package/manifest.json b/clicks/vtohz2/doc/package/manifest.json
index a6800c11fd..de5417d69a 100644
--- a/clicks/vtohz2/doc/package/manifest.json
+++ b/clicks/vtohz2/doc/package/manifest.json
@@ -1,6 +1,6 @@
{
- "architecture": "ARM|PIC|PIC32",
- "category": "Measurements",
+ "architecture": "ARM|PIC|PIC32|RISC-V|AVR",
+ "category": "Click Boards > Mixed signal > Measurements",
"changelog": "Resources/CHANGELOG.md",
"contains": [
"libraries",
@@ -8,8 +8,7 @@
"examples",
"source_files"
],
- "dependency_list": [
- ],
+"dependency_list": [],
"details": "Resources/DETAILS.md",
"display_name": "V to Hz 2 click",
"example_list": [
@@ -26,16 +25,14 @@
"name": "mikroe.click.vtohz2",
"product_link": "https://www.mikroe.com/v-to-hz-2-click",
"short_description": "V to Hz 2 click is a device that converts an analog voltage input signal into a pulse wave signal of a certain frequency.",
- "supported_compiler": "mikroC AI",
+ "supported_compiler": "mikroC AI|GCC",
"type": "Library",
- "_type":"mikroSDK Library",
- "related_projects":[
+ "_type": "mikroSDK Library",
+ "related_projects": [
2426
],
- "version": "2.0.0.6"
+ "version": "2.1.0.6",
+ "cmake": true,
+ "alias": "Click.VToHz2",
+ "subdir_name": "lib_vtohz2"
}
-
-
-
-
-
diff --git a/clicks/vtohz2/example/CMakeLists.txt b/clicks/vtohz2/example/CMakeLists.txt
new file mode 100644
index 0000000000..6466b5f250
--- /dev/null
+++ b/clicks/vtohz2/example/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(example_vtohz2 LANGUAGES MikroC)
+else()
+ project(example_vtohz2 LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_executable(example_vtohz2
+ main.c
+
+)
+
+
+############################ example_vtohz2 GENERATED CODE START ###########################
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(example_vtohz2 PUBLIC MikroC.Core)
+find_package(MikroSDK.Board REQUIRED)
+target_link_libraries(example_vtohz2 PUBLIC MikroSDK.Board)
+find_package(MikroSDK.Log REQUIRED)
+target_link_libraries(example_vtohz2 PUBLIC MikroSDK.Log)
+add_subdirectory(lib_vtohz2)
+target_link_libraries(example_vtohz2 PUBLIC Click.VToHz2)
+############################ example_vtohz2 GENERATED CODE END ###########################
diff --git a/clicks/vtohz2/example/manifest.exm b/clicks/vtohz2/example/manifest.exm
index d7620c0045..361ece8c3b 100644
--- a/clicks/vtohz2/example/manifest.exm
+++ b/clicks/vtohz2/example/manifest.exm
@@ -2,7 +2,7 @@
"name": "V to Hz 2 Click",
"description": "V to Hz 2 click is a device that converts an analog voltage input signal into a pulse wave signal of a certain frequency.",
"image" : "../../Resources/click_icon.png",
- "toolchain": ["mikrocarm","mikrocpic","mikrocpic32"],
+ "toolchain": ["mikrocarm","mikrocpic","mikrocpic32","gcc-riscv","mikrocavr"],
"hw" : ["click","VFC32KU","TPS65131"],
"category" : ["Measurements"]
}
diff --git a/clicks/vtohz2/example/memake.txt b/clicks/vtohz2/example/memake.txt
deleted file mode 100644
index 1e0f8c077e..0000000000
--- a/clicks/vtohz2/example/memake.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-type: executable
-target: example_vtohz2
-
-depends: {
- MikroC.Core
- MikroSDK.Board
- MikroSDK.Log
- Click.VToHz2
-}
-
-uses: {
- MikroC.Core
-}
-
-sources: {
- main.c
-}
diff --git a/clicks/vtohz2/lib/memake.txt b/clicks/vtohz2/lib/memake.txt
deleted file mode 100644
index 569342ce4c..0000000000
--- a/clicks/vtohz2/lib/memake.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-type: library
-
-target: lib_vtohz2
-
-alias: Click.VToHz2
-
-sources: {
- src/vtohz2.c
-}
-
-headers: {
- include/vtohz2.h
-}
-
-include: {
- include
-}
-
-install: {
- src(include/vtohz2.h) dst(include/vtohz2.h)
-}
-
-expInclude: {
- include
-}
-
-depends: {
- MikroC.Core
- MikroSDK.Driver
-}
-
-uses: {
- MikroC.Core
-}
-
-others: {
- ../README.md
- ../DETAILS.md
- ../CHANGELOG.md
-}
diff --git a/clicks/vtohz2/lib_vtohz2/CMakeLists.txt b/clicks/vtohz2/lib_vtohz2/CMakeLists.txt
new file mode 100644
index 0000000000..9c30566f12
--- /dev/null
+++ b/clicks/vtohz2/lib_vtohz2/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(lib_vtohz2 LANGUAGES MikroC)
+else()
+ project(lib_vtohz2 LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_library(lib_vtohz2 STATIC
+ src/vtohz2.c
+ include/vtohz2.h
+)
+add_library(Click.VToHz2 ALIAS lib_vtohz2)
+
+
+
+target_include_directories(lib_vtohz2 PUBLIC
+ include
+)
+
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(lib_vtohz2 PUBLIC MikroC.Core)
+find_package(MikroSDK.Driver REQUIRED)
+target_link_libraries(lib_vtohz2 PUBLIC MikroSDK.Driver)
diff --git a/clicks/vtohz2/lib_vtohz2/include/Click.VToHz2 b/clicks/vtohz2/lib_vtohz2/include/Click.VToHz2
new file mode 100644
index 0000000000..013abfd50a
--- /dev/null
+++ b/clicks/vtohz2/lib_vtohz2/include/Click.VToHz2
@@ -0,0 +1 @@
+#include "vtohz2.h"
diff --git a/clicks/vtohz2/lib/include/vtohz2.h b/clicks/vtohz2/lib_vtohz2/include/vtohz2.h
similarity index 100%
rename from clicks/vtohz2/lib/include/vtohz2.h
rename to clicks/vtohz2/lib_vtohz2/include/vtohz2.h
diff --git a/clicks/vtohz2/lib/src/vtohz2.c b/clicks/vtohz2/lib_vtohz2/src/vtohz2.c
similarity index 100%
rename from clicks/vtohz2/lib/src/vtohz2.c
rename to clicks/vtohz2/lib_vtohz2/src/vtohz2.c
diff --git a/clicks/vtohz2/memake.txt b/clicks/vtohz2/memake.txt
deleted file mode 100644
index 59cd515fa9..0000000000
--- a/clicks/vtohz2/memake.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-type: subdirs
-project: VToHz2
-
-subdirs: {
- lib
- example
-}
diff --git a/clicks/waveform/CHANGELOG.md b/clicks/waveform/CHANGELOG.md
index a428f9dd62..cdeade9400 100644
--- a/clicks/waveform/CHANGELOG.md
+++ b/clicks/waveform/CHANGELOG.md
@@ -1,4 +1,4 @@
## Changelog
-### Version 2.0.0.11
+### Version 2.1.0.14
- Initial release
diff --git a/clicks/waveform/CMakeLists.txt b/clicks/waveform/CMakeLists.txt
new file mode 100644
index 0000000000..041ab917e4
--- /dev/null
+++ b/clicks/waveform/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(example_waveform LANGUAGES MikroC)
+else()
+ project(example_waveform LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_executable(example_waveform
+ example/main.c
+
+)
+
+
+############################ example_waveform GENERATED CODE START ###########################
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(example_waveform PUBLIC MikroC.Core)
+find_package(MikroSDK.Board REQUIRED)
+target_link_libraries(example_waveform PUBLIC MikroSDK.Board)
+find_package(MikroSDK.Log REQUIRED)
+target_link_libraries(example_waveform PUBLIC MikroSDK.Log)
+add_subdirectory(lib_waveform)
+target_link_libraries(example_waveform PUBLIC Click.Waveform)
+############################ example_waveform GENERATED CODE END ###########################
diff --git a/clicks/waveform/DETAILS.md b/clicks/waveform/DETAILS.md
index 89506ebfe5..abf89db0a3 100644
--- a/clicks/waveform/DETAILS.md
+++ b/clicks/waveform/DETAILS.md
@@ -3,7 +3,7 @@
---
# Waveform click
-Waveform Click is a precise sine/triangle/square waveform generator, capable of reproducing frequencies up to 12MHz.
+> Waveform Click is a precise sine/triangle/square waveform generator, capable of reproducing frequencies up to 12MHz.
@@ -36,27 +36,36 @@ Package can be downloaded/installed directly form compilers IDE(recommended way)
#### Standard key functions :
-- Config Object Initialization function.
-> void waveform_cfg_setup ( waveform_cfg_t *cfg );
-
-- Initialization function.
-> WAVEFORM_RETVAL waveform_init ( waveform_t *ctx, waveform_cfg_t *cfg );
+- `waveform_cfg_setup` Config Object Initialization function.
+```c
+void waveform_cfg_setup ( waveform_cfg_t *cfg );
+```
+- `waveform_init` Initialization function.
+```c
+err_t waveform_init ( waveform_t *ctx, waveform_cfg_t *cfg );
+```
#### Example key functions :
-- Freqency function
-> void waveform_write_freqency ( waveform_t *ctx, uint32_t f );
-
-- Triangle output function
-> void waveform_triangle_output ( waveform_t *ctx, uint32_t f );
+- `waveform_sine_output` Sinusoide output function
+```c
+void waveform_sine_output ( waveform_t *ctx, uint32_t freq );
+```
+
+- `waveform_triangle_output` Triangle output function
+```c
+void waveform_triangle_output ( waveform_t *ctx, uint32_t freq );
+```
-- Square output function
-> void waveform_square_output ( waveform_t *ctx, uint32_t f );
+- `waveform_square_output` Square output function
+```c
+void waveform_square_output ( waveform_t *ctx, uint32_t freq );
+```
## Examples Description
-> This program outputs wave forms.
+> This example demonstrates the use of Waveform click board.
**The demo application is composed of two sections :**
@@ -69,7 +78,7 @@ Package can be downloaded/installed directly form compilers IDE(recommended way)
void application_init ( )
{
log_cfg_t log_cfg;
- waveform_cfg_t cfg;
+ waveform_cfg_t waveform_cfg;
/**
* Logger initialization.
@@ -82,82 +91,38 @@ void application_init ( )
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
- log_info( &logger, "---- Application Init ----" );
+ log_info( &logger, " Application Init " );
- // Click initialization.
-
- waveform_cfg_setup( &cfg );
- WAVEFORM_MAP_MIKROBUS( cfg, MIKROBUS_1 );
- waveform_init( &waveform, &cfg );
+ // Click initialization.
+ waveform_cfg_setup( &waveform_cfg );
+ WAVEFORM_MAP_MIKROBUS( waveform_cfg, MIKROBUS_1 );
+ if ( SPI_MASTER_ERROR == waveform_init( &waveform, &waveform_cfg ) )
+ {
+ log_error( &logger, " Communication init." );
+ for ( ; ; );
+ }
- freq = waveform_aprox_freqcalculation( 5000 );
- waveform_square_output( &waveform, freq );
- freq = 0;
+ waveform_sine_output( &waveform, frequency );
+ log_printf( &logger, "Sine wave output set with approx. frequency: %lu Hz\r\n", frequency );
+ waveform_display_commands ( );
+ log_info( &logger, " Application Task " );
}
```
### Application Task
-> Predefined characters are inputed from the serial port.
-> Changes the signal frequency, waveform or amplitude depending on the receiver character.
+> Predefined commands are inputed from the serial port.
+> Changes the signal frequency, waveform or amplitude depending on the receiver command.
```c
void application_task ( )
{
- uint8_t rx_len = log_read ( &logger, rx_data_buffer, 1 );
-
- if ( rx_len > 0 )
+ uint8_t command = 0;
+ if ( 1 == log_read ( &logger, &command, 1 ) )
{
- switch( rx_data_buffer[ 0 ] )
- {
- case '+': {
- waveform_digipot_inc( &waveform );
- log_printf( &logger, "Increasing amplitude of the current wave.\r\n" );
- break;
- }
- case '-': {
- waveform_digipot_dec( &waveform );
- log_printf( &logger, "Decreasing amplitude of the current wave.\r\n" );
- break;
- }
- case 'S': {
- frequency_increment( WAVEFORM_SINE_OUT );
- log_printf( &logger, "Increasing frequency of the sine wave.\r\n" );
- break;
- }
- case 's': {
- frequency_decrement( WAVEFORM_SINE_OUT );
- log_printf( &logger, "Decreasing frequency of the sine wave.\r\n" );
- break;
- }
- case 'T': {
- frequency_increment( WAVEFORM_TRIANGLE_OUT );
- log_printf( &logger, "Increasing frequency of the triangle wave.\r\n" );
- break;
- }
- case 't': {
- frequency_decrement( WAVEFORM_TRIANGLE_OUT );
- log_printf( &logger, "Decreasing frequency of the triangle wave.\r\n" );
- break;
- }
- case 'Q': {
- frequency_increment( WAVEFORM_SQUARE_OUT );
- log_printf( &logger, "Increasing frequency of the square wave.\r\n" );
- break;
- }
- case 'q': {
- frequency_decrement( WAVEFORM_SQUARE_OUT );
- log_printf( &logger, "Decreasing frequency of the square wave.\r\n" );
- break;
- }
- default :{
- break;
- }
- }
- rx_data_buffer[ 0 ] = 0;
- rx_len = 0;
+ waveform_parse_command ( command );
}
}
diff --git a/clicks/waveform/README.md b/clicks/waveform/README.md
index 5c0d504ae8..e91af926c9 100644
--- a/clicks/waveform/README.md
+++ b/clicks/waveform/README.md
@@ -1,13 +1,10 @@
\mainpage Main Page
-
-
-
---
# Waveform click
-Waveform Click is a precise sine/triangle/square waveform generator, capable of reproducing frequencies up to 12MHz.
+> Waveform Click is a precise sine/triangle/square waveform generator, capable of reproducing frequencies up to 12MHz.
@@ -40,27 +37,36 @@ Package can be downloaded/installed directly form compilers IDE(recommended way)
#### Standard key functions :
-- Config Object Initialization function.
-> void waveform_cfg_setup ( waveform_cfg_t *cfg );
-
-- Initialization function.
-> WAVEFORM_RETVAL waveform_init ( waveform_t *ctx, waveform_cfg_t *cfg );
+- `waveform_cfg_setup` Config Object Initialization function.
+```c
+void waveform_cfg_setup ( waveform_cfg_t *cfg );
+```
+- `waveform_init` Initialization function.
+```c
+err_t waveform_init ( waveform_t *ctx, waveform_cfg_t *cfg );
+```
#### Example key functions :
-- Freqency function
-> void waveform_write_freqency ( waveform_t *ctx, uint32_t f );
-
-- Triangle output function
-> void waveform_triangle_output ( waveform_t *ctx, uint32_t f );
+- `waveform_sine_output` Sinusoide output function
+```c
+void waveform_sine_output ( waveform_t *ctx, uint32_t freq );
+```
-- Square output function
-> void waveform_square_output ( waveform_t *ctx, uint32_t f );
+- `waveform_triangle_output` Triangle output function
+```c
+void waveform_triangle_output ( waveform_t *ctx, uint32_t freq );
+```
+
+- `waveform_square_output` Square output function
+```c
+void waveform_square_output ( waveform_t *ctx, uint32_t freq );
+```
## Examples Description
-> This program outputs wave forms.
+> This example demonstrates the use of Waveform click board.
**The demo application is composed of two sections :**
@@ -73,7 +79,7 @@ Package can be downloaded/installed directly form compilers IDE(recommended way)
void application_init ( )
{
log_cfg_t log_cfg;
- waveform_cfg_t cfg;
+ waveform_cfg_t waveform_cfg;
/**
* Logger initialization.
@@ -86,82 +92,38 @@ void application_init ( )
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
- log_info( &logger, "---- Application Init ----" );
-
- // Click initialization.
+ log_info( &logger, " Application Init " );
- waveform_cfg_setup( &cfg );
- WAVEFORM_MAP_MIKROBUS( cfg, MIKROBUS_1 );
- waveform_init( &waveform, &cfg );
+ // Click initialization.
+ waveform_cfg_setup( &waveform_cfg );
+ WAVEFORM_MAP_MIKROBUS( waveform_cfg, MIKROBUS_1 );
+ if ( SPI_MASTER_ERROR == waveform_init( &waveform, &waveform_cfg ) )
+ {
+ log_error( &logger, " Communication init." );
+ for ( ; ; );
+ }
- freq = waveform_aprox_freqcalculation( 5000 );
- waveform_square_output( &waveform, freq );
- freq = 0;
+ waveform_sine_output( &waveform, frequency );
+ log_printf( &logger, "Sine wave output set with approx. frequency: %lu Hz\r\n", frequency );
+ waveform_display_commands ( );
+ log_info( &logger, " Application Task " );
}
```
### Application Task
-> Predefined characters are inputed from the serial port.
-> Changes the signal frequency, waveform or amplitude depending on the receiver character.
+> Predefined commands are inputed from the serial port.
+> Changes the signal frequency, waveform or amplitude depending on the receiver command.
```c
void application_task ( )
{
- uint8_t rx_len = log_read ( &logger, rx_data_buffer, 1 );
-
- if ( rx_len > 0 )
+ uint8_t command = 0;
+ if ( 1 == log_read ( &logger, &command, 1 ) )
{
- switch( rx_data_buffer[ 0 ] )
- {
- case '+': {
- waveform_digipot_inc( &waveform );
- log_printf( &logger, "Increasing amplitude of the current wave.\r\n" );
- break;
- }
- case '-': {
- waveform_digipot_dec( &waveform );
- log_printf( &logger, "Decreasing amplitude of the current wave.\r\n" );
- break;
- }
- case 'S': {
- frequency_increment( WAVEFORM_SINE_OUT );
- log_printf( &logger, "Increasing frequency of the sine wave.\r\n" );
- break;
- }
- case 's': {
- frequency_decrement( WAVEFORM_SINE_OUT );
- log_printf( &logger, "Decreasing frequency of the sine wave.\r\n" );
- break;
- }
- case 'T': {
- frequency_increment( WAVEFORM_TRIANGLE_OUT );
- log_printf( &logger, "Increasing frequency of the triangle wave.\r\n" );
- break;
- }
- case 't': {
- frequency_decrement( WAVEFORM_TRIANGLE_OUT );
- log_printf( &logger, "Decreasing frequency of the triangle wave.\r\n" );
- break;
- }
- case 'Q': {
- frequency_increment( WAVEFORM_SQUARE_OUT );
- log_printf( &logger, "Increasing frequency of the square wave.\r\n" );
- break;
- }
- case 'q': {
- frequency_decrement( WAVEFORM_SQUARE_OUT );
- log_printf( &logger, "Decreasing frequency of the square wave.\r\n" );
- break;
- }
- default :{
- break;
- }
- }
- rx_data_buffer[ 0 ] = 0;
- rx_len = 0;
+ waveform_parse_command ( command );
}
}
diff --git a/clicks/waveform/doc/doxy/Doxyfile.doxy b/clicks/waveform/doc/doxy/Doxyfile.doxy
index 082d2c7574..dbf01a695d 100644
--- a/clicks/waveform/doc/doxy/Doxyfile.doxy
+++ b/clicks/waveform/doc/doxy/Doxyfile.doxy
@@ -44,21 +44,21 @@ PROJECT_NUMBER = 2.0.0.0
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
-PROJECT_BRIEF =
+PROJECT_BRIEF =
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
-PROJECT_LOGO =
+PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
-OUTPUT_DIRECTORY = ../clicks/waveform/temp/Help/doc
+OUTPUT_DIRECTORY = ../cmake/waveform/temp/Help/doc
# 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
@@ -162,7 +162,7 @@ FULL_PATH_NAMES = YES
# will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
-STRIP_FROM_PATH =
+STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which
@@ -171,7 +171,7 @@ STRIP_FROM_PATH =
# specify the list of include paths that are normally passed to the compiler
# using the -I flag.
-STRIP_FROM_INC_PATH =
+STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
# less readable) file names. This can be useful is your file systems doesn't
@@ -238,13 +238,13 @@ TAB_SIZE = 4
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines.
-ALIASES =
+ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
-TCL_SUBST =
+TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
@@ -291,7 +291,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
-EXTENSION_MAPPING =
+EXTENSION_MAPPING =
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
@@ -648,7 +648,7 @@ GENERATE_DEPRECATEDLIST= YES
# sections, marked by \if ... \endif and \cond
# ... \endcond blocks.
-ENABLED_SECTIONS =
+ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
# initial value of a variable or macro / define can have for it to appear in the
@@ -690,7 +690,7 @@ SHOW_NAMESPACES = YES
# by doxygen. Whatever the program writes to standard output is used as the file
# version. For an example see the documentation.
-FILE_VERSION_FILTER =
+FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
# by doxygen. The layout file controls the global structure of the generated
@@ -703,7 +703,7 @@ FILE_VERSION_FILTER =
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty.
-LAYOUT_FILE =
+LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
@@ -713,7 +713,7 @@ LAYOUT_FILE =
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. See also \cite for info how to create references.
-CITE_BIB_FILES =
+CITE_BIB_FILES =
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
@@ -778,7 +778,7 @@ WARN_FORMAT = "$file:$line: $text"
# messages should be written. If left blank the output is written to standard
# error (stderr).
-WARN_LOGFILE =
+WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
@@ -790,9 +790,9 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = ../clicks/waveform/example \
- ../clicks/waveform/lib/include \
- ../clicks/waveform/README.md
+INPUT = ../cmake/waveform/example \
+ ../cmake/waveform/lib_waveform/include \
+ ../cmake/waveform/README.md
# 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
@@ -877,7 +877,7 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
-EXCLUDE =
+EXCLUDE =
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -893,7 +893,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
-EXCLUDE_PATTERNS =
+EXCLUDE_PATTERNS =
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@@ -904,13 +904,13 @@ EXCLUDE_PATTERNS =
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
-EXCLUDE_SYMBOLS =
+EXCLUDE_SYMBOLS =
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
# command).
-EXAMPLE_PATH = ../clicks/waveform/example
+EXAMPLE_PATH = ../cmake/waveform/example
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -930,7 +930,7 @@ EXAMPLE_RECURSIVE = YES
# that contain images that are to be included in the documentation (see the
# \image command).
-IMAGE_PATH =
+IMAGE_PATH =
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
@@ -951,7 +951,7 @@ IMAGE_PATH =
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
-INPUT_FILTER =
+INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis. Doxygen will compare the file name with each pattern and apply the
@@ -964,7 +964,7 @@ INPUT_FILTER =
# 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
# INPUT_FILTER) will also be used to filter the input files that are used for
@@ -979,14 +979,14 @@ FILTER_SOURCE_FILES = NO
# *.ext= (so without naming a filter).
# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
-FILTER_SOURCE_PATTERNS =
+FILTER_SOURCE_PATTERNS =
# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
# is part of the input, its contents will be placed on the main page
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.
-USE_MDFILE_AS_MAINPAGE =
+USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# Configuration options related to source browsing
@@ -1091,7 +1091,7 @@ CLANG_ASSISTED_PARSING = NO
# specified with INPUT and INCLUDE_PATH.
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
-CLANG_OPTIONS =
+CLANG_OPTIONS =
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
@@ -1117,7 +1117,7 @@ COLS_IN_ALPHA_INDEX = 5
# while generating the index headers.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-IGNORE_PREFIX =
+IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
@@ -1161,7 +1161,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_HEADER =
+HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
@@ -1171,7 +1171,7 @@ HTML_HEADER =
# that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_FOOTER =
+HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of
@@ -1183,7 +1183,7 @@ HTML_FOOTER =
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_STYLESHEET =
+HTML_STYLESHEET =
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
@@ -1196,7 +1196,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@@ -1206,7 +1206,7 @@ HTML_EXTRA_STYLESHEET =
# files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_FILES =
+HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
@@ -1335,7 +1335,7 @@ GENERATE_HTMLHELP = YES
# written to the html output directory.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-CHM_FILE =
+CHM_FILE =
# 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,
@@ -1343,7 +1343,7 @@ CHM_FILE =
# The file has to be specified with full path.
# 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
# (YES) or that it should be included in the master .chm file (NO).
@@ -1356,7 +1356,7 @@ GENERATE_CHI = NO
# and project file content.
# 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
# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
@@ -1387,7 +1387,7 @@ GENERATE_QHP = NO
# the HTML output folder.
# This tag requires that the tag GENERATE_QHP is set to YES.
-QCH_FILE =
+QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
@@ -1412,7 +1412,7 @@ QHP_VIRTUAL_FOLDER = ./temp/Help/doc
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
@@ -1420,21 +1420,21 @@ QHP_CUST_FILTER_NAME =
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_CUST_FILTER_ATTRS =
+QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
# https://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_SECT_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
# The QHG_LOCATION tag can be used to specify the location of Qt's
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
# generated .qhp file.
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHG_LOCATION =
+QHG_LOCATION =
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
# generated, together with the HTML files, they form an Eclipse help plugin. To
@@ -1567,7 +1567,7 @@ MATHJAX_RELPATH = https://cdn.mathjax.org/mathjax/latest
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_EXTENSIONS =
+MATHJAX_EXTENSIONS =
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
# of code that will be used on startup of the MathJax code. See the MathJax site
@@ -1575,7 +1575,7 @@ MATHJAX_EXTENSIONS =
# example see the documentation.
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_CODEFILE =
+MATHJAX_CODEFILE =
# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
# the HTML output. The underlying search engine uses javascript and DHTML and
@@ -1635,7 +1635,7 @@ EXTERNAL_SEARCH = NO
# Searching" for details.
# This tag requires that the tag SEARCHENGINE is set to YES.
-SEARCHENGINE_URL =
+SEARCHENGINE_URL =
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
# search data is written to a file for indexing by an external tool. With the
@@ -1651,7 +1651,7 @@ SEARCHDATA_FILE = searchdata.xml
# projects and redirect the results back to the right project.
# This tag requires that the tag SEARCHENGINE is set to YES.
-EXTERNAL_SEARCH_ID =
+EXTERNAL_SEARCH_ID =
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
# projects other than the one defined by this configuration file, but that are
@@ -1661,7 +1661,7 @@ EXTERNAL_SEARCH_ID =
# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
# This tag requires that the tag SEARCHENGINE is set to YES.
-EXTRA_SEARCH_MAPPINGS =
+EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
@@ -1725,7 +1725,7 @@ PAPER_TYPE = a4
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-EXTRA_PACKAGES =
+EXTRA_PACKAGES =
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
# generated LaTeX document. The header should contain everything until the first
@@ -1741,7 +1741,7 @@ EXTRA_PACKAGES =
# to HTML_HEADER.
# 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
# generated LaTeX document. The footer should contain everything after the last
@@ -1752,7 +1752,7 @@ LATEX_HEADER =
# 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.
-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
@@ -1763,7 +1763,7 @@ LATEX_FOOTER =
# list).
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_STYLESHEET =
# 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
@@ -1771,7 +1771,7 @@ LATEX_EXTRA_STYLESHEET =
# markers available.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_EXTRA_FILES =
+LATEX_EXTRA_FILES =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
@@ -1879,14 +1879,14 @@ RTF_HYPERLINKS = NO
# default style sheet that doxygen normally uses.
# This tag requires that the tag GENERATE_RTF is set to YES.
-RTF_STYLESHEET_FILE =
+RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an RTF document. Syntax is
# similar to doxygen's config file. A template extensions file can be generated
# using doxygen -e rtf extensionFile.
# This tag requires that the tag GENERATE_RTF is set to YES.
-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.
@@ -1931,7 +1931,7 @@ MAN_EXTENSION = .3
# MAN_EXTENSION with the initial . removed.
# This tag requires that the tag GENERATE_MAN is set to YES.
-MAN_SUBDIR =
+MAN_SUBDIR =
# 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
@@ -2044,7 +2044,7 @@ PERLMOD_PRETTY = YES
# overwrite each other's variables.
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-PERLMOD_MAKEVAR_PREFIX =
+PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
@@ -2085,7 +2085,7 @@ SEARCH_INCLUDES = YES
# preprocessor.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-INCLUDE_PATH =
+INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
@@ -2093,7 +2093,7 @@ INCLUDE_PATH =
# used.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-INCLUDE_FILE_PATTERNS =
+INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that are
# defined before the preprocessor is started (similar to the -D option of e.g.
@@ -2103,7 +2103,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-PREDEFINED =
+PREDEFINED =
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
@@ -2112,7 +2112,7 @@ PREDEFINED =
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-EXPAND_AS_DEFINED =
+EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
@@ -2141,13 +2141,13 @@ SKIP_FUNCTION_MACROS = YES
# 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.
-TAGFILES =
+TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
# tag file that is based on the input files it reads. See section "Linking to
# external documentation" for more information about the usage of tag files.
-GENERATE_TAGFILE =
+GENERATE_TAGFILE =
# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
# the class index. If set to NO, only the inherited external classes will be
@@ -2196,14 +2196,14 @@ CLASS_DIAGRAMS = YES
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
-MSCGEN_PATH =
+MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
# If left empty dia is assumed to be found in the default search path.
-DIA_PATH =
+DIA_PATH =
# 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.
@@ -2252,7 +2252,7 @@ DOT_FONTSIZE = 10
# the path where dot can find it using this tag.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_FONTPATH =
+DOT_FONTPATH =
# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
# each documented class showing the direct and indirect inheritance relations.
@@ -2396,26 +2396,26 @@ INTERACTIVE_SVG = NO
# found. If left blank, it is assumed the dot tool can be found in the path.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_PATH =
+DOT_PATH =
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the \dotfile
# command).
# This tag requires that the tag HAVE_DOT is set to YES.
-DOTFILE_DIRS =
+DOTFILE_DIRS =
# The MSCFILE_DIRS tag can be used to specify one or more directories that
# contain msc files that are included in the documentation (see the \mscfile
# command).
-MSCFILE_DIRS =
+MSCFILE_DIRS =
# The DIAFILE_DIRS tag can be used to specify one or more directories that
# contain dia files that are included in the documentation (see the \diafile
# command).
-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
@@ -2423,17 +2423,17 @@ DIAFILE_DIRS =
# generate a warning when it encounters a \startuml command in this case and
# will not generate output for the diagram.
-PLANTUML_JAR_PATH =
+PLANTUML_JAR_PATH =
# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
# configuration file for plantuml.
-PLANTUML_CFG_FILE =
+PLANTUML_CFG_FILE =
# When using plantuml, the specified paths are searched for files specified by
# the !include statement in a plantuml block.
-PLANTUML_INCLUDE_PATH =
+PLANTUML_INCLUDE_PATH =
# 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
@@ -2494,7 +2494,3 @@ GENERATE_LEGEND = YES
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_CLEANUP = YES
-
-
-
-
diff --git a/clicks/waveform/doc/package/manifest.json b/clicks/waveform/doc/package/manifest.json
index 01c8e878b4..7fc0871e4b 100644
--- a/clicks/waveform/doc/package/manifest.json
+++ b/clicks/waveform/doc/package/manifest.json
@@ -1,6 +1,6 @@
{
- "architecture": "ARM|PIC|PIC32",
- "category": "Clock generator",
+ "architecture": "ARM|PIC|PIC32|RISC-V|AVR",
+ "category": "Click Boards > Clock & Timing > Clock generator",
"changelog": "Resources/CHANGELOG.md",
"contains": [
"libraries",
@@ -8,8 +8,7 @@
"examples",
"source_files"
],
- "dependency_list": [
- ],
+ "dependency_list": [],
"details": "Resources/DETAILS.md",
"display_name": "Waveform click",
"example_list": [
@@ -26,19 +25,15 @@
"name": "mikroe.click.waveform",
"product_link": "https://www.mikroe.com/waveform-click",
"short_description": "Waveform Click is a precise sine/triangle/square waveform generator, capable of reproducing frequencies up to 12MHz.",
- "supported_compiler": "mikroC AI",
+ "supported_compiler": "mikroC AI|GCC",
"type": "Library",
- "_type":"mikroSDK Library",
- "related_projects":[
+ "_type": "mikroSDK Library",
+ "related_projects": [
2614
],
- "version": "2.0.0.11"
+ "version": "2.1.0.14",
+ "cmake": true,
+ "alias": "Click.Waveform",
+ "subdir_name": "lib_waveform"
}
-
-
-
-
-
-
-
diff --git a/clicks/waveform/example/CMakeLists.txt b/clicks/waveform/example/CMakeLists.txt
new file mode 100644
index 0000000000..58b832d8ee
--- /dev/null
+++ b/clicks/waveform/example/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(example_waveform LANGUAGES MikroC)
+else()
+ project(example_waveform LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_executable(example_waveform
+ main.c
+
+)
+
+
+############################ example_waveform GENERATED CODE START ###########################
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(example_waveform PUBLIC MikroC.Core)
+find_package(MikroSDK.Board REQUIRED)
+target_link_libraries(example_waveform PUBLIC MikroSDK.Board)
+find_package(MikroSDK.Log REQUIRED)
+target_link_libraries(example_waveform PUBLIC MikroSDK.Log)
+add_subdirectory(lib_waveform)
+target_link_libraries(example_waveform PUBLIC Click.Waveform)
+############################ example_waveform GENERATED CODE END ###########################
diff --git a/clicks/waveform/example/main.c b/clicks/waveform/example/main.c
index 0144a9a44e..ba80b6fafa 100644
--- a/clicks/waveform/example/main.c
+++ b/clicks/waveform/example/main.c
@@ -3,7 +3,7 @@
* \brief Waveform Click example
*
* # Description
- * This program outputs wave forms.
+ * This example demonstrates the use of Waveform click board.
*
* The application is composed of two sections :
*
@@ -11,94 +11,44 @@
* Initializes the communication interface and configures the click board.
*
* ## Application Task
- * Predefined characters are inputed from the serial port.
- * Changes the signal frequency, waveform or amplitude depending on the receiver character.
- *
- * ## Additional Functions
- * uint32_t waveform_aprox_freqcalculation ( float freqency ) - This function is used
- * to calculate the aproximate value that will be written to the frequency set
- * register.
- *
- * void output_waveform ( uint32_t frequency_temp, uint8_t output_mode ) - This function
- * checks which wave form has been chosen and sets frequency of the wave.
- *
- * void frequency_increment ( uint8_t output_mode ) - This function increases frequency
- * of the wave.
- *
- * void frequency_decrement ( uint8_t output_mode ) - This function reduces frequency
- * of the wave.
+ * Predefined commands are inputed from the serial port.
+ * Changes the signal frequency, waveform or amplitude depending on the receiver command.
*
* \author MikroE Team
*
*/
-// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "waveform.h"
-// ------------------------------------------------------------------ VARIABLES
-
static waveform_t waveform;
static log_t logger;
-static uint32_t freq;
-static char rx_data_buffer[ 2 ];
-
-// ------------------------------------------------------- ADDITIONAL FUNCTIONS
-
-uint32_t waveform_aprox_freqcalculation ( float freqency )
-{
- uint32_t calculation;
- float waveform_osc_freq = 25000000.0;
- float waveform_constant = 268435456.0; // 2^28
-
- calculation = freqency * ( waveform_constant / waveform_osc_freq );
-
- return calculation;
-}
-
-void output_waveform ( uint32_t frequency_temp, uint8_t output_mode )
-{
- if ( output_mode == WAVEFORM_SINE_OUT )
- {
- waveform_sine_output( &waveform, frequency_temp );
- }
- else if ( output_mode == WAVEFORM_TRIANGLE_OUT )
- {
- waveform_triangle_output( &waveform, frequency_temp );
- }
- else if ( output_mode == WAVEFORM_SQUARE_OUT )
- {
- waveform_square_output( &waveform, frequency_temp );
- }
-}
+static uint32_t frequency = 200000;
+static uint32_t frequency_step = 10000;
-void frequency_increment ( uint8_t output_mode )
-{
- uint32_t frequency_temp;
- freq += 1;
- frequency_temp = freq << 14;
- output_waveform( frequency_temp, output_mode );
-}
-
-void frequency_decrement ( uint8_t output_mode )
-{
- uint32_t frequency_temp;
- if ( freq > 1 )
- {
- freq -= 1;
- }
- frequency_temp = freq << 14;
- output_waveform( frequency_temp, output_mode );
-}
-
-// ------------------------------------------------------ APPLICATION FUNCTIONS
+/**
+ * @brief Waveform display commands function.
+ * @details This function displays the list of supported commands on the USB UART.
+ * @return None.
+ * @note None.
+ */
+void waveform_display_commands ( void );
+
+/**
+ * @brief Waveform parse command function.
+ * @details This function checks if the input command is supported and executes it.
+ * @param[in] command : Command input, for more details refer to @b waveform_display_commands function.
+ * @return None.
+ * @note None.
+ */
+void waveform_parse_command ( uint8_t command );
-void application_init ( )
+void application_init ( void )
{
log_cfg_t log_cfg;
- waveform_cfg_t cfg;
+ waveform_cfg_t waveform_cfg;
/**
* Logger initialization.
@@ -111,77 +61,33 @@ void application_init ( )
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
- log_info( &logger, "---- Application Init ----" );
+ log_info( &logger, " Application Init " );
- // Click initialization.
-
- waveform_cfg_setup( &cfg );
- WAVEFORM_MAP_MIKROBUS( cfg, MIKROBUS_1 );
- waveform_init( &waveform, &cfg );
+ // Click initialization.
+ waveform_cfg_setup( &waveform_cfg );
+ WAVEFORM_MAP_MIKROBUS( waveform_cfg, MIKROBUS_1 );
+ if ( SPI_MASTER_ERROR == waveform_init( &waveform, &waveform_cfg ) )
+ {
+ log_error( &logger, " Communication init." );
+ for ( ; ; );
+ }
- freq = waveform_aprox_freqcalculation( 5000 );
- waveform_square_output( &waveform, freq );
- freq = 1;
+ waveform_sine_output( &waveform, frequency );
+ log_printf( &logger, "Sine wave output set with approx. frequency: %lu Hz\r\n", frequency );
+ waveform_display_commands ( );
+ log_info( &logger, " Application Task " );
}
-void application_task ( )
+void application_task ( void )
{
- uint8_t rx_len = log_read ( &logger, rx_data_buffer, 1 );
-
- if ( rx_len > 0 )
+ uint8_t command = 0;
+ if ( 1 == log_read ( &logger, &command, 1 ) )
{
- switch( rx_data_buffer[ 0 ] )
- {
- case '+': {
- waveform_digipot_inc( &waveform );
- log_printf( &logger, "Increasing amplitude of the current wave.\r\n" );
- break;
- }
- case '-': {
- waveform_digipot_dec( &waveform );
- log_printf( &logger, "Decreasing amplitude of the current wave.\r\n" );
- break;
- }
- case 'S': {
- frequency_increment( WAVEFORM_SINE_OUT );
- log_printf( &logger, "Increasing frequency of the sine wave.\r\n" );
- break;
- }
- case 's': {
- frequency_decrement( WAVEFORM_SINE_OUT );
- log_printf( &logger, "Decreasing frequency of the sine wave.\r\n" );
- break;
- }
- case 'T': {
- frequency_increment( WAVEFORM_TRIANGLE_OUT );
- log_printf( &logger, "Increasing frequency of the triangle wave.\r\n" );
- break;
- }
- case 't': {
- frequency_decrement( WAVEFORM_TRIANGLE_OUT );
- log_printf( &logger, "Decreasing frequency of the triangle wave.\r\n" );
- break;
- }
- case 'Q': {
- frequency_increment( WAVEFORM_SQUARE_OUT );
- log_printf( &logger, "Increasing frequency of the square wave.\r\n" );
- break;
- }
- case 'q': {
- frequency_decrement( WAVEFORM_SQUARE_OUT );
- log_printf( &logger, "Decreasing frequency of the square wave.\r\n" );
- break;
- }
- default :{
- break;
- }
- }
- rx_data_buffer[ 0 ] = 0;
- rx_len = 0;
+ waveform_parse_command ( command );
}
}
-void main ( )
+void main ( void )
{
application_init( );
@@ -191,4 +97,118 @@ void main ( )
}
}
+void waveform_display_commands ( void )
+{
+ log_printf( &logger, "-------------------------------------------\r\n" );
+ log_info( &logger, "- UART commands list -\r\n" );
+ log_printf( &logger, "'+' - Increase amplitude.\r\n" );
+ log_printf( &logger, "'-' - Decrease amplitude.\r\n" );
+ log_printf( &logger, "'S' - Select sine wave output and increase frequency.\r\n" );
+ log_printf( &logger, "'s' - Select sine wave output and decrease frequency.\r\n" );
+ log_printf( &logger, "'T' - Select triangle wave output and increase frequency.\r\n" );
+ log_printf( &logger, "'t' - Select triangle wave output and decrease frequency.\r\n" );
+ log_printf( &logger, "'Q' - Select square wave output and increase frequency.\r\n" );
+ log_printf( &logger, "'q' - Select square wave output and decrease frequency.\r\n" );
+ log_printf( &logger, "'L' or 'l' - Display commands list.\r\n" );
+ log_printf( &logger, "-------------------------------------------\r\n" );
+}
+
+void waveform_parse_command ( uint8_t command )
+{
+ switch ( command )
+ {
+ case '+':
+ {
+ log_printf( &logger, "Increasing amplitude of the current wave.\r\n" );
+ waveform_digipot_inc ( &waveform );
+ break;
+ }
+ case '-':
+ {
+ log_printf( &logger, "Decreasing amplitude of the current wave.\r\n" );
+ waveform_digipot_dec ( &waveform );
+ break;
+ }
+ case 'S':
+ {
+ log_printf( &logger, "Increasing frequency of the sine wave.\r\n" );
+ frequency += frequency_step;
+ waveform_sine_output( &waveform, frequency );
+ log_printf( &logger, "Approx. frequency: %lu Hz\r\n", frequency );
+ break;
+ }
+ case 's':
+ {
+ log_printf( &logger, "Decreasing frequency of the sine wave.\r\n" );
+ if ( frequency < frequency_step )
+ {
+ frequency = 0;
+ }
+ else
+ {
+ frequency -= frequency_step;
+ }
+ waveform_sine_output( &waveform, frequency );
+ log_printf( &logger, "Approx. frequency: %lu Hz\r\n", frequency );
+ break;
+ }
+ case 'T':
+ {
+ log_printf( &logger, "Increasing frequency of the triangle wave.\r\n" );
+ frequency += frequency_step;
+ waveform_triangle_output( &waveform, frequency );
+ log_printf( &logger, "Approx. frequency: %lu Hz\r\n", frequency );
+ break;
+ }
+ case 't':
+ {
+ log_printf( &logger, "Decreasing frequency of the triangle wave.\r\n" );
+ if ( frequency < frequency_step )
+ {
+ frequency = 0;
+ }
+ else
+ {
+ frequency -= frequency_step;
+ }
+ waveform_triangle_output( &waveform, frequency );
+ log_printf( &logger, "Approx. frequency: %lu Hz\r\n", frequency );
+ break;
+ }
+ case 'Q':
+ {
+ log_printf( &logger, "Increasing frequency of the square wave.\r\n" );
+ frequency += frequency_step;
+ waveform_square_output( &waveform, frequency );
+ log_printf( &logger, "Approx. frequency: %lu Hz\r\n", frequency );
+ break;
+ }
+ case 'q':
+ {
+ log_printf( &logger, "Decreasing frequency of the square wave.\r\n" );
+ if ( frequency < frequency_step )
+ {
+ frequency = 0;
+ }
+ else
+ {
+ frequency -= frequency_step;
+ }
+ waveform_square_output( &waveform, frequency );
+ log_printf( &logger, "Approx. frequency: %lu Hz\r\n", frequency );
+ break;
+ }
+ case 'L': case 'l':
+ {
+ waveform_display_commands ( );
+ break;
+ }
+ default :
+ {
+ log_error( &logger, "Wrong command." );
+ break;
+ }
+ }
+}
+
// ------------------------------------------------------------------------ END
diff --git a/clicks/waveform/example/manifest.exm b/clicks/waveform/example/manifest.exm
index 3a7e405443..36989dc15d 100644
--- a/clicks/waveform/example/manifest.exm
+++ b/clicks/waveform/example/manifest.exm
@@ -2,7 +2,7 @@
"name": "Waveform Click",
"description": "Waveform Click is a precise sine/triangle/square waveform generator, capable of reproducing frequencies up to 12MHz",
"image" : "../../Resources/click_icon.png",
- "toolchain": ["mikrocarm","mikrocpic","mikrocpic32"],
+ "toolchain": ["mikrocarm","mikrocpic","mikrocpic32","gcc-riscv","mikrocavr"],
"hw" : ["click","AD9833"],
"category" : ["Measurements"]
}
diff --git a/clicks/waveform/example/memake.txt b/clicks/waveform/example/memake.txt
deleted file mode 100644
index 0c0a962b56..0000000000
--- a/clicks/waveform/example/memake.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-type: executable
-target: example_waveform
-
-depends: {
- MikroC.Core
- MikroSDK.Board
- MikroSDK.Log
- Click.Waveform
-}
-
-uses: {
- MikroC.Core
-}
-
-sources: {
- main.c
-}
diff --git a/clicks/waveform/lib/memake.txt b/clicks/waveform/lib/memake.txt
deleted file mode 100644
index ab35baa97c..0000000000
--- a/clicks/waveform/lib/memake.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-type: library
-
-target: lib_waveform
-
-alias: Click.Waveform
-
-sources: {
- src/waveform.c
-}
-
-headers: {
- include/waveform.h
-}
-
-include: {
- include
-}
-
-install: {
- src(include/waveform.h) dst(include/waveform.h)
-}
-
-expInclude: {
- include
-}
-
-depends: {
- MikroC.Core
- MikroSDK.Driver
-}
-
-uses: {
- MikroC.Core
-}
-
-others: {
- ../README.md
- ../DETAILS.md
- ../CHANGELOG.md
-}
diff --git a/clicks/waveform/lib_waveform/CMakeLists.txt b/clicks/waveform/lib_waveform/CMakeLists.txt
new file mode 100644
index 0000000000..c6df486fb0
--- /dev/null
+++ b/clicks/waveform/lib_waveform/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.21)
+if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
+ project(lib_waveform LANGUAGES MikroC)
+else()
+ project(lib_waveform LANGUAGES C ASM)
+endif()
+
+if (NOT PROJECT_TYPE)
+ set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)
+endif()
+
+add_library(lib_waveform STATIC
+ src/waveform.c
+ include/waveform.h
+)
+add_library(Click.Waveform ALIAS lib_waveform)
+
+
+
+target_include_directories(lib_waveform PUBLIC
+ include
+)
+
+find_package(MikroC.Core REQUIRED)
+target_link_libraries(lib_waveform PUBLIC MikroC.Core)
+find_package(MikroSDK.Driver REQUIRED)
+target_link_libraries(lib_waveform PUBLIC MikroSDK.Driver)
diff --git a/clicks/waveform/lib_waveform/include/Click.Waveform b/clicks/waveform/lib_waveform/include/Click.Waveform
new file mode 100644
index 0000000000..1c4607cde6
--- /dev/null
+++ b/clicks/waveform/lib_waveform/include/Click.Waveform
@@ -0,0 +1 @@
+#include "waveform.h"
diff --git a/clicks/waveform/lib/include/waveform.h b/clicks/waveform/lib_waveform/include/waveform.h
similarity index 67%
rename from clicks/waveform/lib/include/waveform.h
rename to clicks/waveform/lib_waveform/include/waveform.h
index 751627dde7..bd1b185b5e 100644
--- a/clicks/waveform/lib/include/waveform.h
+++ b/clicks/waveform/lib_waveform/include/waveform.h
@@ -1,249 +1,252 @@
-/*
- * MikroSDK - MikroE Software Development Kit
- * Copyright© 2020 MikroElektronika d.o.o.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
- * OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*!
- * \file
- *
- * \brief This file contains API for Waveform Click driver.
- *
- * \addtogroup waveform Waveform Click Driver
- * @{
- */
-// ----------------------------------------------------------------------------
-
-#ifndef WAVEFORM_H
-#define WAVEFORM_H
-
-#include "drv_digital_out.h"
-#include "drv_digital_in.h"
-#include "drv_spi_master.h"
-
-
-// -------------------------------------------------------------- PUBLIC MACROS
-/**
- * \defgroup macros Macros
- * \{
- */
-
-/**
- * \defgroup map_mikrobus MikroBUS
- * \{
- */
-
-#define WAVEFORM_MAP_MIKROBUS( cfg, mikrobus ) \
- cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
- cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
- cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
- cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
- cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
- cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM )
-/** \} */
-
-/**
- * \defgroup error_code Error Code
- * \{
- */
-#define WAVEFORM_RETVAL uint8_t
-
-#define WAVEFORM_OK 0x00
-#define WAVEFORM_INIT_ERROR 0xFF
-/** \} */
-
-/**
- * \defgroup bitmask Bitmask
- * \{
- */
-#define WAVEFORM_CR_B28_BITMASK 1<<13
-#define WAVEFORM_CR_HLB_BITMASK 1<<12
-#define WAVEFORM_CR_FSELECT_BITMASK 1<<11
-#define WAVEFORM_CR_PSELECT_BITMASK 1<<10
-#define WAVEFORM_CR_RESET_BITMASK 1<<8
-#define WAVEFORM_CR_SLEEP1_BITMASK 1<<7
-#define WAVEFORM_CR_SLEEP12_BITMASK 1<<6
-#define WAVEFORM_CR_OPBITEN_BITMASK 1<<5
-#define WAVEFORM_CR_DIV2_BITMASK 1<<3
-#define WAVEFORM_CR_MODE_BITMASK 1<<1
-/** \} */
-
-/**
- * \defgroup output Output
- * \{
- */
-#define WAVEFORM_SINE_OUT 0x01
-#define WAVEFORM_TRIANGLE_OUT 0x02
-#define WAVEFORM_SQUARE_OUT 0x03
-/** \} */
-
-/** \} */ // End group macro
-// --------------------------------------------------------------- PUBLIC TYPES
-/**
- * \defgroup type Types
- * \{
- */
-
-/**
- * @brief Click ctx object definition.
- */
-typedef struct
-{
- // Output pins
-
- digital_out_t rst;
- digital_out_t pwm;
- digital_out_t cs;
-
- // Modules
-
- spi_master_t spi;
- pin_name_t chip_select;
-} waveform_t;
-
-/**
- * @brief Click configuration structure definition.
- */
-typedef struct
-{
- // Communication gpio pins
-
- pin_name_t miso;
- pin_name_t mosi;
- pin_name_t sck;
- pin_name_t cs;
-
- // Additional gpio pins
-
- pin_name_t rst;
- pin_name_t pwm;
-
- // static variable
-
- uint32_t spi_speed;
- spi_master_mode_t spi_mode;
- spi_master_chip_select_polarity_t cs_polarity;
-
-} waveform_cfg_t;
-
-/** \} */ // End types group
-// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
-
-/**
- * \defgroup public_function Public function
- * \{
- */
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-/**
- * @brief Config Object Initialization function.
- *
- * @param cfg Click configuration structure.
- *
- * @description This function initializes click configuration structure to init state.
- * @note All used pins will be set to unconnected state.
- */
-void waveform_cfg_setup ( waveform_cfg_t *cfg );
-
-/**
- * @brief Initialization function.
- * @param waveform Click object.
- * @param cfg Click configuration structure.
- *
- * @description This function initializes all necessary pins and peripherals used for this click.
- */
-WAVEFORM_RETVAL waveform_init ( waveform_t *ctx, waveform_cfg_t *cfg );
-
-/**
- * @brief Decrement function
- *
- * @param ctx Click object.
- *
- * @description This function
- */
-void waveform_digipot_dec ( waveform_t *ctx );
-
-/**
- * @brief Increment function
- *
- * @param ctx Click object.
- */
-void waveform_digipot_inc ( waveform_t *ctx );
-
-/**
- * @brief Registry finction
- *
- * @param ctx Click object.
- * @param reg_setting Generic SPI function for writing 16bit values to the waveform generating chip.
- */
-void waveform_write_reg ( waveform_t *ctx, uint16_t reg_setting );
-
-/**
- * @brief Freqency function
- *
- * @param ctx Click object.
- * @param f Output a sine wave and set the frequency by passing the raw 24bit value.
- *
- * @description This function returns freqency.
- */
-void waveform_write_freqency ( waveform_t *ctx, uint32_t f );
-
-/**
- * @brief Sinusoide output function
- *
- * @param ctx Click object.
- * @param f Output a sine wave and set the frequency by passing the raw 24bit value.
- *
- * @description This functin outputs sinusodie signal.
- */
-void waveform_sine_output ( waveform_t *ctx, uint32_t f );
-
-/**
- * @brief Triangle output function
- *
- * @param ctx Click object.
- * @param f Output a sine wave and set the frequency by passing the raw 24bit value.
- *
- * @description This functin outputs triangle signal.
- */
-void waveform_triangle_output ( waveform_t *ctx, uint32_t f );
-
-/**
- * @brief Square output function
- *
- * @param ctx Click object.
- * @param f Output a sine wave and set the frequency by passing the raw 24bit value.
- *
- * @description This functin outputs square signal.
- */
-void waveform_square_output ( waveform_t *ctx, uint32_t f );
-
-#ifdef __cplusplus
-}
-#endif
-#endif // _WAVEFORM_H_
-
-/** \} */ // End public_function group
-/// \} // End click Driver group
-/*! @} */
-// ------------------------------------------------------------------------- END
+/*
+ * MikroSDK - MikroE Software Development Kit
+ * Copyright© 2020 MikroElektronika d.o.o.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+ * OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*!
+ * \file
+ *
+ * \brief This file contains API for Waveform Click driver.
+ *
+ * \addtogroup waveform Waveform Click Driver
+ * @{
+ */
+// ----------------------------------------------------------------------------
+
+#ifndef WAVEFORM_H
+#define WAVEFORM_H
+
+#include "drv_digital_out.h"
+#include "drv_digital_in.h"
+#include "drv_spi_master.h"
+
+
+// -------------------------------------------------------------- PUBLIC MACROS
+/**
+ * \defgroup macros Macros
+ * \{
+ */
+
+/**
+ * \defgroup map_mikrobus MikroBUS
+ * \{
+ */
+
+#define WAVEFORM_MAP_MIKROBUS( cfg, mikrobus ) \
+ cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
+ cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
+ cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
+ cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
+ cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
+ cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM )
+/** \} */
+
+/**
+ * \defgroup error_code Error Code
+ * \{
+ */
+#define WAVEFORM_OK 0
+#define WAVEFORM_ERROR -1
+/** \} */
+
+/**
+ * \defgroup bitmask Bitmask
+ * \{
+ */
+#define WAVEFORM_CR_B28_BITMASK 0x2000
+#define WAVEFORM_CR_HLB_BITMASK 0x1000
+#define WAVEFORM_CR_FSELECT_BITMASK 0x0800
+#define WAVEFORM_CR_PSELECT_BITMASK 0x0400
+#define WAVEFORM_CR_RESET_BITMASK 0x0100
+#define WAVEFORM_CR_SLEEP1_BITMASK 0x0080
+#define WAVEFORM_CR_SLEEP12_BITMASK 0x0040
+#define WAVEFORM_CR_OPBITEN_BITMASK 0x0020
+#define WAVEFORM_CR_DIV2_BITMASK 0x0008
+#define WAVEFORM_CR_MODE_BITMASK 0x0002
+/** \} */
+
+/**
+ * \defgroup output Output
+ * \{
+ */
+#define WAVEFORM_SINE_OUT 0x01
+#define WAVEFORM_TRIANGLE_OUT 0x02
+#define WAVEFORM_SQUARE_OUT 0x03
+/** \} */
+
+/**
+ * \defgroup freq_settings Frequency settings
+ * \{
+ */
+#define WAVEFORM_OSC_FREQUENCY 25000000ul
+#define WAVEFORM_FREQ_RESOLUTION 0x0FFFFFFFul
+/** \} */
+
+/** \} */ // End group macro
+// --------------------------------------------------------------- PUBLIC TYPES
+/**
+ * \defgroup type Types
+ * \{
+ */
+
+/**
+ * @brief Click ctx object definition.
+ */
+typedef struct
+{
+ // Output pins
+ digital_out_t rst;
+ digital_out_t pwm;
+
+ // Modules
+ spi_master_t spi;
+ pin_name_t chip_select;
+
+} waveform_t;
+
+/**
+ * @brief Click configuration structure definition.
+ */
+typedef struct
+{
+ // Communication gpio pins
+ pin_name_t miso;
+ pin_name_t mosi;
+ pin_name_t sck;
+ pin_name_t cs;
+
+ // Additional gpio pins
+ pin_name_t rst;
+ pin_name_t pwm;
+
+ // static variable
+ uint32_t spi_speed;
+ spi_master_mode_t spi_mode;
+ spi_master_chip_select_polarity_t cs_polarity;
+
+} waveform_cfg_t;
+
+/** \} */ // End types group
+// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
+
+/**
+ * \defgroup public_function Public function
+ * \{
+ */
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/**
+ * @brief Config Object Initialization function.
+ *
+ * @param cfg Click configuration structure.
+ *
+ * @details This function initializes click configuration structure to init state.
+ * @note All used pins will be set to unconnected state.
+ */
+void waveform_cfg_setup ( waveform_cfg_t *cfg );
+
+/**
+ * @brief Initialization function.
+ * @param waveform Click object.
+ * @param cfg Click configuration structure.
+ *
+ * @details This function initializes all necessary pins and peripherals used for this click.
+ */
+err_t waveform_init ( waveform_t *ctx, waveform_cfg_t *cfg );
+
+/**
+ * @brief Decrement function
+ *
+ * @param ctx Click object.
+ *
+ * @details This function decreases amplitude.
+ */
+void waveform_digipot_dec ( waveform_t *ctx );
+
+/**
+ * @brief Increment function
+ *
+ * @param ctx Click object.
+ *
+ * @details This function increases amplitude.
+ */
+void waveform_digipot_inc ( waveform_t *ctx );
+
+/**
+ * @brief Registry function
+ *
+ * @param ctx Click object.
+ * @param reg_setting Generic SPI function for writing 16bit values to the waveform generating chip.
+ */
+void waveform_write_reg ( waveform_t *ctx, uint16_t reg_setting );
+
+/**
+ * @brief Frequency function
+ *
+ * @param ctx Click object.
+ * @param freq Set the frequency by passing the raw 24bit value.
+ *
+ * @details This function sets frequency.
+ */
+void waveform_write_frequency ( waveform_t *ctx, uint32_t freq );
+
+/**
+ * @brief Sinusoide output function
+ *
+ * @param ctx Click object.
+ * @param freq Set the frequency by passing the raw 24bit value.
+ *
+ * @details This function outputs sinusoide signal.
+ */
+void waveform_sine_output ( waveform_t *ctx, uint32_t freq );
+
+/**
+ * @brief Triangle output function
+ *
+ * @param ctx Click object.
+ * @param freq Set the frequency by passing the raw 24bit value.
+ *
+ * @details This function outputs triangle signal.
+ */
+void waveform_triangle_output ( waveform_t *ctx, uint32_t freq );
+
+/**
+ * @brief Square output function
+ *
+ * @param ctx Click object.
+ * @param freq Set the frequency by passing the raw 24bit value.
+ *
+ * @details This function outputs square signal.
+ */
+void waveform_square_output ( waveform_t *ctx, uint32_t freq );
+
+#ifdef __cplusplus
+}
+#endif
+#endif // _WAVEFORM_H_
+
+/** \} */ // End public_function group
+/// \} // End click Driver group
+/*! @} */
+// ------------------------------------------------------------------------- END
diff --git a/clicks/waveform/lib/src/waveform.c b/clicks/waveform/lib_waveform/src/waveform.c
similarity index 62%
rename from clicks/waveform/lib/src/waveform.c
rename to clicks/waveform/lib_waveform/src/waveform.c
index fc6898069d..412f00fa54 100644
--- a/clicks/waveform/lib/src/waveform.c
+++ b/clicks/waveform/lib_waveform/src/waveform.c
@@ -1,170 +1,169 @@
-/*
- * MikroSDK - MikroE Software Development Kit
- * Copyright© 2020 MikroElektronika d.o.o.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
- * OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*!
- * \file
- *
- */
-
-#include "waveform.h"
-
-// ------------------------------------------------------------- PRIVATE MACROS
-
-#define WAVEFORM_DUMMY 0
-
-// ------------------------------------------------ PUBLIC FUNCTION DEFINITIONS
-
-void waveform_cfg_setup ( waveform_cfg_t *cfg )
-{
- // Communication gpio pins
-
- cfg->sck = HAL_PIN_NC;
- cfg->miso = HAL_PIN_NC;
- cfg->mosi = HAL_PIN_NC;
- cfg->cs = HAL_PIN_NC;
-
- // Additional gpio pins
-
- cfg->rst = HAL_PIN_NC;
- cfg->pwm = HAL_PIN_NC;
-
- cfg->spi_speed = 100000;
- cfg->spi_mode = SPI_MASTER_MODE_2;
- cfg->cs_polarity = SPI_MASTER_CHIP_SELECT_POLARITY_ACTIVE_LOW;
-}
-
-WAVEFORM_RETVAL waveform_init ( waveform_t *ctx, waveform_cfg_t *cfg )
-{
- spi_master_config_t spi_cfg;
-
- spi_master_configure_default( &spi_cfg );
- spi_cfg.speed = cfg->spi_speed;
- spi_cfg.sck = cfg->sck;
- spi_cfg.miso = cfg->miso;
- spi_cfg.mosi = cfg->mosi;
- spi_cfg.default_write_data = WAVEFORM_DUMMY;
-
- digital_out_init( &ctx->cs, cfg->cs );
- ctx->chip_select = cfg->cs;
-
- if ( spi_master_open( &ctx->spi, &spi_cfg ) == SPI_MASTER_ERROR )
- {
- return WAVEFORM_INIT_ERROR;
- }
-
- spi_master_set_default_write_data( &ctx->spi, WAVEFORM_DUMMY );
- spi_master_set_speed( &ctx->spi, cfg->spi_speed );
- spi_master_set_mode( &ctx->spi, cfg->spi_mode );
- spi_master_set_chip_select_polarity( cfg->cs_polarity );
-
- // Output pins
-
- digital_out_init( &ctx->rst, cfg->rst );
- digital_out_init( &ctx->pwm, cfg->pwm );
-
- spi_master_deselect_device( ctx->chip_select );
- digital_out_high( &ctx->rst );
- digital_out_high( &ctx->pwm );
-
- return WAVEFORM_OK;
-}
-
-void waveform_digipot_dec ( waveform_t *ctx )
-{
- uint8_t transfer;
-
- transfer = 0x07;
-
- spi_master_select_device( ctx->chip_select );
- Delay_1ms( );
- spi_master_write( &ctx->spi, &transfer, 1 );
- Delay_1ms( );
- spi_master_deselect_device( ctx->chip_select );
-}
-
-void waveform_digipot_inc ( waveform_t *ctx )
-{
- uint8_t transfer;
-
- transfer = 0x1F;
-
- spi_master_select_device( ctx->chip_select );
- Delay_1ms( );
- spi_master_write( &ctx->spi, &transfer, 1 );
- Delay_1ms( );
- spi_master_deselect_device( ctx->chip_select );
-}
-
-void waveform_write_reg ( waveform_t *ctx, uint16_t reg_setting )
-{
- uint8_t temp[ 2 ];
-
- temp[ 0 ] = ( uint8_t ) ( reg_setting >> 8 );
- temp[ 1 ] = ( uint8_t ) ( reg_setting );
-
- digital_out_low( &ctx->rst );
- Delay_1ms( );
- spi_master_write( &ctx->spi, temp, 2 );
- Delay_1ms( );
- digital_out_high( &ctx->rst );
-}
-
-void waveform_write_freqency ( waveform_t *ctx, uint32_t f )
-{
- uint16_t fekreg_0 = 0;
- uint16_t fekreg_1 = 0;
-
- fekreg_0 = f & 0x7FFF;
- fekreg_1 = ( f >> 14 ) & 0x7FFF;
-
- waveform_write_reg( ctx, 0x0000 );
- waveform_write_reg( ctx, 0x8000 | fekreg_0 );
-
- waveform_write_reg( ctx, 0x1000 );
- waveform_write_reg( ctx, 0x4000 | fekreg_1 );
-}
-
-void waveform_sine_output ( waveform_t *ctx, uint32_t f )
-{
- waveform_write_freqency( ctx, f );
- waveform_write_reg( ctx, 0x2100 );
- waveform_write_reg( ctx, 0x2000 );
-}
-
-void waveform_triangle_output ( waveform_t *ctx, uint32_t f )
-{
- waveform_write_freqency( ctx, f );
- waveform_write_reg( ctx, WAVEFORM_CR_B28_BITMASK | WAVEFORM_CR_MODE_BITMASK );
-}
-
-void waveform_square_output ( waveform_t *ctx, uint32_t f )
-{
- waveform_write_freqency( ctx, f );
- waveform_write_reg( ctx, WAVEFORM_CR_B28_BITMASK |
- WAVEFORM_CR_DIV2_BITMASK |
- WAVEFORM_CR_OPBITEN_BITMASK );
-}
-
-// ------------------------------------------------------------------------- END
-
+/*
+ * MikroSDK - MikroE Software Development Kit
+ * Copyright© 2020 MikroElektronika d.o.o.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+ * OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*!
+ * \file
+ *
+ */
+
+#include "waveform.h"
+
+// ------------------------------------------------------------- PRIVATE MACROS
+
+#define WAVEFORM_DUMMY 0
+
+// ------------------------------------------------ PUBLIC FUNCTION DEFINITIONS
+
+void waveform_cfg_setup ( waveform_cfg_t *cfg )
+{
+ // Communication gpio pins
+ cfg->sck = HAL_PIN_NC;
+ cfg->miso = HAL_PIN_NC;
+ cfg->mosi = HAL_PIN_NC;
+ cfg->cs = HAL_PIN_NC;
+
+ // Additional gpio pins
+ cfg->rst = HAL_PIN_NC;
+ cfg->pwm = HAL_PIN_NC;
+
+ cfg->spi_speed = 100000;
+ cfg->spi_mode = SPI_MASTER_MODE_2;
+ cfg->cs_polarity = SPI_MASTER_CHIP_SELECT_POLARITY_ACTIVE_LOW;
+}
+
+err_t waveform_init ( waveform_t *ctx, waveform_cfg_t *cfg )
+{
+ spi_master_config_t spi_cfg;
+
+ spi_master_configure_default( &spi_cfg );
+
+ spi_cfg.sck = cfg->sck;
+ spi_cfg.miso = cfg->miso;
+ spi_cfg.mosi = cfg->mosi;
+
+ ctx->chip_select = cfg->cs;
+
+ if ( SPI_MASTER_ERROR == spi_master_open( &ctx->spi, &spi_cfg ) )
+ {
+ return SPI_MASTER_ERROR;
+ }
+
+ if ( SPI_MASTER_ERROR == spi_master_set_default_write_data( &ctx->spi, WAVEFORM_DUMMY ) )
+ {
+ return SPI_MASTER_ERROR;
+ }
+
+ if ( SPI_MASTER_ERROR == spi_master_set_mode( &ctx->spi, cfg->spi_mode ) )
+ {
+ return SPI_MASTER_ERROR;
+ }
+
+ if ( SPI_MASTER_ERROR == spi_master_set_speed( &ctx->spi, cfg->spi_speed ) )
+ {
+ return SPI_MASTER_ERROR;
+ }
+
+ spi_master_set_chip_select_polarity( cfg->cs_polarity );
+ spi_master_deselect_device( ctx->chip_select );
+
+ // Output pins
+ digital_out_init( &ctx->rst, cfg->rst );
+ digital_out_init( &ctx->pwm, cfg->pwm );
+
+ digital_out_high( &ctx->rst );
+ digital_out_high( &ctx->pwm );
+
+ return WAVEFORM_OK;
+}
+
+void waveform_digipot_dec ( waveform_t *ctx )
+{
+ uint8_t data_in = 0x07;
+ spi_master_select_device( ctx->chip_select );
+ Delay_1ms( );
+ spi_master_write( &ctx->spi, &data_in, 1 );
+ Delay_1ms( );
+ spi_master_deselect_device( ctx->chip_select );
+}
+
+void waveform_digipot_inc ( waveform_t *ctx )
+{
+ uint8_t data_in = 0x1F;
+ spi_master_select_device( ctx->chip_select );
+ Delay_1ms( );
+ spi_master_write( &ctx->spi, &data_in, 1 );
+ Delay_1ms( );
+ spi_master_deselect_device( ctx->chip_select );
+}
+
+void waveform_write_reg ( waveform_t *ctx, uint16_t reg_setting )
+{
+ uint8_t data_in[ 2 ] = { 0 };
+ data_in[ 0 ] = ( uint8_t ) ( ( reg_setting >> 8 ) & 0xFF );
+ data_in[ 1 ] = ( uint8_t ) ( reg_setting & 0xFF );
+ digital_out_low( &ctx->rst );
+ Delay_1ms( );
+ spi_master_write( &ctx->spi, data_in, 2 );
+ Delay_1ms( );
+ digital_out_high( &ctx->rst );
+}
+
+void waveform_write_frequency ( waveform_t *ctx, uint32_t freq )
+{
+ uint16_t freq0_reg = 0;
+ uint16_t freq1_reg = 0;
+ uint32_t freq_reg = 0;
+
+ freq_reg = ( uint32_t ) ( freq / ( ( float ) WAVEFORM_OSC_FREQUENCY / WAVEFORM_FREQ_RESOLUTION ) );
+ freq0_reg = freq_reg & 0x3FFF;
+ freq1_reg = ( freq_reg >> 14 ) & 0x3FFF;
+
+ waveform_write_reg( ctx, 0x0000 );
+ waveform_write_reg( ctx, 0x8000 | freq0_reg );
+
+ waveform_write_reg( ctx, 0x1000 );
+ waveform_write_reg( ctx, 0x4000 | freq1_reg );
+}
+
+void waveform_sine_output ( waveform_t *ctx, uint32_t freq )
+{
+ waveform_write_frequency( ctx, freq );
+ waveform_write_reg( ctx, 0x2100 );
+ waveform_write_reg( ctx, 0x2000 );
+}
+
+void waveform_triangle_output ( waveform_t *ctx, uint32_t freq )
+{
+ waveform_write_frequency( ctx, freq );
+ waveform_write_reg( ctx, WAVEFORM_CR_B28_BITMASK | WAVEFORM_CR_MODE_BITMASK );
+}
+
+void waveform_square_output ( waveform_t *ctx, uint32_t freq )
+{
+ waveform_write_frequency( ctx, freq );
+ waveform_write_reg( ctx, WAVEFORM_CR_B28_BITMASK | WAVEFORM_CR_DIV2_BITMASK | WAVEFORM_CR_OPBITEN_BITMASK );
+}
+
+// ------------------------------------------------------------------------- END
+
diff --git a/clicks/waveform/memake.txt b/clicks/waveform/memake.txt
deleted file mode 100644
index 97d43f538c..0000000000
--- a/clicks/waveform/memake.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-type: subdirs
-project: Waveform
-
-subdirs: {
- lib
- example
-}