Compare commits
No commits in common. "dev" and "error-mem-viewer" have entirely different histories.
dev
...
error-mem-
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -10,6 +10,3 @@
|
|||||||
path = stm-firmware/base64-lib
|
path = stm-firmware/base64-lib
|
||||||
url = https://git.shimatta.de/mhu/base64-lib.git
|
url = https://git.shimatta.de/mhu/base64-lib.git
|
||||||
branch = master
|
branch = master
|
||||||
[submodule "stm-firmware/linklist-lib"]
|
|
||||||
path = stm-firmware/linklist-lib
|
|
||||||
url = https://git.shimatta.de/mhu/linklist-lib.git
|
|
||||||
|
361
GPLv2.md
361
GPLv2.md
@ -1,361 +0,0 @@
|
|||||||
### GNU GENERAL PUBLIC LICENSE
|
|
||||||
|
|
||||||
Version 2, June 1991
|
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
### Preamble
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your freedom
|
|
||||||
to share and change it. By contrast, the GNU General Public License is
|
|
||||||
intended to guarantee your freedom to share and change free
|
|
||||||
software--to make sure the software is free for all its users. This
|
|
||||||
General Public License applies to most of the Free Software
|
|
||||||
Foundation's software and to any other program whose authors commit to
|
|
||||||
using it. (Some other Free Software Foundation software is covered by
|
|
||||||
the GNU Lesser General Public License instead.) You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
this service if you wish), that you receive source code or can get it
|
|
||||||
if you want it, that you can change the software or use pieces of it
|
|
||||||
in new free programs; and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
anyone to deny you these rights or to ask you to surrender the rights.
|
|
||||||
These restrictions translate to certain responsibilities for you if
|
|
||||||
you distribute copies of the software, or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must give the recipients all the rights that
|
|
||||||
you have. You must make sure that they, too, receive or can get the
|
|
||||||
source code. And you must show them these terms so they know their
|
|
||||||
rights.
|
|
||||||
|
|
||||||
We protect your rights with two steps: (1) copyright the software, and
|
|
||||||
(2) offer you this license which gives you legal permission to copy,
|
|
||||||
distribute and/or modify the software.
|
|
||||||
|
|
||||||
Also, for each author's protection and ours, we want to make certain
|
|
||||||
that everyone understands that there is no warranty for this free
|
|
||||||
software. If the software is modified by someone else and passed on,
|
|
||||||
we want its recipients to know that what they have is not the
|
|
||||||
original, so that any problems introduced by others will not reflect
|
|
||||||
on the original authors' reputations.
|
|
||||||
|
|
||||||
Finally, any free program is threatened constantly by software
|
|
||||||
patents. We wish to avoid the danger that redistributors of a free
|
|
||||||
program will individually obtain patent licenses, in effect making the
|
|
||||||
program proprietary. To prevent this, we have made it clear that any
|
|
||||||
patent must be licensed for everyone's free use or not licensed at
|
|
||||||
all.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
**0.** This License applies to any program or other work which
|
|
||||||
contains a notice placed by the copyright holder saying it may be
|
|
||||||
distributed under the terms of this General Public License. The
|
|
||||||
"Program", below, refers to any such program or work, and a "work
|
|
||||||
based on the Program" means either the Program or any derivative work
|
|
||||||
under copyright law: that is to say, a work containing the Program or
|
|
||||||
a portion of it, either verbatim or with modifications and/or
|
|
||||||
translated into another language. (Hereinafter, translation is
|
|
||||||
included without limitation in the term "modification".) Each licensee
|
|
||||||
is addressed as "you".
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running the Program is not restricted, and the output from the Program
|
|
||||||
is covered only if its contents constitute a work based on the Program
|
|
||||||
(independent of having been made by running the Program). Whether that
|
|
||||||
is true depends on what the Program does.
|
|
||||||
|
|
||||||
**1.** You may copy and distribute verbatim copies of the Program's
|
|
||||||
source code as you receive it, in any medium, provided that you
|
|
||||||
conspicuously and appropriately publish on each copy an appropriate
|
|
||||||
copyright notice and disclaimer of warranty; keep intact all the
|
|
||||||
notices that refer to this License and to the absence of any warranty;
|
|
||||||
and give any other recipients of the Program a copy of this License
|
|
||||||
along with the Program.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy, and
|
|
||||||
you may at your option offer warranty protection in exchange for a
|
|
||||||
fee.
|
|
||||||
|
|
||||||
**2.** You may modify your copy or copies of the Program or any
|
|
||||||
portion of it, thus forming a work based on the Program, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
|
|
||||||
**a)** You must cause the modified files to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
|
|
||||||
**b)** You must cause any work that you distribute or publish, that in
|
|
||||||
whole or in part contains or is derived from the Program or any part
|
|
||||||
thereof, to be licensed as a whole at no charge to all third parties
|
|
||||||
under the terms of this License.
|
|
||||||
|
|
||||||
|
|
||||||
**c)** If the modified program normally reads commands interactively
|
|
||||||
when run, you must cause it, when started running for such interactive
|
|
||||||
use in the most ordinary way, to print or display an announcement
|
|
||||||
including an appropriate copyright notice and a notice that there is
|
|
||||||
no warranty (or else, saying that you provide a warranty) and that
|
|
||||||
users may redistribute the program under these conditions, and telling
|
|
||||||
the user how to view a copy of this License. (Exception: if the
|
|
||||||
Program itself is interactive but does not normally print such an
|
|
||||||
announcement, your work based on the Program is not required to print
|
|
||||||
an announcement.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Program,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Program, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote
|
|
||||||
it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Program.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Program
|
|
||||||
with the Program (or with a work based on the Program) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
**3.** You may copy and distribute the Program (or a work based on it,
|
|
||||||
under Section 2) in object code or executable form under the terms of
|
|
||||||
Sections 1 and 2 above provided that you also do one of the following:
|
|
||||||
|
|
||||||
|
|
||||||
**a)** Accompany it with the complete corresponding machine-readable
|
|
||||||
source code, which must be distributed under the terms of Sections 1
|
|
||||||
and 2 above on a medium customarily used for software interchange; or,
|
|
||||||
|
|
||||||
|
|
||||||
**b)** Accompany it with a written offer, valid for at least three
|
|
||||||
years, to give any third party, for a charge no more than your cost of
|
|
||||||
physically performing source distribution, a complete machine-readable
|
|
||||||
copy of the corresponding source code, to be distributed under the
|
|
||||||
terms of Sections 1 and 2 above on a medium customarily used for
|
|
||||||
software interchange; or,
|
|
||||||
|
|
||||||
|
|
||||||
**c)** Accompany it with the information you received as to the offer
|
|
||||||
to distribute corresponding source code. (This alternative is allowed
|
|
||||||
only for noncommercial distribution and only if you received the
|
|
||||||
program in object code or executable form with such an offer, in
|
|
||||||
accord with Subsection b above.)
|
|
||||||
|
|
||||||
The source code for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For an executable work, complete source
|
|
||||||
code means all the source code for all modules it contains, plus any
|
|
||||||
associated interface definition files, plus the scripts used to
|
|
||||||
control compilation and installation of the executable. However, as a
|
|
||||||
special exception, the source code distributed need not include
|
|
||||||
anything that is normally distributed (in either source or binary
|
|
||||||
form) with the major components (compiler, kernel, and so on) of the
|
|
||||||
operating system on which the executable runs, unless that component
|
|
||||||
itself accompanies the executable.
|
|
||||||
|
|
||||||
If distribution of executable or object code is made by offering
|
|
||||||
access to copy from a designated place, then offering equivalent
|
|
||||||
access to copy the source code from the same place counts as
|
|
||||||
distribution of the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
**4.** You may not copy, modify, sublicense, or distribute the Program
|
|
||||||
except as expressly provided under this License. Any attempt otherwise
|
|
||||||
to copy, modify, sublicense or distribute the Program is void, and
|
|
||||||
will automatically terminate your rights under this License. However,
|
|
||||||
parties who have received copies, or rights, from you under this
|
|
||||||
License will not have their licenses terminated so long as such
|
|
||||||
parties remain in full compliance.
|
|
||||||
|
|
||||||
**5.** You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Program or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Program (or any work based on the
|
|
||||||
Program), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Program or works based on it.
|
|
||||||
|
|
||||||
**6.** Each time you redistribute the Program (or any work based on
|
|
||||||
the Program), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute or modify the Program subject to
|
|
||||||
these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties to
|
|
||||||
this License.
|
|
||||||
|
|
||||||
**7.** If, as a consequence of a court judgment or allegation of
|
|
||||||
patent infringement or for any other reason (not limited to patent
|
|
||||||
issues), conditions are imposed on you (whether by court order,
|
|
||||||
agreement or otherwise) that contradict the conditions of this
|
|
||||||
License, they do not excuse you from the conditions of this License.
|
|
||||||
If you cannot distribute so as to satisfy simultaneously your
|
|
||||||
obligations under this License and any other pertinent obligations,
|
|
||||||
then as a consequence you may not distribute the Program at all. For
|
|
||||||
example, if a patent license would not permit royalty-free
|
|
||||||
redistribution of the Program by all those who receive copies directly
|
|
||||||
or indirectly through you, then the only way you could satisfy both it
|
|
||||||
and this License would be to refrain entirely from distribution of the
|
|
||||||
Program.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under
|
|
||||||
any particular circumstance, the balance of the section is intended to
|
|
||||||
apply and the section as a whole is intended to apply in other
|
|
||||||
circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system, which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
**8.** If the distribution and/or use of the Program is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Program under this License
|
|
||||||
may add an explicit geographical distribution limitation excluding
|
|
||||||
those countries, so that distribution is permitted only in or among
|
|
||||||
countries not thus excluded. In such case, this License incorporates
|
|
||||||
the limitation as if written in the body of this License.
|
|
||||||
|
|
||||||
**9.** The Free Software Foundation may publish revised and/or new
|
|
||||||
versions of the General Public License from time to time. Such new
|
|
||||||
versions will be similar in spirit to the present version, but may
|
|
||||||
differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Program
|
|
||||||
specifies a version number of this License which applies to it and
|
|
||||||
"any later version", you have the option of following the terms and
|
|
||||||
conditions either of that version or of any later version published by
|
|
||||||
the Free Software Foundation. If the Program does not specify a
|
|
||||||
version number of this License, you may choose any version ever
|
|
||||||
published by the Free Software Foundation.
|
|
||||||
|
|
||||||
**10.** If you wish to incorporate parts of the Program into other
|
|
||||||
free programs whose distribution conditions are different, write to
|
|
||||||
the author to ask for permission. For software which is copyrighted by
|
|
||||||
the Free Software Foundation, write to the Free Software Foundation;
|
|
||||||
we sometimes make exceptions for this. Our decision will be guided by
|
|
||||||
the two goals of preserving the free status of all derivatives of our
|
|
||||||
free software and of promoting the sharing and reuse of software
|
|
||||||
generally.
|
|
||||||
|
|
||||||
**NO WARRANTY**
|
|
||||||
|
|
||||||
**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
|
|
||||||
WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
|
||||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
|
||||||
OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY
|
|
||||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
|
||||||
PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
|
|
||||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
|
||||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
|
||||||
AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
|
|
||||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
|
||||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
|
||||||
PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
|
||||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
|
||||||
FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF
|
|
||||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
DAMAGES.
|
|
||||||
|
|
||||||
### END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
### How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these
|
|
||||||
terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest to
|
|
||||||
attach them to the start of each source file to most effectively
|
|
||||||
convey the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
one line to give the program's name and an idea of what it does.
|
|
||||||
Copyright (C) yyyy name of author
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper
|
|
||||||
mail.
|
|
||||||
|
|
||||||
If the program is interactive, make it output a short notice like this
|
|
||||||
when it starts in an interactive mode:
|
|
||||||
|
|
||||||
Gnomovision version 69, Copyright (C) year name of author
|
|
||||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
|
|
||||||
type `show w'. This is free software, and you are welcome
|
|
||||||
to redistribute it under certain conditions; type `show c'
|
|
||||||
for details.
|
|
||||||
|
|
||||||
The hypothetical commands \`show w' and \`show c' should show the
|
|
||||||
appropriate parts of the General Public License. Of course, the
|
|
||||||
commands you use may be called something other than \`show w' and
|
|
||||||
\`show c'; they could even be mouse-clicks or menu items--whatever
|
|
||||||
suits your program.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or
|
|
||||||
your school, if any, to sign a "copyright disclaimer" for the program,
|
|
||||||
if necessary. Here is a sample; alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright
|
|
||||||
interest in the program `Gnomovision'
|
|
||||||
(which makes passes at compilers) written
|
|
||||||
by James Hacker.
|
|
||||||
|
|
||||||
signature of Ty Coon, 1 April 1989
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
This General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library,
|
|
||||||
you may consider it more useful to permit linking proprietary
|
|
||||||
applications with the library. If this is what you want to do, use the
|
|
||||||
[GNU Lesser General Public
|
|
||||||
License](https://www.gnu.org/licenses/lgpl.html) instead of this
|
|
||||||
License.
|
|
21
Jenkinsfile
vendored
21
Jenkinsfile
vendored
@ -1,21 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent any
|
|
||||||
|
|
||||||
stages {
|
|
||||||
stage('Build') {
|
|
||||||
steps {
|
|
||||||
echo 'Building..'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Test') {
|
|
||||||
steps {
|
|
||||||
echo 'Testing..'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Deploy') {
|
|
||||||
steps {
|
|
||||||
echo 'Deploying....'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
367
LICENSE.md
367
LICENSE.md
@ -1,10 +1,361 @@
|
|||||||
# License of the Relow Oven Control Firmware
|
### GNU GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
This software is licsensed according to the GPLv2. See GPLv2.md for details.
|
Version 2, June 1991
|
||||||
However, this software includes various third party libraries for which different licenses apply:
|
|
||||||
|
|
||||||
- Shellmatta Shell implementation by Stefan Strobel: Licensed under ``Mozilla Public License Version 2.0``
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
- CMSIS by ARM Limited <https://github.com/ARM-software/CMSIS_5>, licensed under ``Apache License Version 2.0, January 2004``
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
- STM Header Files etc. by ST Microelectronics icensed under a custom license. See the sphinx documentation (section License) for details.
|
|
||||||
- FatFs: Custom License (See source files of FatFS)
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
- SHA256 Library <https://github.com/amosnier/sha-2> licensed under the ``Unilicense``
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
### Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your freedom
|
||||||
|
to share and change it. By contrast, the GNU General Public License is
|
||||||
|
intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if
|
||||||
|
you distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on,
|
||||||
|
we want its recipients to know that what they have is not the
|
||||||
|
original, so that any problems introduced by others will not reflect
|
||||||
|
on the original authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at
|
||||||
|
all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
**0.** This License applies to any program or other work which
|
||||||
|
contains a notice placed by the copyright holder saying it may be
|
||||||
|
distributed under the terms of this General Public License. The
|
||||||
|
"Program", below, refers to any such program or work, and a "work
|
||||||
|
based on the Program" means either the Program or any derivative work
|
||||||
|
under copyright law: that is to say, a work containing the Program or
|
||||||
|
a portion of it, either verbatim or with modifications and/or
|
||||||
|
translated into another language. (Hereinafter, translation is
|
||||||
|
included without limitation in the term "modification".) Each licensee
|
||||||
|
is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the Program
|
||||||
|
(independent of having been made by running the Program). Whether that
|
||||||
|
is true depends on what the Program does.
|
||||||
|
|
||||||
|
**1.** You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a
|
||||||
|
fee.
|
||||||
|
|
||||||
|
**2.** You may modify your copy or copies of the Program or any
|
||||||
|
portion of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
|
||||||
|
**a)** You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
|
||||||
|
**b)** You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any part
|
||||||
|
thereof, to be licensed as a whole at no charge to all third parties
|
||||||
|
under the terms of this License.
|
||||||
|
|
||||||
|
|
||||||
|
**c)** If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such interactive
|
||||||
|
use in the most ordinary way, to print or display an announcement
|
||||||
|
including an appropriate copyright notice and a notice that there is
|
||||||
|
no warranty (or else, saying that you provide a warranty) and that
|
||||||
|
users may redistribute the program under these conditions, and telling
|
||||||
|
the user how to view a copy of this License. (Exception: if the
|
||||||
|
Program itself is interactive but does not normally print such an
|
||||||
|
announcement, your work based on the Program is not required to print
|
||||||
|
an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote
|
||||||
|
it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
**3.** You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
|
||||||
|
**a)** Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections 1
|
||||||
|
and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
|
||||||
|
**b)** Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your cost of
|
||||||
|
physically performing source distribution, a complete machine-readable
|
||||||
|
copy of the corresponding source code, to be distributed under the
|
||||||
|
terms of Sections 1 and 2 above on a medium customarily used for
|
||||||
|
software interchange; or,
|
||||||
|
|
||||||
|
|
||||||
|
**c)** Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is allowed
|
||||||
|
only for noncommercial distribution and only if you received the
|
||||||
|
program in object code or executable form with such an offer, in
|
||||||
|
accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
**4.** You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt otherwise
|
||||||
|
to copy, modify, sublicense or distribute the Program is void, and
|
||||||
|
will automatically terminate your rights under this License. However,
|
||||||
|
parties who have received copies, or rights, from you under this
|
||||||
|
License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
**5.** You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
**6.** Each time you redistribute the Program (or any work based on
|
||||||
|
the Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
**7.** If, as a consequence of a court judgment or allegation of
|
||||||
|
patent infringement or for any other reason (not limited to patent
|
||||||
|
issues), conditions are imposed on you (whether by court order,
|
||||||
|
agreement or otherwise) that contradict the conditions of this
|
||||||
|
License, they do not excuse you from the conditions of this License.
|
||||||
|
If you cannot distribute so as to satisfy simultaneously your
|
||||||
|
obligations under this License and any other pertinent obligations,
|
||||||
|
then as a consequence you may not distribute the Program at all. For
|
||||||
|
example, if a patent license would not permit royalty-free
|
||||||
|
redistribution of the Program by all those who receive copies directly
|
||||||
|
or indirectly through you, then the only way you could satisfy both it
|
||||||
|
and this License would be to refrain entirely from distribution of the
|
||||||
|
Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
**8.** If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
**9.** The Free Software Foundation may publish revised and/or new
|
||||||
|
versions of the General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and
|
||||||
|
"any later version", you have the option of following the terms and
|
||||||
|
conditions either of that version or of any later version published by
|
||||||
|
the Free Software Foundation. If the Program does not specify a
|
||||||
|
version number of this License, you may choose any version ever
|
||||||
|
published by the Free Software Foundation.
|
||||||
|
|
||||||
|
**10.** If you wish to incorporate parts of the Program into other
|
||||||
|
free programs whose distribution conditions are different, write to
|
||||||
|
the author to ask for permission. For software which is copyrighted by
|
||||||
|
the Free Software Foundation, write to the Free Software Foundation;
|
||||||
|
we sometimes make exceptions for this. Our decision will be guided by
|
||||||
|
the two goals of preserving the free status of all derivatives of our
|
||||||
|
free software and of promoting the sharing and reuse of software
|
||||||
|
generally.
|
||||||
|
|
||||||
|
**NO WARRANTY**
|
||||||
|
|
||||||
|
**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
|
WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||||
|
OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY
|
||||||
|
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||||
|
PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
|
||||||
|
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||||
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||||
|
AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||||
|
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||||
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||||
|
PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||||
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||||
|
FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF
|
||||||
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGES.
|
||||||
|
|
||||||
|
### END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
### How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these
|
||||||
|
terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to
|
||||||
|
attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
one line to give the program's name and an idea of what it does.
|
||||||
|
Copyright (C) yyyy name of author
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper
|
||||||
|
mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
|
||||||
|
type `show w'. This is free software, and you are welcome
|
||||||
|
to redistribute it under certain conditions; type `show c'
|
||||||
|
for details.
|
||||||
|
|
||||||
|
The hypothetical commands \`show w' and \`show c' should show the
|
||||||
|
appropriate parts of the General Public License. Of course, the
|
||||||
|
commands you use may be called something other than \`show w' and
|
||||||
|
\`show c'; they could even be mouse-clicks or menu items--whatever
|
||||||
|
suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or
|
||||||
|
your school, if any, to sign a "copyright disclaimer" for the program,
|
||||||
|
if necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright
|
||||||
|
interest in the program `Gnomovision'
|
||||||
|
(which makes passes at compilers) written
|
||||||
|
by James Hacker.
|
||||||
|
|
||||||
|
signature of Ty Coon, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library,
|
||||||
|
you may consider it more useful to permit linking proprietary
|
||||||
|
applications with the library. If this is what you want to do, use the
|
||||||
|
[GNU Lesser General Public
|
||||||
|
License](https://www.gnu.org/licenses/lgpl.html) instead of this
|
||||||
|
License.
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit aeb2707d80049094337742d0f62cd24dbef1c01d
|
Subproject commit 3a58e3dd1c2ef6de78df89c8fdc7ba96b51cd4e0
|
3
doc/.vscode/settings.json
vendored
3
doc/.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"restructuredtext.confPath": "${workspaceFolder}/source"
|
|
||||||
}
|
|
3
doc/source/.vscode/settings.json
vendored
3
doc/source/.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"restructuredtext.confPath": "${workspaceFolder}"
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
<mxfile host="Electron" modified="2021-05-22T15:48:58.897Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/14.1.8 Chrome/87.0.4280.88 Electron/11.1.1 Safari/537.36" etag="60nNVEjkDLNBMWFG8AC7" version="14.1.8" type="device"><diagram id="3R1YF1CA5z1RRVBQNkpO" name="Page-1">7VlLc9o6FP41LGFkCduwbCBtF+1cbtOZpkthy7Z6ZURk8eqvr2TLLwSBFIgnmZtFxjqSjh7n+85D9NAk3X4SeJl85SFhPQjCbQ9NexB6vq/+a8GuEKCRVwhiQcNC5NSCB/qbGCEw0hUNSdYaKDlnki7bwoAvFiSQLRkWgm/awyLO2qsucUwswUOAmS39QUOZFNIR9Gv5Z0LjpFzZ8cZFT4rLweYkWYJDvmmI0H0PTQTnsvhKtxPC9N2V91LM+3ikt9qYIAt5zgRvNpa/npLHmH16+jdwvo+m7rzvmr3JXXlgEqrzmyYXMuExX2B2X0vvBF8tQqK1AtWqx3zhfKmEjhL+IlLujDHxSnIlSmTKTK/asNg9mvl546duDNyyOd02O6c70yr2qjd49ApKiGARE/nMuceVARRwCU+JWkfNE4RhSddt/dhAKK7GVVNnnKqVITBor1BrwO74oK2i2JeZ1bTVnqJ9PZ7b1pPxlQiIpUd9NI5Ti3IkvAAVhqJrzFbmKr7hjRLMvjsAgPyeMppJvAjIQfx8wXPlBVo2x4zGC/UdKFMRoQRrIiRVPPtgOlIahgW8lO7feJ7r01Zf6lPm53bveu60woFWQLa9A07ATK6p10TIcRrYcDDa+2DgAH/cMknfLHkhYhwwGLug8YcOrlIq5FGUkZuY3OnGE2ypfGx8N/yAatVuQDdKL/C33iNvzYig6qo0Al/oUgrKnXIpZ7geZ3ih72mZ/qV2HlvU7kGPqf3ezdVHLPM7KQQRz5FaI8J7WvGyo5/lNv2gBiC03NadtZZKkdpooautX4kba+6DjzEV4jXINgmV5GGJ88vfqCRjz7FkyyLuR3SroXgXUcYmnHGRK0KhS0bhUMkzKfh/pNEzgnPkec/5EwsGR10ELPlTeuyhcT2bOmlwjShp5AsuuJGdHce+0vfF5ytStwy3p7kLb5M3oHa8h8Pz8oarOX9geYWJCthzgaVCAwT/1GGnCag2XE7wdI+WURTBIDhEy9Cbe+6VaOnv3atrs9KBB2jp3YyW6O3Rsmbiz2YC/wq0hGfS8tJs/jKTQos8fdv5SkHxImZnBDTBpdo11zlxfwxs5hBHhTT/EHPGno/wtQIabAe0qiRpUAcdYM6+57raNUP4ZpijGjfMMy/OHw/HIA+cqDlvHIMgej4GVbXnt3dWe8IjOUVdfCIXOC3bXKn4RM7gcFH7CuXm0LK2Zc3SSrlFZzyjxivOuZQ81Q6wfFHTpgpxllRMtyzeQMO+8aV2BVrXUq+bbmP9jjkgTBlT6HEDPFeeFgdykK70uyOjucZOygw03CNp12UGfINlRnf5jHdmPuP4nSY09vNf0xOb1wJRlu4PZKGpuaZSb3FK1rRIX958tYBg59XCqBN2/SVTbv3A5vjn0qfTF7Zym/8/sd029lXlR2exD9hX+h5+PDtNxLOfuruNY/Zbt52tXBKVXqkSHx95HDxRiaOX414169+ji1S//lEf3f8B</diagram></mxfile>
|
|
@ -9,3 +9,6 @@ Safety Controller
|
|||||||
safety-adc
|
safety-adc
|
||||||
|
|
||||||
|
|
||||||
|
.. doxygengroup:: safety-controller
|
||||||
|
:project: Reflow Controller Firmware
|
||||||
|
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
.. _hw_version_detect:
|
|
||||||
|
|
||||||
Automatic Hardware Version detection
|
|
||||||
====================================
|
|
||||||
|
|
||||||
Functional Description
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
In order to automatically select the available hardware features, the firmware checks the PCB's version
|
|
||||||
using vertain pins on the microcontroller.
|
|
||||||
|
|
||||||
The hardware revision is represented by the enum type :c:enum:`hw_revision`. A call to :c:func:`get_pcb_hardware_version` retrieves the revision.
|
|
||||||
When the function is called for the first time, it activates pull-up resistors on pin numbers :c:macro:`HW_REV_DETECT_PIN_LOW` to :c:macro:`HW_REV_DETECT_PIN_HIGH`
|
|
||||||
on port :c:macro:`HW_REV_DETECT_GPIO` and reads in the binary number.
|
|
||||||
|
|
||||||
The revision is set by externally connecting the pins to ground. The bit pattern read from the port is inverted and then checked internally to derive the hardware version.
|
|
||||||
After the version is read for the first time, it is stored internally and subsequent calls to :c:func:`get_pcb_hardware_version` only retrieve the internally stored value to reduce the overhead of the function.
|
|
||||||
|
|
||||||
Hardware Version Dependent Features
|
|
||||||
-----------------------------------
|
|
||||||
|
|
||||||
- The settings module searches for an external EEPROM on the SPI interface to store some settings, like the calibration. This is enabled for all versions higher or equal to ``v1.3``.
|
|
||||||
- The safety controller enables the acknowledging of the external watchdog for all versions higher or equal to ``v1.3``.
|
|
||||||
- The oven driver has a separate safety enable for the solid state relay which it enables on all versions higher or equal to ``v1.3``.
|
|
||||||
|
|
||||||
|
|
||||||
API Documentation
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
.. doxygengroup:: hw-version-detect
|
|
||||||
:project: Reflow Controller Firmware
|
|
@ -11,8 +11,6 @@ mechanisms and the behavior. For a detailed code documentation see the doxygen o
|
|||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
pt1000-processing
|
pt1000-processing
|
||||||
pid-controller
|
|
||||||
safety/index
|
safety/index
|
||||||
code/index
|
code/index
|
||||||
hw-version-detect
|
|
||||||
peripherals
|
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
.. _peripherals:
|
|
||||||
|
|
||||||
Used Peripheral Modules
|
|
||||||
=======================
|
|
||||||
|
|
||||||
This section lists all the used peripheral modules of the ``STM32F407VxT6``.
|
|
||||||
|
|
||||||
Core Peripherals
|
|
||||||
----------------
|
|
||||||
|
|
||||||
- ``SysTick``: Generating a 100us tick for the LCD routine and 1ms base system tick.
|
|
||||||
- ``NVIC``: Interrupt controller
|
|
||||||
- ``FPU``: The Flaoting Point Unit is activated and used in this formware.
|
|
||||||
|
|
||||||
AHB Peripherals
|
|
||||||
---------------
|
|
||||||
|
|
||||||
- ``DMA2``
|
|
||||||
- ``Stream0``: DMA transfer of PT1000 measurement ADC to memory
|
|
||||||
- ``Stream4``: DMA transfer of Safety ADC measurement values
|
|
||||||
- ``Stream5``: Shell UART RX
|
|
||||||
- ``Stream7``: Shell UART TX
|
|
||||||
- ``RNG``: Random number generation for stack corruption / overflow checker.
|
|
||||||
- ``CRC``: CRC verfication of various data (Safety structures, EEPROM data, Safety RAM)
|
|
||||||
- ``Backup RAM``: Backup RAM storing errors and bootloader information beyond system resets. The memory is cleared by a power cycle!
|
|
||||||
|
|
||||||
ABP1 Peripherals
|
|
||||||
----------------
|
|
||||||
|
|
||||||
- ``IWDG``: Independent Watchdog
|
|
||||||
- ``TIM2``: PT1000 measurement ADC sample time generation timer. Genewrates the 1 KHz sample trigger to the ADC peripheral via the internal event routing system.
|
|
||||||
- ``TIM3``: PWM timer for oven relais output.
|
|
||||||
- ``TIM5``: Input capture for rotary encoder.
|
|
||||||
- ``TIM7``: Timer for loudspeaker tone generation.
|
|
||||||
|
|
||||||
|
|
||||||
APB2 Peripherals
|
|
||||||
----------------
|
|
||||||
|
|
||||||
- ``SPI1``: SPI for external SPI-EEPROM
|
|
||||||
- ``SDIO``: SD card interface
|
|
||||||
- ``USART1``: Shell UART
|
|
||||||
- ``ADC1``: Safety ADC for monitoring voltages
|
|
||||||
- ``ADC3``: PT1000 measurement ADC
|
|
@ -1,78 +0,0 @@
|
|||||||
.. _pid_controller:
|
|
||||||
|
|
||||||
PID Controller
|
|
||||||
==============
|
|
||||||
|
|
||||||
The PID controller is the main element of the oven. It controls the output of the solid state relais in order to achieve the desired temperature.
|
|
||||||
|
|
||||||
The PID controller is implemented in the ``pid-controller.c`` file. See the :ref:`pid_code_api` for details.
|
|
||||||
|
|
||||||
Functional Description
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
The following figure shows the PID controller's structure.
|
|
||||||
|
|
||||||
.. drawio-image:: pid.drawio
|
|
||||||
|
|
||||||
The controller is composed of 3 paths. The proportional, the derivate, and the integrator path.
|
|
||||||
Compared to a textbook PID controller, this version contains a few additional features.
|
|
||||||
|
|
||||||
The integrator has a configurable maximum limit of :c:var:`pid_controller.integral_max`. Once this value is reached (plus or minus), the integrator freezes.
|
|
||||||
The integrator is also frozen in case the output value is in saturation. This serves as an anti-windup protection.
|
|
||||||
|
|
||||||
The output value saturates at configurable high and low limits (:c:var:`pid_controller.output_sat_max` and :c:var:`pid_controller.output_sat_min`). The controller instance used for the
|
|
||||||
reflow oven's solid state relais output is saturated by software to a limit of 0 to 100.
|
|
||||||
|
|
||||||
In addition to the above features, the derivate term contains an additional first order low pass filter in order to prevent coupling of high frequency noise amplified by the derivate term.
|
|
||||||
The low pass filter is charcterized by its time constant :math:`k_{d\tau}`.
|
|
||||||
|
|
||||||
Time Continuous Transfer Function
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
The time continous transfer function of the PID controller is
|
|
||||||
|
|
||||||
.. math:: H_c(s) = \frac{Y_c(s)}{X_c(s)} = k_p + \frac{k_i}{s} + \frac{k_ds}{1+sk_{d\tau}}
|
|
||||||
|
|
||||||
|
|
||||||
Time Discrete Transfer Function
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
The time descrete transfer function which is implemented in the code is derived by converting the time continuous transfer function
|
|
||||||
with the bilinear transformation:
|
|
||||||
|
|
||||||
.. math:: s = \frac{2}{T_s}\cdot \frac{z-1}{z+1}
|
|
||||||
|
|
||||||
The frequency warping of the bilinear transform can be considered negligible because the PID controller is targetted for low frequency temperature signal data with a maximum far below the nyquist freqency.
|
|
||||||
In this area, the mapping of the continuous frequencies to the time descrete can be considered linear.
|
|
||||||
|
|
||||||
The time discrete transfer function after inserting the bilinear transform is:
|
|
||||||
|
|
||||||
.. math:: H_d(z) = H_c(s)\bigg|_{s=\frac{2}{T_s}\cdot \frac{z-1}{z+1}} = k_p + \frac{k_i T_s (z+1)}{2(z-1)} + \frac{\frac{2}{T_s}k_d(z-1)}{\left(1+\frac{2k_{d\tau}}{T_s}\right)z+\left(1-\frac{2k_{d\tau}}{T_s}\right)}.
|
|
||||||
|
|
||||||
Converted to an implementable form:
|
|
||||||
|
|
||||||
.. math:: H_d(z) = k_p + \frac{k_iT_s(1+ z^{-1})}{2(1-z^{-1})} + \frac{\frac{2}{T_s}k_d(1-z^{-1})}{(1+2k_{d\tau}T_s^{-1})+(1-2k_{d\tau}T_s^{-1})z^{-1}}
|
|
||||||
|
|
||||||
This function can be splitted in the three individual parts of the PID controller:
|
|
||||||
|
|
||||||
.. math:: H_{d1}(z) = k_p
|
|
||||||
.. math:: H_{d2}(z) = \frac{k_iT_s(1+ z^{-1})}{2(1-z^{-1})}
|
|
||||||
.. math:: H_{d3}(z) = \frac{\frac{2}{T_s}k_d(1-z^{-1})}{(1+2k_{d\tau}T_s^{-1})+(1-2k_{d\tau}T_s^{-1})z^{-1}}
|
|
||||||
|
|
||||||
The individual time domain difference equations :math:`y_i[n] = \mathcal{Z}^{-1}\left\lbrace H_{di} * X(z)\right\rbrace` that are implemented in software are:
|
|
||||||
|
|
||||||
.. math:: y_1[n] = k_p x[n]
|
|
||||||
.. math:: y_2[n] = \underbrace{\frac{k_iT_s}{2}}_{k_{i_t}} \left( x[n] + x[n-1]\right) + y_2[n-1]
|
|
||||||
.. math:: y_3[n] = \underbrace{\frac{2k_{d}}{2k_{d\tau} + T_s}}_{k_{d_t}}\left( x[n] - x[n-1] \right) + \underbrace{\frac{2k_{d\tau} - T_s}{2k_{d\tau} + T_s}}_{\overline{k_{d_t}}} y_3[n-1]
|
|
||||||
|
|
||||||
The final output value is the sum of all three terms:
|
|
||||||
|
|
||||||
.. math:: y[n] = \sum_{i=1}^{3} y_i[n]
|
|
||||||
|
|
||||||
.. _pid_code_api:
|
|
||||||
|
|
||||||
PID Controller Code API
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
.. doxygengroup:: pid-controller
|
|
||||||
:project: Reflow Controller Firmware
|
|
@ -1 +0,0 @@
|
|||||||
<mxfile host="Electron" modified="2021-06-14T21:01:35.428Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/14.1.8 Chrome/87.0.4280.88 Electron/11.1.1 Safari/537.36" etag="ORruDkFRflEPSgIrI-Cx" version="14.1.8" type="device"><diagram name="Page-1" id="b520641d-4fe3-3701-9064-5fc419738815">3Vttb6M4EP41+dgIMObl4/bl7lba1VXqSbt3XyonOMRXiDnjtGR//dnYQHhLySaEdFFV2ePx2Hjm8YzHZAbu4ux3hpL1VxrgaGYZQTYD9zPL8j1T/JeEnSJA6CtCyEigSGZFeCI/sCYamrolAU5rjJzSiJOkTlzSzQYveY2GGKNvdbYVjeqjJijELcLTEkVt6jcS8LWmmoZRNfyBSbjWQ3tQNyzQ8iVkdLvR480ssMof1RyjUpYipGsU0DdFykWAhxm4Y5RyVYqzOxzJpS2WTY3zW09rOW+GN3xIBy/JHl5eQ/vrX8//QJh8C+iPpxutq5TvivXAgVgeXaWMr2lINyh6qKi3+TtjKdUQtYrnC6WJIJqC+C/mfKd1jbacCtKax5FuxRnh3/fKf0tRc6hr95mWnFd2RWXD2e57xSirf++3Vd3yWq3fI2YkxhwzTVQvLd+0dy0LpdEtW+IDC1iYLGIh5of4zFLlAkmYiumwnejIcIQ4ea1PBGmbDku+susjJWKKlqHh50BLrEfeSePPstyCUohRk9M9KwsRhb2pVKTcbo6wISlyAiMqDaJmDpV19BjEcN2/r9NRVFrujIVCHWOQOtuC7HcEKeNuCfrEGNrtsSWSIT0wYbd7nN55NfjNOr8oqBmc1Ui1Gl5RtMXFfu1EQru3C1EIZeHzhuOQIU5Z0SRGKltLdlZRbPH38kxUoQWCysSlvb6tCcdPCcp3kzfhSuvmvCJRdEcjyvK+IIDYC2xBTzmjL3ivxbMWwHFKQ37FjOPssCm3TVR3ALChCe1CjLeaJ1S09b4TbFjSvlXXtpej1QQ+ikM6ow8Bo+wjtt+AJfTnHnRN21L//Ys6CfA+/u6Fl35Vb3wU/oJfBn/W9PgzPgr++gLCMjaYKCCEVxcQ+talA8JpNvHpA0I4TkBo1HcJAH7xgBBcIiCEHQ5J+ZOkx59wRtAmzI31Kp2JU8c96HAm3iV9ifO+y39kNBFQJxLo3U6/qQOc8fpao4iEG1FeimWS+/mtXESyRNEn3RCTIFA7DE7JD7TIRUngazMWcuHtDN5LWWJTSdX+MqEa62CwDdhSo9+hRmssNYI2Eq41JBCVMVM9I3ns93blkb212XU0bii8wNQXtMDRo8CIhKxoWlDOaSwhUSQ35ZoHKF2Xum/hc0/JTahyaRxSViLHjbNQZpznOMJLsfcKvjlaCOyhJZ+n2zhGchLPOYqnAitsgFVE9C2wwg6wwtHi92nA+pOh1+jJWWtg4HYytE9TmtUbi8zc22AG7zjaztz7nrjkWsAZ0ZAsn0PEcSrKbwlK02eBSiV4Eni2UiDAHQRP2xlL0+608Dzu7uScSHSGInFSIPaHrCua++xKcc5/W1o03Kig8ZNgMK0kqxqLOPYryki8jUUVxRJFm0WaHMhpCcQnsZysxH+Msj3slzGymlBPmHxS6gthb7Xsgqaz9PBiNQ403WGHldEcpzVJ4uuMCANDkxTjZJubO+3A1MLZ0ssDglghhiTpgOM7ShP1pcGKZFK7TYQY+XMeHFjNCBK2gWBd9LjXsXDXA4TzJ9csf+7bP2W7bVmwLUuQnEY0MfZNS/uq5fMm2cp5BviV5KemThXn8eN4yZVesOgve3TnWWna+8o/YKq90Lox5o4NzZo+dO1Eo7kBcG47RvXUBzHmvufvPZ5dH4CuVikeRff2JOCd+vp0nLS7Z7Rc2hyYBrBtz3Kh54BBqD42d+56x+XO3+EfJ3duX1FK0Bp8TWhNdfgBg+8ERzHklokMyy8ebbnNWx8bHrbcBj88bOjAdQ+wj2Tn7fPgn1uufGmK+JZpZ2qsMA7k96C/hl9V8O71q2Jr9626Mm7O41c9Z97cVsfzlaB9A1gq92lPuec8Wl8k69W6UADtI4XZdaZoxr1nO1PYkxyuT/yqxJ3MXXgD3cXJgc9pB0WvHz8x2ah814fLSzmNr2+9NnbcDujYo0HHbC3i9UNnMuT4HwM5/gHkFJniD48c054aOu1ESLnMitZc5It+XXKGJW+F3B3Xz11Z9J9IHopq9VMlFYJVPwcDD/8D</diagram></mxfile>
|
|
@ -120,7 +120,19 @@ are used to set the resistance calibration internally. For a guide on how to cal
|
|||||||
|
|
||||||
The calibration is calculated the following way:
|
The calibration is calculated the following way:
|
||||||
|
|
||||||
.. drawio-image:: calibration.drawio
|
.. blockdiag::
|
||||||
|
:desctable:
|
||||||
|
|
||||||
|
blockdiag {
|
||||||
|
orientation = portrait;
|
||||||
|
|
||||||
|
LF [label="LF", shape=beginpoint, description="Low Frequency PT1000 Value"];
|
||||||
|
SENS [label="Sens", description="Sensitivity Correction :math:`\sigma`"];
|
||||||
|
OFFSET [label="Offset", description="Offset Correction :math:`O`"];
|
||||||
|
OUT [shape=endpoint, description="Corrected Value"];
|
||||||
|
|
||||||
|
LF -> OFFSET -> SENS -> OUT
|
||||||
|
}
|
||||||
|
|
||||||
The final calibrated PT1000 resistance is calculated as:
|
The final calibrated PT1000 resistance is calculated as:
|
||||||
|
|
||||||
@ -129,11 +141,11 @@ The final calibrated PT1000 resistance is calculated as:
|
|||||||
|
|
||||||
The default values, if no calibration is loaded / executed, are:
|
The default values, if no calibration is loaded / executed, are:
|
||||||
|
|
||||||
======== =====================
|
============== =========
|
||||||
Offset Sensitivity Deviation
|
:math:`\sigma` :math:`O`
|
||||||
======== =====================
|
============== =========
|
||||||
0 0
|
0 0
|
||||||
======== =====================
|
============== =========
|
||||||
|
|
||||||
Get Calibration Corrected Value
|
Get Calibration Corrected Value
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -21,5 +21,4 @@ which are used to retain boot information across resets, for example to communic
|
|||||||
flags
|
flags
|
||||||
backup-ram
|
backup-ram
|
||||||
error-handling
|
error-handling
|
||||||
startup-tests
|
|
||||||
stack-checking
|
stack-checking
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
.. _safety_startup_tests:
|
|
||||||
|
|
||||||
Startup Tests
|
|
||||||
=============
|
|
||||||
|
|
||||||
The following tests will be performed after each reset / power cycle of the controller.
|
|
||||||
|
|
||||||
Internal Memory Test
|
|
||||||
--------------------
|
|
||||||
Directly after startup and after setting up the system clocks, the controller performs memory checks on the internal SRAM and the core coupled memory.
|
|
||||||
|
|
||||||
RAM checking is performed by testing the following sequences:
|
|
||||||
|
|
||||||
- Alternating 0x55AA55AA / 0xAA55AA55 pattern
|
|
||||||
- Alternating 0xAA55AA55 / 0x55AA55AA pattern
|
|
||||||
- 0xFFFFFFFF constant value
|
|
||||||
- 0x00000000 constant value
|
|
||||||
|
|
||||||
The following functions implement the RAM checking:
|
|
||||||
|
|
||||||
.. doxygenfunction:: startup_test_perform_ccm_ram_check
|
|
||||||
|
|
||||||
.. doxygenfunction:: startup_test_perform_system_ram_check
|
|
@ -1,27 +0,0 @@
|
|||||||
.. _hw_watchdog:
|
|
||||||
|
|
||||||
Hardware Watchdog
|
|
||||||
=================
|
|
||||||
|
|
||||||
the PCB (> v1.3) is equipped with an external power supply monitor and hardware watchdog IC ``STM6822S``.
|
|
||||||
The watchdog is periodically reset by the firmware.
|
|
||||||
|
|
||||||
.. note:: The external watchdog is only activated in Release mode. When building the application in Debug mode, it is deactivated because setting breakpoints or other events that distrb the program flow would trigger a the external watchdog and force a software reset.
|
|
||||||
|
|
||||||
|
|
||||||
During startup of the power supply, it keeps the controller in reset until the power supply is stable.
|
|
||||||
The following picture shows the 3.3 Volt supply rail on channel 2 and the low active reset signal of the STM32F407 on channel 1.
|
|
||||||
|
|
||||||
.. image:: hw_watchdog_delay.png
|
|
||||||
:alt: Image not found
|
|
||||||
|
|
||||||
The total startup delay is larger than 200 ms.
|
|
||||||
|
|
||||||
The follwoing figure shows the startup of the voltage rgulator and the reset signal.
|
|
||||||
|
|
||||||
.. image:: hw_watchdog_startup.png
|
|
||||||
:alt: Image not found
|
|
||||||
|
|
||||||
The power supply is gradually ramped up over approximately 500 us. The external watchdog does not work fpr voltages below 0.9 Volt. Therefore the reset signal rises simultaneously.
|
|
||||||
Once the supply voltage exceeds 0.9 Volts, the reset signal is pulled low. This ensures that the controller is not able to start until the > 200 ms startup time have passed.
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 27 KiB |
Binary file not shown.
Before Width: | Height: | Size: 28 KiB |
@ -3,7 +3,7 @@
|
|||||||
Hardware
|
Hardware
|
||||||
========
|
========
|
||||||
|
|
||||||
This guide on the reflow controller's hardware is based on the ``reflow-oven-control-pcb`` -- Version ``v1.3``
|
This guide on the reflow controller's hardware is based on the ``reflow-oven-control-pcb`` -- Version ``v1.2``
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
.. _hardware_modifications_v1_2:
|
.. _hardware_modifications:
|
||||||
|
|
||||||
Hardware Modifications for PCB v1.2
|
Hardware Modifications
|
||||||
===================================
|
======================
|
||||||
|
|
||||||
Analog Frontend
|
Analog Frontend
|
||||||
---------------
|
---------------
|
||||||
@ -13,11 +13,3 @@ Power Supply
|
|||||||
------------
|
------------
|
||||||
.. note::
|
.. note::
|
||||||
Replace transformer ``BV-EI-303-2010`` with ``BV-EI-303-2050``, which has the same footprint but a little more power and does not heat that much.
|
Replace transformer ``BV-EI-303-2010`` with ``BV-EI-303-2050``, which has the same footprint but a little more power and does not heat that much.
|
||||||
|
|
||||||
.. _hardware_modifications_v1_3:
|
|
||||||
|
|
||||||
Hardware Modifications for PCB v1.3
|
|
||||||
===================================
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
solder jumpers to bridge GND and Earth together must be soldered for the SD card slot to work properly. The card detect's switch terminal is on Earth potential.
|
|
@ -10,8 +10,7 @@ Quick Links
|
|||||||
===========
|
===========
|
||||||
|
|
||||||
* :ref:`genindex`
|
* :ref:`genindex`
|
||||||
* :ref:`hardware_modifications_v1_2`
|
* :ref:`hardware_modifications`
|
||||||
* :ref:`hardware_modifications_v1_3`
|
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
Although the Shimatta Reflow Controller provides a bunch of safety mechanisms that -- in theory -- prevent your house from burning down, NEVER leave the oven controller running unattended. This project is published in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
Although the Shimatta Reflow Controller provides a bunch of safety mechanisms that -- in theory -- prevent your house from burning down, NEVER leave the oven controller running unattended. This project is published in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
@ -9,36 +9,8 @@ The firmware includes following third-party software libraries:
|
|||||||
- ``shellmatta`` by ``Stefan Strobel`` <https://git.shimatta.net/shimatta/shellmatta>, licensed under ``Mozilla Public License Version 2.0``
|
- ``shellmatta`` by ``Stefan Strobel`` <https://git.shimatta.net/shimatta/shellmatta>, licensed under ``Mozilla Public License Version 2.0``
|
||||||
- ``CMSIS`` by ``ARM Limited`` <https://github.com/ARM-software/CMSIS_5>, licensed under ``Apache License Version 2.0, January 2004``
|
- ``CMSIS`` by ``ARM Limited`` <https://github.com/ARM-software/CMSIS_5>, licensed under ``Apache License Version 2.0, January 2004``
|
||||||
- ``STM Header files and startup code`` by ``ST Microelectronics``, licensed under a `custom license <ST License for Used Header Files_>`_
|
- ``STM Header files and startup code`` by ``ST Microelectronics``, licensed under a `custom license <ST License for Used Header Files_>`_
|
||||||
- ``SHA-256 Library`` by ``Alain Mosnier`` <https://github.com/amosnier/sha-2>, licensed under ``Zero Clause BSD License`` or the ``Unlicense``
|
|
||||||
- ``FatFS`` Library by ``ChaN`` licensed under a `custom license <FatFS License_>`_
|
|
||||||
|
|
||||||
|
|
||||||
FatFS License
|
|
||||||
-------------
|
|
||||||
|
|
||||||
FatFs has being developped as a personal project of the author, ChaN. It is free from the code anyone else wrote at current release. Following code block shows a copy of the FatFs license document that heading the source files.::
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------/
|
|
||||||
/ FatFs - Generic FAT Filesystem Module Rx.xx /
|
|
||||||
/-----------------------------------------------------------------------------/
|
|
||||||
/
|
|
||||||
/ Copyright (C) 20xx, ChaN, all right reserved.
|
|
||||||
/
|
|
||||||
/ FatFs module is an open source software. Redistribution and use of FatFs in
|
|
||||||
/ source and binary forms, with or without modification, are permitted provided
|
|
||||||
/ that the following condition is met:
|
|
||||||
/
|
|
||||||
/ 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
/ this condition and the following disclaimer.
|
|
||||||
/
|
|
||||||
/ This software is provided by the copyright holder and contributors "AS IS"
|
|
||||||
/ and any warranties related to this software are DISCLAIMED.
|
|
||||||
/ The copyright owner or contributors be NOT LIABLE for any damages caused
|
|
||||||
/ by use of this software.
|
|
||||||
/----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
Therefore FatFs license is one of the BSD-style licenses, but there is a significant feature. FatFs is mainly intended for embedded systems. In order to extend the usability for commercial products, the redistributions of FatFs in binary form, such as embedded code, binary library and any forms without source code, do not need to include about FatFs in the documentations. This is equivalent to the 1-clause BSD license. Of course FatFs is compatible with the most of open source software licenses include GNU GPL. When you redistribute the FatFs source code with changes or create a fork, the license can also be changed to GNU GPL, BSD-style license or any open source software license that not conflict with FatFs license.
|
|
||||||
|
|
||||||
ST License for Used Header Files
|
ST License for Used Header Files
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
# This is a comment
|
|
||||||
pid_conf 10 0.3 5 60 2.5 0.5
|
|
||||||
temp_set 50
|
|
||||||
wait_temp 45
|
|
||||||
temp_set 45
|
|
||||||
temp_ramp 150 120
|
|
||||||
temp_ramp 190 90
|
|
||||||
pid_conf 9 0.5 6 60 2.5 0.5
|
|
||||||
temp_set 250
|
|
||||||
wait_temp 245
|
|
||||||
temp_off
|
|
||||||
beep 1
|
|
||||||
wait_time 1
|
|
||||||
beep 0
|
|
||||||
|
|
@ -21,7 +21,6 @@ struct safety_memory_header {
|
|||||||
uint32_t boot_status_offset; /**< @brief Offset of the safety_memory_boot_status struct (in 32 bit words)*/
|
uint32_t boot_status_offset; /**< @brief Offset of the safety_memory_boot_status struct (in 32 bit words)*/
|
||||||
uint32_t config_overrides_offset; /**< @brief Offset address of override entries */
|
uint32_t config_overrides_offset; /**< @brief Offset address of override entries */
|
||||||
uint32_t config_overrides_len; /**< @brief Length of override entries in words */
|
uint32_t config_overrides_len; /**< @brief Length of override entries in words */
|
||||||
uint32_t firmware_update_filename; /**< @brief Filename of the firmware update. This string is at maximum 256 bytes long including the 0 terminator */
|
|
||||||
uint32_t err_memory_offset; /**< @brief Offset of the error memory */
|
uint32_t err_memory_offset; /**< @brief Offset of the error memory */
|
||||||
uint32_t err_memory_end; /**< @brief End of the error memory. This points to the word after the error memory, containing the CRC of the whole backup RAM. */
|
uint32_t err_memory_end; /**< @brief End of the error memory. This points to the word after the error memory, containing the CRC of the whole backup RAM. */
|
||||||
uint32_t crc; /**< @brief CRC of the header */
|
uint32_t crc; /**< @brief CRC of the header */
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#include <error-mem-viewer/crc.h>
|
#include <error-mem-viewer/crc.h>
|
||||||
|
|
||||||
static uint32_t do_crc(uint32_t init, uint32_t data)
|
uint32_t do_crc(uint32_t init, uint32_t data)
|
||||||
{
|
{
|
||||||
uint32_t crc = init;
|
uint32_t crc = init;
|
||||||
uint32_t cnt;
|
uint32_t cnt;
|
||||||
|
|
||||||
for (cnt=0; cnt < 32; cnt++) {
|
for(cnt=0; cnt < 32; cnt++)
|
||||||
|
{
|
||||||
crc = ((int32_t)(crc ^ data))<0 ? (crc << 1) ^ 0x04C11DB7 : crc << 1;
|
crc = ((int32_t)(crc ^ data))<0 ? (crc << 1) ^ 0x04C11DB7 : crc << 1;
|
||||||
data <<=1;
|
data <<=1;
|
||||||
}
|
}
|
||||||
@ -17,7 +18,7 @@ uint32_t calculate_stm_crc(uint32_t *data, size_t len)
|
|||||||
{
|
{
|
||||||
uint32_t crc = ~0U;
|
uint32_t crc = ~0U;
|
||||||
|
|
||||||
while (len--) {
|
while(len--) {
|
||||||
crc = do_crc(crc, *data++);
|
crc = do_crc(crc, *data++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,21 +214,16 @@ static void show_error_memory(GtkTreeView *tree_view, const unsigned char *memor
|
|||||||
valid = true;
|
valid = true;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
header.firmware_update_filename = dat;
|
|
||||||
interpret = new_string_printf("Offset of FW update filename: %u", dat);
|
|
||||||
valid = true;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
header.err_memory_offset = dat;
|
header.err_memory_offset = dat;
|
||||||
interpret = new_string_printf("Error memory offset addr: %u", dat);
|
interpret = new_string_printf("Error memory offset addr: %u", dat);
|
||||||
valid = true;
|
valid = true;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 5:
|
||||||
header.err_memory_end = dat;
|
header.err_memory_end = dat;
|
||||||
interpret = new_string_printf("Error memory end ptr: %u", dat);
|
interpret = new_string_printf("Error memory end ptr: %u", dat);
|
||||||
valid = true;
|
valid = true;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 6:
|
||||||
header.crc = dat;
|
header.crc = dat;
|
||||||
valid = check_err_mem_header(&header, &expected_value);
|
valid = check_err_mem_header(&header, &expected_value);
|
||||||
if (valid) {
|
if (valid) {
|
||||||
@ -240,7 +235,7 @@ static void show_error_memory(GtkTreeView *tree_view, const unsigned char *memor
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i <= 7) {
|
if (i <= 6) {
|
||||||
state = ENTRY_STATE_INVALID;
|
state = ENTRY_STATE_INVALID;
|
||||||
goto print;
|
goto print;
|
||||||
}
|
}
|
||||||
|
@ -422,13 +422,6 @@
|
|||||||
"print(calc_temp(2000))\n",
|
"print(calc_temp(2000))\n",
|
||||||
"print(calc_temp(2000+adc_min_res))"
|
"print(calc_temp(2000+adc_min_res))"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": []
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
@ -447,7 +440,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.9.6"
|
"version": "3.9.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
@ -1,475 +0,0 @@
|
|||||||
{
|
|
||||||
"cells": [
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "7c270395",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"import numpy as np\n",
|
|
||||||
"from scipy import signal\n",
|
|
||||||
"import matplotlib.pyplot as plt\n",
|
|
||||||
"import pandas as pd\n",
|
|
||||||
"from scipy.fft import fft, fftfreq"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "b09956cf",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"id": "348b4663",
|
|
||||||
"metadata": {},
|
|
||||||
"source": [
|
|
||||||
"## Filter comparison"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "eef8fc32",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"alpha = 0.01\n",
|
|
||||||
"mavg_b = [alpha]\n",
|
|
||||||
"mavg_a = [1, -(1-alpha)]"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "06cc8d91",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"# Sinc filter\n",
|
|
||||||
"b_sinc = [\n",
|
|
||||||
" 0.013166773445594984,\n",
|
|
||||||
" 0.015510026576574206,\n",
|
|
||||||
" 0.017943762856303655,\n",
|
|
||||||
" 0.020436419999452039,\n",
|
|
||||||
" 0.022953654956480787,\n",
|
|
||||||
" 0.025459023223972144,\n",
|
|
||||||
" 0.027914730737546672,\n",
|
|
||||||
" 0.030282439536854874,\n",
|
|
||||||
" 0.032524106530629059,\n",
|
|
||||||
" 0.034602833419516990,\n",
|
|
||||||
" 0.036483705201686277,\n",
|
|
||||||
" 0.038134594717421900,\n",
|
|
||||||
" 0.039526911389630152,\n",
|
|
||||||
" 0.040636273671486346,\n",
|
|
||||||
" 0.041443086683647982,\n",
|
|
||||||
" 0.041933009054862178,\n",
|
|
||||||
" 0.042097295996679322,\n",
|
|
||||||
" 0.041933009054862178,\n",
|
|
||||||
" 0.041443086683647982,\n",
|
|
||||||
" 0.040636273671486346,\n",
|
|
||||||
" 0.039526911389630152,\n",
|
|
||||||
" 0.038134594717421900,\n",
|
|
||||||
" 0.036483705201686277,\n",
|
|
||||||
" 0.034602833419516990,\n",
|
|
||||||
" 0.032524106530629059,\n",
|
|
||||||
" 0.030282439536854874,\n",
|
|
||||||
" 0.027914730737546672,\n",
|
|
||||||
" 0.025459023223972144,\n",
|
|
||||||
" 0.022953654956480787,\n",
|
|
||||||
" 0.020436419999452039,\n",
|
|
||||||
" 0.017943762856303655,\n",
|
|
||||||
" 0.015510026576574206,\n",
|
|
||||||
" 0.013166773445594984,\n",
|
|
||||||
"]\n",
|
|
||||||
"b_sinc = [\n",
|
|
||||||
" -0.000005301919181359,\n",
|
|
||||||
" -0.000020372384569462,\n",
|
|
||||||
" -0.000043393375246200,\n",
|
|
||||||
" -0.000071643508460196,\n",
|
|
||||||
" -0.000101272447699964,\n",
|
|
||||||
" -0.000127045709202358,\n",
|
|
||||||
" -0.000142084479366378,\n",
|
|
||||||
" -0.000137630058679112,\n",
|
|
||||||
" -0.000102865422361326,\n",
|
|
||||||
" -0.000024826753571648,\n",
|
|
||||||
" 0.000111564545505229,\n",
|
|
||||||
" 0.000323323938002668,\n",
|
|
||||||
" 0.000629062120588115,\n",
|
|
||||||
" 0.001048471626315150,\n",
|
|
||||||
" 0.001601644955843253,\n",
|
|
||||||
" 0.002308239744151386,\n",
|
|
||||||
" 0.003186518744650963,\n",
|
|
||||||
" 0.004252303894058680,\n",
|
|
||||||
" 0.005517893567100900,\n",
|
|
||||||
" 0.006990999568786174,\n",
|
|
||||||
" 0.008673764799041549,\n",
|
|
||||||
" 0.010561923390649710,\n",
|
|
||||||
" 0.012644162210467481,\n",
|
|
||||||
" 0.014901735907231652,\n",
|
|
||||||
" 0.017308377414832196,\n",
|
|
||||||
" 0.019830532444994709,\n",
|
|
||||||
" 0.022427930710902887,\n",
|
|
||||||
" 0.025054489273884574,\n",
|
|
||||||
" 0.027659525485854094,\n",
|
|
||||||
" 0.030189239563895277,\n",
|
|
||||||
" 0.032588410933658420,\n",
|
|
||||||
" 0.034802239101869442,\n",
|
|
||||||
" 0.036778249821351520,\n",
|
|
||||||
" 0.038468181363671021,\n",
|
|
||||||
" 0.039829764251821352,\n",
|
|
||||||
" 0.040828311002284692,\n",
|
|
||||||
" 0.041438040179150003,\n",
|
|
||||||
" 0.041643070995549647,\n",
|
|
||||||
" 0.041438040179150003,\n",
|
|
||||||
" 0.040828311002284692,\n",
|
|
||||||
" 0.039829764251821366,\n",
|
|
||||||
" 0.038468181363671021,\n",
|
|
||||||
" 0.036778249821351520,\n",
|
|
||||||
" 0.034802239101869456,\n",
|
|
||||||
" 0.032588410933658420,\n",
|
|
||||||
" 0.030189239563895291,\n",
|
|
||||||
" 0.027659525485854094,\n",
|
|
||||||
" 0.025054489273884584,\n",
|
|
||||||
" 0.022427930710902898,\n",
|
|
||||||
" 0.019830532444994709,\n",
|
|
||||||
" 0.017308377414832207,\n",
|
|
||||||
" 0.014901735907231647,\n",
|
|
||||||
" 0.012644162210467488,\n",
|
|
||||||
" 0.010561923390649715,\n",
|
|
||||||
" 0.008673764799041547,\n",
|
|
||||||
" 0.006990999568786178,\n",
|
|
||||||
" 0.005517893567100902,\n",
|
|
||||||
" 0.004252303894058680,\n",
|
|
||||||
" 0.003186518744650965,\n",
|
|
||||||
" 0.002308239744151388,\n",
|
|
||||||
" 0.001601644955843254,\n",
|
|
||||||
" 0.001048471626315152,\n",
|
|
||||||
" 0.000629062120588114,\n",
|
|
||||||
" 0.000323323938002668,\n",
|
|
||||||
" 0.000111564545505229,\n",
|
|
||||||
" -0.000024826753571648,\n",
|
|
||||||
" -0.000102865422361327,\n",
|
|
||||||
" -0.000137630058679112,\n",
|
|
||||||
" -0.000142084479366378,\n",
|
|
||||||
" -0.000127045709202359,\n",
|
|
||||||
" -0.000101272447699963,\n",
|
|
||||||
" -0.000071643508460196,\n",
|
|
||||||
" -0.000043393375246200,\n",
|
|
||||||
" -0.000020372384569461,\n",
|
|
||||||
" -0.000005301919181359,\n",
|
|
||||||
"]\n",
|
|
||||||
"b_sinc = np.around([k * 56536 for k in b_sinc])/65536\n",
|
|
||||||
"\n",
|
|
||||||
"\n",
|
|
||||||
"def combined_sinc_mavg(alpha = 0.4):\n",
|
|
||||||
" b1 = [alpha]\n",
|
|
||||||
" b2 = b_sinc\n",
|
|
||||||
" a1 = [1, -(1-alpha)]\n",
|
|
||||||
" a2 = [1]\n",
|
|
||||||
" \n",
|
|
||||||
" b = np.convolve(b1, b2)\n",
|
|
||||||
" a = np.convolve(a1, a2)\n",
|
|
||||||
" return b,a\n",
|
|
||||||
"\n",
|
|
||||||
"def iir_notch(freq, r, fsa):\n",
|
|
||||||
" b = [1, -2*np.cos(freq/fsa*2*np.pi), 1]\n",
|
|
||||||
" a = [1, -2*r*np.cos(freq/fsa*2*np.pi), r*r]\n",
|
|
||||||
" return b,a"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "299fc59e",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "0af3fa7b",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"def plot_transfer_func(b, a, fsa = 1):\n",
|
|
||||||
" omega, vals = signal.freqz(b, a, worN = 1024)\n",
|
|
||||||
" plt.plot(omega/(2*np.pi)*fsa, abs(vals))\n",
|
|
||||||
" \n",
|
|
||||||
"sample_rate = 1e3/6\n",
|
|
||||||
"plt.figure(figsize=(16,8))\n",
|
|
||||||
"plt.yscale('log')\n",
|
|
||||||
"plot_transfer_func(mavg_b, mavg_a, sample_rate)\n",
|
|
||||||
"plt.ylabel('|H(w)| [dB]')\n",
|
|
||||||
"plt.xlabel('Frequency [Hz]')\n",
|
|
||||||
"\n",
|
|
||||||
"plot_transfer_func(b_sinc, [1], sample_rate)\n",
|
|
||||||
"\n",
|
|
||||||
"# Combined filter\n",
|
|
||||||
"b,a = combined_sinc_mavg(alpha = 1)\n",
|
|
||||||
"b_notch, a_notch = iir_notch(50, 0.875, sample_rate)\n",
|
|
||||||
"b = np.convolve(b, b_notch)\n",
|
|
||||||
"a = np.convolve(a, a_notch)\n",
|
|
||||||
"plot_transfer_func(b,a, sample_rate)\n",
|
|
||||||
"plt.grid()\n",
|
|
||||||
"\n",
|
|
||||||
"plt.legend(['MAVG a = 0.01', 'SINC', 'SINC+MAVG'])\n",
|
|
||||||
"plt.xlim(0, 70)\n",
|
|
||||||
"plt.show()"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"id": "c9b87b82",
|
|
||||||
"metadata": {},
|
|
||||||
"source": [
|
|
||||||
"# Notch filters (Not used for implementation)"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "c360b127",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"plt.figure(figsize=(16,8))\n",
|
|
||||||
"plt.yscale('log')\n",
|
|
||||||
"a = [1]\n",
|
|
||||||
"b = [1, -2*np.cos(50/sample_rate*2*np.pi), 1]\n",
|
|
||||||
"plot_transfer_func(b,a, sample_rate)\n",
|
|
||||||
"\n",
|
|
||||||
"b = [1, -2*np.cos(60/sample_rate*2*np.pi), 1]\n",
|
|
||||||
"plot_transfer_func(b,a, sample_rate)\n",
|
|
||||||
"\n",
|
|
||||||
"r = 0.875\n",
|
|
||||||
"b,a = iir_notch(50, r, sample_rate)\n",
|
|
||||||
"plot_transfer_func(b,a, sample_rate)\n",
|
|
||||||
"\n",
|
|
||||||
"b,a = iir_notch(60, r, sample_rate)\n",
|
|
||||||
"plot_transfer_func(b,a, sample_rate)\n",
|
|
||||||
"plt.xlim(40,70)\n",
|
|
||||||
"plt.legend(['FIR 50 Hz Notch', 'FIR 60 Hz', 'IIR 50Hz', 'IIR 60Hz'])\n",
|
|
||||||
"plt.show()"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"id": "891bf909",
|
|
||||||
"metadata": {},
|
|
||||||
"source": [
|
|
||||||
"# Singal testing"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "29277520",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"N = 30000\n",
|
|
||||||
"time = np.linspace(0, 1/sample_rate*N, N, endpoint=False)\n",
|
|
||||||
"sig = 10*signal.sawtooth(2*np.pi*0.2*time)+10 #+ 0.5 * np.sin(2*np.pi*50*time)+0.8 * np.sin(2*np.pi*80*time)\n",
|
|
||||||
"\n",
|
|
||||||
"plt.figure(figsize=(16,8))\n",
|
|
||||||
"\n",
|
|
||||||
"spur_len = 3\n",
|
|
||||||
"\n",
|
|
||||||
"sig[1000:1000+spur_len] = sig[1000]+5\n",
|
|
||||||
"sig[2000:2000+spur_len] = sig[2000]-6\n",
|
|
||||||
"sig[3000:3000+spur_len] = sig[3000]+2\n",
|
|
||||||
"sig[4000:4000+spur_len] = sig[4000]+8\n",
|
|
||||||
"\n",
|
|
||||||
"\n",
|
|
||||||
"plt.plot(time, sig)\n",
|
|
||||||
"\n",
|
|
||||||
"\n",
|
|
||||||
"# Apply the combined filter:\n",
|
|
||||||
"b,a = combined_sinc_mavg(alpha = 1)\n",
|
|
||||||
"\n",
|
|
||||||
"bn,an = iir_notch(50, 0.875, sample_rate)\n",
|
|
||||||
"a = np.convolve(a, an)\n",
|
|
||||||
"b = np.convolve(b, bn)\n",
|
|
||||||
"\n",
|
|
||||||
"#b,a = mavg_b, mavg_a\n",
|
|
||||||
"\n",
|
|
||||||
"w,h = signal.freqz(b,a)\n",
|
|
||||||
"gain_corr = round(1/abs(h[0])*65536)/65536\n",
|
|
||||||
"\n",
|
|
||||||
"sig_f = signal.lfilter(b, a, sig) * gain_corr\n",
|
|
||||||
"\n",
|
|
||||||
"\n",
|
|
||||||
"print('Gain correction:', gain_corr)\n",
|
|
||||||
"\n",
|
|
||||||
"plt.plot(time, sig_f)\n",
|
|
||||||
"plt.xlim(5,10)\n",
|
|
||||||
"plt.show()\n",
|
|
||||||
"\n",
|
|
||||||
"plt.figure(figsize=(16,8))\n",
|
|
||||||
"plt.plot(time, abs(sig-sig_f))\n",
|
|
||||||
"plt.xlim(5,10)\n",
|
|
||||||
"plt.ylim(0,2)\n",
|
|
||||||
"plt.show()"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "13758640",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"\n",
|
|
||||||
"window = signal.windows.hamming(N)\n",
|
|
||||||
"\n",
|
|
||||||
"h_sig = fft(sig*window)\n",
|
|
||||||
"f_sig = fftfreq(N, 1/sample_rate)[:N//2]\n",
|
|
||||||
"\n",
|
|
||||||
"h_sig_f = fft(sig_f*window)\n",
|
|
||||||
"f_sig_f = fftfreq(N, 1/sample_rate)[:N//2]\n",
|
|
||||||
"\n",
|
|
||||||
"plt.figure(figsize=(16,10))\n",
|
|
||||||
"plt.yscale('log')\n",
|
|
||||||
"plt.plot(f_sig, 2.0/N*abs(h_sig[0:N//2]))\n",
|
|
||||||
"plt.plot(f_sig_f, 2.0/N*abs(h_sig_f[0:N//2]))\n",
|
|
||||||
"plt.show();"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"id": "f4b81600",
|
|
||||||
"metadata": {},
|
|
||||||
"source": [
|
|
||||||
"# PT1000 HF Filtering"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "a87370ee",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"raw_data = pd.read_csv(r'pt1000_hf_2kOhm_v1.3.dat')\n",
|
|
||||||
"raw_data = pd.read_csv(r'pt1000_hf_changing.dat')\n",
|
|
||||||
"time = np.linspace(0, 2000*6e-3, 2000, endpoint=False)\n",
|
|
||||||
"\n",
|
|
||||||
"plt.figure(figsize=(22,12))\n",
|
|
||||||
"plt.plot(time, raw_data['hf_value']*2500/4096)\n",
|
|
||||||
"\n",
|
|
||||||
"alpha = 0.005\n",
|
|
||||||
"\n",
|
|
||||||
"mavg_b = [alpha]\n",
|
|
||||||
"mavg_a = [1, -(1-alpha)]\n",
|
|
||||||
"\n",
|
|
||||||
"zi = signal.lfilter_zi(mavg_b, mavg_a)\n",
|
|
||||||
"filtered, _ = signal.lfilter(mavg_b, mavg_a, raw_data['hf_value'], zi=zi*raw_data['hf_value'][0])\n",
|
|
||||||
"plt.plot(time, filtered*2500/4096)\n",
|
|
||||||
"filtered_avg_low = filtered\n",
|
|
||||||
"\n",
|
|
||||||
"alpha = 0.01\n",
|
|
||||||
"mavg_b = [alpha]\n",
|
|
||||||
"mavg_a = [1, -(1-alpha)]\n",
|
|
||||||
"\n",
|
|
||||||
"zi = signal.lfilter_zi(mavg_b, mavg_a)\n",
|
|
||||||
"filtered, _ = signal.lfilter(mavg_b, mavg_a, raw_data['hf_value'], zi=zi*raw_data['hf_value'][0])\n",
|
|
||||||
"plt.plot(time, filtered*2500/4096)\n",
|
|
||||||
"filtered_avg = filtered\n",
|
|
||||||
"\n",
|
|
||||||
"\n",
|
|
||||||
"\n",
|
|
||||||
"# Apply the combined filter:\n",
|
|
||||||
"b,a = combined_sinc_mavg(alpha = 0.08)\n",
|
|
||||||
"\n",
|
|
||||||
"bn,an = iir_notch(4, 0.75, sample_rate)\n",
|
|
||||||
"a = np.convolve(a, an)\n",
|
|
||||||
"b = np.convolve(b, bn)\n",
|
|
||||||
"\n",
|
|
||||||
"zi = signal.lfilter_zi(b, a)\n",
|
|
||||||
"filtered, _ = signal.lfilter(b, a, raw_data['hf_value'], zi=zi*raw_data['hf_value'][0])\n",
|
|
||||||
"\n",
|
|
||||||
"w,h = signal.freqz(b,a)\n",
|
|
||||||
"gain_corr = round(1/abs(h[0])*65536)/65536\n",
|
|
||||||
"\n",
|
|
||||||
"plt.plot(time, filtered*gain_corr*2500/4096)\n",
|
|
||||||
"plt.savefig('expl.pdf', format='pdf', dpi=1200)\n",
|
|
||||||
"plt.show()\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"id": "3eae0e71",
|
|
||||||
"metadata": {},
|
|
||||||
"source": [
|
|
||||||
"## Spectrum"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "8d082b99",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"window =signal.windows.hamming(len(raw_data['hf_value']))\n",
|
|
||||||
"raw_fft = fft(np.array(raw_data['hf_value'].to_list())*window)\n",
|
|
||||||
"f_raw = fftfreq(len(raw_data), 1/sample_rate)[:len(raw_data)//2]\n",
|
|
||||||
"plt.figure(figsize=(16,10));\n",
|
|
||||||
"plt.yscale('log')\n",
|
|
||||||
"plt.plot(f_raw, abs(raw_fft[:len(raw_data)//2]))\n",
|
|
||||||
"\n",
|
|
||||||
"avg_fft = fft(np.array(filtered_avg)*window)\n",
|
|
||||||
"plt.plot(f_raw, abs(avg_fft[:len(raw_data)//2]))\n",
|
|
||||||
"\n",
|
|
||||||
"avg_fft = fft(np.array(filtered_avg_low)*window)\n",
|
|
||||||
"plt.plot(f_raw, abs(avg_fft[:len(raw_data)//2]))\n",
|
|
||||||
"\n",
|
|
||||||
"sinc_fft = fft(np.array(filtered)*window)\n",
|
|
||||||
"plt.plot(f_raw, abs(sinc_fft[:len(raw_data)//2]))\n",
|
|
||||||
"plt.xscale('log')\n",
|
|
||||||
"plt.show()"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "e09d63f9",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"print(np.std(filtered_avg_low/4096*2500))\n",
|
|
||||||
"print(np.std(filtered_avg/4096*2500))\n",
|
|
||||||
"print(np.std(filtered/4096*2500))\n",
|
|
||||||
"\n",
|
|
||||||
"print('Min',min(filtered_avg/4096*2500), 'Max', max(filtered_avg)/4096*2500)\n",
|
|
||||||
"print('Min',min(filtered)/4096*2500*gain_corr, 'Max', max(filtered)/4096*2500*gain_corr)"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"metadata": {
|
|
||||||
"kernelspec": {
|
|
||||||
"display_name": "Python 3",
|
|
||||||
"language": "python",
|
|
||||||
"name": "python3"
|
|
||||||
},
|
|
||||||
"language_info": {
|
|
||||||
"codemirror_mode": {
|
|
||||||
"name": "ipython",
|
|
||||||
"version": 3
|
|
||||||
},
|
|
||||||
"file_extension": ".py",
|
|
||||||
"mimetype": "text/x-python",
|
|
||||||
"name": "python",
|
|
||||||
"nbconvert_exporter": "python",
|
|
||||||
"pygments_lexer": "ipython3",
|
|
||||||
"version": "3.9.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nbformat": 4,
|
|
||||||
"nbformat_minor": 5
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
8
stm-firmware/.gitignore
vendored
8
stm-firmware/.gitignore
vendored
@ -15,11 +15,3 @@ reflow-controller.includes
|
|||||||
*.config
|
*.config
|
||||||
*.files
|
*.files
|
||||||
*.user.*
|
*.user.*
|
||||||
*.user
|
|
||||||
|
|
||||||
# VSCODE and CLANGD sepcific excludes
|
|
||||||
|
|
||||||
.vscode/
|
|
||||||
build/
|
|
||||||
.cache/
|
|
||||||
compile_commands.json
|
|
||||||
|
@ -1,145 +0,0 @@
|
|||||||
set(CMAKE_SYSTEM_NAME Generic)
|
|
||||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
|
||||||
set(CMAKE_CROSSCOMPILING 1)
|
|
||||||
cmake_minimum_required(VERSION 3.18)
|
|
||||||
|
|
||||||
set(CMAKE_TOOLCHAIN_FILE "arm-none-eabi-gcc.cmake")
|
|
||||||
|
|
||||||
project(reflow-controller)
|
|
||||||
|
|
||||||
if(NOT WIN32)
|
|
||||||
string(ASCII 27 Esc)
|
|
||||||
set(ColorReset "${Esc}[m")
|
|
||||||
set(ColorBold "${Esc}[1m")
|
|
||||||
set(Red "${Esc}[31m")
|
|
||||||
set(Green "${Esc}[32m")
|
|
||||||
set(Yellow "${Esc}[33m")
|
|
||||||
set(Blue "${Esc}[34m")
|
|
||||||
set(Magenta "${Esc}[35m")
|
|
||||||
set(Cyan "${Esc}[36m")
|
|
||||||
set(White "${Esc}[37m")
|
|
||||||
set(BoldRed "${Esc}[1;31m")
|
|
||||||
set(BoldGreen "${Esc}[1;32m")
|
|
||||||
set(BoldYellow "${Esc}[1;33m")
|
|
||||||
set(BoldBlue "${Esc}[1;34m")
|
|
||||||
set(BoldMagenta "${Esc}[1;35m")
|
|
||||||
set(BoldCyan "${Esc}[1;36m")
|
|
||||||
set(BoldWhite "${Esc}[1;37m")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(Git)
|
|
||||||
if (GIT_FOUND)
|
|
||||||
message("Git found")
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${GIT_EXECUTABLE} describe --always --tags --dirty
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
OUTPUT_VARIABLE GIT_DESCRIBE
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
)
|
|
||||||
message("${BoldGreen}Git based version number: ${GIT_DESCRIBE}${ColorReset}")
|
|
||||||
else (GIT_FOUND)
|
|
||||||
message("${BoldRed}No git installation found. It is highly recommended using git to generate the version number")
|
|
||||||
message(FATAL_ERROR "Git is required")
|
|
||||||
endif (GIT_FOUND)
|
|
||||||
|
|
||||||
find_program(PATCHELFCRC patchelfcrc)
|
|
||||||
if (PATCHELFCRC)
|
|
||||||
message("patchelfcrc found: ${PATCHELFCRC}")
|
|
||||||
else(PATCHELFCRC)
|
|
||||||
message(FATAL_ERROR "${BoldRed}Patchelfcrc not found. Cannot patch CRC checksum into ELF file: patchelfcrc: command not found! See: https://git.shimatta.de/mhu/patchelfcrc${ColorReset}")
|
|
||||||
endif (PATCHELFCRC)
|
|
||||||
|
|
||||||
|
|
||||||
set(ELFFILE ${PROJECT_NAME}.elf)
|
|
||||||
set(HEXFILE ${PROJECT_NAME}.hex)
|
|
||||||
set(MAPFILE ${PROJECT_NAME}.map)
|
|
||||||
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/stm32f407vet6_flash.ld)
|
|
||||||
|
|
||||||
add_compile_options(-Wall -Wextra -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized -Wunused-parameter)
|
|
||||||
add_compile_options(-mlittle-endian -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles -Wimplicit-fallthrough=3 -Wsign-compare)
|
|
||||||
|
|
||||||
|
|
||||||
add_definitions(-DBASE64_LOOKUP_TABLE_SECTION=\".ccm.bss\" -DSHELLMATTA_HELP_ALIAS=\"?\" -DHSE_VALUE=8000000UL -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4)
|
|
||||||
|
|
||||||
add_subdirectory(doxygen)
|
|
||||||
add_subdirectory(updater/ram-code)
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
|
|
||||||
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
add_definitions(-DDEBUGBUILD)
|
|
||||||
add_compile_options(-O0 -g)
|
|
||||||
add_link_options(-Wl,-Map=${MAPFILE})
|
|
||||||
ELSE()
|
|
||||||
add_compile_options(-O3 -g)
|
|
||||||
add_link_options(-Wl,--gc-sections)
|
|
||||||
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
|
|
||||||
|
|
||||||
if (UART_ON_DEBUG_HEADER)
|
|
||||||
add_definitions(-DUART_ON_DEBUG_HEADER)
|
|
||||||
message("${BoldRed}UART forced to debug header${ColorReset}")
|
|
||||||
endif (UART_ON_DEBUG_HEADER)
|
|
||||||
|
|
||||||
add_subdirectory(base64-lib)
|
|
||||||
add_subdirectory(linklist-lib)
|
|
||||||
|
|
||||||
aux_source_directory("." MAIN_SOURCES)
|
|
||||||
aux_source_directory("config-parser" CFG_PARSER_SRCS)
|
|
||||||
aux_source_directory("ui" UI_SRCS)
|
|
||||||
aux_source_directory("fatfs" FAT_SRCS)
|
|
||||||
aux_source_directory("fatfs/shimatta_sdio_driver" SDIO_SRCS)
|
|
||||||
aux_source_directory("boot" BOOT_SRCS)
|
|
||||||
aux_source_directory("setup" SETUP_SRCS)
|
|
||||||
aux_source_directory("stm-periph" STM_PERIPH_SRCS)
|
|
||||||
aux_source_directory("settings" SETTINGS_SRCS)
|
|
||||||
aux_source_directory("safety" SAFETY_SRCS)
|
|
||||||
aux_source_directory("shellmatta/src" SHELLMATTA_SRCS)
|
|
||||||
aux_source_directory("updater" UPDATER_SRCS)
|
|
||||||
aux_source_directory("temp-profile" PROFILE_SRCS)
|
|
||||||
|
|
||||||
set(GEN_VERSION_HEADER_PATH "${CMAKE_CURRENT_BINARY_DIR}/include/generated-version")
|
|
||||||
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
generate-version-header
|
|
||||||
COMMAND mkdir -p ${GEN_VERSION_HEADER_PATH} && bash "${CMAKE_CURRENT_SOURCE_DIR}/create_version_header.sh" "${GEN_VERSION_HEADER_PATH}/version.h"
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
COMMENT "Generating version number using git"
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(${ELFFILE} ${MAIN_SOURCES} ${CFG_PARSER_SRCS} ${UI_SRCS}
|
|
||||||
${FAT_SRCS} ${SDIO_SRCS} ${BOOT_SRCS} ${SETUP_SRCS}
|
|
||||||
${STM_PERIPH_SRCS} ${SETTINGS_SRCS} ${SAFETY_SRCS}
|
|
||||||
${SHELLMATTA_SRCS} ${UPDATER_SRCS} ${PROFILE_SRCS}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_dependencies(${ELFFILE} updater-ram-code-header-blob generate-version-header)
|
|
||||||
|
|
||||||
|
|
||||||
target_include_directories(${ELFFILE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/shellmatta/api ${CMAKE_CURRENT_SOURCE_DIR}/config-parser/include)
|
|
||||||
target_link_options(${ELFFILE} PRIVATE -mlittle-endian -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 --disable-newlib-supplied-syscalls -nostartfiles -T${LINKER_SCRIPT} -Wl,--print-memory-usage)
|
|
||||||
target_link_libraries(${ELFFILE} base64-lib linklist-lib)
|
|
||||||
target_include_directories(${ELFFILE} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/updater/ram-code/include/" "${CMAKE_CURRENT_BINARY_DIR}/include/")
|
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
TARGET ${ELFFILE}
|
|
||||||
POST_BUILD
|
|
||||||
COMMAND ${PATCHELFCRC} --little-endian --verbose --granularity word --start-magic 0xa8be53f9 --end-magic 0xffa582ff -O .flashcrc -p crc-32-mpeg -S .text -S .data -S .ccmdata -S .vectors "${CMAKE_CURRENT_BINARY_DIR}/${ELFFILE}"
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
COMMENT "Running Flash CRC Patcher"
|
|
||||||
)
|
|
||||||
|
|
||||||
set(HEX_PATH "${CMAKE_CURRENT_BINARY_DIR}/${HEXFILE}")
|
|
||||||
add_custom_target(update-image ALL DEPENDS ${HEX_PATH} "${HEX_PATH}.sha")
|
|
||||||
add_custom_command(
|
|
||||||
DEPENDS ${ELFFILE}
|
|
||||||
OUTPUT ${HEX_PATH}
|
|
||||||
COMMAND ${CMAKE_OBJCOPY} -O ihex ${ELFFILE} ${HEX_PATH}
|
|
||||||
)
|
|
||||||
add_custom_command(
|
|
||||||
DEPENDS ${HEX_PATH}
|
|
||||||
OUTPUT "${HEX_PATH}.sha"
|
|
||||||
COMMAND sha256sum "${HEX_PATH}" | cut -d " " -f 1 > "${HEX_PATH}.sha"
|
|
||||||
)
|
|
224
stm-firmware/Makefile
Normal file
224
stm-firmware/Makefile
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
################################Shimatta Makefile####################################
|
||||||
|
#CPU: STM32F407VET6
|
||||||
|
#Compiler: arm-none-eabi
|
||||||
|
#####################################################################################
|
||||||
|
#Add Files and Folders below#########################################################
|
||||||
|
CFILES = main.c syscalls.c setup/system_stm32f4xx.c systick.c boot/startup_stm32f407vx.c
|
||||||
|
ASFILES =
|
||||||
|
INCLUDEPATH = -Iinclude
|
||||||
|
|
||||||
|
OBJDIR_BASE = obj
|
||||||
|
TARGET_BASE = reflow-controller
|
||||||
|
LIBRARYPATH = -L.
|
||||||
|
LIBRARIES =
|
||||||
|
|
||||||
|
DEFINES = -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4 -DHSE_VALUE=8000000UL
|
||||||
|
MAPFILE_BASE = memory-mapping
|
||||||
|
LINKER_SCRIPT=stm32f407vet6_flash.ld
|
||||||
|
|
||||||
|
export GIT_VER = $(shell git describe --always --dirty --tags)
|
||||||
|
DEFINES += -DGIT_VER=$(GIT_VER)
|
||||||
|
|
||||||
|
ifneq ($(VERBOSE),true)
|
||||||
|
QUIET=@
|
||||||
|
else
|
||||||
|
QUIET=
|
||||||
|
endif
|
||||||
|
|
||||||
|
##Custom Files###
|
||||||
|
CFILES += adc-meas.c
|
||||||
|
|
||||||
|
# Shellmatta
|
||||||
|
CFILES += shellmatta/src/shellmatta.c shellmatta/src/shellmatta_autocomplete.c shellmatta/src/shellmatta_escape.c shellmatta/src/shellmatta_history.c shellmatta/src/shellmatta_utils.c shellmatta/src/shellmatta_opt.c shell.c
|
||||||
|
INCLUDEPATH += -Ishellmatta/api
|
||||||
|
DEFINES += -DSHELLMATTA_HELP_ALIAS=\"?\"
|
||||||
|
|
||||||
|
# RCC Manager
|
||||||
|
CFILES += stm-periph/rcc-manager.c
|
||||||
|
CFILES += stm-periph/uart.c stm-periph/dma-ring-buffer.c stm-periph/backup-ram.c
|
||||||
|
CFILES += stm-periph/rng.c stm-periph/spi.c
|
||||||
|
CFILES += digio.c
|
||||||
|
CFILES += stm-periph/unique-id.c
|
||||||
|
CFILES += calibration.c
|
||||||
|
CFILES += temp-converter.c
|
||||||
|
CFILES += rotary-encoder.c button.c
|
||||||
|
CFILES += ui/lcd.c ui/menu.c ui/gui.c
|
||||||
|
CFILES += fatfs/diskio.c fatfs/ff.c fatfs/ffsystem.c fatfs/ffunicode.c fatfs/shimatta_sdio_driver/shimatta_sdio.c
|
||||||
|
CFILES += pid-controller.c oven-driver.c
|
||||||
|
CFILES += settings/settings.c settings/settings-sd-card.c settings/spi-eeprom.c settings/settings-eeprom.c
|
||||||
|
CFILES += stm-periph/crc-unit.c
|
||||||
|
CFILES += safety/safety-adc.c safety/safety-controller.c safety/watchdog.c safety/fault.c safety/safety-memory.c safety/stack-check.c
|
||||||
|
CFILES += hw-version-detect.c
|
||||||
|
CFILES += config-parser/config-parser.c
|
||||||
|
CFILES += updater/updater.c
|
||||||
|
INCLUDEPATH += -Iconfig-parser/include
|
||||||
|
|
||||||
|
CFILES += base64-lib/src/base64-lib.c
|
||||||
|
INCLUDEPATH += -Ibase64-lib/include
|
||||||
|
DEFINES += -DBASE64_LOOKUP_TABLE_SECTION="\".ccm.bss\""
|
||||||
|
|
||||||
|
|
||||||
|
DEBUG_DEFINES = -DDEBUGBUILD
|
||||||
|
RELEASE_DEFINES = -DUART_ON_DEBUG_HEADER
|
||||||
|
|
||||||
|
###################################################################################
|
||||||
|
ifeq ($(CROSS_COMPILE),)
|
||||||
|
CROSS_COMPILE=arm-none-eabi-
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC=$(CROSS_COMPILE)gcc
|
||||||
|
OBJCOPY=$(CROSS_COMPILE)objcopy
|
||||||
|
OBJDUMP=$(CROSS_COMPILE)objdump
|
||||||
|
SIZE=$(CROSS_COMPILE)size
|
||||||
|
|
||||||
|
CFLAGS_RELEASE = -O3 -g
|
||||||
|
CFLAGS_DEBUG = -O0 -g
|
||||||
|
|
||||||
|
LFLAGS_RELEASE = -Wl,--gc-sections
|
||||||
|
LFLAGS_DEBUG =
|
||||||
|
|
||||||
|
CFLAGS =
|
||||||
|
LFLAGS =
|
||||||
|
|
||||||
|
ifneq ($(DEBUGBUILD),true)
|
||||||
|
DEFINES += $(RELEASE_DEFINES)
|
||||||
|
CFLAGS += $(CFLAGS_RELEASE)
|
||||||
|
LFLAGS += $(LFLAGS_RELEASE)
|
||||||
|
target = $(TARGET_BASE)-release
|
||||||
|
OBJDIR = $(OBJDIR_BASE)/release
|
||||||
|
MAPFILE = $(MAPFILE_BASE)-release
|
||||||
|
else
|
||||||
|
DEFINES += $(DEBUG_DEFINES)
|
||||||
|
target = $(TARGET_BASE)-debug
|
||||||
|
CFLAGS += $(CFLAGS_DEBUG)
|
||||||
|
LFLAGS += $(LFLAGS_DEBUG)
|
||||||
|
OBJDIR = $(OBJDIR_BASE)/debug
|
||||||
|
MAPFILE = $(MAPFILE_BASE)-debug
|
||||||
|
endif
|
||||||
|
|
||||||
|
LFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
|
||||||
|
LFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 --disable-newlib-supplied-syscalls -nostartfiles
|
||||||
|
LFLAGS += -T$(LINKER_SCRIPT) -Wl,-Map=$(MAPFILE).map -Wl,--print-memory-usage
|
||||||
|
|
||||||
|
CFLAGS += -c -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
|
||||||
|
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles
|
||||||
|
CFLAGS += -Wall -Wextra -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized -Wunused-parameter -Wimplicit-fallthrough=3 -Wsign-compare
|
||||||
|
|
||||||
|
####################################################################################
|
||||||
|
|
||||||
|
OBJ = $(CFILES:%.c=$(OBJDIR)/%.c.o)
|
||||||
|
ASOBJ += $(ASFILES:%.S=$(OBJDIR)/%.S.o)
|
||||||
|
|
||||||
|
default: $(target).elf
|
||||||
|
|
||||||
|
all: debug release
|
||||||
|
|
||||||
|
release:
|
||||||
|
$(QUIET)$(MAKE) DEBUGBUILD=false
|
||||||
|
|
||||||
|
debug:
|
||||||
|
$(QUIET)$(MAKE) DEBUGBUILD=true
|
||||||
|
|
||||||
|
%.bin: %.elf
|
||||||
|
$(QUIET)$(OBJCOPY) -O binary $^ $@
|
||||||
|
%.hex: %.elf
|
||||||
|
$(QUIET)$(OBJCOPY) -O ihex $^ $@
|
||||||
|
|
||||||
|
|
||||||
|
#Linking
|
||||||
|
$(target).elf: $(OBJ) $(ASOBJ) $(LINKER_SCRIPT)
|
||||||
|
@echo [LD] $@
|
||||||
|
$(QUIET)$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $(OBJ) $(ASOBJ) $(LIBRARIES)
|
||||||
|
$(QUIET)$(SIZE) $@
|
||||||
|
@echo "Built Version $(GIT_VER)"
|
||||||
|
|
||||||
|
$(OBJDIR)/updater/updater.c.o: updater/ram-code/updater-ram-code.bin.h
|
||||||
|
|
||||||
|
#Compiling
|
||||||
|
$(OBJ):
|
||||||
|
@echo [CC] $@
|
||||||
|
$(eval OUTPATH=$(dir $@))
|
||||||
|
@mkdir -p $(OUTPATH)
|
||||||
|
$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.c.o=%.c)
|
||||||
|
$(ASOBJ):
|
||||||
|
@echo [AS] $@
|
||||||
|
$(eval OUTPATH=$(dir $@))
|
||||||
|
@mkdir -p $(OUTPATH)
|
||||||
|
$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.S.o=%.S)
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: qtproject-legacy qtproject qtproject-debug clean mrproper objcopy disassemble program program-debug updater/ram-code/updater-ram-code.bin.h
|
||||||
|
|
||||||
|
updater/ram-code/updater-ram-code.bin.h:
|
||||||
|
$(QUIET)$(MAKE) -C updater/ram-code updater-ram-code.bin.h
|
||||||
|
|
||||||
|
program-debug:
|
||||||
|
$(QUIET)$(MAKE) DEBUGBUILD=true program
|
||||||
|
|
||||||
|
program: $(target).elf
|
||||||
|
./program-device.sh $<
|
||||||
|
|
||||||
|
disassemble: $(target).elf
|
||||||
|
$(QUIET)$(OBJDUMP) -D -s $< > $(target).lss
|
||||||
|
|
||||||
|
objcopy: $(target).bin $(target).hex
|
||||||
|
|
||||||
|
mrproper: clean
|
||||||
|
ifneq ($(DEBUGBUILD),true)
|
||||||
|
@echo "Purging RELEASE project files"
|
||||||
|
else
|
||||||
|
@echo "Purging DEBUG project files"
|
||||||
|
endif
|
||||||
|
$(QUIET)rm -f $(target).pro $(target).creator $(target).files $(target).cflags $(target).cxxflags $(target).includes $(target).config
|
||||||
|
ifneq ($(DEBUGBUILD),true)
|
||||||
|
$(QUIET)$(MAKE) DEBUGBUILD=true mrproper
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo -n "Cleaning up derived files for "
|
||||||
|
ifneq ($(DEBUGBUILD),true)
|
||||||
|
@echo "RELEASE build"
|
||||||
|
else
|
||||||
|
@echo "DEBUG build"
|
||||||
|
endif
|
||||||
|
$(QUIET)rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(ASOBJ) $(mapfile).map $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|
||||||
|
$(QUIET)rm -rf $(OBJDIR)/*
|
||||||
|
$(MAKE) -C updater/ram-code clean
|
||||||
|
ifneq ($(DEBUGBUILD),true)
|
||||||
|
$(QUIET)$(MAKE) DEBUGBUILD=true clean
|
||||||
|
endif
|
||||||
|
|
||||||
|
qtproject-legacy:
|
||||||
|
echo -e "TEMPLATE = app\nCONFIG -= console app_bundle qt" > $(target).pro
|
||||||
|
echo -e "SOURCES += $(CFILES) $(ASFILES)" >> $(target).pro
|
||||||
|
echo -ne "INCLUDEPATH += " >> $(target).pro
|
||||||
|
echo "$(INCLUDEPATH)" | sed "s!-I!./!g" >> $(target).pro
|
||||||
|
echo -ne "HEADERS += " >> $(target).pro
|
||||||
|
find -name "*.h" | tr "\\n" " " >> $(target).pro
|
||||||
|
echo -ne "\nDEFINES += " >> $(target).pro
|
||||||
|
echo "$(DEFINES)" | sed "s/-D//g" >> $(target).pro
|
||||||
|
|
||||||
|
qtproject-debug:
|
||||||
|
@echo "Generating debug build project"
|
||||||
|
$(QUIET)$(MAKE) DEBUGBUILD=true qtproject
|
||||||
|
|
||||||
|
qtproject:
|
||||||
|
$(QUIET)rm -f $(target).files $(target).cflags $(target).config $(target).creator $(target).includes $(target).creator.user
|
||||||
|
@echo "Generating source file list"
|
||||||
|
$(QUIET)echo "$(CFILES)" | tr ' ' '\n' > $(target).files
|
||||||
|
@echo -n "Appending found header files from folders "
|
||||||
|
@echo `echo $(INCLUDEPATH) | sed "s/-I//g"`
|
||||||
|
$(QUIET)for dir in `echo $(INCLUDEPATH) | sed "s/-I//g"`; do \
|
||||||
|
find `echo "$${dir}"` -name "*.h" >> $(target).files; \
|
||||||
|
done
|
||||||
|
@echo "Generating $(target).cflags"
|
||||||
|
$(QUIET)echo "" > $(target).cflags
|
||||||
|
@echo "Generating $(target).includes"
|
||||||
|
$(QUIET)echo $(INCLUDEPATH) | sed "s/-I/,/g" | tr , '\n' | sed "/^$$/d" > $(target).includes;
|
||||||
|
@echo "Generating $(target).config"
|
||||||
|
$(QUIET)echo $(DEFINES) | sed "s/-D/,#define /g" | tr , '\n' | sed "/^$$/d" > $(target).config
|
||||||
|
@echo "Generating $(target).creator"
|
||||||
|
$(QUIET)echo "[GENERAL]" > $(target).creator
|
||||||
|
|
||||||
|
-include $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|
@ -82,8 +82,6 @@ static inline void adc_pt1000_disable_adc(void)
|
|||||||
ADC_PT1000_PERIPH->CR2 &= ~ADC_CR2_ADON;
|
ADC_PT1000_PERIPH->CR2 &= ~ADC_CR2_ADON;
|
||||||
DMA2_Stream0->CR = 0;
|
DMA2_Stream0->CR = 0;
|
||||||
|
|
||||||
safety_controller_set_crc_monitor(ERR_CRC_MON_MEAS_ADC, SAFETY_CRC_MON_MEAS_ADC_PW);
|
|
||||||
|
|
||||||
safety_controller_report_error_with_key(ERR_FLAG_MEAS_ADC_OFF, MEAS_ADC_SAFETY_FLAG_KEY);
|
safety_controller_report_error_with_key(ERR_FLAG_MEAS_ADC_OFF, MEAS_ADC_SAFETY_FLAG_KEY);
|
||||||
safety_controller_enable_timing_mon(ERR_TIMING_MEAS_ADC, false);
|
safety_controller_enable_timing_mon(ERR_TIMING_MEAS_ADC, false);
|
||||||
rcc_manager_disable_clock(&RCC->APB2ENR, BITMASK_TO_BITNO(RCC_APB2ENR_ADC3EN));
|
rcc_manager_disable_clock(&RCC->APB2ENR, BITMASK_TO_BITNO(RCC_APB2ENR_ADC3EN));
|
||||||
@ -183,8 +181,6 @@ void adc_pt1000_setup_meas(void)
|
|||||||
streaming_flag_ptr = NULL;
|
streaming_flag_ptr = NULL;
|
||||||
adc_watchdog_counter = 0UL;
|
adc_watchdog_counter = 0UL;
|
||||||
stream_buffer = NULL;
|
stream_buffer = NULL;
|
||||||
|
|
||||||
safety_controller_set_crc_monitor(ERR_CRC_MON_MEAS_ADC, SAFETY_CRC_MON_MEAS_ADC_PW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void adc_pt1000_set_moving_average_filter_param(float alpha)
|
void adc_pt1000_set_moving_average_filter_param(float alpha)
|
||||||
@ -236,7 +232,7 @@ int adc_pt1000_get_current_resistance(float *resistance)
|
|||||||
*resistance = adc_pt1000_apply_calibration(pt1000_res_raw_lf);
|
*resistance = adc_pt1000_apply_calibration(pt1000_res_raw_lf);
|
||||||
|
|
||||||
if (safety_controller_get_flags_by_mask(ERR_FLAG_MEAS_ADC_OFF | ERR_FLAG_MEAS_ADC_OVERFLOW |
|
if (safety_controller_get_flags_by_mask(ERR_FLAG_MEAS_ADC_OFF | ERR_FLAG_MEAS_ADC_OVERFLOW |
|
||||||
ERR_FLAG_MEAS_ADC_WATCHDOG | ERR_FLAG_TIMING_MEAS_ADC)) {
|
ERR_FLAG_MEAS_ADC_WATCHDOG)) {
|
||||||
ret_val = -100;
|
ret_val = -100;
|
||||||
goto return_value;
|
goto return_value;
|
||||||
}
|
}
|
||||||
@ -315,8 +311,7 @@ static inline __attribute__((optimize("O3"))) void adc_pt1000_filter(float adc_p
|
|||||||
stable_sample_counter = 0;
|
stable_sample_counter = 0;
|
||||||
alpha = ADC_PT1000_FILTER_WEIGHT_FAST;
|
alpha = ADC_PT1000_FILTER_WEIGHT_FAST;
|
||||||
if (old_state != 1) {
|
if (old_state != 1) {
|
||||||
safety_controller_report_error_with_key(ERR_FLAG_MEAS_ADC_UNSTABLE,
|
safety_controller_report_error_with_key(ERR_FLAG_MEAS_ADC_UNSTABLE, MEAS_ADC_SAFETY_FLAG_KEY);
|
||||||
MEAS_ADC_SAFETY_FLAG_KEY);
|
|
||||||
old_state = 1;
|
old_state = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -324,8 +319,7 @@ static inline __attribute__((optimize("O3"))) void adc_pt1000_filter(float adc_p
|
|||||||
if (old_state != 2) {
|
if (old_state != 2) {
|
||||||
stable_sample_counter++;
|
stable_sample_counter++;
|
||||||
if (stable_sample_counter >= ADC_PT1000_FILTER_STABLE_SAMPLE_COUNT) {
|
if (stable_sample_counter >= ADC_PT1000_FILTER_STABLE_SAMPLE_COUNT) {
|
||||||
safety_controller_ack_flag_with_key(ERR_FLAG_MEAS_ADC_UNSTABLE,
|
safety_controller_ack_flag_with_key(ERR_FLAG_MEAS_ADC_UNSTABLE, MEAS_ADC_SAFETY_FLAG_KEY);
|
||||||
MEAS_ADC_SAFETY_FLAG_KEY);
|
|
||||||
old_state = 2;
|
old_state = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
if(MINGW OR CYGWIN OR WIN32)
|
|
||||||
set(UTIL_SEARCH_CMD where)
|
|
||||||
elseif(UNIX OR APPLE)
|
|
||||||
set(UTIL_SEARCH_CMD which)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(TOOLCHAIN_PREFIX arm-none-eabi-)
|
|
||||||
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${UTIL_SEARCH_CMD} ${TOOLCHAIN_PREFIX}gcc
|
|
||||||
OUTPUT_VARIABLE BINUTILS_PATH
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
)
|
|
||||||
|
|
||||||
get_filename_component(ARM_TOOLCHAIN_DIR ${BINUTILS_PATH} DIRECTORY)
|
|
||||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
|
||||||
|
|
||||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
|
|
||||||
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
|
|
||||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
|
|
||||||
|
|
||||||
set(CMAKE_OBJCOPY ${ARM_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}objcopy CACHE INTERNAL "objcopy tool")
|
|
||||||
set(CMAKE_SIZE_UTIL ${ARM_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}size CACHE INTERNAL "size tool")
|
|
||||||
|
|
||||||
set(CMAKE_FIND_ROOT_PATH ${BINUTILS_PATH})
|
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -1 +1 @@
|
|||||||
Subproject commit 251e90abf349d05bdb0d63afa86c478d8b0ebb98
|
Subproject commit 80090b4b20b779dd18803b3194c6d90235a1785b
|
@ -1,126 +0,0 @@
|
|||||||
#include "startup-tests.h"
|
|
||||||
|
|
||||||
uint32_t startup_test_perform_ccm_ram_check(void)
|
|
||||||
{
|
|
||||||
const void *ccmram_base = (void *)0x10000000UL;
|
|
||||||
const uint32_t ccmram_size = 64U * 1024UL;
|
|
||||||
volatile uint32_t *word_ptr;
|
|
||||||
uint32_t target_val;
|
|
||||||
uint32_t idx;
|
|
||||||
uint32_t ret = 0UL;
|
|
||||||
|
|
||||||
|
|
||||||
/* Perform inversion test with 0x55 and 0xAA, Part 1 */
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ccmram_base; idx < ccmram_size / 4U; idx++) {
|
|
||||||
word_ptr[idx] = idx & 1 ? 0x55AA55AAUL : 0xAA55AA55UL;
|
|
||||||
}
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ccmram_base; idx < ccmram_size / 4U; idx++) {
|
|
||||||
target_val = idx & 1 ? 0x55AA55AAUL : 0xAA55AA55UL;
|
|
||||||
if (target_val != word_ptr[idx]) {
|
|
||||||
ret = (uint32_t)&word_ptr[idx];
|
|
||||||
goto exit_ret_address;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Perform inversion test with 0x55 and 0xAA, Part 2 */
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ccmram_base; idx < ccmram_size / 4U; idx++) {
|
|
||||||
word_ptr[idx] = idx & 1 ? 0xAA55AA55UL : 0x55AA55AAUL;
|
|
||||||
}
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ccmram_base; idx < ccmram_size / 4U; idx++) {
|
|
||||||
target_val = idx & 1 ? 0xAA55AA55UL : 0x55AA55AAUL;
|
|
||||||
if (target_val != word_ptr[idx]) {
|
|
||||||
ret = (uint32_t)&word_ptr[idx];
|
|
||||||
goto exit_ret_address;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Perform static test with 0xFF */
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ccmram_base; idx < ccmram_size / 4U; idx++) {
|
|
||||||
word_ptr[idx] = 0xFFFFFFFFUL;
|
|
||||||
}
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ccmram_base; idx < ccmram_size / 4U; idx++) {
|
|
||||||
target_val = 0xFFFFFFFFUL;
|
|
||||||
if (target_val != word_ptr[idx]) {
|
|
||||||
ret = (uint32_t)&word_ptr[idx];
|
|
||||||
goto exit_ret_address;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Perform static test with 0x00 */
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ccmram_base; idx < ccmram_size / 4U; idx++) {
|
|
||||||
word_ptr[idx] = 0x0UL;
|
|
||||||
}
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ccmram_base; idx < ccmram_size / 4U; idx++) {
|
|
||||||
target_val = 0x0UL;
|
|
||||||
if (target_val != word_ptr[idx]) {
|
|
||||||
ret = (uint32_t)&word_ptr[idx];
|
|
||||||
goto exit_ret_address;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
exit_ret_address:
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t startup_test_perform_system_ram_check()
|
|
||||||
{
|
|
||||||
const void *ram_base = (void *)0x20000000UL;
|
|
||||||
const uint32_t ram_size = 128U * 1024UL;
|
|
||||||
volatile uint32_t *word_ptr;
|
|
||||||
uint32_t target_val;
|
|
||||||
uint32_t idx;
|
|
||||||
uint32_t ret = 0UL;
|
|
||||||
|
|
||||||
|
|
||||||
/* Perform inversion test with 0x55 and 0xAA, Part 1 */
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ram_base; idx < ram_size / 4U; idx++) {
|
|
||||||
word_ptr[idx] = idx & 1 ? 0x55AA55AAUL : 0xAA55AA55UL;
|
|
||||||
}
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ram_base; idx < ram_size / 4U; idx++) {
|
|
||||||
target_val = idx & 1 ? 0x55AA55AAUL : 0xAA55AA55UL;
|
|
||||||
if (target_val != word_ptr[idx]) {
|
|
||||||
ret = (uint32_t)&word_ptr[idx];
|
|
||||||
goto exit_ret_address;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Perform inversion test with 0x55 and 0xAA, Part 2 */
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ram_base; idx < ram_size / 4U; idx++) {
|
|
||||||
word_ptr[idx] = idx & 1 ? 0xAA55AA55UL : 0x55AA55AAUL;
|
|
||||||
}
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ram_base; idx < ram_size / 4U; idx++) {
|
|
||||||
target_val = idx & 1 ? 0xAA55AA55UL : 0x55AA55AAUL;
|
|
||||||
if (target_val != word_ptr[idx]) {
|
|
||||||
ret = (uint32_t)&word_ptr[idx];
|
|
||||||
goto exit_ret_address;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Perform static test with 0xFF */
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ram_base; idx < ram_size / 4U; idx++) {
|
|
||||||
word_ptr[idx] = 0xFFFFFFFFUL;
|
|
||||||
}
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ram_base; idx < ram_size / 4U; idx++) {
|
|
||||||
target_val = 0xFFFFFFFFUL;
|
|
||||||
if (target_val != word_ptr[idx]) {
|
|
||||||
ret = (uint32_t)&word_ptr[idx];
|
|
||||||
goto exit_ret_address;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Perform static test with 0x00 */
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ram_base; idx < ram_size / 4U; idx++) {
|
|
||||||
word_ptr[idx] = 0x0UL;
|
|
||||||
}
|
|
||||||
for (idx = 0, word_ptr = (volatile uint32_t *)ram_base; idx < ram_size / 4U; idx++) {
|
|
||||||
target_val = 0x0UL;
|
|
||||||
if (target_val != word_ptr[idx]) {
|
|
||||||
ret = (uint32_t)&word_ptr[idx];
|
|
||||||
goto exit_ret_address;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exit_ret_address:
|
|
||||||
return ret;
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
#ifndef _STARTUP_TESTS_H_
|
|
||||||
#define _STARTUP_TESTS_H_
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Do a RAM check of the CCM RAM.
|
|
||||||
*
|
|
||||||
* Loop over the whole CCM memory area and check it.
|
|
||||||
*
|
|
||||||
* @return 0 if successful. Else the defect address is returned.
|
|
||||||
* @warning This will completely corrupt this memory!
|
|
||||||
* You have to ensure to set it to sane values afterwards!
|
|
||||||
*/
|
|
||||||
uint32_t startup_test_perform_ccm_ram_check(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Do a RAM check of the stnadard SRAM regions
|
|
||||||
* @return 0 if successful. If an error is found, the faulty address is returned
|
|
||||||
* @warning This completely destroys all content in the memory!
|
|
||||||
* @warning Ensure that the stack pointer is moved to a different memory reagion (CCM RAM)!
|
|
||||||
*/
|
|
||||||
uint32_t startup_test_perform_system_ram_check(void);
|
|
||||||
|
|
||||||
#endif /* _STARTUP_TESTS_H_ */
|
|
@ -19,7 +19,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "startup-tests.h"
|
|
||||||
|
|
||||||
/* C++ library init */
|
/* C++ library init */
|
||||||
# if defined(__cplusplus)
|
# if defined(__cplusplus)
|
||||||
@ -289,7 +288,7 @@ extern unsigned int __ld_eheap;
|
|||||||
|
|
||||||
#define CPACR (*((volatile uint32_t *)0xE000ED88))
|
#define CPACR (*((volatile uint32_t *)0xE000ED88))
|
||||||
|
|
||||||
void __attribute__((noreturn)) Reset_Handler(void) {
|
void Reset_Handler(void) {
|
||||||
/* Stack is already initialized by hardware */
|
/* Stack is already initialized by hardware */
|
||||||
|
|
||||||
/* The first thing we do here, is to initialize the FPU
|
/* The first thing we do here, is to initialize the FPU
|
||||||
@ -298,9 +297,6 @@ void __attribute__((noreturn)) Reset_Handler(void) {
|
|||||||
*/
|
*/
|
||||||
CPACR |= (0xF << 20);
|
CPACR |= (0xF << 20);
|
||||||
|
|
||||||
/**
|
|
||||||
* Prepare RAM etc for the System Init function. This ensures, the RAM tests execute at max speed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Copy .data section */
|
/* Copy .data section */
|
||||||
__init_section(&__ld_load_data, &__ld_sdata, &__ld_edata);
|
__init_section(&__ld_load_data, &__ld_sdata, &__ld_edata);
|
||||||
@ -316,74 +312,6 @@ void __attribute__((noreturn)) Reset_Handler(void) {
|
|||||||
/* Set clocks, waitstates, ART operation etc. */
|
/* Set clocks, waitstates, ART operation etc. */
|
||||||
SystemInit();
|
SystemInit();
|
||||||
|
|
||||||
if (startup_test_perform_ccm_ram_check()) {
|
|
||||||
/* Hang forever in case of an error. We cannot handle this (yet?) */
|
|
||||||
while (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Move the stack and the stack pointer to CCMRAM
|
|
||||||
* This allows us to perform a RAM test on the main RAM.
|
|
||||||
*/
|
|
||||||
__asm__ __volatile__ (
|
|
||||||
"mov r2, sp\n" /* Move stack pointer to register 2 */
|
|
||||||
"sub r2, %[stacktop], r2\n" /* Subtract stackpointer from top of ram => byte usage */
|
|
||||||
"mov r3, sp\n" /* Init r3 with first word address to copy (stack pointer) */
|
|
||||||
"sub r4, %[ccmtop], r2\n" /* Init r4 with first address to copy to! This will be the new stack pointer! */
|
|
||||||
"mov r5, r4\n" /* R5 will be the new stackpointer after we are finished copying */
|
|
||||||
"copyloop:\n"
|
|
||||||
"cmp r3, %[stacktop]\n" /* Check if we still have word to copy. If not => finish */
|
|
||||||
"beq finish\n"
|
|
||||||
"ldr.w r6, [r3, #0]\n" /* Load word from [r3] and store into [r4] */
|
|
||||||
"str.w r6, [r4, #0]\n"
|
|
||||||
"add r3, #4\n" /* Increment pointers */
|
|
||||||
"add r4, #4\n"
|
|
||||||
"b copyloop\n" /* go back to loop head */
|
|
||||||
"finish:\n"
|
|
||||||
"mov sp, r5\n" /* Set the new stack pointer to the beginning of the copied area */
|
|
||||||
:
|
|
||||||
: [stacktop]"r"(&__ld_top_of_stack), [ccmtop]"r"(0x10000000UL + (64U * 1024UL))
|
|
||||||
: "memory", "r2", "r3", "r4", "r5", "r6");
|
|
||||||
|
|
||||||
if (startup_test_perform_system_ram_check()) {
|
|
||||||
while (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Move the stack back to system ram */
|
|
||||||
__asm__ __volatile__ (
|
|
||||||
"mov r2, sp\n" /* Move stack pointer to register 2 */
|
|
||||||
"sub r2, %[ccmtop], r2\n" /* Subtract stackpointer from top of ccmram => byte usage */
|
|
||||||
"mov r3, sp\n" /* Init r3 with first word address to copy (stack pointer) */
|
|
||||||
"sub r4, %[stacktop], r2\n" /* Init r4 with first address to copy to! This will be the new stack pointer! */
|
|
||||||
"mov r5, r4\n" /* R5 will be the new stackpointer after we are finished copying */
|
|
||||||
"copyloop_2:\n"
|
|
||||||
"cmp r3, %[ccmtop]\n" /* Check if we still have word to copy. If not => finish */
|
|
||||||
"beq finish_2\n"
|
|
||||||
"ldr.w r6, [r3, #0]\n" /* Load word from [r3] and store into [r4] */
|
|
||||||
"str.w r6, [r4, #0]\n"
|
|
||||||
"add r3, #4\n" /* Increment pointers */
|
|
||||||
"add r4, #4\n"
|
|
||||||
"b copyloop_2\n" /* go back to loop head */
|
|
||||||
"finish_2:\n"
|
|
||||||
"mov sp, r5\n" /* Set the new stack pointer to the beginning of the copied area */
|
|
||||||
:
|
|
||||||
: [stacktop]"r"(&__ld_top_of_stack), [ccmtop]"r"(0x10000000UL + (64U * 1024UL))
|
|
||||||
: "memory", "r2", "r3", "r4", "r5", "r6");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RAM tests destroyed our values. So we have to copy them again...
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Copy .data section */
|
|
||||||
__init_section(&__ld_load_data, &__ld_sdata, &__ld_edata);
|
|
||||||
/* Fill bss with zero */
|
|
||||||
__fill_zero(&__ld_sbss, &__ld_ebss);
|
|
||||||
/* Fill Heap with zero */
|
|
||||||
__fill_zero(&__ld_sheap, &__ld_eheap);
|
|
||||||
/* Fill static CCM memory with zeroes */
|
|
||||||
__fill_zero(&__ld_sbss_ccm, &__ld_ebss_ccm);
|
|
||||||
/* Init CCM RAM data section */
|
|
||||||
__init_section(&__ld_load_ccm_data, &__ld_sdata_ccm, &__ld_edata_ccm);
|
|
||||||
|
|
||||||
/* C++ init function */
|
/* C++ init function */
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
__libc_init_array();
|
__libc_init_array();
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stm32/stm32f4xx.h>
|
#include <stm32/stm32f4xx.h>
|
||||||
#include <reflow-controller/ui/button.h>
|
#include <reflow-controller/button.h>
|
||||||
#include <stm-periph/stm32-gpio-macros.h>
|
#include <stm-periph/stm32-gpio-macros.h>
|
||||||
#include <stm-periph/rcc-manager.h>
|
#include <stm-periph/rcc-manager.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -53,7 +53,6 @@ void button_init()
|
|||||||
enum button_state button_read_event()
|
enum button_state button_read_event()
|
||||||
{
|
{
|
||||||
uint64_t time_delta;
|
uint64_t time_delta;
|
||||||
uint64_t activation_stmp;
|
|
||||||
enum button_state temp_state;
|
enum button_state temp_state;
|
||||||
|
|
||||||
if (override_state != BUTTON_IDLE) {
|
if (override_state != BUTTON_IDLE) {
|
||||||
@ -67,13 +66,7 @@ enum button_state button_read_event()
|
|||||||
int_state = BUTTON_IDLE;
|
int_state = BUTTON_IDLE;
|
||||||
return temp_state;
|
return temp_state;
|
||||||
} else {
|
} else {
|
||||||
/* Unfortunately I don't jave a better idea for now to ensure,
|
time_delta = systick_get_global_tick() - to_active_timestamp;
|
||||||
* that to_active_timestamp is read atomically
|
|
||||||
*/
|
|
||||||
__disable_irq();
|
|
||||||
activation_stmp = to_active_timestamp;
|
|
||||||
__enable_irq();
|
|
||||||
time_delta = systick_get_global_tick() - activation_stmp;
|
|
||||||
if (time_delta >= BUTTON_LONG_ON_TIME_MS)
|
if (time_delta >= BUTTON_LONG_ON_TIME_MS)
|
||||||
return BUTTON_LONG;
|
return BUTTON_LONG;
|
||||||
else if (time_delta >= BUTTON_SHORT_ON_TIME_MS)
|
else if (time_delta >= BUTTON_SHORT_ON_TIME_MS)
|
@ -28,24 +28,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Config parser magic value used to check sanity of passed structs
|
|
||||||
*/
|
|
||||||
#define CONFIG_PARSER_MAGIC 0x464a6e2bUL
|
#define CONFIG_PARSER_MAGIC 0x464a6e2bUL
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Config parser type casting macro
|
|
||||||
*/
|
|
||||||
#define CONFIG_PARSER(p) ((struct config_parser *)(p))
|
#define CONFIG_PARSER(p) ((struct config_parser *)(p))
|
||||||
|
|
||||||
/**
|
#define config_parser_check_handle(handle) do { if (!(handle) || \
|
||||||
* @brief Check if the supplied pointer is a valid @ref config_parser_handle_t
|
|
||||||
*
|
|
||||||
* If the pointer is invalid, the function using this macro will return with
|
|
||||||
* CONFIG_PARSER_PARAM_ERR
|
|
||||||
*/
|
|
||||||
#define config_parser_check_handle(handle) do { \
|
|
||||||
if (!(handle) || \
|
|
||||||
((struct config_parser *)(handle))->magic != CONFIG_PARSER_MAGIC) \
|
((struct config_parser *)(handle))->magic != CONFIG_PARSER_MAGIC) \
|
||||||
return CONFIG_PARSER_PARAM_ERR; \
|
return CONFIG_PARSER_PARAM_ERR; \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -70,17 +56,8 @@ config_parser_handle_t config_parser_open_file(struct config_parser *config_pars
|
|||||||
return (config_parser_handle_t)config_parser;
|
return (config_parser_handle_t)config_parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Token delimiters for the config parser.
|
|
||||||
*/
|
|
||||||
static const char * const token_delim = " \t";
|
static const char * const token_delim = " \t";
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Parse a value in the configuration
|
|
||||||
* @param entry Entry to parse the value in to
|
|
||||||
* @param value_start_token char pointer holding the value. Must be null-terminated
|
|
||||||
* @return 0 if successful
|
|
||||||
*/
|
|
||||||
static int parse_value(struct config_parser_entry *entry, char *value_start_token)
|
static int parse_value(struct config_parser_entry *entry, char *value_start_token)
|
||||||
{
|
{
|
||||||
char *dot;
|
char *dot;
|
||||||
@ -99,18 +76,19 @@ static int parse_value(struct config_parser_entry *entry, char *value_start_toke
|
|||||||
|
|
||||||
if (value_start_token[0] != '-') {
|
if (value_start_token[0] != '-') {
|
||||||
/* Try parsing as ul */
|
/* Try parsing as ul */
|
||||||
|
/* Try parsing as int */
|
||||||
entry->value.uint_val = strtoul(value_start_token, &endptr, 0);
|
entry->value.uint_val = strtoul(value_start_token, &endptr, 0);
|
||||||
if (endptr == value_start_token)
|
if (endptr == value_start_token) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
entry->type = CONFIG_PARSER_TYPE_UINT;
|
entry->type = CONFIG_PARSER_TYPE_UINT;
|
||||||
goto exit;
|
goto exit;
|
||||||
} else {
|
} else {
|
||||||
/* Try parsing as int */
|
/* Try parsing as int */
|
||||||
entry->value.int_val = strtod(value_start_token, &endptr);
|
entry->value.int_val = strtod(value_start_token, &endptr);
|
||||||
if (endptr == value_start_token)
|
if (endptr == value_start_token) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
entry->type = CONFIG_PARSER_TYPE_INT;
|
entry->type = CONFIG_PARSER_TYPE_INT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,15 +96,13 @@ exit:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum config_parser_ret config_parser_get_line(config_parser_handle_t handle, struct config_parser_entry *entry,
|
enum config_parser_ret config_parser_get_line(config_parser_handle_t handle, struct config_parser_entry *entry, bool force_float)
|
||||||
bool force_float)
|
|
||||||
{
|
{
|
||||||
struct config_parser *p;
|
struct config_parser *p;
|
||||||
char *token;
|
|
||||||
int token_round = 0;
|
|
||||||
|
|
||||||
config_parser_check_handle(handle);
|
config_parser_check_handle(handle);
|
||||||
p = CONFIG_PARSER(handle);
|
p = CONFIG_PARSER(handle);
|
||||||
|
char *token;
|
||||||
|
int token_round = 0;
|
||||||
|
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return CONFIG_PARSER_PARAM_ERR;
|
return CONFIG_PARSER_PARAM_ERR;
|
||||||
@ -141,6 +117,7 @@ enum config_parser_ret config_parser_get_line(config_parser_handle_t handle, str
|
|||||||
if (token[0] == '#') {
|
if (token[0] == '#') {
|
||||||
if (token_round == 0)
|
if (token_round == 0)
|
||||||
return CONFIG_PARSER_LINE_COMMENT;
|
return CONFIG_PARSER_LINE_COMMENT;
|
||||||
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,8 +126,9 @@ enum config_parser_ret config_parser_get_line(config_parser_handle_t handle, str
|
|||||||
entry->name = token;
|
entry->name = token;
|
||||||
break;
|
break;
|
||||||
case 1: /* = Symbol */
|
case 1: /* = Symbol */
|
||||||
if (strcmp(token, "="))
|
if (strcmp(token, "=")) {
|
||||||
return CONFIG_PARSER_LINE_MALFORM;
|
return CONFIG_PARSER_LINE_MALFORM;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2: /* VALUE */
|
case 2: /* VALUE */
|
||||||
if (parse_value(entry, token))
|
if (parse_value(entry, token))
|
||||||
@ -180,7 +158,6 @@ enum config_parser_ret config_parser_reset_to_start(config_parser_handle_t handl
|
|||||||
{
|
{
|
||||||
FRESULT res;
|
FRESULT res;
|
||||||
struct config_parser *p;
|
struct config_parser *p;
|
||||||
|
|
||||||
config_parser_check_handle(handle);
|
config_parser_check_handle(handle);
|
||||||
p = CONFIG_PARSER(handle);
|
p = CONFIG_PARSER(handle);
|
||||||
|
|
||||||
@ -203,7 +180,6 @@ enum config_parser_ret config_parser_close_file(config_parser_handle_t handle)
|
|||||||
{
|
{
|
||||||
struct config_parser *p;
|
struct config_parser *p;
|
||||||
FRESULT res;
|
FRESULT res;
|
||||||
|
|
||||||
config_parser_check_handle(handle);
|
config_parser_check_handle(handle);
|
||||||
p = CONFIG_PARSER(handle);
|
p = CONFIG_PARSER(handle);
|
||||||
|
|
||||||
|
@ -33,68 +33,44 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <fatfs/ff.h>
|
#include <fatfs/ff.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Confi parser instance struct
|
|
||||||
*/
|
|
||||||
struct config_parser {
|
struct config_parser {
|
||||||
uint32_t magic; /**< @brief Magic value. Checked by each function to verify if the passed pointer is valid */
|
uint32_t magic;
|
||||||
bool write; /**< @brief File opened in write / read mode */
|
bool write;
|
||||||
FIL file; /**< @brief FatFS file */
|
FIL file;
|
||||||
char *buffer; /**< @brief Working buffer */
|
char *buffer;
|
||||||
size_t buff_size; /** @brief Size of the working buffer config_parser::buffer */
|
size_t buff_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief handle type for the config parser. Never dereference this pointer directly!
|
|
||||||
*/
|
|
||||||
typedef void * config_parser_handle_t;
|
typedef void * config_parser_handle_t;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Differnet value types a config entry can hold
|
|
||||||
*/
|
|
||||||
enum config_parser_value_type {
|
enum config_parser_value_type {
|
||||||
CONFIG_PARSER_TYPE_UINT = 0,
|
CONFIG_PARSER_TYPE_UINT = 0,
|
||||||
CONFIG_PARSER_TYPE_INT,
|
CONFIG_PARSER_TYPE_INT,
|
||||||
CONFIG_PARSER_TYPE_FLOAT,
|
CONFIG_PARSER_TYPE_FLOAT,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Error return code of config parser functions
|
|
||||||
*/
|
|
||||||
enum config_parser_ret {
|
enum config_parser_ret {
|
||||||
CONFIG_PARSER_OK = 0, /**< @brief Operation succeeded */
|
CONFIG_PARSER_OK = 0,
|
||||||
CONFIG_PARSER_PARAM_ERR, /**< @brief Function parameter error */
|
CONFIG_PARSER_PARAM_ERR,
|
||||||
CONFIG_PARSER_GENERIC_ERR, /**< @brief Generic unspecified error */
|
CONFIG_PARSER_GENERIC_ERR,
|
||||||
CONFIG_PARSER_IOERR, /**< @brief I/O Error while file handling */
|
CONFIG_PARSER_IOERR,
|
||||||
CONFIG_PARSER_LINE_COMMENT, /**< @brief The parser encountered a line starting with a comment. */
|
CONFIG_PARSER_LINE_COMMENT,
|
||||||
CONFIG_PARSER_LINE_TOO_LONG, /**< @brief The read line is too long for the parser to process. */
|
CONFIG_PARSER_LINE_TOO_LONG,
|
||||||
CONFIG_PARSER_LINE_MALFORM, /**< @brief Malfoirmed line. Line is neither a commenbt nor a key=value string */
|
CONFIG_PARSER_LINE_MALFORM,
|
||||||
CONFIG_PARSER_END_REACHED, /**< @brief The config parser has reached the end of the file */
|
CONFIG_PARSER_END_REACHED,
|
||||||
CONFIG_PARSER_WRONG_MODE, /**< @brief Read or write requested on config parser instance that is opened in a different mode */
|
CONFIG_PARSER_WRONG_MODE,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Represents a configuration key-value-pair used by the config parser
|
|
||||||
*/
|
|
||||||
struct config_parser_entry {
|
struct config_parser_entry {
|
||||||
const char *name; /**< @brief Pointer to the name of the config entry (key) */
|
const char *name;
|
||||||
enum config_parser_value_type type; /**< @brief Type of the value held by this struct */
|
enum config_parser_value_type type;
|
||||||
union {
|
union {
|
||||||
uint32_t uint_val;
|
uint32_t uint_val;
|
||||||
int32_t int_val;
|
int32_t int_val;
|
||||||
float float_val;
|
float float_val;
|
||||||
} value; /**< @brief Value of the config entry. For correct processing, config_parser_entry::type has to be taken into account */
|
} value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Open a config file
|
|
||||||
* @param config_parser Struict holding the config parser isntance. Will be filled by this function
|
|
||||||
* @param write Open the config file for writing (true) or reading (false)
|
|
||||||
* @param file_name File name to open
|
|
||||||
* @param working_buffer A working buffer used by the config parser to process the file.
|
|
||||||
* @param buff_size Size of \p working_buffer. Must be large enough to hold a full line of the config file
|
|
||||||
* @return Config parser error
|
|
||||||
*/
|
|
||||||
config_parser_handle_t config_parser_open_file(struct config_parser *config_parser, bool write, const char *file_name,
|
config_parser_handle_t config_parser_open_file(struct config_parser *config_parser, bool write, const char *file_name,
|
||||||
char *working_buffer, size_t buff_size);
|
char *working_buffer, size_t buff_size);
|
||||||
|
|
||||||
@ -107,37 +83,13 @@ config_parser_handle_t config_parser_open_file(struct config_parser *config_pars
|
|||||||
* @return Config parser error
|
* @return Config parser error
|
||||||
*/
|
*/
|
||||||
enum config_parser_ret config_parser_get_line(config_parser_handle_t handle, struct config_parser_entry *entry, bool force_float);
|
enum config_parser_ret config_parser_get_line(config_parser_handle_t handle, struct config_parser_entry *entry, bool force_float);
|
||||||
/**
|
|
||||||
* @brief Reset the config parser instance to the beginning of the config file
|
|
||||||
* @param handle Config parser
|
|
||||||
* @return Config parser error
|
|
||||||
*/
|
|
||||||
enum config_parser_ret config_parser_reset_to_start(config_parser_handle_t handle);
|
enum config_parser_ret config_parser_reset_to_start(config_parser_handle_t handle);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Write a config entry to a config file
|
|
||||||
* @param handle Handle to the config parser. This must be opened in write mode.
|
|
||||||
* @param entry
|
|
||||||
* @return Config parser error
|
|
||||||
* @warning This function is currently not implemented and will return with a success!
|
|
||||||
*/
|
|
||||||
enum config_parser_ret config_parser_write_entry(config_parser_handle_t handle, const struct config_parser_entry *entry);
|
enum config_parser_ret config_parser_write_entry(config_parser_handle_t handle, const struct config_parser_entry *entry);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Close a config parser handle
|
|
||||||
* @param handle Config parser
|
|
||||||
* @return Config parser error
|
|
||||||
*/
|
|
||||||
enum config_parser_ret config_parser_close_file(config_parser_handle_t handle);
|
enum config_parser_ret config_parser_close_file(config_parser_handle_t handle);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check if the \p return_val is a abort condition to stop parsing a file.
|
|
||||||
*
|
|
||||||
* This function will return true if a disk error occured or the end of file is reached.
|
|
||||||
*
|
|
||||||
* @param return_val
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
bool config_parser_ret_is_abort_condition(enum config_parser_ret return_val);
|
bool config_parser_ret_is_abort_condition(enum config_parser_ret return_val);
|
||||||
|
|
||||||
#endif /* _CONFIG_PARSER_H_ */
|
#endif /* _CONFIG_PARSER_H_ */
|
||||||
|
@ -6,7 +6,7 @@ import pathlib
|
|||||||
|
|
||||||
license_header = """/* Reflow Oven Controller
|
license_header = """/* Reflow Oven Controller
|
||||||
*
|
*
|
||||||
* Copyright (C) 2022 Mario Hüttel <mario.huettel@gmx.net>
|
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
||||||
*
|
*
|
||||||
* This file is part of the Reflow Oven Controller Project.
|
* This file is part of the Reflow Oven Controller Project.
|
||||||
*
|
*
|
||||||
@ -37,7 +37,7 @@ cpath = os.path.join(project_dir, sys.argv[1]+'.c')
|
|||||||
hfile = sys.argv[1]+'.h'
|
hfile = sys.argv[1]+'.h'
|
||||||
hpath = os.path.join(module_include_dir, hfile)
|
hpath = os.path.join(module_include_dir, hfile)
|
||||||
|
|
||||||
h_define = '_'+hfile.replace('.', '_').replace('-', '_').replace('/', '_').upper()+'_'
|
h_define = '__'+hfile.replace('.', '_').replace('-', '_').replace('/', '_').upper()+'__'
|
||||||
|
|
||||||
if os.path.exists(cpath) or os.path.exists(hpath):
|
if os.path.exists(cpath) or os.path.exists(hpath):
|
||||||
print("File already exists! Abort!")
|
print("File already exists! Abort!")
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [[ -z $1 ]]; then
|
|
||||||
# Exit with error in case no output file is specified
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
firmware_version=`git describe --tags --always --dirty`
|
|
||||||
commit=`git rev-parse HEAD`
|
|
||||||
|
|
||||||
echo "#ifndef _VERSION_GENERATED_H_" > $1
|
|
||||||
echo "#define _VERSION_GENERATED_H_" >> $1
|
|
||||||
echo "#define GIT_VERSION_STRING \"$firmware_version\"" >> $1
|
|
||||||
echo "#define GIT_FULL_COMMIT \"$commit\"" >> $1
|
|
||||||
echo "#endif /* _VERSION_GENERATED_H_ */" >> $1
|
|
@ -18,11 +18,6 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @addtogroup digio
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <reflow-controller/digio.h>
|
#include <reflow-controller/digio.h>
|
||||||
#include <stm32/stm32f4xx.h>
|
#include <stm32/stm32f4xx.h>
|
||||||
#include <stm-periph/rcc-manager.h>
|
#include <stm-periph/rcc-manager.h>
|
||||||
@ -52,10 +47,17 @@ static void digio_setup_pin_int(uint8_t bit_no, uint8_t in_out, uint8_t alt_func
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void digio_init(void)
|
void digio_setup_default_all(void)
|
||||||
{
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
rcc_manager_enable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(DIGIO_RCC_MASK));
|
rcc_manager_enable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(DIGIO_RCC_MASK));
|
||||||
digio_set_default_values();
|
|
||||||
|
for (i = 0; i < COUNT_OF(digio_pins); i++) {
|
||||||
|
digio_setup_pin_int(digio_pins[i], digio_default_io[i], digio_default_altfunc[i]);
|
||||||
|
if (digio_default_io[i] == 1)
|
||||||
|
digio_set(i, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void digio_setup_pin(uint8_t num, uint8_t in_out, uint8_t alt_func)
|
void digio_setup_pin(uint8_t num, uint8_t in_out, uint8_t alt_func)
|
||||||
@ -67,22 +69,12 @@ void digio_setup_pin(uint8_t num, uint8_t in_out, uint8_t alt_func)
|
|||||||
|
|
||||||
void digio_set(uint8_t num, int val)
|
void digio_set(uint8_t num, int val)
|
||||||
{
|
{
|
||||||
uint8_t pin;
|
|
||||||
|
|
||||||
if (num >= COUNT_OF(digio_pins))
|
if (num >= COUNT_OF(digio_pins))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pin = digio_pins[num];
|
|
||||||
|
|
||||||
/* Check if port is an output. If not, do noting. */
|
|
||||||
if ((DIGIO_PORT->MODER & (0x3<<pin)) != OUTPUT(pin)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (val)
|
if (val)
|
||||||
DIGIO_PORT->ODR |= (1<<pin);
|
DIGIO_PORT->ODR |= (1<<digio_pins[num]);
|
||||||
else
|
else
|
||||||
DIGIO_PORT->ODR &= ~(1<<pin);
|
DIGIO_PORT->ODR &= ~(1<<digio_pins[num]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int digio_get(uint8_t num)
|
int digio_get(uint8_t num)
|
||||||
@ -127,12 +119,7 @@ int led_get(uint8_t num)
|
|||||||
return ((LED_PORT->ODR & (1<<led_pins[num])) ? 1 : 0);
|
return ((LED_PORT->ODR & (1<<led_pins[num])) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the timer for the beeper to generate the output frequency
|
|
||||||
*
|
|
||||||
* TIM7 is used as the frequency generating timer. If @ref LOUDSPEAKER_MULTIFREQ
|
|
||||||
* is 0, the timer is unused and this function does nothing.
|
|
||||||
*/
|
|
||||||
static void loudspeaker_freq_timer_init(void)
|
static void loudspeaker_freq_timer_init(void)
|
||||||
{
|
{
|
||||||
#if LOUDSPEAKER_MULTIFREQ
|
#if LOUDSPEAKER_MULTIFREQ
|
||||||
@ -156,13 +143,6 @@ void loudspeaker_setup(void)
|
|||||||
loudspeaker_set(0U);
|
loudspeaker_set(0U);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Start the beeper
|
|
||||||
* @param val frequency value of the speaker in 'Timer relaod values'
|
|
||||||
* @note If @ref LOUDSPEAKER_MULTIFREQ isn't set,
|
|
||||||
* the speaker output will be set to high and no frequency is generated.
|
|
||||||
* The value of @p val is ignored in this case
|
|
||||||
*/
|
|
||||||
static void loudspeaker_start_beep(uint16_t val)
|
static void loudspeaker_start_beep(uint16_t val)
|
||||||
{
|
{
|
||||||
#if LOUDSPEAKER_MULTIFREQ
|
#if LOUDSPEAKER_MULTIFREQ
|
||||||
@ -175,9 +155,6 @@ static void loudspeaker_start_beep(uint16_t val)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Stop the beeping of the loudspeaker
|
|
||||||
*/
|
|
||||||
static void loudspeaker_stop_beep(void)
|
static void loudspeaker_stop_beep(void)
|
||||||
{
|
{
|
||||||
#if LOUDSPEAKER_MULTIFREQ
|
#if LOUDSPEAKER_MULTIFREQ
|
||||||
@ -195,10 +172,11 @@ void loudspeaker_set(uint16_t val)
|
|||||||
{
|
{
|
||||||
loudspeaker_val = val;
|
loudspeaker_val = val;
|
||||||
|
|
||||||
if (!val)
|
if (!val) {
|
||||||
loudspeaker_stop_beep();
|
loudspeaker_stop_beep();
|
||||||
else
|
} else {
|
||||||
loudspeaker_start_beep(val);
|
loudspeaker_start_beep(val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t loudspeaker_get(void)
|
uint16_t loudspeaker_get(void)
|
||||||
@ -207,12 +185,6 @@ uint16_t loudspeaker_get(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if LOUDSPEAKER_MULTIFREQ
|
#if LOUDSPEAKER_MULTIFREQ
|
||||||
/**
|
|
||||||
* @brief Timer7 IRQ Handler
|
|
||||||
*
|
|
||||||
* This IRQ Handler is used by the loudspeaker to synthesize the output frequency.
|
|
||||||
* If @ref LOUDSPEAKER_MULTIFREQ is 0, TIM7 and this interrupt will not be used.
|
|
||||||
*/
|
|
||||||
void TIM7_IRQHandler(void)
|
void TIM7_IRQHandler(void)
|
||||||
{
|
{
|
||||||
TIM7->SR = 0UL;
|
TIM7->SR = 0UL;
|
||||||
@ -220,16 +192,3 @@ void TIM7_IRQHandler(void)
|
|||||||
LOUDSPEAKER_PORT->ODR ^= (1<<LOUDSPEAKER_PIN);
|
LOUDSPEAKER_PORT->ODR ^= (1<<LOUDSPEAKER_PIN);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
void digio_set_default_values()
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = 0; i < COUNT_OF(digio_pins); i++) {
|
|
||||||
digio_setup_pin_int(digio_pins[i], digio_default_io[i], digio_default_altfunc[i]);
|
|
||||||
if (digio_default_io[i] == 1)
|
|
||||||
digio_set(i, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
find_package(Doxygen)
|
|
||||||
|
|
||||||
if(NOT WIN32)
|
|
||||||
string(ASCII 27 Esc)
|
|
||||||
set(ColorReset "${Esc}[m")
|
|
||||||
set(ColorBold "${Esc}[1m")
|
|
||||||
set(Red "${Esc}[31m")
|
|
||||||
set(Green "${Esc}[32m")
|
|
||||||
set(Yellow "${Esc}[33m")
|
|
||||||
set(Blue "${Esc}[34m")
|
|
||||||
set(Magenta "${Esc}[35m")
|
|
||||||
set(Cyan "${Esc}[36m")
|
|
||||||
set(White "${Esc}[37m")
|
|
||||||
set(BoldRed "${Esc}[1;31m")
|
|
||||||
set(BoldGreen "${Esc}[1;32m")
|
|
||||||
set(BoldYellow "${Esc}[1;33m")
|
|
||||||
set(BoldBlue "${Esc}[1;34m")
|
|
||||||
set(BoldMagenta "${Esc}[1;35m")
|
|
||||||
set(BoldCyan "${Esc}[1;36m")
|
|
||||||
set(BoldWhite "${Esc}[1;37m")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (DOXYGEN_FOUND)
|
|
||||||
add_custom_target(documentation DEPENDS doxygen doxygen-pdf)
|
|
||||||
|
|
||||||
add_custom_target(doxygen
|
|
||||||
COMMAND ./build-doxygen.sh "${PROJECT_BINARY_DIR}"
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
COMMENT "Generating documentation with Doxygen")
|
|
||||||
|
|
||||||
add_custom_target(
|
|
||||||
doxygen-pdf
|
|
||||||
COMMAND make
|
|
||||||
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/latex"
|
|
||||||
DEPENDS doxygen
|
|
||||||
)
|
|
||||||
else (DOXYGEN_FOUND)
|
|
||||||
message("${BoldMagenta}Doxygen needs to be installed to generate the doxygen documentation${ColorReset}")
|
|
||||||
message("${BoldMagenta}doxygen, documentation, doxygen-latex targets will not be available${ColorReset}")
|
|
||||||
endif (DOXYGEN_FOUND)
|
|
@ -1,4 +1,4 @@
|
|||||||
# Doxyfile 1.9.2
|
# Doxyfile 1.8.20
|
||||||
|
|
||||||
# This file describes the settings to be used by the documentation system
|
# This file describes the settings to be used by the documentation system
|
||||||
# doxygen (www.doxygen.org) for a project.
|
# doxygen (www.doxygen.org) for a project.
|
||||||
@ -93,6 +93,14 @@ ALLOW_UNICODE_NAMES = NO
|
|||||||
|
|
||||||
OUTPUT_LANGUAGE = English
|
OUTPUT_LANGUAGE = English
|
||||||
|
|
||||||
|
# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all
|
||||||
|
# documentation generated by doxygen is written. Doxygen will use this
|
||||||
|
# information to generate all generated output in the proper direction.
|
||||||
|
# Possible values are: None, LTR, RTL and Context.
|
||||||
|
# The default value is: None.
|
||||||
|
|
||||||
|
OUTPUT_TEXT_DIRECTION = None
|
||||||
|
|
||||||
# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
|
# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
|
||||||
# descriptions after the members that are listed in the file and class
|
# descriptions after the members that are listed in the file and class
|
||||||
# documentation (similar to Javadoc). Set to NO to disable this.
|
# documentation (similar to Javadoc). Set to NO to disable this.
|
||||||
@ -250,16 +258,16 @@ TAB_SIZE = 8
|
|||||||
# the documentation. An alias has the form:
|
# the documentation. An alias has the form:
|
||||||
# name=value
|
# name=value
|
||||||
# For example adding
|
# For example adding
|
||||||
# "sideeffect=@par Side Effects:^^"
|
# "sideeffect=@par Side Effects:\n"
|
||||||
# will allow you to put the command \sideeffect (or @sideeffect) in the
|
# will allow you to put the command \sideeffect (or @sideeffect) in the
|
||||||
# documentation, which will result in a user-defined paragraph with heading
|
# documentation, which will result in a user-defined paragraph with heading
|
||||||
# "Side Effects:". Note that you cannot put \n's in the value part of an alias
|
# "Side Effects:". You can put \n's in the value part of an alias to insert
|
||||||
# to insert newlines (in the resulting output). You can put ^^ in the value part
|
# newlines (in the resulting output). You can put ^^ in the value part of an
|
||||||
# of an alias to insert a newline as if a physical newline was in the original
|
# alias to insert a newline as if a physical newline was in the original file.
|
||||||
# file. When you need a literal { or } or , in the value part of an alias you
|
# When you need a literal { or } or , in the value part of an alias you have to
|
||||||
# have to escape them by means of a backslash (\), this can lead to conflicts
|
# escape them by means of a backslash (\), this can lead to conflicts with the
|
||||||
# with the commands \{ and \} for these it is advised to use the version @{ and
|
# commands \{ and \} for these it is advised to use the version @{ and @} or use
|
||||||
# @} or use a double escape (\\{ and \\})
|
# a double escape (\\{ and \\})
|
||||||
|
|
||||||
ALIASES =
|
ALIASES =
|
||||||
|
|
||||||
@ -304,8 +312,8 @@ OPTIMIZE_OUTPUT_SLICE = NO
|
|||||||
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
||||||
# using this tag. The format is ext=language, where ext is a file extension, and
|
# using this tag. The format is ext=language, where ext is a file extension, and
|
||||||
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
|
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
|
||||||
# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice,
|
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL,
|
||||||
# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
|
# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
|
||||||
# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
|
# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
|
||||||
# tries to guess whether the code is fixed or free formatted code, this is the
|
# tries to guess whether the code is fixed or free formatted code, this is the
|
||||||
# default for Fortran type files). For instance to make doxygen treat .inc files
|
# default for Fortran type files). For instance to make doxygen treat .inc files
|
||||||
@ -315,10 +323,7 @@ OPTIMIZE_OUTPUT_SLICE = NO
|
|||||||
# Note: For files without extension you can use no_extension as a placeholder.
|
# Note: For files without extension you can use no_extension as a placeholder.
|
||||||
#
|
#
|
||||||
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
|
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
|
||||||
# the files are not read by doxygen. When specifying no_extension you should add
|
# the files are not read by doxygen.
|
||||||
# * to the FILE_PATTERNS.
|
|
||||||
#
|
|
||||||
# Note see also the list of default file extension mappings.
|
|
||||||
|
|
||||||
EXTENSION_MAPPING =
|
EXTENSION_MAPPING =
|
||||||
|
|
||||||
@ -458,12 +463,12 @@ LOOKUP_CACHE_SIZE = 0
|
|||||||
# than 0 to get more control over the balance between CPU load and processing
|
# than 0 to get more control over the balance between CPU load and processing
|
||||||
# speed. At this moment only the input processing can be done using multiple
|
# speed. At this moment only the input processing can be done using multiple
|
||||||
# threads. Since this is still an experimental feature the default is set to 1,
|
# threads. Since this is still an experimental feature the default is set to 1,
|
||||||
# which effectively disables parallel processing. Please report any issues you
|
# which efficively disables parallel processing. Please report any issues you
|
||||||
# encounter. Generating dot graphs in parallel is controlled by the
|
# encounter. Generating dot graphs in parallel is controlled by the
|
||||||
# DOT_NUM_THREADS setting.
|
# DOT_NUM_THREADS setting.
|
||||||
# Minimum value: 0, maximum value: 32, default value: 1.
|
# Minimum value: 0, maximum value: 32, default value: 1.
|
||||||
|
|
||||||
NUM_PROC_THREADS = 0
|
NUM_PROC_THREADS = 1
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Build related configuration options
|
# Build related configuration options
|
||||||
@ -528,13 +533,6 @@ EXTRACT_LOCAL_METHODS = NO
|
|||||||
|
|
||||||
EXTRACT_ANON_NSPACES = NO
|
EXTRACT_ANON_NSPACES = NO
|
||||||
|
|
||||||
# If this flag is set to YES, the name of an unnamed parameter in a declaration
|
|
||||||
# will be determined by the corresponding definition. By default unnamed
|
|
||||||
# parameters remain unnamed in the output.
|
|
||||||
# The default value is: YES.
|
|
||||||
|
|
||||||
RESOLVE_UNNAMED_PARAMS = YES
|
|
||||||
|
|
||||||
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
|
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
|
||||||
# undocumented members inside documented classes or files. If set to NO these
|
# undocumented members inside documented classes or files. If set to NO these
|
||||||
# members will be included in the various overviews, but no documentation
|
# members will be included in the various overviews, but no documentation
|
||||||
@ -572,18 +570,11 @@ HIDE_IN_BODY_DOCS = NO
|
|||||||
|
|
||||||
INTERNAL_DOCS = NO
|
INTERNAL_DOCS = NO
|
||||||
|
|
||||||
# With the correct setting of option CASE_SENSE_NAMES doxygen will better be
|
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
|
||||||
# able to match the capabilities of the underlying filesystem. In case the
|
# names in lower-case letters. If set to YES, upper-case letters are also
|
||||||
# filesystem is case sensitive (i.e. it supports files in the same directory
|
# allowed. This is useful if you have classes or files whose names only differ
|
||||||
# whose names only differ in casing), the option must be set to YES to properly
|
# in case and if your file system supports case sensitive file names. Windows
|
||||||
# deal with such files in case they appear in the input. For filesystems that
|
# (including Cygwin) and Mac users are advised to set this option to NO.
|
||||||
# are not case sensitive the option should be be set to NO to properly deal with
|
|
||||||
# output files written for symbols that only differ in casing, such as for two
|
|
||||||
# classes, one named CLASS and the other named Class, and to also support
|
|
||||||
# references to files without having to specify the exact matching casing. On
|
|
||||||
# Windows (including Cygwin) and MacOS, users should typically set this option
|
|
||||||
# to NO, whereas on Linux or other Unix flavors it should typically be set to
|
|
||||||
# YES.
|
|
||||||
# The default value is: system dependent.
|
# The default value is: system dependent.
|
||||||
|
|
||||||
CASE_SENSE_NAMES = NO
|
CASE_SENSE_NAMES = NO
|
||||||
@ -602,12 +593,6 @@ HIDE_SCOPE_NAMES = YES
|
|||||||
|
|
||||||
HIDE_COMPOUND_REFERENCE= NO
|
HIDE_COMPOUND_REFERENCE= NO
|
||||||
|
|
||||||
# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class
|
|
||||||
# will show which file needs to be included to use the class.
|
|
||||||
# The default value is: YES.
|
|
||||||
|
|
||||||
SHOW_HEADERFILE = YES
|
|
||||||
|
|
||||||
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
|
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
|
||||||
# the files that are included by a file in the documentation of that file.
|
# the files that are included by a file in the documentation of that file.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
@ -765,8 +750,7 @@ FILE_VERSION_FILTER =
|
|||||||
# output files in an output format independent way. To create the layout file
|
# output files in an output format independent way. To create the layout file
|
||||||
# that represents doxygen's defaults, run doxygen with the -l option. You can
|
# that represents doxygen's defaults, run doxygen with the -l option. You can
|
||||||
# optionally specify a file name after the option, if omitted DoxygenLayout.xml
|
# optionally specify a file name after the option, if omitted DoxygenLayout.xml
|
||||||
# will be used as the name of the layout file. See also section "Changing the
|
# will be used as the name of the layout file.
|
||||||
# layout of pages" for information.
|
|
||||||
#
|
#
|
||||||
# Note that if you run doxygen from a directory containing a file called
|
# Note that if you run doxygen from a directory containing a file called
|
||||||
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
|
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
|
||||||
@ -812,35 +796,24 @@ WARNINGS = YES
|
|||||||
WARN_IF_UNDOCUMENTED = YES
|
WARN_IF_UNDOCUMENTED = YES
|
||||||
|
|
||||||
# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
|
# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
|
||||||
# potential errors in the documentation, such as documenting some parameters in
|
# potential errors in the documentation, such as not documenting some parameters
|
||||||
# a documented function twice, or documenting parameters that don't exist or
|
# in a documented function, or documenting parameters that don't exist or using
|
||||||
# using markup commands wrongly.
|
# markup commands wrongly.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
WARN_IF_DOC_ERROR = YES
|
WARN_IF_DOC_ERROR = YES
|
||||||
|
|
||||||
# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete
|
|
||||||
# function parameter documentation. If set to NO, doxygen will accept that some
|
|
||||||
# parameters have no documentation without warning.
|
|
||||||
# The default value is: YES.
|
|
||||||
|
|
||||||
WARN_IF_INCOMPLETE_DOC = YES
|
|
||||||
|
|
||||||
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
|
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
|
||||||
# are documented, but have no documentation for their parameters or return
|
# are documented, but have no documentation for their parameters or return
|
||||||
# value. If set to NO, doxygen will only warn about wrong parameter
|
# value. If set to NO, doxygen will only warn about wrong or incomplete
|
||||||
# documentation, but not about the absence of documentation. If EXTRACT_ALL is
|
# parameter documentation, but not about the absence of documentation. If
|
||||||
# set to YES then this flag will automatically be disabled. See also
|
# EXTRACT_ALL is set to YES then this flag will automatically be disabled.
|
||||||
# WARN_IF_INCOMPLETE_DOC
|
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
WARN_NO_PARAMDOC = NO
|
WARN_NO_PARAMDOC = NO
|
||||||
|
|
||||||
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
|
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
|
||||||
# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
|
# a warning is encountered.
|
||||||
# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
|
|
||||||
# at the end of the doxygen process doxygen will return with a non-zero status.
|
|
||||||
# Possible values are: NO, YES and FAIL_ON_WARNINGS.
|
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
WARN_AS_ERROR = NO
|
WARN_AS_ERROR = NO
|
||||||
@ -876,8 +849,8 @@ INPUT = ../
|
|||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||||
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
|
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
|
||||||
# documentation (see:
|
# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
|
||||||
# https://www.gnu.org/software/libiconv/) for the list of possible encodings.
|
# possible encodings.
|
||||||
# The default value is: UTF-8.
|
# The default value is: UTF-8.
|
||||||
|
|
||||||
INPUT_ENCODING = UTF-8
|
INPUT_ENCODING = UTF-8
|
||||||
@ -890,14 +863,12 @@ INPUT_ENCODING = UTF-8
|
|||||||
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
|
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
|
||||||
# read by doxygen.
|
# read by doxygen.
|
||||||
#
|
#
|
||||||
# Note the list of default checked file patterns might differ from the list of
|
|
||||||
# default file extension mappings.
|
|
||||||
#
|
|
||||||
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
|
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
|
||||||
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
|
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
|
||||||
# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml,
|
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
|
||||||
# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C
|
# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment),
|
||||||
# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
|
# *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen
|
||||||
|
# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
|
||||||
# *.vhdl, *.ucf, *.qsf and *.ice.
|
# *.vhdl, *.ucf, *.qsf and *.ice.
|
||||||
|
|
||||||
FILE_PATTERNS = *.c \
|
FILE_PATTERNS = *.c \
|
||||||
@ -963,13 +934,8 @@ RECURSIVE = YES
|
|||||||
|
|
||||||
EXCLUDE = ../include/stm32 \
|
EXCLUDE = ../include/stm32 \
|
||||||
../include/arm_math.h \
|
../include/arm_math.h \
|
||||||
../include/cmsis/ \
|
../include/cmsis \
|
||||||
../shellmatta/test/ \
|
../shellmatta/test
|
||||||
../linklist-lib/test \
|
|
||||||
../base64-lib/test \
|
|
||||||
../shellmatta/doc/main.dox \
|
|
||||||
../updater/ram-code \
|
|
||||||
./
|
|
||||||
|
|
||||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
# 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
|
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||||
@ -1177,6 +1143,13 @@ VERBATIM_HEADERS = YES
|
|||||||
|
|
||||||
ALPHABETICAL_INDEX = YES
|
ALPHABETICAL_INDEX = YES
|
||||||
|
|
||||||
|
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
|
||||||
|
# which the alphabetical index list will be split.
|
||||||
|
# Minimum value: 1, maximum value: 20, default value: 5.
|
||||||
|
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
|
||||||
|
|
||||||
|
COLS_IN_ALPHA_INDEX = 5
|
||||||
|
|
||||||
# In case all classes in a project start with a common prefix, all classes will
|
# In case all classes in a project start with a common prefix, all classes will
|
||||||
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
|
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
|
||||||
# can be used to specify a prefix (or a list of prefixes) that should be ignored
|
# can be used to specify a prefix (or a list of prefixes) that should be ignored
|
||||||
@ -1276,7 +1249,7 @@ HTML_EXTRA_FILES =
|
|||||||
|
|
||||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
||||||
# will adjust the colors in the style sheet and background images according to
|
# will adjust the colors in the style sheet and background images according to
|
||||||
# this color. Hue is specified as an angle on a color-wheel, see
|
# this color. Hue is specified as an angle on a colorwheel, see
|
||||||
# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
|
# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
|
||||||
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
|
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
|
||||||
# purple, and 360 is red again.
|
# purple, and 360 is red again.
|
||||||
@ -1286,7 +1259,7 @@ HTML_EXTRA_FILES =
|
|||||||
HTML_COLORSTYLE_HUE = 220
|
HTML_COLORSTYLE_HUE = 220
|
||||||
|
|
||||||
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
|
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
|
||||||
# in the HTML output. For a value of 0 the output will use gray-scales only. A
|
# in the HTML output. For a value of 0 the output will use grayscales only. A
|
||||||
# value of 255 will produce the most vivid colors.
|
# value of 255 will produce the most vivid colors.
|
||||||
# Minimum value: 0, maximum value: 255, default value: 100.
|
# Minimum value: 0, maximum value: 255, default value: 100.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
@ -1347,11 +1320,10 @@ HTML_INDEX_NUM_ENTRIES = 100
|
|||||||
|
|
||||||
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
|
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
|
||||||
# generated that can be used as input for Apple's Xcode 3 integrated development
|
# generated that can be used as input for Apple's Xcode 3 integrated development
|
||||||
# environment (see:
|
# environment (see: https://developer.apple.com/xcode/), introduced with OSX
|
||||||
# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To
|
# 10.5 (Leopard). To create a documentation set, doxygen will generate a
|
||||||
# create a documentation set, doxygen will generate a Makefile in the HTML
|
# Makefile in the HTML output directory. Running make will produce the docset in
|
||||||
# output directory. Running make will produce the docset in that directory and
|
# that directory and running make install will install the docset in
|
||||||
# running make install will install the docset in
|
|
||||||
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
|
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
|
||||||
# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
|
# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
|
||||||
# genXcode/_index.html for more information.
|
# genXcode/_index.html for more information.
|
||||||
@ -1393,12 +1365,8 @@ DOCSET_PUBLISHER_NAME = Publisher
|
|||||||
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
|
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
|
||||||
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
|
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
|
||||||
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
|
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
|
||||||
# on Windows. In the beginning of 2021 Microsoft took the original page, with
|
# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on
|
||||||
# a.o. the download links, offline the HTML help workshop was already many years
|
# Windows.
|
||||||
# in maintenance mode). You can download the HTML help workshop from the web
|
|
||||||
# archives at Installation executable (see:
|
|
||||||
# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo
|
|
||||||
# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe).
|
|
||||||
#
|
#
|
||||||
# The HTML Help Workshop contains a compiler that can convert all HTML output
|
# The HTML Help Workshop contains a compiler that can convert all HTML output
|
||||||
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
|
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
|
||||||
@ -1473,8 +1441,7 @@ QCH_FILE =
|
|||||||
|
|
||||||
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
|
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
|
||||||
# Project output. For more information please see Qt Help Project / Namespace
|
# Project output. For more information please see Qt Help Project / Namespace
|
||||||
# (see:
|
# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
|
||||||
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
|
|
||||||
# The default value is: org.doxygen.Project.
|
# The default value is: org.doxygen.Project.
|
||||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||||
|
|
||||||
@ -1482,8 +1449,8 @@ QHP_NAMESPACE = org.doxygen.Project
|
|||||||
|
|
||||||
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
|
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
|
||||||
# Help Project output. For more information please see Qt Help Project / Virtual
|
# Help Project output. For more information please see Qt Help Project / Virtual
|
||||||
# Folders (see:
|
# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
|
||||||
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders).
|
# folders).
|
||||||
# The default value is: doc.
|
# The default value is: doc.
|
||||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||||
|
|
||||||
@ -1491,16 +1458,16 @@ QHP_VIRTUAL_FOLDER = doc
|
|||||||
|
|
||||||
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
|
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
|
||||||
# filter to add. For more information please see Qt Help Project / Custom
|
# filter to add. For more information please see Qt Help Project / Custom
|
||||||
# Filters (see:
|
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
|
||||||
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
|
# filters).
|
||||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
# 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
|
# 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
|
# custom filter to add. For more information please see Qt Help Project / Custom
|
||||||
# Filters (see:
|
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
|
||||||
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
|
# filters).
|
||||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||||
|
|
||||||
QHP_CUST_FILTER_ATTRS =
|
QHP_CUST_FILTER_ATTRS =
|
||||||
@ -1512,9 +1479,9 @@ QHP_CUST_FILTER_ATTRS =
|
|||||||
|
|
||||||
QHP_SECT_FILTER_ATTRS =
|
QHP_SECT_FILTER_ATTRS =
|
||||||
|
|
||||||
# The QHG_LOCATION tag can be used to specify the location (absolute path
|
# The QHG_LOCATION tag can be used to specify the location of Qt's
|
||||||
# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to
|
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
|
||||||
# run qhelpgenerator on the generated .qhp file.
|
# generated .qhp file.
|
||||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||||
|
|
||||||
QHG_LOCATION =
|
QHG_LOCATION =
|
||||||
@ -1557,28 +1524,16 @@ DISABLE_INDEX = NO
|
|||||||
# to work a browser that supports JavaScript, DHTML, CSS and frames is required
|
# to work a browser that supports JavaScript, DHTML, CSS and frames is required
|
||||||
# (i.e. any modern browser). Windows users are probably better off using the
|
# (i.e. any modern browser). Windows users are probably better off using the
|
||||||
# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
|
# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
|
||||||
# further fine tune the look of the index (see "Fine-tuning the output"). As an
|
# further fine-tune the look of the index. As an example, the default style
|
||||||
# example, the default style sheet generated by doxygen has an example that
|
# sheet generated by doxygen has an example that shows how to put an image at
|
||||||
# shows how to put an image at the root of the tree instead of the PROJECT_NAME.
|
# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
|
||||||
# Since the tree basically has the same information as the tab index, you could
|
# the same information as the tab index, you could consider setting
|
||||||
# consider setting DISABLE_INDEX to YES when enabling this option.
|
# DISABLE_INDEX to YES when enabling this option.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
GENERATE_TREEVIEW = NO
|
GENERATE_TREEVIEW = NO
|
||||||
|
|
||||||
# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the
|
|
||||||
# FULL_SIDEBAR option determines if the side bar is limited to only the treeview
|
|
||||||
# area (value NO) or if it should extend to the full height of the window (value
|
|
||||||
# YES). Setting this to YES gives a layout similar to
|
|
||||||
# https://docs.readthedocs.io with more room for contents, but less room for the
|
|
||||||
# project logo, title, and description. If either GENERATOR_TREEVIEW or
|
|
||||||
# DISABLE_INDEX is set to NO, this option has no effect.
|
|
||||||
# The default value is: NO.
|
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
|
||||||
|
|
||||||
FULL_SIDEBAR = NO
|
|
||||||
|
|
||||||
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
|
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
|
||||||
# doxygen will group on one line in the generated HTML documentation.
|
# doxygen will group on one line in the generated HTML documentation.
|
||||||
#
|
#
|
||||||
@ -1651,29 +1606,11 @@ FORMULA_MACROFILE =
|
|||||||
|
|
||||||
USE_MATHJAX = YES
|
USE_MATHJAX = YES
|
||||||
|
|
||||||
# With MATHJAX_VERSION it is possible to specify the MathJax version to be used.
|
|
||||||
# Note that the different versions of MathJax have different requirements with
|
|
||||||
# regards to the different settings, so it is possible that also other MathJax
|
|
||||||
# settings have to be changed when switching between the different MathJax
|
|
||||||
# versions.
|
|
||||||
# Possible values are: MathJax_2 and MathJax_3.
|
|
||||||
# The default value is: MathJax_2.
|
|
||||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
|
||||||
|
|
||||||
MATHJAX_VERSION = MathJax_2
|
|
||||||
|
|
||||||
# When MathJax is enabled you can set the default output format to be used for
|
# When MathJax is enabled you can set the default output format to be used for
|
||||||
# the MathJax output. For more details about the output format see MathJax
|
# the MathJax output. See the MathJax site (see:
|
||||||
# version 2 (see:
|
# http://docs.mathjax.org/en/latest/output.html) for more details.
|
||||||
# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3
|
|
||||||
# (see:
|
|
||||||
# http://docs.mathjax.org/en/latest/web/components/output.html).
|
|
||||||
# Possible values are: HTML-CSS (which is slower, but has the best
|
# Possible values are: HTML-CSS (which is slower, but has the best
|
||||||
# compatibility. This is the name for Mathjax version 2, for MathJax version 3
|
# compatibility), NativeMML (i.e. MathML) and SVG.
|
||||||
# this will be translated into chtml), NativeMML (i.e. MathML. Only supported
|
|
||||||
# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This
|
|
||||||
# is the name for Mathjax version 3, for MathJax version 2 this will be
|
|
||||||
# translated into HTML-CSS) and SVG.
|
|
||||||
# The default value is: HTML-CSS.
|
# The default value is: HTML-CSS.
|
||||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||||
|
|
||||||
@ -1686,29 +1623,22 @@ MATHJAX_FORMAT = HTML-CSS
|
|||||||
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
|
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
|
||||||
# Content Delivery Network so you can quickly see the result without installing
|
# Content Delivery Network so you can quickly see the result without installing
|
||||||
# MathJax. However, it is strongly recommended to install a local copy of
|
# MathJax. However, it is strongly recommended to install a local copy of
|
||||||
# MathJax from https://www.mathjax.org before deployment. The default value is:
|
# MathJax from https://www.mathjax.org before deployment.
|
||||||
# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2
|
# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2.
|
||||||
# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3
|
|
||||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||||
|
|
||||||
MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/
|
MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/
|
||||||
|
|
||||||
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
|
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
|
||||||
# extension names that should be enabled during MathJax rendering. For example
|
# extension names that should be enabled during MathJax rendering. For example
|
||||||
# for MathJax version 2 (see
|
|
||||||
# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions):
|
|
||||||
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
|
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
|
||||||
# For example for MathJax version 3 (see
|
|
||||||
# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html):
|
|
||||||
# MATHJAX_EXTENSIONS = ams
|
|
||||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
# 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
|
# 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
|
# of code that will be used on startup of the MathJax code. See the MathJax site
|
||||||
# (see:
|
# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
|
||||||
# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an
|
|
||||||
# example see the documentation.
|
# example see the documentation.
|
||||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||||
|
|
||||||
@ -1755,8 +1685,7 @@ SERVER_BASED_SEARCH = NO
|
|||||||
#
|
#
|
||||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||||
# (doxysearch.cgi) which are based on the open source search engine library
|
# (doxysearch.cgi) which are based on the open source search engine library
|
||||||
# Xapian (see:
|
# Xapian (see: https://xapian.org/).
|
||||||
# https://xapian.org/).
|
|
||||||
#
|
#
|
||||||
# See the section "External Indexing and Searching" for details.
|
# See the section "External Indexing and Searching" for details.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
@ -1769,9 +1698,8 @@ EXTERNAL_SEARCH = NO
|
|||||||
#
|
#
|
||||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||||
# (doxysearch.cgi) which are based on the open source search engine library
|
# (doxysearch.cgi) which are based on the open source search engine library
|
||||||
# Xapian (see:
|
# Xapian (see: https://xapian.org/). See the section "External Indexing and
|
||||||
# https://xapian.org/). See the section "External Indexing and Searching" for
|
# Searching" for details.
|
||||||
# details.
|
|
||||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||||
|
|
||||||
SEARCHENGINE_URL =
|
SEARCHENGINE_URL =
|
||||||
@ -1809,7 +1737,7 @@ EXTRA_SEARCH_MAPPINGS =
|
|||||||
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
|
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
GENERATE_LATEX = YES
|
GENERATE_LATEX = NO
|
||||||
|
|
||||||
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
|
# 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
|
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
|
||||||
@ -1880,31 +1808,29 @@ PAPER_TYPE = a4
|
|||||||
|
|
||||||
EXTRA_PACKAGES = amsmath
|
EXTRA_PACKAGES = amsmath
|
||||||
|
|
||||||
# The LATEX_HEADER tag can be used to specify a user-defined LaTeX header for
|
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
|
||||||
# the generated LaTeX document. The header should contain everything until the
|
# generated LaTeX document. The header should contain everything until the first
|
||||||
# first chapter. If it is left blank doxygen will generate a standard header. It
|
# chapter. If it is left blank doxygen will generate a standard header. See
|
||||||
# is highly recommended to start with a default header using
|
# section "Doxygen usage" for information on how to let doxygen write the
|
||||||
# doxygen -w latex new_header.tex new_footer.tex new_stylesheet.sty
|
# default header to a separate file.
|
||||||
# and then modify the file new_header.tex. See also section "Doxygen usage" for
|
|
||||||
# information on how to generate the default header that doxygen normally uses.
|
|
||||||
#
|
#
|
||||||
# Note: Only use a user-defined header if you know what you are doing!
|
# Note: Only use a user-defined header if you know what you are doing! The
|
||||||
# Note: The header is subject to change so you typically have to regenerate the
|
# following commands have a special meaning inside the header: $title,
|
||||||
# default header when upgrading to a newer version of doxygen. The following
|
# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
|
||||||
# commands have a special meaning inside the header (and footer): For a
|
# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
|
||||||
# description of the possible markers and block names see the documentation.
|
# 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.
|
# 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 user-defined LaTeX footer for
|
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
|
||||||
# the generated LaTeX document. The footer should contain everything after the
|
# generated LaTeX document. The footer should contain everything after the last
|
||||||
# last chapter. If it is left blank doxygen will generate a standard footer. See
|
# 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
|
# LATEX_HEADER for more information on how to generate a default footer and what
|
||||||
# special commands can be used inside the footer. See also section "Doxygen
|
# special commands can be used inside the footer.
|
||||||
# usage" for information on how to generate the default footer that doxygen
|
#
|
||||||
# normally uses. Note: Only use a user-defined footer if you know what you are
|
# Note: Only use a user-defined footer if you know what you are doing!
|
||||||
# doing!
|
|
||||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||||
|
|
||||||
LATEX_FOOTER =
|
LATEX_FOOTER =
|
||||||
@ -1949,7 +1875,8 @@ USE_PDFLATEX = YES
|
|||||||
|
|
||||||
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
|
# 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
|
# command to the generated LaTeX files. This will instruct LaTeX to keep running
|
||||||
# if errors occur, instead of asking the user for help.
|
# 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.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||||
|
|
||||||
@ -1962,6 +1889,16 @@ LATEX_BATCHMODE = NO
|
|||||||
|
|
||||||
LATEX_HIDE_INDICES = NO
|
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 = YES
|
||||||
|
|
||||||
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
|
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
|
||||||
# bibliography, e.g. plainnat, or ieeetr. See
|
# bibliography, e.g. plainnat, or ieeetr. See
|
||||||
# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
|
# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
|
||||||
@ -2042,6 +1979,16 @@ RTF_STYLESHEET_FILE =
|
|||||||
|
|
||||||
RTF_EXTENSIONS_FILE =
|
RTF_EXTENSIONS_FILE =
|
||||||
|
|
||||||
|
# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
|
||||||
|
# with syntax highlighting in the RTF output.
|
||||||
|
#
|
||||||
|
# Note that which sources are shown also depends on other settings such as
|
||||||
|
# SOURCE_BROWSER.
|
||||||
|
# The default value is: NO.
|
||||||
|
# This tag requires that the tag GENERATE_RTF is set to YES.
|
||||||
|
|
||||||
|
RTF_SOURCE_CODE = NO
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the man page output
|
# Configuration options related to the man page output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@ -2138,6 +2085,15 @@ GENERATE_DOCBOOK = NO
|
|||||||
|
|
||||||
DOCBOOK_OUTPUT = docbook
|
DOCBOOK_OUTPUT = docbook
|
||||||
|
|
||||||
|
# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
|
||||||
|
# program listings (including syntax highlighting and cross-referencing
|
||||||
|
# information) to the DOCBOOK output. Note that enabling this will significantly
|
||||||
|
# increase the size of the DOCBOOK output.
|
||||||
|
# The default value is: NO.
|
||||||
|
# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
|
||||||
|
|
||||||
|
DOCBOOK_PROGRAMLISTING = NO
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options for the AutoGen Definitions output
|
# Configuration options for the AutoGen Definitions output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@ -2427,31 +2383,9 @@ UML_LOOK = NO
|
|||||||
# but if the number exceeds 15, the total amount of fields shown is limited to
|
# but if the number exceeds 15, the total amount of fields shown is limited to
|
||||||
# 10.
|
# 10.
|
||||||
# Minimum value: 0, maximum value: 100, default value: 10.
|
# Minimum value: 0, maximum value: 100, default value: 10.
|
||||||
# This tag requires that the tag UML_LOOK is set to YES.
|
|
||||||
|
|
||||||
UML_LIMIT_NUM_FIELDS = 10
|
|
||||||
|
|
||||||
# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and
|
|
||||||
# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS
|
|
||||||
# tag is set to YES, doxygen will add type and arguments for attributes and
|
|
||||||
# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen
|
|
||||||
# will not generate fields with class member information in the UML graphs. The
|
|
||||||
# class diagrams will look similar to the default class diagrams but using UML
|
|
||||||
# notation for the relationships.
|
|
||||||
# Possible values are: NO, YES and NONE.
|
|
||||||
# The default value is: NO.
|
|
||||||
# This tag requires that the tag UML_LOOK is set to YES.
|
|
||||||
|
|
||||||
DOT_UML_DETAILS = NO
|
|
||||||
|
|
||||||
# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters
|
|
||||||
# to display on a single line. If the actual line length exceeds this threshold
|
|
||||||
# significantly it will wrapped across multiple lines. Some heuristics are apply
|
|
||||||
# to avoid ugly line breaks.
|
|
||||||
# Minimum value: 0, maximum value: 1000, default value: 17.
|
|
||||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||||
|
|
||||||
DOT_WRAP_THRESHOLD = 17
|
UML_LIMIT_NUM_FIELDS = 10
|
||||||
|
|
||||||
# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
|
# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
|
||||||
# collaboration graphs will show the relations between templates and their
|
# collaboration graphs will show the relations between templates and their
|
||||||
@ -2642,11 +2576,9 @@ DOT_MULTI_TARGETS = NO
|
|||||||
|
|
||||||
GENERATE_LEGEND = YES
|
GENERATE_LEGEND = YES
|
||||||
|
|
||||||
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate
|
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
|
||||||
# files that are used to generate the various graphs.
|
# files that are used to generate the various graphs.
|
||||||
#
|
|
||||||
# Note: This setting is not only used for dot files but also for msc temporary
|
|
||||||
# files.
|
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||||
|
|
||||||
DOT_CLEANUP = YES
|
DOT_CLEANUP = YES
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
FatFs License
|
|
||||||
|
|
||||||
FatFs has being developped as a personal project of the author, ChaN. It is free from the code anyone else wrote at current release. Following code block shows a copy of the FatFs license document that heading the source files.
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------/
|
|
||||||
/ FatFs - Generic FAT Filesystem Module Rx.xx /
|
|
||||||
/-----------------------------------------------------------------------------/
|
|
||||||
/
|
|
||||||
/ Copyright (C) 20xx, ChaN, all right reserved.
|
|
||||||
/
|
|
||||||
/ FatFs module is an open source software. Redistribution and use of FatFs in
|
|
||||||
/ source and binary forms, with or without modification, are permitted provided
|
|
||||||
/ that the following condition is met:
|
|
||||||
/
|
|
||||||
/ 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
/ this condition and the following disclaimer.
|
|
||||||
/
|
|
||||||
/ This software is provided by the copyright holder and contributors "AS IS"
|
|
||||||
/ and any warranties related to this software are DISCLAIMED.
|
|
||||||
/ The copyright owner or contributors be NOT LIABLE for any damages caused
|
|
||||||
/ by use of this software.
|
|
||||||
/----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
Therefore FatFs license is one of the BSD-style licenses, but there is a significant feature. FatFs is mainly intended for embedded systems. In order to extend the usability for commercial products, the redistributions of FatFs in binary form, such as embedded code, binary library and any forms without source code, do not need to include about FatFs in the documentations. This is equivalent to the 1-clause BSD license. Of course FatFs is compatible with the most of open source software licenses include GNU GPL. When you redistribute the FatFs source code with changes or create a fork, the license can also be changed to GNU GPL, BSD-style license or any open source software license that not conflict with FatFs license.
|
|
@ -1,5 +1,5 @@
|
|||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* Low level disk I/O module SKELETON for FatFs (C)ChaN, 2019 */
|
/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2019 */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* If a working storage control module is available, it should be */
|
/* If a working storage control module is available, it should be */
|
||||||
/* attached to the FatFs via a glue function rather than modifying it. */
|
/* attached to the FatFs via a glue function rather than modifying it. */
|
||||||
@ -12,8 +12,14 @@
|
|||||||
#include "shimatta_sdio_driver/shimatta_sdio.h"
|
#include "shimatta_sdio_driver/shimatta_sdio.h"
|
||||||
|
|
||||||
/* Definitions of physical drive number for each drive */
|
/* Definitions of physical drive number for each drive */
|
||||||
#define DEV_SD 0
|
#define DEV_SD 0 /* Example: Map MMC/SD card to physical drive 0*/
|
||||||
|
/*
|
||||||
|
DSTATUS SDIO_status();
|
||||||
|
DSTATUS SDIO_initialize();
|
||||||
|
DRESULT SDIO_disk_read(BYTE *buff, DWORD sector, UINT count);
|
||||||
|
DRESULT SDIO_disk_write(const BYTE *buff, DWORD sector, UINT count);
|
||||||
|
DRESULT SDIO_disk_ioctl(BYTE cmd, void* buff);
|
||||||
|
*/
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* Get Drive Status */
|
/* Get Drive Status */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
@ -110,3 +116,4 @@ DRESULT disk_ioctl (
|
|||||||
|
|
||||||
return RES_PARERR;
|
return RES_PARERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,208 +1,170 @@
|
|||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* A Sample Code of User Provided OS Dependent Functions for FatFs */
|
/* Sample Code of OS Dependent Functions for FatFs */
|
||||||
|
/* (C)ChaN, 2018 */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
#include <fatfs/ff.h>
|
#include <fatfs/ff.h>
|
||||||
|
|
||||||
|
|
||||||
#if FF_USE_LFN == 3 /* Use dynamic memory allocation */
|
#if FF_USE_LFN == 3 /* Dynamic memory allocation */
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* Allocate/Free a Memory Block */
|
/* Allocate a memory block */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include <stdlib.h> /* with POSIX API */
|
|
||||||
|
|
||||||
|
|
||||||
void* ff_memalloc ( /* Returns pointer to the allocated memory block (null if not enough core) */
|
void* ff_memalloc ( /* Returns pointer to the allocated memory block (null if not enough core) */
|
||||||
UINT msize /* Number of bytes to allocate */
|
UINT msize /* Number of bytes to allocate */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return malloc((size_t)msize); /* Allocate a new memory block */
|
return malloc(msize); /* Allocate a new memory block with POSIX API */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* Free a memory block */
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void ff_memfree (
|
void ff_memfree (
|
||||||
void* mblock /* Pointer to the memory block to free (no effect if null) */
|
void* mblock /* Pointer to the memory block to free (nothing to do if null) */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
free(mblock); /* Free the memory block */
|
free(mblock); /* Free the memory block with POSIX API */
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if FF_FS_REENTRANT /* Mutal exclusion */
|
#if FF_FS_REENTRANT /* Mutal exclusion */
|
||||||
/*------------------------------------------------------------------------*/
|
|
||||||
/* Definitions of Mutex */
|
|
||||||
/*------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#define OS_TYPE 0 /* 0:Win32, 1:uITRON4.0, 2:uC/OS-II, 3:FreeRTOS, 4:CMSIS-RTOS */
|
|
||||||
|
|
||||||
|
|
||||||
#if OS_TYPE == 0 /* Win32 */
|
|
||||||
#include <windows.h>
|
|
||||||
static HANDLE Mutex[FF_VOLUMES + 1]; /* Table of mutex handle */
|
|
||||||
|
|
||||||
#elif OS_TYPE == 1 /* uITRON */
|
|
||||||
#include "itron.h"
|
|
||||||
#include "kernel.h"
|
|
||||||
static mtxid Mutex[FF_VOLUMES + 1]; /* Table of mutex ID */
|
|
||||||
|
|
||||||
#elif OS_TYPE == 2 /* uc/OS-II */
|
|
||||||
#include "includes.h"
|
|
||||||
static OS_EVENT *Mutex[FF_VOLUMES + 1]; /* Table of mutex pinter */
|
|
||||||
|
|
||||||
#elif OS_TYPE == 3 /* FreeRTOS */
|
|
||||||
#include "FreeRTOS.h"
|
|
||||||
#include "semphr.h"
|
|
||||||
static SemaphoreHandle_t Mutex[FF_VOLUMES + 1]; /* Table of mutex handle */
|
|
||||||
|
|
||||||
#elif OS_TYPE == 4 /* CMSIS-RTOS */
|
|
||||||
#include "cmsis_os.h"
|
|
||||||
static osMutexId Mutex[FF_VOLUMES + 1]; /* Table of mutex ID */
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* Create a Mutex */
|
/* Create a Synchronization Object */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* This function is called in f_mount function to create a new mutex
|
/* This function is called in f_mount() function to create a new
|
||||||
/ or semaphore for the volume. When a 0 is returned, the f_mount function
|
/ synchronization object for the volume, such as semaphore and mutex.
|
||||||
/ fails with FR_INT_ERR.
|
/ When a 0 is returned, the f_mount() function fails with FR_INT_ERR.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int ff_mutex_create ( /* Returns 1:Function succeeded or 0:Could not create the mutex */
|
//const osMutexDef_t Mutex[FF_VOLUMES]; /* Table of CMSIS-RTOS mutex */
|
||||||
int vol /* Mutex ID: Volume mutex (0 to FF_VOLUMES - 1) or system mutex (FF_VOLUMES) */
|
|
||||||
|
|
||||||
|
int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create the sync object */
|
||||||
|
BYTE vol, /* Corresponding volume (logical drive number) */
|
||||||
|
FF_SYNC_t* sobj /* Pointer to return the created sync object */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if OS_TYPE == 0 /* Win32 */
|
/* Win32 */
|
||||||
Mutex[vol] = CreateMutex(NULL, FALSE, NULL);
|
*sobj = CreateMutex(NULL, FALSE, NULL);
|
||||||
return (int)(Mutex[vol] != INVALID_HANDLE_VALUE);
|
return (int)(*sobj != INVALID_HANDLE_VALUE);
|
||||||
|
|
||||||
#elif OS_TYPE == 1 /* uITRON */
|
/* uITRON */
|
||||||
T_CMTX cmtx = {TA_TPRI,1};
|
// T_CSEM csem = {TA_TPRI,1,1};
|
||||||
|
// *sobj = acre_sem(&csem);
|
||||||
|
// return (int)(*sobj > 0);
|
||||||
|
|
||||||
Mutex[vol] = acre_mtx(&cmtx);
|
/* uC/OS-II */
|
||||||
return (int)(Mutex[vol] > 0);
|
// OS_ERR err;
|
||||||
|
// *sobj = OSMutexCreate(0, &err);
|
||||||
|
// return (int)(err == OS_NO_ERR);
|
||||||
|
|
||||||
#elif OS_TYPE == 2 /* uC/OS-II */
|
/* FreeRTOS */
|
||||||
OS_ERR err;
|
// *sobj = xSemaphoreCreateMutex();
|
||||||
|
// return (int)(*sobj != NULL);
|
||||||
|
|
||||||
Mutex[vol] = OSMutexCreate(0, &err);
|
/* CMSIS-RTOS */
|
||||||
return (int)(err == OS_NO_ERR);
|
// *sobj = osMutexCreate(&Mutex[vol]);
|
||||||
|
// return (int)(*sobj != NULL);
|
||||||
#elif OS_TYPE == 3 /* FreeRTOS */
|
|
||||||
Mutex[vol] = xSemaphoreCreateMutex();
|
|
||||||
return (int)(Mutex[vol] != NULL);
|
|
||||||
|
|
||||||
#elif OS_TYPE == 4 /* CMSIS-RTOS */
|
|
||||||
osMutexDef(cmsis_os_mutex);
|
|
||||||
|
|
||||||
Mutex[vol] = osMutexCreate(osMutex(cmsis_os_mutex));
|
|
||||||
return (int)(Mutex[vol] != NULL);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* Delete a Mutex */
|
/* Delete a Synchronization Object */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* This function is called in f_mount function to delete a mutex or
|
/* This function is called in f_mount() function to delete a synchronization
|
||||||
/ semaphore of the volume created with ff_mutex_create function.
|
/ object that created with ff_cre_syncobj() function. When a 0 is returned,
|
||||||
|
/ the f_mount() function fails with FR_INT_ERR.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ff_mutex_delete ( /* Returns 1:Function succeeded or 0:Could not delete due to an error */
|
int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to an error */
|
||||||
int vol /* Mutex ID: Volume mutex (0 to FF_VOLUMES - 1) or system mutex (FF_VOLUMES) */
|
FF_SYNC_t sobj /* Sync object tied to the logical drive to be deleted */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if OS_TYPE == 0 /* Win32 */
|
/* Win32 */
|
||||||
CloseHandle(Mutex[vol]);
|
return (int)CloseHandle(sobj);
|
||||||
|
|
||||||
#elif OS_TYPE == 1 /* uITRON */
|
/* uITRON */
|
||||||
del_mtx(Mutex[vol]);
|
// return (int)(del_sem(sobj) == E_OK);
|
||||||
|
|
||||||
#elif OS_TYPE == 2 /* uC/OS-II */
|
/* uC/OS-II */
|
||||||
OS_ERR err;
|
// OS_ERR err;
|
||||||
|
// OSMutexDel(sobj, OS_DEL_ALWAYS, &err);
|
||||||
|
// return (int)(err == OS_NO_ERR);
|
||||||
|
|
||||||
OSMutexDel(Mutex[vol], OS_DEL_ALWAYS, &err);
|
/* FreeRTOS */
|
||||||
|
// vSemaphoreDelete(sobj);
|
||||||
|
// return 1;
|
||||||
|
|
||||||
#elif OS_TYPE == 3 /* FreeRTOS */
|
/* CMSIS-RTOS */
|
||||||
vSemaphoreDelete(Mutex[vol]);
|
// return (int)(osMutexDelete(sobj) == osOK);
|
||||||
|
|
||||||
#elif OS_TYPE == 4 /* CMSIS-RTOS */
|
|
||||||
osMutexDelete(Mutex[vol]);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* Request a Grant to Access the Volume */
|
/* Request Grant to Access the Volume */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* This function is called on enter file functions to lock the volume.
|
/* This function is called on entering file functions to lock the volume.
|
||||||
/ When a 0 is returned, the file function fails with FR_TIMEOUT.
|
/ When a 0 is returned, the file function fails with FR_TIMEOUT.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int ff_mutex_take ( /* Returns 1:Succeeded or 0:Timeout */
|
int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a grant */
|
||||||
int vol /* Mutex ID: Volume mutex (0 to FF_VOLUMES - 1) or system mutex (FF_VOLUMES) */
|
FF_SYNC_t sobj /* Sync object to wait */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if OS_TYPE == 0 /* Win32 */
|
/* Win32 */
|
||||||
return (int)(WaitForSingleObject(Mutex[vol], FF_FS_TIMEOUT) == WAIT_OBJECT_0);
|
return (int)(WaitForSingleObject(sobj, FF_FS_TIMEOUT) == WAIT_OBJECT_0);
|
||||||
|
|
||||||
#elif OS_TYPE == 1 /* uITRON */
|
/* uITRON */
|
||||||
return (int)(tloc_mtx(Mutex[vol], FF_FS_TIMEOUT) == E_OK);
|
// return (int)(wai_sem(sobj) == E_OK);
|
||||||
|
|
||||||
#elif OS_TYPE == 2 /* uC/OS-II */
|
/* uC/OS-II */
|
||||||
OS_ERR err;
|
// OS_ERR err;
|
||||||
|
// OSMutexPend(sobj, FF_FS_TIMEOUT, &err));
|
||||||
|
// return (int)(err == OS_NO_ERR);
|
||||||
|
|
||||||
OSMutexPend(Mutex[vol], FF_FS_TIMEOUT, &err));
|
/* FreeRTOS */
|
||||||
return (int)(err == OS_NO_ERR);
|
// return (int)(xSemaphoreTake(sobj, FF_FS_TIMEOUT) == pdTRUE);
|
||||||
|
|
||||||
#elif OS_TYPE == 3 /* FreeRTOS */
|
/* CMSIS-RTOS */
|
||||||
return (int)(xSemaphoreTake(Mutex[vol], FF_FS_TIMEOUT) == pdTRUE);
|
// return (int)(osMutexWait(sobj, FF_FS_TIMEOUT) == osOK);
|
||||||
|
|
||||||
#elif OS_TYPE == 4 /* CMSIS-RTOS */
|
|
||||||
return (int)(osMutexWait(Mutex[vol], FF_FS_TIMEOUT) == osOK);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* Release a Grant to Access the Volume */
|
/* Release Grant to Access the Volume */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* This function is called on leave file functions to unlock the volume.
|
/* This function is called on leaving file functions to unlock the volume.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ff_mutex_give (
|
void ff_rel_grant (
|
||||||
int vol /* Mutex ID: Volume mutex (0 to FF_VOLUMES - 1) or system mutex (FF_VOLUMES) */
|
FF_SYNC_t sobj /* Sync object to be signaled */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if OS_TYPE == 0 /* Win32 */
|
/* Win32 */
|
||||||
ReleaseMutex(Mutex[vol]);
|
ReleaseMutex(sobj);
|
||||||
|
|
||||||
#elif OS_TYPE == 1 /* uITRON */
|
/* uITRON */
|
||||||
unl_mtx(Mutex[vol]);
|
// sig_sem(sobj);
|
||||||
|
|
||||||
#elif OS_TYPE == 2 /* uC/OS-II */
|
/* uC/OS-II */
|
||||||
OSMutexPost(Mutex[vol]);
|
// OSMutexPost(sobj);
|
||||||
|
|
||||||
#elif OS_TYPE == 3 /* FreeRTOS */
|
/* FreeRTOS */
|
||||||
xSemaphoreGive(Mutex[vol]);
|
// xSemaphoreGive(sobj);
|
||||||
|
|
||||||
#elif OS_TYPE == 4 /* CMSIS-RTOS */
|
/* CMSIS-RTOS */
|
||||||
osMutexRelease(Mutex[vol]);
|
// osMutexRelease(sobj);
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FF_FS_REENTRANT */
|
#endif
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* Unicode Handling Functions for FatFs R0.13 and Later */
|
/* Unicode handling functions for FatFs R0.13+ */
|
||||||
/*------------------------------------------------------------------------*/
|
|
||||||
/* This module will occupy a huge memory in the .rodata section when the */
|
|
||||||
/* FatFs is configured for LFN with DBCS. If the system has a Unicode */
|
|
||||||
/* library for the code conversion, this module should be modified to use */
|
|
||||||
/* it to avoid silly memory consumption. */
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* This module will occupy a huge memory in the .const section when the /
|
||||||
|
/ FatFs is configured for LFN with DBCS. If the system has any Unicode /
|
||||||
|
/ utilitiy for the code conversion, this module should be modified to use /
|
||||||
|
/ that function to avoid silly memory consumption. /
|
||||||
|
/-------------------------------------------------------------------------*/
|
||||||
/*
|
/*
|
||||||
/ Copyright (C) 2022, ChaN, all right reserved.
|
/ Copyright (C) 2014, ChaN, all right reserved.
|
||||||
/
|
/
|
||||||
/ FatFs module is an open source software. Redistribution and use of FatFs in
|
/ FatFs module is an open source software. Redistribution and use of FatFs in
|
||||||
/ source and binary forms, with or without modification, are permitted provided
|
/ source and binary forms, with or without modification, are permitted provided
|
||||||
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include <fatfs/ff.h>
|
#include <fatfs/ff.h>
|
||||||
|
|
||||||
#if FF_USE_LFN != 0 /* This module will be blanked if in non-LFN configuration */
|
#if FF_USE_LFN /* This module will be blanked if non-LFN configuration */
|
||||||
|
|
||||||
#define MERGE2(a, b) a ## b
|
#define MERGE2(a, b) a ## b
|
||||||
#define CVTBL(tbl, cp) MERGE2(tbl, cp)
|
#define CVTBL(tbl, cp) MERGE2(tbl, cp)
|
||||||
@ -15214,8 +15214,8 @@ static const WCHAR uc869[] = { /* CP869(Greek 2) to Unicode conversion table */
|
|||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* OEM <==> Unicode Conversions for Static Code Page Configuration with */
|
/* OEM <==> Unicode conversions for static code page configuration */
|
||||||
/* SBCS Fixed Code Page */
|
/* SBCS fixed code page */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#if FF_CODE_PAGE != 0 && FF_CODE_PAGE < 900
|
#if FF_CODE_PAGE != 0 && FF_CODE_PAGE < 900
|
||||||
@ -15225,7 +15225,7 @@ WCHAR ff_uni2oem ( /* Returns OEM code character, zero on error */
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
WCHAR c = 0;
|
WCHAR c = 0;
|
||||||
const WCHAR* p = CVTBL(uc, FF_CODE_PAGE);
|
const WCHAR *p = CVTBL(uc, FF_CODE_PAGE);
|
||||||
|
|
||||||
|
|
||||||
if (uni < 0x80) { /* ASCII? */
|
if (uni < 0x80) { /* ASCII? */
|
||||||
@ -15247,7 +15247,7 @@ WCHAR ff_oem2uni ( /* Returns Unicode character in UTF-16, zero on error */
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
WCHAR c = 0;
|
WCHAR c = 0;
|
||||||
const WCHAR* p = CVTBL(uc, FF_CODE_PAGE);
|
const WCHAR *p = CVTBL(uc, FF_CODE_PAGE);
|
||||||
|
|
||||||
|
|
||||||
if (oem < 0x80) { /* ASCII? */
|
if (oem < 0x80) { /* ASCII? */
|
||||||
@ -15267,8 +15267,8 @@ WCHAR ff_oem2uni ( /* Returns Unicode character in UTF-16, zero on error */
|
|||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* OEM <==> Unicode Conversions for Static Code Page Configuration with */
|
/* OEM <==> Unicode conversions for static code page configuration */
|
||||||
/* DBCS Fixed Code Page */
|
/* DBCS fixed code page */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#if FF_CODE_PAGE >= 900
|
#if FF_CODE_PAGE >= 900
|
||||||
@ -15277,7 +15277,7 @@ WCHAR ff_uni2oem ( /* Returns OEM code character, zero on error */
|
|||||||
WORD cp /* Code page for the conversion */
|
WORD cp /* Code page for the conversion */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const WCHAR* p;
|
const WCHAR *p;
|
||||||
WCHAR c = 0, uc;
|
WCHAR c = 0, uc;
|
||||||
UINT i = 0, n, li, hi;
|
UINT i = 0, n, li, hi;
|
||||||
|
|
||||||
@ -15313,7 +15313,7 @@ WCHAR ff_oem2uni ( /* Returns Unicode character in UTF-16, zero on error */
|
|||||||
WORD cp /* Code page for the conversion */
|
WORD cp /* Code page for the conversion */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const WCHAR* p;
|
const WCHAR *p;
|
||||||
WCHAR c = 0;
|
WCHAR c = 0;
|
||||||
UINT i = 0, n, li, hi;
|
UINT i = 0, n, li, hi;
|
||||||
|
|
||||||
@ -15346,7 +15346,7 @@ WCHAR ff_oem2uni ( /* Returns Unicode character in UTF-16, zero on error */
|
|||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* OEM <==> Unicode Conversions for Dynamic Code Page Configuration */
|
/* OEM <==> Unicode conversions for dynamic code page configuration */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#if FF_CODE_PAGE == 0
|
#if FF_CODE_PAGE == 0
|
||||||
@ -15360,7 +15360,7 @@ WCHAR ff_uni2oem ( /* Returns OEM code character, zero on error */
|
|||||||
WORD cp /* Code page for the conversion */
|
WORD cp /* Code page for the conversion */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const WCHAR* p;
|
const WCHAR *p;
|
||||||
WCHAR c = 0, uc;
|
WCHAR c = 0, uc;
|
||||||
UINT i, n, li, hi;
|
UINT i, n, li, hi;
|
||||||
|
|
||||||
@ -15412,7 +15412,7 @@ WCHAR ff_oem2uni ( /* Returns Unicode character in UTF-16, zero on error */
|
|||||||
WORD cp /* Code page for the conversion */
|
WORD cp /* Code page for the conversion */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const WCHAR* p;
|
const WCHAR *p;
|
||||||
WCHAR c = 0;
|
WCHAR c = 0;
|
||||||
UINT i, n, li, hi;
|
UINT i, n, li, hi;
|
||||||
|
|
||||||
@ -15458,14 +15458,14 @@ WCHAR ff_oem2uni ( /* Returns Unicode character in UTF-16, zero on error */
|
|||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* Unicode Up-case Conversion */
|
/* Unicode up-case conversion */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
DWORD ff_wtoupper ( /* Returns up-converted code point */
|
DWORD ff_wtoupper ( /* Returns up-converted code point */
|
||||||
DWORD uni /* Unicode code point to be up-converted */
|
DWORD uni /* Unicode code point to be up-converted */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const WORD* p;
|
const WORD *p;
|
||||||
WORD uc, bc, nc, cmd;
|
WORD uc, bc, nc, cmd;
|
||||||
static const WORD cvt1[] = { /* Compressed up conversion table for U+0000 - U+0FFF */
|
static const WORD cvt1[] = { /* Compressed up conversion table for U+0000 - U+0FFF */
|
||||||
/* Basic Latin */
|
/* Basic Latin */
|
||||||
@ -15590,4 +15590,4 @@ DWORD ff_wtoupper ( /* Returns up-converted code point */
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* #if FF_USE_LFN != 0 */
|
#endif /* #if FF_USE_LFN */
|
||||||
|
@ -1,46 +1,18 @@
|
|||||||
/* Reflow Oven Controller
|
|
||||||
*
|
|
||||||
* Copyright (C) 2021 Mario Hüttel <mario.huettel@gmx.net>
|
|
||||||
*
|
|
||||||
* This file is part of the Reflow Oven Controller Project.
|
|
||||||
*
|
|
||||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with the reflow oven controller project.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @addtogroup hw-version-detect
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <reflow-controller/hw-version-detect.h>
|
#include <reflow-controller/hw-version-detect.h>
|
||||||
#include <stm-periph/rcc-manager.h>
|
#include <stm-periph/rcc-manager.h>
|
||||||
#include <stm32/stm32f4xx.h>
|
#include <stm32/stm32f4xx.h>
|
||||||
|
|
||||||
#if HW_REV_DETECT_PIN_LOW > HW_REV_DETECT_PIN_HIGH
|
#define HW_REV_DETECT_GPIO GPIOE
|
||||||
#error Configuration error for Hardware derection pins. Lowest position must be less than the highest pin position.
|
#define HW_REV_DETECT_RCC_FIELD RCC_AHB1ENR_GPIOEEN
|
||||||
#endif
|
#define HW_REV_DETECT_PIN_LOW (8U)
|
||||||
|
#define HW_REV_DETECT_PIN_HIGH (15U)
|
||||||
|
|
||||||
enum hw_revision get_pcb_hardware_version(void)
|
enum hw_revision get_pcb_hardware_version(void)
|
||||||
{
|
{
|
||||||
uint8_t current_pin;
|
uint8_t current_pin;
|
||||||
uint16_t port_bitmask = 0U; /* Use uint16_t because a port can have 16 IOs max. */
|
uint16_t port_bitmask = 0U;
|
||||||
const uint16_t highest_bit_mask = (1 << (HW_REV_DETECT_PIN_HIGH - HW_REV_DETECT_PIN_LOW));
|
|
||||||
static enum hw_revision revision = HW_REV_NOT_DETECTED;
|
static enum hw_revision revision = HW_REV_NOT_DETECTED;
|
||||||
|
|
||||||
/* If the revision has been previously detected,
|
|
||||||
* just return it and don't do the whole detection stuff
|
|
||||||
*/
|
|
||||||
if (revision != HW_REV_NOT_DETECTED)
|
if (revision != HW_REV_NOT_DETECTED)
|
||||||
return revision;
|
return revision;
|
||||||
|
|
||||||
@ -53,15 +25,12 @@ enum hw_revision get_pcb_hardware_version(void)
|
|||||||
HW_REV_DETECT_GPIO->PUPDR |= PULLUP(current_pin);
|
HW_REV_DETECT_GPIO->PUPDR |= PULLUP(current_pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop again and read in the pin mask.
|
/* Loop again and read in the pin mask */
|
||||||
* Because we use GND-Shorts on the pins to detect the version, the pins are read inverted.
|
|
||||||
*/
|
|
||||||
for (current_pin = HW_REV_DETECT_PIN_LOW; current_pin <= HW_REV_DETECT_PIN_HIGH; current_pin++) {
|
for (current_pin = HW_REV_DETECT_PIN_LOW; current_pin <= HW_REV_DETECT_PIN_HIGH; current_pin++) {
|
||||||
port_bitmask >>= 1;
|
port_bitmask >>= 1;
|
||||||
port_bitmask |= (HW_REV_DETECT_GPIO->IDR & (1 << current_pin)) ? 0x0 : highest_bit_mask;
|
port_bitmask |= (HW_REV_DETECT_GPIO->IDR & (1 << current_pin)) ? 0x0 : 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Resolve the read in bitmask to a hardware version */
|
|
||||||
switch (port_bitmask) {
|
switch (port_bitmask) {
|
||||||
case 0U:
|
case 0U:
|
||||||
revision = HW_REV_V1_2;
|
revision = HW_REV_V1_2;
|
||||||
@ -69,9 +38,6 @@ enum hw_revision get_pcb_hardware_version(void)
|
|||||||
case 1U:
|
case 1U:
|
||||||
revision = HW_REV_V1_3;
|
revision = HW_REV_V1_3;
|
||||||
break;
|
break;
|
||||||
case 2U:
|
|
||||||
revision = HW_REV_V1_3_1;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
revision = HW_REV_ERROR;
|
revision = HW_REV_ERROR;
|
||||||
}
|
}
|
||||||
@ -80,5 +46,3 @@ enum hw_revision get_pcb_hardware_version(void)
|
|||||||
|
|
||||||
return revision;
|
return revision;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/*----------------------------------------------------------------------------/
|
/*----------------------------------------------------------------------------/
|
||||||
/ FatFs - Generic FAT Filesystem module R0.15 /
|
/ FatFs - Generic FAT Filesystem module R0.14 /
|
||||||
/-----------------------------------------------------------------------------/
|
/-----------------------------------------------------------------------------/
|
||||||
/
|
/
|
||||||
/ Copyright (C) 2022, ChaN, all right reserved.
|
/ Copyright (C) 2019, ChaN, all right reserved.
|
||||||
/
|
/
|
||||||
/ FatFs module is an open source software. Redistribution and use of FatFs in
|
/ FatFs module is an open source software. Redistribution and use of FatFs in
|
||||||
/ source and binary forms, with or without modification, are permitted provided
|
/ source and binary forms, with or without modification, are permitted provided
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifndef FF_DEFINED
|
#ifndef FF_DEFINED
|
||||||
#define FF_DEFINED 80286 /* Revision ID */
|
#define FF_DEFINED 86606 /* Revision ID */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -35,14 +35,10 @@ extern "C" {
|
|||||||
|
|
||||||
/* Integer types used for FatFs API */
|
/* Integer types used for FatFs API */
|
||||||
|
|
||||||
#if defined(_WIN32) /* Windows VC++ (for development only) */
|
#if defined(_WIN32) /* Main development platform */
|
||||||
#define FF_INTDEF 2
|
#define FF_INTDEF 2
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
typedef unsigned __int64 QWORD;
|
typedef unsigned __int64 QWORD;
|
||||||
#include <float.h>
|
|
||||||
#define isnan(v) _isnan(v)
|
|
||||||
#define isinf(v) (!_finite(v))
|
|
||||||
|
|
||||||
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) /* C99 or later */
|
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) /* C99 or later */
|
||||||
#define FF_INTDEF 2
|
#define FF_INTDEF 2
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -52,7 +48,6 @@ typedef uint16_t WORD; /* 16-bit unsigned integer */
|
|||||||
typedef uint32_t DWORD; /* 32-bit unsigned integer */
|
typedef uint32_t DWORD; /* 32-bit unsigned integer */
|
||||||
typedef uint64_t QWORD; /* 64-bit unsigned integer */
|
typedef uint64_t QWORD; /* 64-bit unsigned integer */
|
||||||
typedef WORD WCHAR; /* UTF-16 character type */
|
typedef WORD WCHAR; /* UTF-16 character type */
|
||||||
|
|
||||||
#else /* Earlier than C99 */
|
#else /* Earlier than C99 */
|
||||||
#define FF_INTDEF 1
|
#define FF_INTDEF 1
|
||||||
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
|
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
|
||||||
@ -63,6 +58,53 @@ typedef WORD WCHAR; /* UTF-16 character type */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Definitions of volume management */
|
||||||
|
|
||||||
|
#if FF_MULTI_PARTITION /* Multiple partition configuration */
|
||||||
|
typedef struct {
|
||||||
|
BYTE pd; /* Physical drive number */
|
||||||
|
BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */
|
||||||
|
} PARTITION;
|
||||||
|
extern PARTITION VolToPart[]; /* Volume - Partition mapping table */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FF_STR_VOLUME_ID
|
||||||
|
#ifndef FF_VOLUME_STRS
|
||||||
|
extern const char* VolumeStr[FF_VOLUMES]; /* User defied volume ID */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Type of path name strings on FatFs API */
|
||||||
|
|
||||||
|
#ifndef _INC_TCHAR
|
||||||
|
#define _INC_TCHAR
|
||||||
|
|
||||||
|
#if FF_USE_LFN && FF_LFN_UNICODE == 1 /* Unicode in UTF-16 encoding */
|
||||||
|
typedef WCHAR TCHAR;
|
||||||
|
#define _T(x) L ## x
|
||||||
|
#define _TEXT(x) L ## x
|
||||||
|
#elif FF_USE_LFN && FF_LFN_UNICODE == 2 /* Unicode in UTF-8 encoding */
|
||||||
|
typedef char TCHAR;
|
||||||
|
#define _T(x) u8 ## x
|
||||||
|
#define _TEXT(x) u8 ## x
|
||||||
|
#elif FF_USE_LFN && FF_LFN_UNICODE == 3 /* Unicode in UTF-32 encoding */
|
||||||
|
typedef DWORD TCHAR;
|
||||||
|
#define _T(x) U ## x
|
||||||
|
#define _TEXT(x) U ## x
|
||||||
|
#elif FF_USE_LFN && (FF_LFN_UNICODE < 0 || FF_LFN_UNICODE > 3)
|
||||||
|
#error Wrong FF_LFN_UNICODE setting
|
||||||
|
#else /* ANSI/OEM code in SBCS/DBCS */
|
||||||
|
typedef char TCHAR;
|
||||||
|
#define _T(x) x
|
||||||
|
#define _TEXT(x) x
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Type of file size and LBA variables */
|
/* Type of file size and LBA variables */
|
||||||
|
|
||||||
#if FF_FS_EXFAT
|
#if FF_FS_EXFAT
|
||||||
@ -85,57 +127,14 @@ typedef DWORD LBA_t;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Type of path name strings on FatFs API (TCHAR) */
|
|
||||||
|
|
||||||
#if FF_USE_LFN && FF_LFN_UNICODE == 1 /* Unicode in UTF-16 encoding */
|
|
||||||
typedef WCHAR TCHAR;
|
|
||||||
#define _T(x) L ## x
|
|
||||||
#define _TEXT(x) L ## x
|
|
||||||
#elif FF_USE_LFN && FF_LFN_UNICODE == 2 /* Unicode in UTF-8 encoding */
|
|
||||||
typedef char TCHAR;
|
|
||||||
#define _T(x) u8 ## x
|
|
||||||
#define _TEXT(x) u8 ## x
|
|
||||||
#elif FF_USE_LFN && FF_LFN_UNICODE == 3 /* Unicode in UTF-32 encoding */
|
|
||||||
typedef DWORD TCHAR;
|
|
||||||
#define _T(x) U ## x
|
|
||||||
#define _TEXT(x) U ## x
|
|
||||||
#elif FF_USE_LFN && (FF_LFN_UNICODE < 0 || FF_LFN_UNICODE > 3)
|
|
||||||
#error Wrong FF_LFN_UNICODE setting
|
|
||||||
#else /* ANSI/OEM code in SBCS/DBCS */
|
|
||||||
typedef char TCHAR;
|
|
||||||
#define _T(x) x
|
|
||||||
#define _TEXT(x) x
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Definitions of volume management */
|
|
||||||
|
|
||||||
#if FF_MULTI_PARTITION /* Multiple partition configuration */
|
|
||||||
typedef struct {
|
|
||||||
BYTE pd; /* Physical drive number */
|
|
||||||
BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */
|
|
||||||
} PARTITION;
|
|
||||||
extern PARTITION VolToPart[]; /* Volume - Partition mapping table */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if FF_STR_VOLUME_ID
|
|
||||||
#ifndef FF_VOLUME_STRS
|
|
||||||
extern const char* VolumeStr[FF_VOLUMES]; /* User defied volume ID */
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Filesystem object structure (FATFS) */
|
/* Filesystem object structure (FATFS) */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BYTE fs_type; /* Filesystem type (0:not mounted) */
|
BYTE fs_type; /* Filesystem type (0:not mounted) */
|
||||||
BYTE pdrv; /* Volume hosting physical drive */
|
BYTE pdrv; /* Associated physical drive */
|
||||||
BYTE ldrv; /* Logical drive number (used only when FF_FS_REENTRANT) */
|
|
||||||
BYTE n_fats; /* Number of FATs (1 or 2) */
|
BYTE n_fats; /* Number of FATs (1 or 2) */
|
||||||
BYTE wflag; /* win[] status (b0:dirty) */
|
BYTE wflag; /* win[] flag (b0:dirty) */
|
||||||
BYTE fsi_flag; /* FSINFO status (b7:disabled, b0:dirty) */
|
BYTE fsi_flag; /* FSINFO flags (b7:disabled, b0:dirty) */
|
||||||
WORD id; /* Volume mount ID */
|
WORD id; /* Volume mount ID */
|
||||||
WORD n_rootdir; /* Number of root directory entries (FAT12/16) */
|
WORD n_rootdir; /* Number of root directory entries (FAT12/16) */
|
||||||
WORD csize; /* Cluster size [sectors] */
|
WORD csize; /* Cluster size [sectors] */
|
||||||
@ -148,6 +147,9 @@ typedef struct {
|
|||||||
#if FF_FS_EXFAT
|
#if FF_FS_EXFAT
|
||||||
BYTE* dirbuf; /* Directory entry block scratchpad buffer for exFAT */
|
BYTE* dirbuf; /* Directory entry block scratchpad buffer for exFAT */
|
||||||
#endif
|
#endif
|
||||||
|
#if FF_FS_REENTRANT
|
||||||
|
FF_SYNC_t sobj; /* Identifier of sync object */
|
||||||
|
#endif
|
||||||
#if !FF_FS_READONLY
|
#if !FF_FS_READONLY
|
||||||
DWORD last_clst; /* Last allocated cluster */
|
DWORD last_clst; /* Last allocated cluster */
|
||||||
DWORD free_clst; /* Number of free clusters */
|
DWORD free_clst; /* Number of free clusters */
|
||||||
@ -161,10 +163,10 @@ typedef struct {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
DWORD n_fatent; /* Number of FAT entries (number of clusters + 2) */
|
DWORD n_fatent; /* Number of FAT entries (number of clusters + 2) */
|
||||||
DWORD fsize; /* Number of sectors per FAT */
|
DWORD fsize; /* Size of an FAT [sectors] */
|
||||||
LBA_t volbase; /* Volume base sector */
|
LBA_t volbase; /* Volume base sector */
|
||||||
LBA_t fatbase; /* FAT base sector */
|
LBA_t fatbase; /* FAT base sector */
|
||||||
LBA_t dirbase; /* Root directory base sector (FAT12/16) or cluster (FAT32/exFAT) */
|
LBA_t dirbase; /* Root directory base sector/cluster */
|
||||||
LBA_t database; /* Data base sector */
|
LBA_t database; /* Data base sector */
|
||||||
#if FF_FS_EXFAT
|
#if FF_FS_EXFAT
|
||||||
LBA_t bitbase; /* Allocation bitmap base sector */
|
LBA_t bitbase; /* Allocation bitmap base sector */
|
||||||
@ -179,7 +181,7 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FATFS* fs; /* Pointer to the hosting volume of this object */
|
FATFS* fs; /* Pointer to the hosting volume of this object */
|
||||||
WORD id; /* Hosting volume's mount ID */
|
WORD id; /* Hosting volume mount ID */
|
||||||
BYTE attr; /* Object attribute */
|
BYTE attr; /* Object attribute */
|
||||||
BYTE stat; /* Object chain status (b1-0: =0:not contiguous, =2:contiguous, =3:fragmented in this session, b2:sub-directory stretched) */
|
BYTE stat; /* Object chain status (b1-0: =0:not contiguous, =2:contiguous, =3:fragmented in this session, b2:sub-directory stretched) */
|
||||||
DWORD sclust; /* Object data start cluster (0:no cluster or root directory) */
|
DWORD sclust; /* Object data start cluster (0:no cluster or root directory) */
|
||||||
@ -248,7 +250,7 @@ typedef struct {
|
|||||||
WORD ftime; /* Modified time */
|
WORD ftime; /* Modified time */
|
||||||
BYTE fattrib; /* File attribute */
|
BYTE fattrib; /* File attribute */
|
||||||
#if FF_USE_LFN
|
#if FF_USE_LFN
|
||||||
TCHAR altname[FF_SFN_BUF + 1];/* Alternative file name */
|
TCHAR altname[FF_SFN_BUF + 1];/* Altenative file name */
|
||||||
TCHAR fname[FF_LFN_BUF + 1]; /* Primary file name */
|
TCHAR fname[FF_LFN_BUF + 1]; /* Primary file name */
|
||||||
#else
|
#else
|
||||||
TCHAR fname[12 + 1]; /* File name */
|
TCHAR fname[12 + 1]; /* File name */
|
||||||
@ -296,10 +298,8 @@ typedef enum {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------*/
|
|
||||||
/* FatFs Module Application Interface */
|
|
||||||
/*--------------------------------------------------------------*/
|
/*--------------------------------------------------------------*/
|
||||||
|
/* FatFs module application interface */
|
||||||
|
|
||||||
FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */
|
FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */
|
||||||
FRESULT f_close (FIL* fp); /* Close an open file object */
|
FRESULT f_close (FIL* fp); /* Close an open file object */
|
||||||
@ -336,8 +336,6 @@ int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */
|
|||||||
int f_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */
|
int f_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */
|
||||||
TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */
|
TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */
|
||||||
|
|
||||||
/* Some API fucntions are implemented as macro */
|
|
||||||
|
|
||||||
#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
|
#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
|
||||||
#define f_error(fp) ((fp)->err)
|
#define f_error(fp) ((fp)->err)
|
||||||
#define f_tell(fp) ((fp)->fptr)
|
#define f_tell(fp) ((fp)->fptr)
|
||||||
@ -347,47 +345,46 @@ TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the fil
|
|||||||
#define f_rmdir(path) f_unlink(path)
|
#define f_rmdir(path) f_unlink(path)
|
||||||
#define f_unmount(path) f_mount(0, path, 0)
|
#define f_unmount(path) f_mount(0, path, 0)
|
||||||
|
|
||||||
|
#ifndef EOF
|
||||||
|
#define EOF (-1)
|
||||||
|
|
||||||
/*--------------------------------------------------------------*/
|
|
||||||
/* Additional Functions */
|
|
||||||
/*--------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* RTC function (provided by user) */
|
|
||||||
#if !FF_FS_READONLY && !FF_FS_NORTC
|
|
||||||
DWORD get_fattime (void); /* Get current time */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* LFN support functions (defined in ffunicode.c) */
|
|
||||||
|
|
||||||
#if FF_USE_LFN >= 1
|
|
||||||
|
/*--------------------------------------------------------------*/
|
||||||
|
/* Additional user defined functions */
|
||||||
|
|
||||||
|
/* RTC function */
|
||||||
|
#if !FF_FS_READONLY && !FF_FS_NORTC
|
||||||
|
DWORD get_fattime (void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* LFN support functions */
|
||||||
|
#if FF_USE_LFN >= 1 /* Code conversion (defined in unicode.c) */
|
||||||
WCHAR ff_oem2uni (WCHAR oem, WORD cp); /* OEM code to Unicode conversion */
|
WCHAR ff_oem2uni (WCHAR oem, WORD cp); /* OEM code to Unicode conversion */
|
||||||
WCHAR ff_uni2oem (DWORD uni, WORD cp); /* Unicode to OEM code conversion */
|
WCHAR ff_uni2oem (DWORD uni, WORD cp); /* Unicode to OEM code conversion */
|
||||||
DWORD ff_wtoupper (DWORD uni); /* Unicode upper-case conversion */
|
DWORD ff_wtoupper (DWORD uni); /* Unicode upper-case conversion */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* O/S dependent functions (samples available in ffsystem.c) */
|
|
||||||
|
|
||||||
#if FF_USE_LFN == 3 /* Dynamic memory allocation */
|
#if FF_USE_LFN == 3 /* Dynamic memory allocation */
|
||||||
void* ff_memalloc (UINT msize); /* Allocate memory block */
|
void* ff_memalloc (UINT msize); /* Allocate memory block */
|
||||||
void ff_memfree (void* mblock); /* Free memory block */
|
void ff_memfree (void* mblock); /* Free memory block */
|
||||||
#endif
|
#endif
|
||||||
#if FF_FS_REENTRANT /* Sync functions */
|
|
||||||
int ff_mutex_create (int vol); /* Create a sync object */
|
/* Sync functions */
|
||||||
void ff_mutex_delete (int vol); /* Delete a sync object */
|
#if FF_FS_REENTRANT
|
||||||
int ff_mutex_take (int vol); /* Lock sync object */
|
int ff_cre_syncobj (BYTE vol, FF_SYNC_t* sobj); /* Create a sync object */
|
||||||
void ff_mutex_give (int vol); /* Unlock sync object */
|
int ff_req_grant (FF_SYNC_t sobj); /* Lock sync object */
|
||||||
|
void ff_rel_grant (FF_SYNC_t sobj); /* Unlock sync object */
|
||||||
|
int ff_del_syncobj (FF_SYNC_t sobj); /* Delete a sync object */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------*/
|
/*--------------------------------------------------------------*/
|
||||||
/* Flags and Offset Address */
|
/* Flags and offset address */
|
||||||
/*--------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* File access mode and open method flags (3rd argument of f_open) */
|
/* File access mode and open method flags (3rd argument of f_open) */
|
||||||
#define FA_READ 0x01
|
#define FA_READ 0x01
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/*---------------------------------------------------------------------------/
|
/*---------------------------------------------------------------------------/
|
||||||
/ Configurations of FatFs Module
|
/ FatFs Functional Configurations
|
||||||
/---------------------------------------------------------------------------*/
|
/---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#define FFCONF_DEF 80286 /* Revision ID */
|
#define FFCONF_DEF 86606 /* Revision ID */
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------/
|
/*---------------------------------------------------------------------------/
|
||||||
/ Function Configurations
|
/ Function Configurations
|
||||||
@ -25,7 +25,15 @@
|
|||||||
/ 3: f_lseek() function is removed in addition to 2. */
|
/ 3: f_lseek() function is removed in addition to 2. */
|
||||||
|
|
||||||
|
|
||||||
#define FF_USE_FIND 1
|
#define FF_USE_STRFUNC 1
|
||||||
|
/* This option switches string functions, f_gets(), f_putc(), f_puts() and f_printf().
|
||||||
|
/
|
||||||
|
/ 0: Disable string functions.
|
||||||
|
/ 1: Enable without LF-CRLF conversion.
|
||||||
|
/ 2: Enable with LF-CRLF conversion. */
|
||||||
|
|
||||||
|
|
||||||
|
#define FF_USE_FIND 0
|
||||||
/* This option switches filtered directory read functions, f_findfirst() and
|
/* This option switches filtered directory read functions, f_findfirst() and
|
||||||
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
||||||
|
|
||||||
@ -56,30 +64,6 @@
|
|||||||
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
|
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
|
||||||
|
|
||||||
|
|
||||||
#define FF_USE_STRFUNC 1
|
|
||||||
#define FF_PRINT_LLI 0
|
|
||||||
#define FF_PRINT_FLOAT 0
|
|
||||||
#define FF_STRF_ENCODE 0
|
|
||||||
/* FF_USE_STRFUNC switches string functions, f_gets(), f_putc(), f_puts() and
|
|
||||||
/ f_printf().
|
|
||||||
/
|
|
||||||
/ 0: Disable. FF_PRINT_LLI, FF_PRINT_FLOAT and FF_STRF_ENCODE have no effect.
|
|
||||||
/ 1: Enable without LF-CRLF conversion.
|
|
||||||
/ 2: Enable with LF-CRLF conversion.
|
|
||||||
/
|
|
||||||
/ FF_PRINT_LLI = 1 makes f_printf() support long long argument and FF_PRINT_FLOAT = 1/2
|
|
||||||
/ makes f_printf() support floating point argument. These features want C99 or later.
|
|
||||||
/ When FF_LFN_UNICODE >= 1 with LFN enabled, string functions convert the character
|
|
||||||
/ encoding in it. FF_STRF_ENCODE selects assumption of character encoding ON THE FILE
|
|
||||||
/ to be read/written via those functions.
|
|
||||||
/
|
|
||||||
/ 0: ANSI/OEM in current CP
|
|
||||||
/ 1: Unicode in UTF-16LE
|
|
||||||
/ 2: Unicode in UTF-16BE
|
|
||||||
/ 3: Unicode in UTF-8
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------/
|
/*---------------------------------------------------------------------------/
|
||||||
/ Locale and Namespace Configurations
|
/ Locale and Namespace Configurations
|
||||||
/---------------------------------------------------------------------------*/
|
/---------------------------------------------------------------------------*/
|
||||||
@ -153,6 +137,19 @@
|
|||||||
/ on character encoding. When LFN is not enabled, these options have no effect. */
|
/ on character encoding. When LFN is not enabled, these options have no effect. */
|
||||||
|
|
||||||
|
|
||||||
|
#define FF_STRF_ENCODE 3
|
||||||
|
/* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, f_gets(),
|
||||||
|
/ f_putc(), f_puts and f_printf() convert the character encoding in it.
|
||||||
|
/ This option selects assumption of character encoding ON THE FILE to be
|
||||||
|
/ read/written via those functions.
|
||||||
|
/
|
||||||
|
/ 0: ANSI/OEM in current CP
|
||||||
|
/ 1: Unicode in UTF-16LE
|
||||||
|
/ 2: Unicode in UTF-16BE
|
||||||
|
/ 3: Unicode in UTF-8
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define FF_FS_RPATH 2
|
#define FF_FS_RPATH 2
|
||||||
/* This option configures support for relative path.
|
/* This option configures support for relative path.
|
||||||
/
|
/
|
||||||
@ -178,7 +175,7 @@
|
|||||||
/ logical drives. Number of items must not be less than FF_VOLUMES. Valid
|
/ logical drives. Number of items must not be less than FF_VOLUMES. Valid
|
||||||
/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are
|
/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are
|
||||||
/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is
|
/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is
|
||||||
/ not defined, a user defined volume string table is needed as:
|
/ not defined, a user defined volume string table needs to be defined as:
|
||||||
/
|
/
|
||||||
/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
|
/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
|
||||||
*/
|
*/
|
||||||
@ -190,14 +187,14 @@
|
|||||||
/ number and only an FAT volume found on the physical drive will be mounted.
|
/ number and only an FAT volume found on the physical drive will be mounted.
|
||||||
/ When this function is enabled (1), each logical drive number can be bound to
|
/ When this function is enabled (1), each logical drive number can be bound to
|
||||||
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
|
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
|
||||||
/ function will be available. */
|
/ funciton will be available. */
|
||||||
|
|
||||||
|
|
||||||
#define FF_MIN_SS 512
|
#define FF_MIN_SS 512
|
||||||
#define FF_MAX_SS 512
|
#define FF_MAX_SS 512
|
||||||
/* This set of options configures the range of sector size to be supported. (512,
|
/* This set of options configures the range of sector size to be supported. (512,
|
||||||
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
|
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
|
||||||
/ harddisk, but a larger value may be required for on-board flash memory and some
|
/ harddisk. But a larger value may be required for on-board flash memory and some
|
||||||
/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured
|
/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured
|
||||||
/ for variable sector size mode and disk_ioctl() function needs to implement
|
/ for variable sector size mode and disk_ioctl() function needs to implement
|
||||||
/ GET_SECTOR_SIZE command. */
|
/ GET_SECTOR_SIZE command. */
|
||||||
@ -208,8 +205,8 @@
|
|||||||
/ To enable the 64-bit LBA, also exFAT needs to be enabled. (FF_FS_EXFAT == 1) */
|
/ To enable the 64-bit LBA, also exFAT needs to be enabled. (FF_FS_EXFAT == 1) */
|
||||||
|
|
||||||
|
|
||||||
#define FF_MIN_GPT 0x10000000
|
#define FF_MIN_GPT 0x100000000
|
||||||
/* Minimum number of sectors to switch GPT as partitioning format in f_mkfs and
|
/* Minimum number of sectors to switch GPT format to create partition in f_mkfs and
|
||||||
/ f_fdisk function. 0x100000000 max. This option has no effect when FF_LBA64 == 0. */
|
/ f_fdisk function. 0x100000000 max. This option has no effect when FF_LBA64 == 0. */
|
||||||
|
|
||||||
|
|
||||||
@ -231,7 +228,7 @@
|
|||||||
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
|
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
|
||||||
|
|
||||||
|
|
||||||
#define FF_FS_EXFAT 1
|
#define FF_FS_EXFAT 0
|
||||||
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
|
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
|
||||||
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
|
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
|
||||||
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
|
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
|
||||||
@ -240,10 +237,10 @@
|
|||||||
#define FF_FS_NORTC 0
|
#define FF_FS_NORTC 0
|
||||||
#define FF_NORTC_MON 1
|
#define FF_NORTC_MON 1
|
||||||
#define FF_NORTC_MDAY 1
|
#define FF_NORTC_MDAY 1
|
||||||
#define FF_NORTC_YEAR 2022
|
#define FF_NORTC_YEAR 2019
|
||||||
/* The option FF_FS_NORTC switches timestamp feature. If the system does not have
|
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
|
||||||
/ an RTC or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable the
|
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
|
||||||
/ timestamp feature. Every object modified by FatFs will have a fixed timestamp
|
/ the timestamp function. Every object modified by FatFs will have a fixed timestamp
|
||||||
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
|
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
|
||||||
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
|
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
|
||||||
/ added to the project to read current time form real-time clock. FF_NORTC_MON,
|
/ added to the project to read current time form real-time clock. FF_NORTC_MON,
|
||||||
@ -253,7 +250,7 @@
|
|||||||
|
|
||||||
#define FF_FS_NOFSINFO 0
|
#define FF_FS_NOFSINFO 0
|
||||||
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
|
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
|
||||||
/ option, and f_getfree() function at the first time after volume mount will force
|
/ option, and f_getfree() function at first time after volume mount will force
|
||||||
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
|
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
|
||||||
/
|
/
|
||||||
/ bit0=0: Use free cluster count in the FSINFO if available.
|
/ bit0=0: Use free cluster count in the FSINFO if available.
|
||||||
@ -275,21 +272,26 @@
|
|||||||
/ lock control is independent of re-entrancy. */
|
/ lock control is independent of re-entrancy. */
|
||||||
|
|
||||||
|
|
||||||
|
/* #include <somertos.h> // O/S definitions */
|
||||||
#define FF_FS_REENTRANT 0
|
#define FF_FS_REENTRANT 0
|
||||||
#define FF_FS_TIMEOUT 1000
|
#define FF_FS_TIMEOUT 1000
|
||||||
|
#define FF_SYNC_t HANDLE
|
||||||
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
|
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
|
||||||
/ module itself. Note that regardless of this option, file access to different
|
/ module itself. Note that regardless of this option, file access to different
|
||||||
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
|
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
|
||||||
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
|
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
|
||||||
/ to the same volume is under control of this featuer.
|
/ to the same volume is under control of this function.
|
||||||
/
|
/
|
||||||
/ 0: Disable re-entrancy. FF_FS_TIMEOUT have no effect.
|
/ 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect.
|
||||||
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
|
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
|
||||||
/ ff_mutex_create(), ff_mutex_delete(), ff_mutex_take() and ff_mutex_give()
|
/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
|
||||||
/ function, must be added to the project. Samples are available in ffsystem.c.
|
/ function, must be added to the project. Samples are available in
|
||||||
|
/ option/syscall.c.
|
||||||
/
|
/
|
||||||
/ The FF_FS_TIMEOUT defines timeout period in unit of O/S time tick.
|
/ The FF_FS_TIMEOUT defines timeout period in unit of time tick.
|
||||||
*/
|
/ The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
|
||||||
|
/ SemaphoreHandle_t and etc. A header file for O/S definitions needs to be
|
||||||
|
/ included somewhere in the scope of ff.h. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
/**
|
/**
|
||||||
* @brief Moving average filter coefficient for PT1000 measurement
|
* @brief Moving average filter coefficient for PT1000 measurement
|
||||||
*/
|
*/
|
||||||
#define ADC_PT1000_FILTER_WEIGHT 0.01f
|
#define ADC_PT1000_FILTER_WEIGHT 0.005f
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Moving average filter weight used for fast regaulation. This is used when the measured resistance
|
* @brief Moving average filter weight used for fast regaulation. This is used when the measured resistance
|
||||||
|
@ -18,11 +18,6 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @addtogroup digio
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __DIGIO_H__
|
#ifndef __DIGIO_H__
|
||||||
#define __DIGIO_H__
|
#define __DIGIO_H__
|
||||||
|
|
||||||
@ -30,22 +25,10 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <helper-macros/helper-macros.h>
|
#include <helper-macros/helper-macros.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Port the digital I/Os are located in
|
|
||||||
*/
|
|
||||||
#define DIGIO_PORT GPIOB
|
#define DIGIO_PORT GPIOB
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reset and clock control bit mask to enable clock of @ref DIGIO_PORT
|
|
||||||
*/
|
|
||||||
#define DIGIO_RCC_MASK RCC_AHB1ENR_GPIOBEN
|
#define DIGIO_RCC_MASK RCC_AHB1ENR_GPIOBEN
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief List of the pins used by the digio module
|
|
||||||
*/
|
|
||||||
#define DIGIO_PINS 4,5,6,7
|
#define DIGIO_PINS 4,5,6,7
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUGBUILD) || defined(UART_ON_DEBUG_HEADER)
|
#if defined(DEBUGBUILD) || defined(UART_ON_DEBUG_HEADER)
|
||||||
#define DIGIO_INOUT_DEFAULT 0,0,0,0
|
#define DIGIO_INOUT_DEFAULT 0,0,0,0
|
||||||
#define DIGIO_ALTFUNC_DEFAULT 0,0,0,0
|
#define DIGIO_ALTFUNC_DEFAULT 0,0,0,0
|
||||||
@ -54,139 +37,33 @@
|
|||||||
#define DIGIO_ALTFUNC_DEFAULT 0,0,7,7
|
#define DIGIO_ALTFUNC_DEFAULT 0,0,7,7
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The port, the loudspeaker is connected to
|
|
||||||
*/
|
|
||||||
#define BEEPER_PORT GPIOB
|
#define BEEPER_PORT GPIOB
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The RCC mask for @ref BEEPER_PORT
|
|
||||||
*/
|
|
||||||
#define BEEPER_RCC_MASK RCC_AHB1ENR_GPIOBEN
|
#define BEEPER_RCC_MASK RCC_AHB1ENR_GPIOBEN
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable all clocks and setup pins in default setting.
|
|
||||||
* @warning This function uses @ref rcc_manager_enable_clock to enable the clocks. Therefore, it must not be called
|
|
||||||
* multiple times.
|
|
||||||
* @note Calls @ref digio_set_default_values() internally.
|
|
||||||
*/
|
|
||||||
void digio_init(void);
|
|
||||||
|
|
||||||
/**
|
void digio_setup_default_all(void);
|
||||||
* @brief Setup or restore the default DIGIO settings.
|
|
||||||
*
|
|
||||||
* This function can be called multiple times.
|
|
||||||
*/
|
|
||||||
void digio_set_default_values(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set up a DIGIO pin.
|
|
||||||
*
|
|
||||||
* Set up a digital IO pin config. For the index association see the @ref DIGIO_PINS table.
|
|
||||||
*
|
|
||||||
* @param num DIGIO number starting with 0
|
|
||||||
* @param in_out In: 0, Out 1, alternate function: 2
|
|
||||||
* @param alt_func Alternate function to set. Consult datasheet of STM32F407
|
|
||||||
*/
|
|
||||||
void digio_setup_pin(uint8_t num, uint8_t in_out, uint8_t alt_func);
|
void digio_setup_pin(uint8_t num, uint8_t in_out, uint8_t alt_func);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set a digio output port
|
|
||||||
* @param num Digio channel number
|
|
||||||
* @param val Value: 0 or 1.
|
|
||||||
*/
|
|
||||||
void digio_set(uint8_t num, int val);
|
void digio_set(uint8_t num, int val);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Read the state of a digio channel
|
|
||||||
* @param num Channel number
|
|
||||||
* @return digital pin level.
|
|
||||||
*/
|
|
||||||
int digio_get(uint8_t num);
|
int digio_get(uint8_t num);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Port the LEDs are connected to
|
|
||||||
*/
|
|
||||||
#define LED_PORT GPIOB
|
#define LED_PORT GPIOB
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief RCC mask to enable clock for @ref LED_PORT
|
|
||||||
*/
|
|
||||||
#define LED_RCC_MASK RCC_AHB1ENR_GPIOBEN
|
#define LED_RCC_MASK RCC_AHB1ENR_GPIOBEN
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Pin list on @ref LED_PORT that are connected to LEDs
|
|
||||||
*/
|
|
||||||
#define LED_PINS 2,3
|
#define LED_PINS 2,3
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set up the LED Port
|
|
||||||
*/
|
|
||||||
void led_setup(void);
|
void led_setup(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set the LED status
|
|
||||||
* @param num LED number
|
|
||||||
* @param val Value: 1 on, 0 off.
|
|
||||||
*/
|
|
||||||
void led_set(uint8_t num, int val);
|
void led_set(uint8_t num, int val);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the state of a LED
|
|
||||||
* @param num LED number
|
|
||||||
* @return Stateof the LED: 0 off, 1 on; -1 in case of an error
|
|
||||||
*/
|
|
||||||
int led_get(uint8_t num);
|
int led_get(uint8_t num);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Port to use for the loudpseaker
|
|
||||||
*/
|
|
||||||
#define LOUDSPEAKER_PORT GPIOB
|
#define LOUDSPEAKER_PORT GPIOB
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief RCC mask for @ref LOUDSPEAKER_PORT
|
|
||||||
*/
|
|
||||||
#define LOUDSPEAKER_RCC_MASK RCC_AHB1ENR_GPIOBEN
|
#define LOUDSPEAKER_RCC_MASK RCC_AHB1ENR_GPIOBEN
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Pin on @ref LOUDSPEAKER_PORT the speaker is cnnected to
|
|
||||||
*/
|
|
||||||
#define LOUDSPEAKER_PIN 1
|
#define LOUDSPEAKER_PIN 1
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The loudpseaker requires a frequency signal instead of a simple on/off signal.
|
|
||||||
*/
|
|
||||||
#define LOUDSPEAKER_MULTIFREQ 1
|
#define LOUDSPEAKER_MULTIFREQ 1
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Defautl timer relaod for the frequency of the speaker. Only relevant if @ref LOUDSPEAKER_MULTIFREQ is 1.
|
|
||||||
*/
|
|
||||||
#define LOUDSPEAKER_MULTIFREQ_DEFAULT 9
|
#define LOUDSPEAKER_MULTIFREQ_DEFAULT 9
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Setup the loudspeaker
|
|
||||||
*/
|
|
||||||
void loudspeaker_setup(void);
|
void loudspeaker_setup(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set the loudspeaker value
|
|
||||||
*
|
|
||||||
* Zero turns off the beeper. 1 is a special value
|
|
||||||
* and will set the @ref LOUDSPEAKER_MULTIFREQ_DEFAULT value.
|
|
||||||
*
|
|
||||||
* If @ref LOUDSPEAKER_MULTIFREQ is 0, then no actual frequency is produced.
|
|
||||||
* Instead any @p val unequal to zero turns the output pin high and 0 will turn it low.
|
|
||||||
*
|
|
||||||
* @param val Value.
|
|
||||||
*/
|
|
||||||
void loudspeaker_set(uint16_t val);
|
void loudspeaker_set(uint16_t val);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get current value of the loadspeaker
|
|
||||||
* @return Value
|
|
||||||
*/
|
|
||||||
uint16_t loudspeaker_get(void);
|
uint16_t loudspeaker_get(void);
|
||||||
|
|
||||||
#endif /* __DIGIO_H__ */
|
|
||||||
|
|
||||||
/** @} */
|
#endif /* __DIGIO_H__ */
|
||||||
|
@ -1,53 +1,8 @@
|
|||||||
/* Reflow Oven Controller
|
|
||||||
*
|
|
||||||
* Copyright (C) 2021 Mario Hüttel <mario.huettel@gmx.net>
|
|
||||||
*
|
|
||||||
* This file is part of the Reflow Oven Controller Project.
|
|
||||||
*
|
|
||||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with the reflow oven controller project.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @addtogroup hw-version-detect
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _HW_VERSION_DETECT_H_
|
#ifndef _HW_VERSION_DETECT_H_
|
||||||
#define _HW_VERSION_DETECT_H_
|
#define _HW_VERSION_DETECT_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GPIO Port used for hardware version detection
|
|
||||||
*/
|
|
||||||
#define HW_REV_DETECT_GPIO GPIOE
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief RCC Clock register mask used to enable @ref HW_REV_DETECT_GPIO GPIO Port
|
|
||||||
*/
|
|
||||||
#define HW_REV_DETECT_RCC_FIELD RCC_AHB1ENR_GPIOEEN
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Lowest pin on @ref HW_REV_DETECT_GPIO GPIO Port that shall be used to read in the hardware version
|
|
||||||
*/
|
|
||||||
#define HW_REV_DETECT_PIN_LOW (8U)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Highest pin on @ref HW_REV_DETECT_GPIO GPIO Port that shall be used to read in the hardware version
|
|
||||||
*/
|
|
||||||
#define HW_REV_DETECT_PIN_HIGH (15U)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief PCB/Hardware Revision Type
|
* @brief PCB/Hardware Revision Type
|
||||||
*/
|
*/
|
||||||
@ -56,7 +11,6 @@ enum hw_revision {
|
|||||||
HW_REV_ERROR = 1, /**< @brief The hardware revision could not be detected due to an internal error */
|
HW_REV_ERROR = 1, /**< @brief The hardware revision could not be detected due to an internal error */
|
||||||
HW_REV_V1_2 = 120, /**< @brief Hardware Revision v1.2 */
|
HW_REV_V1_2 = 120, /**< @brief Hardware Revision v1.2 */
|
||||||
HW_REV_V1_3 = 130, /**< @brief Hardware Revision v1.3 */
|
HW_REV_V1_3 = 130, /**< @brief Hardware Revision v1.3 */
|
||||||
HW_REV_V1_3_1 = 131, /**< @brief Hardware revision v1.3.1 */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,7 +24,6 @@ enum hw_revision {
|
|||||||
* The function returns the HW revision as an enum hw_revision.
|
* The function returns the HW revision as an enum hw_revision.
|
||||||
* For v1.2 the return value is 120 (HW_REV_V1_2).
|
* For v1.2 the return value is 120 (HW_REV_V1_2).
|
||||||
* For v1.3 the return value is 130 (HW_REV_V1_3).
|
* For v1.3 the return value is 130 (HW_REV_V1_3).
|
||||||
* For v1.3.1 the return value is 131 (HW_REV_V1_3_1).
|
|
||||||
*
|
*
|
||||||
* Other return values are not defined yet.
|
* Other return values are not defined yet.
|
||||||
*
|
*
|
||||||
@ -79,5 +32,3 @@ enum hw_revision {
|
|||||||
enum hw_revision get_pcb_hardware_version(void);
|
enum hw_revision get_pcb_hardware_version(void);
|
||||||
|
|
||||||
#endif /* _HW_VERSION_DETECT_H_ */
|
#endif /* _HW_VERSION_DETECT_H_ */
|
||||||
|
|
||||||
/** @} */
|
|
||||||
|
@ -1,69 +0,0 @@
|
|||||||
/* Reflow Oven Controller
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
|
||||||
*
|
|
||||||
* This file is part of the Reflow Oven Controller Project.
|
|
||||||
*
|
|
||||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with the reflow oven controller project.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @defgroup main-cycle-counter Main Cycle Counter
|
|
||||||
* The main cycle counter is incremented after every loop run of the main loop in main.c
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __MAIN_CYCLE_COUNTER_H__
|
|
||||||
#define __MAIN_CYCLE_COUNTER_H__
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the main cycle counter and reset to 0. This also enables the core cycle counter
|
|
||||||
* This function can be called multiple times.
|
|
||||||
*/
|
|
||||||
void main_and_core_cycle_counter_init(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reset the main cycle counter.
|
|
||||||
* @note This does not reset the core cycle counter
|
|
||||||
*/
|
|
||||||
void main_cycle_counter_reset(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Increment the main cycle counter by 1
|
|
||||||
*/
|
|
||||||
void main_cycle_counter_inc(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the current main cycle counter value
|
|
||||||
* @return Value
|
|
||||||
*/
|
|
||||||
uint64_t main_cycle_counter_get(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reset the core cycle counter to 0
|
|
||||||
*/
|
|
||||||
void core_cycle_counter_reset(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the current value of the core cycle counter
|
|
||||||
*
|
|
||||||
* @return uint32_t Counter value
|
|
||||||
*/
|
|
||||||
uint32_t core_cycle_counter_get(void);
|
|
||||||
|
|
||||||
#endif /* __MAIN_CYCLE_COUNTER_H__ */
|
|
||||||
|
|
||||||
/** @} */
|
|
@ -21,93 +21,34 @@
|
|||||||
#ifndef __OVEN_DRIVER_H__
|
#ifndef __OVEN_DRIVER_H__
|
||||||
#define __OVEN_DRIVER_H__
|
#define __OVEN_DRIVER_H__
|
||||||
|
|
||||||
/**
|
|
||||||
* @defgroup oven-driver Oven SSR Driver and PID Controller
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <reflow-controller/pid-controller.h>
|
#include <reflow-controller/pid-controller.h>
|
||||||
|
|
||||||
/**
|
enum oven_pid_status {OVEN_PID_DEACTIVATED,
|
||||||
* @brief Status of the PID controlling the oven
|
OVEN_PID_RUNNING,
|
||||||
*/
|
OVEN_PID_ABORTED};
|
||||||
enum oven_pid_status {
|
|
||||||
OVEN_PID_DEACTIVATED, /**< @brief The PID of the oven is deactivated. */
|
|
||||||
OVEN_PID_RUNNING, /**< @brief The PID of the oven is currently active and running. */
|
|
||||||
OVEN_PID_ABORTED, /**< @brief The PID of the oven has been aborted due to an error and is not running. */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the oven driver.
|
|
||||||
*
|
|
||||||
* This will initialize the Timer for the PWM output to the SSR.
|
|
||||||
* If the hardware revision is >= v1.3 the SSR safety enable line will also be initialized.
|
|
||||||
*/
|
|
||||||
void oven_driver_init(void);
|
void oven_driver_init(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set a power level on the oven control output
|
|
||||||
* @param power Power level between 0 to 100
|
|
||||||
* @note This will not actually set the output. For this, @ref oven_driver_apply_power_level() has to be called.
|
|
||||||
* It will be called in the main loop.
|
|
||||||
*/
|
|
||||||
void oven_driver_set_power(uint8_t power);
|
void oven_driver_set_power(uint8_t power);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable the oven driver.
|
|
||||||
*
|
|
||||||
* This shuts down the oven driver timer and the corresponding clocks.
|
|
||||||
*/
|
|
||||||
void oven_driver_disable(void);
|
void oven_driver_disable(void);
|
||||||
|
|
||||||
/**
|
void oven_pid_ack_errors(void);
|
||||||
* @brief Initialize the PID controller for the oven output
|
|
||||||
* @param PID controller holding the settings
|
|
||||||
*/
|
|
||||||
void oven_pid_init(struct pid_controller *controller_to_copy);
|
void oven_pid_init(struct pid_controller *controller_to_copy);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Handle the PID controller.
|
|
||||||
* This must be called cyclically. When the sampling period has passed, the function will process the PT1000
|
|
||||||
* resistance and do a PID cycluilation for this sample.
|
|
||||||
* @note This function must be called with a frequency greater or equal to the PID's sampling frequency
|
|
||||||
*/
|
|
||||||
void oven_pid_handle(void);
|
void oven_pid_handle(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Stop the oven PID controller
|
|
||||||
*/
|
|
||||||
void oven_pid_stop(void);
|
void oven_pid_stop(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Abort the oven PID controller. This is the same as oven_pid_stop() but will set the abort flag.
|
|
||||||
* @note this function is called by the safety controller to disable the PID controller in case of an error.
|
|
||||||
*/
|
|
||||||
void oven_pid_abort(void);
|
void oven_pid_abort(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set the target temperature of the PID controller.
|
|
||||||
* @param temp
|
|
||||||
*/
|
|
||||||
void oven_pid_set_target_temperature(float temp);
|
void oven_pid_set_target_temperature(float temp);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Output the power level currently configured to the SSR.
|
|
||||||
*
|
|
||||||
* This function is separated from oven_driver_set_power() because it is called in the main loop after the
|
|
||||||
* safety controller has run. This ensures, that if the safety controller decides to stop the PID no glitch makes it
|
|
||||||
* out to the SSR.
|
|
||||||
*/
|
|
||||||
void oven_driver_apply_power_level(void);
|
void oven_driver_apply_power_level(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the current status of the oven's PID controller
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
enum oven_pid_status oven_pid_get_status(void);
|
enum oven_pid_status oven_pid_get_status(void);
|
||||||
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
#endif /* __OVEN_DRIVER_H__ */
|
#endif /* __OVEN_DRIVER_H__ */
|
||||||
|
@ -18,150 +18,35 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @addtogroup pid-controller
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __PID_CONTROLLER_H__
|
#ifndef __PID_CONTROLLER_H__
|
||||||
#define __PID_CONTROLLER_H__
|
#define __PID_CONTROLLER_H__
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Representation of a PID controller
|
|
||||||
*/
|
|
||||||
struct pid_controller {
|
struct pid_controller {
|
||||||
/**
|
|
||||||
* @brief Derivate term @f$k_d@f$
|
|
||||||
*/
|
|
||||||
float k_deriv;
|
float k_deriv;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Integral term @f$k_i@f$
|
|
||||||
*/
|
|
||||||
float k_int;
|
float k_int;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Proportional term @f$k_p@f$
|
|
||||||
*/
|
|
||||||
float k_p;
|
float k_p;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Internally precalculated auxiliary value. @f$k_{i_t} = \frac{1}{2}k_{i} \cdot T_s@f$
|
|
||||||
*
|
|
||||||
* This value is caluclated during the @ref pid_init function to reduce calculations during the continous
|
|
||||||
* PID sampling.
|
|
||||||
*/
|
|
||||||
float k_int_t;
|
float k_int_t;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Internally precalculated auxiliary value. @f$k_{d_t} = 2\frac{k_{d}}{T_s + 2 k_{d\tau}}@f$
|
|
||||||
*
|
|
||||||
* This value is caluclated during the @ref pid_init function to reduce calculations during the continous
|
|
||||||
* PID sampling.
|
|
||||||
*/
|
|
||||||
float k_deriv_t;
|
float k_deriv_t;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Internally precalculated auxiliary value. @f$\overline{k_{d_t}} = \frac{2 k_{d\tau} - T_s}{ 2k_{d\tau} + T_s}@f$
|
|
||||||
*
|
|
||||||
* This value is caluclated during the @ref pid_init function to reduce calculations during the continous
|
|
||||||
* PID sampling.
|
|
||||||
*/
|
|
||||||
float k_inv_deriv_t;
|
float k_inv_deriv_t;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Saturation of output value
|
|
||||||
* @note This value is set to 100 (corresponding to 100%) for the temperature controller
|
|
||||||
*/
|
|
||||||
float output_sat_max;
|
float output_sat_max;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Minumum saturation of PID output value.
|
|
||||||
* @note This value is set to 0 for the temperature controller as the oven driver is not able to cool
|
|
||||||
*/
|
|
||||||
float output_sat_min;
|
float output_sat_min;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Maximum value @f$i_{max}@f$ the inegrator in the PID controller can reach.
|
|
||||||
*
|
|
||||||
* The output of the integral term of the PID controller is limited to @f$\pm i_{max}@f$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
float integral_max;
|
float integral_max;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Sampling period @f$T_s@f$ of the PID controller in seconds
|
|
||||||
*/
|
|
||||||
float sample_period;
|
float sample_period;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Output value of the PID controller
|
|
||||||
*/
|
|
||||||
volatile float control_output;
|
volatile float control_output;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Internal state variable holding the last input value.
|
|
||||||
*/
|
|
||||||
volatile float last_in;
|
volatile float last_in;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief integral term's value
|
|
||||||
*/
|
|
||||||
volatile float integral;
|
volatile float integral;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief derivate term's value
|
|
||||||
*/
|
|
||||||
volatile float derivate;
|
volatile float derivate;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize a @ref pid_controller struct
|
|
||||||
* @param pid Struct to initilaize
|
|
||||||
* @param k_deriv Derivate term
|
|
||||||
* @param k_int integral term
|
|
||||||
* @param k_p Proportional term
|
|
||||||
* @param output_sat_min Minimum output saturation
|
|
||||||
* @param output_sat_max Maximum output saturation
|
|
||||||
* @param integral_max Maximum integral term
|
|
||||||
* @param kd_tau Time constant of derivate term low pass filter
|
|
||||||
* @param sample_period Sample time in seconds
|
|
||||||
*/
|
|
||||||
void pid_init(struct pid_controller *pid, float k_deriv, float k_int, float k_p,
|
void pid_init(struct pid_controller *pid, float k_deriv, float k_int, float k_p,
|
||||||
float output_sat_min, float output_sat_max, float integral_max, float kd_tau, float sample_period);
|
float output_sat_min, float output_sat_max, float integral_max, float kd_tau, float sample_period);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reset a PID controller.
|
|
||||||
*
|
|
||||||
* This sets all internal states to 0.
|
|
||||||
*
|
|
||||||
* @param pid Controller
|
|
||||||
*/
|
|
||||||
void pid_zero(struct pid_controller *pid);
|
void pid_zero(struct pid_controller *pid);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Execute a tiome step of the PID controller. This function must be periodically called in an pid_controller::sample_period interval
|
|
||||||
* @note This function does not check its calling interval. It must be ensured by the caller.
|
|
||||||
* @param pid Pid controller to execute
|
|
||||||
* @param deviation Input deviation
|
|
||||||
* @return Current controller output after the calculated time step
|
|
||||||
*/
|
|
||||||
float pid_sample(struct pid_controller *pid, float deviation);
|
float pid_sample(struct pid_controller *pid, float deviation);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Retrieve the controller's current output
|
|
||||||
* @param pid Pid controller
|
|
||||||
* @return Output
|
|
||||||
*/
|
|
||||||
float pid_get_control_output(const struct pid_controller *pid);
|
float pid_get_control_output(const struct pid_controller *pid);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Duplicate a PID controller
|
|
||||||
* @param dest destination controller
|
|
||||||
* @param src Source controller
|
|
||||||
* @return 0 if successful
|
|
||||||
*/
|
|
||||||
int pid_copy(struct pid_controller *dest, const struct pid_controller *src);
|
int pid_copy(struct pid_controller *dest, const struct pid_controller *src);
|
||||||
|
|
||||||
#endif /* __PID_CONTROLLER_H__ */
|
#endif /* __PID_CONTROLLER_H__ */
|
||||||
|
|
||||||
/** @} */
|
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
/* Reflow Oven Controller
|
|
||||||
*
|
|
||||||
* Copyright (C) 2022 Mario Hüttel <mario.huettel@gmx.net>
|
|
||||||
*
|
|
||||||
* This file is part of the Reflow Oven Controller Project.
|
|
||||||
*
|
|
||||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with the reflow oven controller project.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SAFETY_FLASH_CRC_STRUCT_H_
|
|
||||||
#define _SAFETY_FLASH_CRC_STRUCT_H_
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
struct flash_crcs {
|
|
||||||
uint32_t start_magic;
|
|
||||||
uint32_t crc_section_text;
|
|
||||||
uint32_t crc_section_data;
|
|
||||||
uint32_t crc_section_ccm_data;
|
|
||||||
uint32_t crc_section_vectors;
|
|
||||||
uint32_t end_magic;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern const struct flash_crcs crcs_in_flash;
|
|
||||||
|
|
||||||
#endif /* _SAFETY_FLASH_CRC_STRUCT_H_ */
|
|
@ -1,56 +0,0 @@
|
|||||||
/* Reflow Oven Controller
|
|
||||||
*
|
|
||||||
* Copyright (C) 2022 Mario Hüttel <mario.huettel@gmx.net>
|
|
||||||
*
|
|
||||||
* This file is part of the Reflow Oven Controller Project.
|
|
||||||
*
|
|
||||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with the reflow oven controller project.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SAFETY_FLASH_CRC_H_
|
|
||||||
#define _SAFETY_FLASH_CRC_H_
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
enum flash_crc_section {
|
|
||||||
FLASH_CRC_VECTOR = 0,
|
|
||||||
FLASH_CRC_TEXT,
|
|
||||||
FLASH_CRC_DATA,
|
|
||||||
FLASH_CRC_CCMDATA,
|
|
||||||
N_FLASH_CRC,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Perform a CRC check of the flash memory and set appropriate flags
|
|
||||||
* @return negative if internal error occured. Otherwise (independent from CRC check result) 0.
|
|
||||||
* @note This function requires the safety controller (and CRC unit) to be set up before calling!
|
|
||||||
*/
|
|
||||||
int flash_crc_trigger_check(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Calculate CRC over flash section
|
|
||||||
* @param sec Section to calculate CRC over
|
|
||||||
* @param[out] crc_result Calculated CRC
|
|
||||||
* @return negative if internal error occured. Otherwise (independent from CRC check result) 0.
|
|
||||||
*/
|
|
||||||
int flash_crc_calc_section(enum flash_crc_section sec, uint32_t *crc_result);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get expected CRC value of a section
|
|
||||||
* @param sec Section
|
|
||||||
* @return Expected CRC
|
|
||||||
*/
|
|
||||||
uint32_t flash_crc_get_expected_crc(enum flash_crc_section sec);
|
|
||||||
|
|
||||||
#endif /* _SAFETY_FLASH_CRC_H_ */
|
|
@ -67,7 +67,7 @@ int safety_adc_poll_result(void);
|
|||||||
* After that, it is safe to use the output values until a new conversion is triggered using #safety_adc_trigger_meas
|
* After that, it is safe to use the output values until a new conversion is triggered using #safety_adc_trigger_meas
|
||||||
*
|
*
|
||||||
* @warning This function return a constant buffer, that is directly written on by the DMA! Check #safety_adc_poll_result to prevent race conditions.
|
* @warning This function return a constant buffer, that is directly written on by the DMA! Check #safety_adc_poll_result to prevent race conditions.
|
||||||
* @return Array of raw ADC readings with length of #SAFETY_ADC_NUM_OF_CHANNELS
|
* @return Array of raw ADC readings with lenght of #SAFETY_ADC_NUM_OF_CHANNELS
|
||||||
*/
|
*/
|
||||||
const uint16_t *safety_adc_get_values(void);
|
const uint16_t *safety_adc_get_values(void);
|
||||||
|
|
||||||
|
@ -27,15 +27,6 @@
|
|||||||
#ifndef __SAFETY_CONFIG_H__
|
#ifndef __SAFETY_CONFIG_H__
|
||||||
#define __SAFETY_CONFIG_H__
|
#define __SAFETY_CONFIG_H__
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Weights of error flags.
|
|
||||||
*/
|
|
||||||
enum config_weight {
|
|
||||||
SAFETY_FLAG_CONFIG_WEIGHT_NONE = 0, /**< @brief This flag has no global error consequence, but might be respected by certain software modules. */
|
|
||||||
SAFETY_FLAG_CONFIG_WEIGHT_PID = 1, /**< @brief This flag will force a stop of the temperature PID controller */
|
|
||||||
SAFETY_FLAG_CONFIG_WEIGHT_PANIC = 2, /**< @brief This flag will trigger the panic mode */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enum type representing safety flags.
|
* @brief Enum type representing safety flags.
|
||||||
*
|
*
|
||||||
@ -65,11 +56,6 @@ enum safety_flag {
|
|||||||
ERR_FLAG_SAFETY_TAB_CORRUPT = (1<<16),
|
ERR_FLAG_SAFETY_TAB_CORRUPT = (1<<16),
|
||||||
ERR_FLAG_AMON_SUPPLY_VOLT = (1<<17),
|
ERR_FLAG_AMON_SUPPLY_VOLT = (1<<17),
|
||||||
ERR_FLAG_OVERTEMP = (1<<18),
|
ERR_FLAG_OVERTEMP = (1<<18),
|
||||||
ERR_FLAG_FLASH_CRC_CODE = (1<<19),
|
|
||||||
ERR_FLAG_FLASH_CRC_DATA = (1<<20),
|
|
||||||
ERR_FLAG_CFG_CRC_MEAS_ADC = (1<<21),
|
|
||||||
ERR_FLAG_CFG_CRC_SAFETY_ADC = (1<<22),
|
|
||||||
ERR_FLAG_CFG_CRC_MISC = (1<<23),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,13 +71,6 @@ enum timing_monitor {
|
|||||||
ERR_TIMING_MAIN_LOOP = (1<<3),
|
ERR_TIMING_MAIN_LOOP = (1<<3),
|
||||||
};
|
};
|
||||||
|
|
||||||
enum crc_monitor {
|
|
||||||
ERR_CRC_MON_MEAS_ADC = 0,
|
|
||||||
ERR_CRC_MON_SAFETY_ADC,
|
|
||||||
ERR_CRC_MON_MISC,
|
|
||||||
N_ERR_CRC_MON
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enum Type representing analog value monitors.
|
* @brief Enum Type representing analog value monitors.
|
||||||
*
|
*
|
||||||
@ -126,21 +105,19 @@ enum analog_value_monitor {
|
|||||||
#define WATCHDOG_HALT_DEBUG (0)
|
#define WATCHDOG_HALT_DEBUG (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
#define WATCHDOG_PRESCALER 16
|
||||||
* @brief Watchdog clock prescaler value
|
|
||||||
*/
|
|
||||||
#define WATCHDOG_PRESCALER (16)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Watchdog reload value
|
|
||||||
*/
|
|
||||||
#define WATCHDOG_RELOAD_VALUE (2500)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Minimum number of bytes that have to be free on the stack. If this is not the case, an error is detected
|
* @brief Minimum number of bytes that have to be free on the stack. If this is not the case, an error is detected
|
||||||
*/
|
*/
|
||||||
#define SAFETY_MIN_STACK_FREE 0x100
|
#define SAFETY_MIN_STACK_FREE 0x100
|
||||||
|
|
||||||
|
#define PID_CONTROLLER_ERR_CAREMASK (ERR_FLAG_STACK | ERR_FLAG_AMON_UC_TEMP | ERR_FLAG_AMON_VREF | \
|
||||||
|
ERR_FLAG_TIMING_PID | ERR_FLAG_TIMING_MEAS_ADC | ERR_FLAG_MEAS_ADC_OFF | \
|
||||||
|
ERR_FLAG_MEAS_ADC_OVERFLOW)
|
||||||
|
|
||||||
|
#define HALTING_CAREMASK (ERR_FLAG_STACK | ERR_FLAG_AMON_UC_TEMP)
|
||||||
|
|
||||||
#define SAFETY_ADC_VREF_MVOLT (2500.0f)
|
#define SAFETY_ADC_VREF_MVOLT (2500.0f)
|
||||||
#define SAFETY_ADC_VREF_TOL_MVOLT (100.0f)
|
#define SAFETY_ADC_VREF_TOL_MVOLT (100.0f)
|
||||||
#define SAFETY_ADC_TEMP_LOW_LIM (0.0f)
|
#define SAFETY_ADC_TEMP_LOW_LIM (0.0f)
|
||||||
@ -167,25 +144,6 @@ enum analog_value_monitor {
|
|||||||
*/
|
*/
|
||||||
#define SAFETY_CONTROLLER_ADC_DELAY_MS 250
|
#define SAFETY_CONTROLLER_ADC_DELAY_MS 250
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Password for resetting ERR_CRC_MON_MEAS_ADC
|
|
||||||
*/
|
|
||||||
#define SAFETY_CRC_MON_MEAS_ADC_PW 0xD96254A2
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Password for resetting ERR_CRC_MON_SAFETY_ADC
|
|
||||||
*/
|
|
||||||
#define SAFETY_CRC_MON_SAFETY_ADC_PW 0xA8DF2368
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Password for resetting ERR_CRC_MON_MISC
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#define SAFETY_CRC_MON_MISC_PW 0x9A62E96A
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Default persistence of safety flags. These values are loaded into the safety tables on startup.
|
|
||||||
*/
|
|
||||||
#define SAFETY_CONFIG_DEFAULT_PERSIST ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_MEAS_ADC_OFF, false), \
|
#define SAFETY_CONFIG_DEFAULT_PERSIST ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_MEAS_ADC_OFF, false), \
|
||||||
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_MEAS_ADC_WATCHDOG, false), \
|
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_MEAS_ADC_WATCHDOG, false), \
|
||||||
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_MEAS_ADC_UNSTABLE, false), \
|
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_MEAS_ADC_UNSTABLE, false), \
|
||||||
@ -205,14 +163,7 @@ enum analog_value_monitor {
|
|||||||
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_SAFETY_TAB_CORRUPT, true), \
|
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_SAFETY_TAB_CORRUPT, true), \
|
||||||
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_AMON_SUPPLY_VOLT, false), \
|
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_AMON_SUPPLY_VOLT, false), \
|
||||||
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_OVERTEMP, false), \
|
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_OVERTEMP, false), \
|
||||||
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_FLASH_CRC_CODE, true), \
|
|
||||||
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_FLASH_CRC_DATA, true), \
|
|
||||||
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_CFG_CRC_MEAS_ADC, true), \
|
|
||||||
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_CFG_CRC_SAFETY_ADC, true), \
|
|
||||||
ERR_FLAG_PERSIST_ENTRY(ERR_FLAG_CFG_CRC_MISC, true),
|
|
||||||
/**
|
|
||||||
* @brief Default config weights of safety flags. These values are loaded into the safety tables on startup.
|
|
||||||
*/
|
|
||||||
#define SAFETY_CONFIG_DEFAULT_WEIGHTS ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_MEAS_ADC_OFF, SAFETY_FLAG_CONFIG_WEIGHT_PID), \
|
#define SAFETY_CONFIG_DEFAULT_WEIGHTS ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_MEAS_ADC_OFF, SAFETY_FLAG_CONFIG_WEIGHT_PID), \
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_MEAS_ADC_WATCHDOG, SAFETY_FLAG_CONFIG_WEIGHT_PID), \
|
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_MEAS_ADC_WATCHDOG, SAFETY_FLAG_CONFIG_WEIGHT_PID), \
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_MEAS_ADC_UNSTABLE, SAFETY_FLAG_CONFIG_WEIGHT_NONE), \
|
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_MEAS_ADC_UNSTABLE, SAFETY_FLAG_CONFIG_WEIGHT_NONE), \
|
||||||
@ -224,7 +175,9 @@ enum analog_value_monitor {
|
|||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_STACK, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
|
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_STACK, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_SAFETY_ADC, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
|
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_SAFETY_ADC, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_SYSTICK, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
|
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_SYSTICK, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_WTCHDG_FIRED, SAFETY_FLAG_CONFIG_WEIGHT_PID), \
|
/* Watchdog timeout is not handled periodically, but only on startup.
|
||||||
|
* Therefore, it is not listed here */\
|
||||||
|
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_WTCHDG_FIRED, SAFETY_FLAG_CONFIG_WEIGHT_NONE), \
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_UNCAL, SAFETY_FLAG_CONFIG_WEIGHT_NONE), \
|
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_UNCAL, SAFETY_FLAG_CONFIG_WEIGHT_NONE), \
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_DEBUG, SAFETY_FLAG_CONFIG_WEIGHT_NONE), \
|
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_DEBUG, SAFETY_FLAG_CONFIG_WEIGHT_NONE), \
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_TIMING_MAIN_LOOP, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
|
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_TIMING_MAIN_LOOP, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
|
||||||
@ -232,10 +185,5 @@ enum analog_value_monitor {
|
|||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_SAFETY_TAB_CORRUPT, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
|
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_SAFETY_TAB_CORRUPT, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_AMON_SUPPLY_VOLT, SAFETY_FLAG_CONFIG_WEIGHT_PID), \
|
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_AMON_SUPPLY_VOLT, SAFETY_FLAG_CONFIG_WEIGHT_PID), \
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_OVERTEMP, SAFETY_FLAG_CONFIG_WEIGHT_PID), \
|
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_OVERTEMP, SAFETY_FLAG_CONFIG_WEIGHT_PID), \
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_FLASH_CRC_CODE, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
|
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_FLASH_CRC_DATA, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
|
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_CFG_CRC_MEAS_ADC, SAFETY_FLAG_CONFIG_WEIGHT_PID), \
|
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_CFG_CRC_SAFETY_ADC, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
|
|
||||||
ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_CFG_CRC_MISC, SAFETY_FLAG_CONFIG_WEIGHT_PANIC)
|
|
||||||
|
|
||||||
#endif /* __SAFETY_CONFIG_H__ */
|
#endif /* __SAFETY_CONFIG_H__ */
|
||||||
|
@ -70,14 +70,14 @@ struct timing_monitor_info {
|
|||||||
* You have to call safety_controller_handle
|
* You have to call safety_controller_handle
|
||||||
* If this function fails, it will hang, because errors in the safety controller are not recoverable
|
* If this function fails, it will hang, because errors in the safety controller are not recoverable
|
||||||
*/
|
*/
|
||||||
void safety_controller_init(void);
|
void safety_controller_init();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Handle the safety controller.
|
* @brief Handle the safety controller.
|
||||||
* @note This function must be executed periodically in order to prevent the watchdog from resetting the firmware
|
* @note This function must be executed periodically in order to prevent the watchdog from resetting the firmware
|
||||||
* @returns Worst flag weigth that is currently set.
|
* @return 0 if successful
|
||||||
*/
|
*/
|
||||||
enum config_weight safety_controller_handle(void);
|
int safety_controller_handle();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Report one or multiple errors to the safety controller
|
* @brief Report one or multiple errors to the safety controller
|
||||||
@ -170,13 +170,13 @@ bool safety_controller_get_flags_by_mask(enum safety_flag mask);
|
|||||||
* @brief Get the count of error flags
|
* @brief Get the count of error flags
|
||||||
* @return Error flag count
|
* @return Error flag count
|
||||||
*/
|
*/
|
||||||
uint32_t safety_controller_get_flag_count(void);
|
uint32_t safety_controller_get_flag_count();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the count of analog monitors
|
* @brief Get the count of analog monitors
|
||||||
* @return Analog monitor count
|
* @return Analog monitor count
|
||||||
*/
|
*/
|
||||||
uint32_t safety_controller_get_analog_monitor_count(void);
|
uint32_t safety_controller_get_analog_monitor_count();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get an error flag's name by its index.
|
* @brief Get an error flag's name by its index.
|
||||||
@ -267,14 +267,6 @@ int safety_controller_set_overtemp_limit(float over_temperature);
|
|||||||
*/
|
*/
|
||||||
float safety_controller_get_overtemp_limit(void);
|
float safety_controller_get_overtemp_limit(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Recalculate the CRC of a given CRC Monitor. This has to be done once the supervised registers update
|
|
||||||
* @param mon Monitor to recalculate
|
|
||||||
* @param password Password
|
|
||||||
* @return 0 if successful
|
|
||||||
*/
|
|
||||||
int safety_controller_set_crc_monitor(enum crc_monitor mon, uint32_t password);
|
|
||||||
|
|
||||||
#endif /* __SAFETY_CONTROLLER_H__ */
|
#endif /* __SAFETY_CONTROLLER_H__ */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <reflow-controller/safety/safety-config.h>
|
|
||||||
|
|
||||||
/** @addtogroup safety-memory
|
/** @addtogroup safety-memory
|
||||||
* @{
|
* @{
|
||||||
@ -36,14 +35,9 @@
|
|||||||
#define SAFETY_MEMORY_MAGIC 0x12AA5CB7
|
#define SAFETY_MEMORY_MAGIC 0x12AA5CB7
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Error memory NOP entry word written to the memory
|
* @brief Error memory NOP entry
|
||||||
*/
|
*/
|
||||||
#define SAFETY_MEMORY_NOP_ENTRY_WORD 0xC1AA1222UL
|
#define SAFETY_MEMORY_NOP_ENTRY 0xC1AA1222
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Low Byte (byte 0) of error memory entry
|
|
||||||
*/
|
|
||||||
#define SAFETY_MEMORY_ERROR_ENTRY_MARKER 0x51U
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Offset address for the safety_memory_header.
|
* @brief Offset address for the safety_memory_header.
|
||||||
@ -53,8 +47,6 @@
|
|||||||
|
|
||||||
#define SAFETY_MEMORY_CONFIG_OVERRIDE_COUNT 32UL
|
#define SAFETY_MEMORY_CONFIG_OVERRIDE_COUNT 32UL
|
||||||
|
|
||||||
#define SAFETY_MEMORY_UPDATE_FILENAME_MAXSIZE 256U
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Safety memory header
|
* @brief Safety memory header
|
||||||
*/
|
*/
|
||||||
@ -63,7 +55,6 @@ struct safety_memory_header {
|
|||||||
uint32_t boot_status_offset; /**< @brief Offset of the safety_memory_boot_status struct (in 32 bit words)*/
|
uint32_t boot_status_offset; /**< @brief Offset of the safety_memory_boot_status struct (in 32 bit words)*/
|
||||||
uint32_t config_overrides_offset; /**< @brief Offset address of override entries */
|
uint32_t config_overrides_offset; /**< @brief Offset address of override entries */
|
||||||
uint32_t config_overrides_len; /**< @brief Length of override entries in words */
|
uint32_t config_overrides_len; /**< @brief Length of override entries in words */
|
||||||
uint32_t firmware_update_filename; /**< @brief Filename of the firmware update. This string is at maximum 256 bytes long including the 0 terminator */
|
|
||||||
uint32_t err_memory_offset; /**< @brief Offset of the error memory */
|
uint32_t err_memory_offset; /**< @brief Offset of the error memory */
|
||||||
uint32_t err_memory_end; /**< @brief End of the error memory. This points to the word after the error memory, containing the CRC of the whole backup RAM. */
|
uint32_t err_memory_end; /**< @brief End of the error memory. This points to the word after the error memory, containing the CRC of the whole backup RAM. */
|
||||||
uint32_t crc; /**< @brief CRC of the header */
|
uint32_t crc; /**< @brief CRC of the header */
|
||||||
@ -132,6 +123,15 @@ enum config_override_entry_type {
|
|||||||
SAFETY_MEMORY_CONFIG_OVERRIDE_PERSISTENCE = 2,
|
SAFETY_MEMORY_CONFIG_OVERRIDE_PERSISTENCE = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Weights of error flags.
|
||||||
|
*/
|
||||||
|
enum config_weight {
|
||||||
|
SAFETY_FLAG_CONFIG_WEIGHT_NONE = 0, /**< @brief This flag has no global error consequence, but might be respected by certain software modules. */
|
||||||
|
SAFETY_FLAG_CONFIG_WEIGHT_PID = 1, /**< @brief This flag will force a stop of the temperature PID controller */
|
||||||
|
SAFETY_FLAG_CONFIG_WEIGHT_PANIC = 2, /**< @brief This flag will trigger the panic mode */
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief representation of a config override memory entry
|
* @brief representation of a config override memory entry
|
||||||
*/
|
*/
|
||||||
@ -240,35 +240,13 @@ int safety_memory_insert_config_override(struct config_override *config_override
|
|||||||
int safety_memory_get_config_override_count(uint32_t *count);
|
int safety_memory_get_config_override_count(uint32_t *count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get a config entry
|
* @brief Get a config ovveide entry
|
||||||
* @param idx Index of the requested entry
|
* @param idx Index of the requested entry
|
||||||
* @param[out] config_override READ override
|
* @param[out] config_override READ override
|
||||||
* @return 0 if successful
|
* @return 0 if successful
|
||||||
*/
|
*/
|
||||||
int safety_memory_get_config_override(uint32_t idx, struct config_override *config_override);
|
int safety_memory_get_config_override(uint32_t idx, struct config_override *config_override);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Read the set update filename from the safety backup memory
|
|
||||||
*
|
|
||||||
* \p filename has to be large enough to hold the filename (255 chars) plus the '\0'-terminator.
|
|
||||||
*
|
|
||||||
* @param[out] filename Array to fill in file name. May be NULL to only read the length.
|
|
||||||
* @param[out] outlen String length of the filename. May be NULL to only read the file name.
|
|
||||||
* @note \p filename may be NULL. In this case this function can be used to read the currently set filename's length.
|
|
||||||
* @warning Function will fail if both parameters are NULL
|
|
||||||
* @return 0 if successful
|
|
||||||
*/
|
|
||||||
int safety_memory_get_update_filename(char *filename, size_t *outlen);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set the filename of the update file
|
|
||||||
* @param[in] filename Filename to set. Must be 255 chars at max (256 including null terminator)
|
|
||||||
* @return 0 if successful
|
|
||||||
*/
|
|
||||||
int safety_memory_set_update_filename(const char *filename);
|
|
||||||
|
|
||||||
#ifndef SAFETY_MEMORY_STRIPOUT_DUMP
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get a base64 dump of the whole safety memory.
|
* @brief Get a base64 dump of the whole safety memory.
|
||||||
* @param[out] buffer Buffer to write the base 64 dump into.
|
* @param[out] buffer Buffer to write the base 64 dump into.
|
||||||
@ -278,8 +256,6 @@ int safety_memory_set_update_filename(const char *filename);
|
|||||||
*/
|
*/
|
||||||
int safety_memory_dump_base64(char *buffer, size_t buffsize, size_t *used_size);
|
int safety_memory_dump_base64(char *buffer, size_t buffsize, size_t *used_size);
|
||||||
|
|
||||||
#endif /* SAFETY_MEMORY_STRIPOUT_DUMP */
|
|
||||||
|
|
||||||
#endif /* __SAFETY_MEMORY_H__ */
|
#endif /* __SAFETY_MEMORY_H__ */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -27,19 +27,11 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Setup the watchdog for the safety controller
|
* @brief Setup the watchdog for the safety controller
|
||||||
*
|
* @param Prescaler to use for the 32 KHz LSI clock
|
||||||
* The watchdog timeout can be calculated with:
|
|
||||||
* \f[ t = \frac{(\mathrm{RELOAD_VAL} + 1)\cdot \mathrm{PRESCALER}}{32000 } s\f]
|
|
||||||
*
|
|
||||||
* Valid prescaler values are: 4, 8, 16, 32, 64, 128, 256.
|
|
||||||
* @param prescaler Prescaler to use for the 32 KHz LSI clock
|
|
||||||
* @param reload_value Reload value to reload the timer with when reset. 0 to 0xFFF
|
|
||||||
* @return 0 if successful
|
* @return 0 if successful
|
||||||
* @return -1 if prescaler is wrong
|
|
||||||
* @return -2 if a reload value > 0xFFF is selected. 0xFFF will be used in this case
|
|
||||||
* @note Once the watchdog is enabled, it cannot be turned off!
|
* @note Once the watchdog is enabled, it cannot be turned off!
|
||||||
*/
|
*/
|
||||||
int watchdog_setup(uint16_t prescaler, uint16_t reload_value);
|
int watchdog_setup(uint8_t prescaler);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reset watchdog counter
|
* @brief Reset watchdog counter
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
/* Reflow Oven Controller
|
|
||||||
*
|
|
||||||
* Copyright (C) 2022 Mario Hüttel <mario.huettel@gmx.net>
|
|
||||||
*
|
|
||||||
* This file is part of the Reflow Oven Controller Project.
|
|
||||||
*
|
|
||||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with the reflow oven controller project.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SD_H_
|
|
||||||
#define _SD_H_
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <fatfs/ff.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Mount the SD card if available and not already mounted
|
|
||||||
* @param fs Filesystem to mount to.
|
|
||||||
* @return true if mounted, false if an error occured or the SD is not inserted and cannot be mounted
|
|
||||||
*/
|
|
||||||
bool mount_sd_card_if_avail(FATFS *fs);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return whether an SD card is inserted and mounted
|
|
||||||
*
|
|
||||||
* @return true SD inserted and mounted
|
|
||||||
* @return false No SD inserted or not mounted
|
|
||||||
*/
|
|
||||||
bool sd_card_is_mounted(void);
|
|
||||||
|
|
||||||
#endif /* _SD_H_ */
|
|
@ -24,13 +24,6 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <reflow-controller/settings/settings.h>
|
#include <reflow-controller/settings/settings.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Save the calibration to the SD card
|
|
||||||
* @param sens_deviation Sensitivity deviation from nomila sensitivity (1)
|
|
||||||
* @param offset Offset
|
|
||||||
* @param active Calibration is active. If false, the calibration will be deleted from SD card
|
|
||||||
* @return 0 if successful
|
|
||||||
*/
|
|
||||||
int sd_card_settings_save_calibration(float sens_deviation, float offset, bool active);
|
int sd_card_settings_save_calibration(float sens_deviation, float offset, bool active);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,13 +34,6 @@ int sd_card_settings_save_calibration(float sens_deviation, float offset, bool a
|
|||||||
*/
|
*/
|
||||||
int sd_card_settings_try_load_calibration(float *sens_deviation, float *offset);
|
int sd_card_settings_try_load_calibration(float *sens_deviation, float *offset);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Load the PID parameters from @ref SETTINGS_PID_PARAMETER_FILE
|
|
||||||
* @param settings The PID settings
|
|
||||||
* @return Load result.
|
|
||||||
* @note This function is currently not used for the temperature profiles. They implement the PID parameters directy
|
|
||||||
* inside the profile
|
|
||||||
*/
|
|
||||||
enum settings_load_result sd_card_settings_load_pid_oven_parameters(struct oven_pid_settings *settings);
|
enum settings_load_result sd_card_settings_load_pid_oven_parameters(struct oven_pid_settings *settings);
|
||||||
|
|
||||||
#endif /* __SETTINGS_SETTINGS_SD_CARD_H__ */
|
#endif /* __SETTINGS_SETTINGS_SD_CARD_H__ */
|
||||||
|
@ -18,31 +18,26 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __SETTINGS_SETTINGS_H__
|
#ifndef __SETTINGS_SETTINGS_H__
|
||||||
#define __SETTINGS_SETTINGS_H__
|
#define __SETTINGS_SETTINGS_H__
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Settings for the PID controller that are stored in the config file
|
|
||||||
*/
|
|
||||||
struct oven_pid_settings {
|
struct oven_pid_settings {
|
||||||
float kd; /**< @brief Derivate term */
|
float kd;
|
||||||
float kp; /**< @brief Proportional term */
|
float kp;
|
||||||
float ki; /**< @brief Integral term */
|
float ki;
|
||||||
float kd_tau; /**< @brief Time constant of the derivate term's low pass filter */
|
float kd_tau;
|
||||||
float t_sample; /**< @brief Sampling time in seconds. @warning The loading function expects the file to hold a ms value */
|
float t_sample;
|
||||||
float max_integral; /**< @brief Maximum value of the intgral term */
|
float max_integral;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Results of a setting loading
|
|
||||||
*/
|
|
||||||
enum settings_load_result {
|
enum settings_load_result {
|
||||||
SETT_LOAD_SUCCESS = 0, /**< @brief Setting loaded successfully */
|
SETT_LOAD_SUCCESS = 0,
|
||||||
SETT_LOAD_FILE_NOT_FOUND, /**< @brief File not found. This is only used by Settings on the SD card */
|
SETT_LOAD_FILE_NOT_FOUND,
|
||||||
SETT_LOAD_ERR, /**< @brief Generic loading error */
|
SETT_LOAD_ERR,
|
||||||
SETT_LOAD_DISK_ERR, /**< @brief Disk access failure during loading */
|
SETT_LOAD_DISK_ERR
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SETTINGS_PID_PARAMETER_FILE "pid.conf"
|
#define SETTINGS_PID_PARAMETER_FILE "pid.conf"
|
||||||
@ -55,49 +50,14 @@ enum settings_load_result {
|
|||||||
*/
|
*/
|
||||||
int settings_save_calibration(float sens_deviation, float offset, bool active);
|
int settings_save_calibration(float sens_deviation, float offset, bool active);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Load the calibration
|
|
||||||
*
|
|
||||||
* If an EEPROM is present, it is first tried to be retrieved from EEPROM.
|
|
||||||
* If there is no EEPROM or there is no valid data inside, it is tried to be loaded from SD card.
|
|
||||||
*
|
|
||||||
* @param sens_dev Sensiotivity deviation
|
|
||||||
* @param offset Offset
|
|
||||||
* @return 0 if successful and calibration valid
|
|
||||||
*/
|
|
||||||
int settings_load_calibration(float *sens_dev, float *offset);
|
int settings_load_calibration(float *sens_dev, float *offset);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Load PID overn parameters from file on SD card. This function is not implemented for EEPROM.
|
|
||||||
* @param settings settings
|
|
||||||
* @return Load result
|
|
||||||
*/
|
|
||||||
enum settings_load_result settings_load_pid_oven_parameters(struct oven_pid_settings *settings);
|
enum settings_load_result settings_load_pid_oven_parameters(struct oven_pid_settings *settings);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief read the configured overtemperature limit
|
|
||||||
* @param[out] over_temp_limit Overtemperature limit in degrees Celsius
|
|
||||||
* @return Load result
|
|
||||||
*/
|
|
||||||
enum settings_load_result settings_load_overtemp_limit(float *over_temp_limit);
|
enum settings_load_result settings_load_overtemp_limit(float *over_temp_limit);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Save the overtemperature limit
|
|
||||||
* @param over_temp_limit Limit in degrees Celsius
|
|
||||||
* @param active Overtemperature limit active. If false: The config is delted and the controller uses its default limit
|
|
||||||
* @return 0 if successful
|
|
||||||
*/
|
|
||||||
int settings_save_overtemp_limit(float over_temp_limit, bool active);
|
int settings_save_overtemp_limit(float over_temp_limit, bool active);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Setup the settings module
|
|
||||||
*
|
|
||||||
* This function has to be called before performing any settings operations.
|
|
||||||
* It checks if an EEPTROM is connected and sets the appropriate settings storage in this case.
|
|
||||||
*
|
|
||||||
* EEPROM storage will only be available for HW versions > 1.3. Some functions require an EEPROM because the counterpart
|
|
||||||
* on the SD card is not defined. These functions will fail without an EEPROM.
|
|
||||||
*/
|
|
||||||
void settings_setup(void);
|
void settings_setup(void);
|
||||||
|
|
||||||
#endif /* __SETTINGS_SETTINGS_H__ */
|
#endif /* __SETTINGS_SETTINGS_H__ */
|
||||||
|
@ -24,59 +24,19 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the SPI for the eeprom.
|
|
||||||
* @return 0 if succesful
|
|
||||||
*/
|
|
||||||
int spi_eeprom_init(void);
|
|
||||||
|
|
||||||
/**
|
int spi_eeprom_init();
|
||||||
* @brief Uninitialize the SPI EEPROM
|
|
||||||
*/
|
void spi_eeprom_deinit();
|
||||||
void spi_eeprom_deinit(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Read from SPI EEPROM
|
|
||||||
* @param addr address to read from
|
|
||||||
* @param rx_buff buffer to write data to
|
|
||||||
* @param count Amount of bytes to read
|
|
||||||
* @return 0 if successful
|
|
||||||
*/
|
|
||||||
int spi_eeprom_read(uint32_t addr, uint8_t *rx_buff, uint32_t count);
|
int spi_eeprom_read(uint32_t addr, uint8_t *rx_buff, uint32_t count);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check if the EEPROM is currently performing a write and therefore cannot serve other requests
|
|
||||||
* @return true: Write in Progress, false: No write active
|
|
||||||
*/
|
|
||||||
bool spi_eeprom_write_in_progress(void);
|
bool spi_eeprom_write_in_progress(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Write data to the EEPROM
|
|
||||||
* @param addr Address to write to
|
|
||||||
* @param data Data to write
|
|
||||||
* @param count Amount of bytes to write
|
|
||||||
* @return 0 if successful
|
|
||||||
* @note The page handling of the EEPROM is done internally. When using this function there is no need to worry about
|
|
||||||
* the 16 byte page boundaries of the EEPROM
|
|
||||||
*/
|
|
||||||
int spi_eeprom_write(uint32_t addr, const uint8_t *data, uint32_t count);
|
int spi_eeprom_write(uint32_t addr, const uint8_t *data, uint32_t count);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Read the status register of the EEPROM
|
|
||||||
* @return status register
|
|
||||||
*/
|
|
||||||
uint8_t spi_eeprom_read_status_reg(void);
|
uint8_t spi_eeprom_read_status_reg(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check if an EEPROM is connected to the SPI.
|
|
||||||
*
|
|
||||||
* This is done by trying to set the write enable latch in the status register and reading it back.
|
|
||||||
* After it has been set, it is immediately reset.
|
|
||||||
*
|
|
||||||
* If it can't be read back, no EEPROM is connected
|
|
||||||
*
|
|
||||||
* @return true: EEPROM is connected, false: No (compatible) EEPROM found
|
|
||||||
*/
|
|
||||||
bool spi_eeprom_check_connected(void);
|
bool spi_eeprom_check_connected(void);
|
||||||
|
|
||||||
#endif /* __SETTINGS_SPI_EEPROM_H__ */
|
#endif /* __SETTINGS_SPI_EEPROM_H__ */
|
||||||
|
@ -25,11 +25,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* UART_DIV is 45.5625 => 115200 @ 84 MHz */
|
/* UART_DIV is 45.5625 => 115200 @ 84 MHz */
|
||||||
#define SHELL_UART_DEFAULT_DIV_FRACTION 9U /* Equals 9/16 = 0.5625 */
|
#define SHELL_UART_DIV_FRACTION 9U /* Equals 9/16 = 0.5625 */
|
||||||
#define SHELL_UART_DEFAULT_DIV_MANTISSA 45U /* Equals 45 */
|
#define SHELL_UART_DIV_MANTISSA 45U /* Equals 45 */
|
||||||
|
|
||||||
#define SHELL_UART_DEFAULT_BRR_REG_VALUE ((SHELL_UART_DEFAULT_DIV_MANTISSA<<4) | SHELL_UART_DEFAULT_DIV_FRACTION);
|
#define SHELL_UART_BRR_REG_VALUE ((SHELL_UART_DIV_MANTISSA<<4) | SHELL_UART_DIV_FRACTION);
|
||||||
|
|
||||||
#define SHELL_UART_PERIPHERAL_CLOCK (84000000UL)
|
|
||||||
|
|
||||||
#endif /* __SHELL_UART_CONFIG_H__ */
|
#endif /* __SHELL_UART_CONFIG_H__ */
|
@ -69,28 +69,10 @@ void systick_setup(void);
|
|||||||
*/
|
*/
|
||||||
void systick_wait_ms(uint32_t ms);
|
void systick_wait_ms(uint32_t ms);
|
||||||
|
|
||||||
/**
|
uint64_t systick_get_global_tick();
|
||||||
* @brief Get the gloabl millisecond tick. This can be used to implement all sorts of time based procedures / waits.
|
|
||||||
* @warning Use this with care in interrupts. It may lead to race conditions. It is generally safe for use in standard program flow though.
|
|
||||||
* @return Global millisecond tick.
|
|
||||||
*/
|
|
||||||
uint64_t systick_get_global_tick(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Calculate the uptime from the current millisecond tick.
|
|
||||||
* @param[out] days Days. May be NULL.
|
|
||||||
* @param[out] hours Hours. May be NULL.
|
|
||||||
* @param[out] minutes Minutes. May be NULL.
|
|
||||||
* @param[out] seconds Seconds. May be NULL.
|
|
||||||
*/
|
|
||||||
void systick_get_uptime_from_tick(uint32_t *days, uint32_t *hours, uint32_t *minutes, uint32_t *seconds);
|
void systick_get_uptime_from_tick(uint32_t *days, uint32_t *hours, uint32_t *minutes, uint32_t *seconds);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check if \p ticks (milliseconds) have passed since \p start_timestamp
|
|
||||||
* @param start_timestamp Start timestamp
|
|
||||||
* @param ticks tick count
|
|
||||||
* @return true: Time has passed
|
|
||||||
*/
|
|
||||||
bool systick_ticks_have_passed(uint64_t start_timestamp, uint64_t ticks);
|
bool systick_ticks_have_passed(uint64_t start_timestamp, uint64_t ticks);
|
||||||
|
|
||||||
#endif /* __SYSTICK_H__ */
|
#endif /* __SYSTICK_H__ */
|
||||||
|
@ -25,8 +25,7 @@
|
|||||||
* @brief Convert PT1000 resistance to temperature in degrees celsius
|
* @brief Convert PT1000 resistance to temperature in degrees celsius
|
||||||
* @param resistance PT1000 resistance value
|
* @param resistance PT1000 resistance value
|
||||||
* @param[out] temp_out Temperature output
|
* @param[out] temp_out Temperature output
|
||||||
* @return 0 if ok, -1 if value is below conversion range, 1 if value is above conversion range,
|
* @return 0 if ok, -1 if value is below conversion range, 1 if value is above conversion range,-1000 in case of pointer error
|
||||||
* -1000 in case of pointer error
|
|
||||||
*/
|
*/
|
||||||
int temp_converter_convert_resistance_to_temp(float resistance, float *temp_out);
|
int temp_converter_convert_resistance_to_temp(float resistance, float *temp_out);
|
||||||
|
|
||||||
@ -37,6 +36,6 @@ int temp_converter_convert_resistance_to_temp(float resistance, float *temp_out)
|
|||||||
* @return 0 if ok, -1 if tmeperature is below the lookup table, 1 if value is above the lookup table, -1000 in case of a pointer error,
|
* @return 0 if ok, -1 if tmeperature is below the lookup table, 1 if value is above the lookup table, -1000 in case of a pointer error,
|
||||||
* -100 if an internal error occured. This should never happen, if the lookup table is correct
|
* -100 if an internal error occured. This should never happen, if the lookup table is correct
|
||||||
*/
|
*/
|
||||||
int temp_converter_convert_temp_to_resistance(float temp, float *resistance_out);
|
int temp_convertet_convert_temp_to_resistance(float temp, float *resistance_out);
|
||||||
|
|
||||||
#endif /* __TEMP_CONVERTER_H__ */
|
#endif /* __TEMP_CONVERTER_H__ */
|
||||||
|
@ -1,94 +0,0 @@
|
|||||||
/* Reflow Oven Controller
|
|
||||||
*
|
|
||||||
* Copyright (C) 2021 Mario Hüttel <mario.huettel@gmx.net>
|
|
||||||
*
|
|
||||||
* This file is part of the Reflow Oven Controller Project.
|
|
||||||
*
|
|
||||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with the reflow oven controller project.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @addtogroup temp-profile
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __TEMP_PROFILE_EXECUTER_H__
|
|
||||||
#define __TEMP_PROFILE_EXECUTER_H__
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <reflow-controller/temp-profile/temp-profile-parser.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Maximum command count of a temperature profile the parser will handle
|
|
||||||
*/
|
|
||||||
#define MAX_PROFILE_LENGTH 64
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Status of the temperature profile execution
|
|
||||||
*/
|
|
||||||
enum tpe_status {
|
|
||||||
TPE_OFF, /**< @brief No profile execution */
|
|
||||||
TPE_RUNNING, /**< @brief Profile currently running */
|
|
||||||
TPE_ABORT, /**< @brief Profile execution aborted due to event / error */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The execution state of the temperature profile
|
|
||||||
*/
|
|
||||||
struct tpe_exec_state {
|
|
||||||
enum tpe_status status; /**< @brief Execution status */
|
|
||||||
float setpoint; /**< @brief Temperature setpoint in degrees Celsius */
|
|
||||||
uint64_t start_timestamp; /**< @brief The millisicend tick timestamp, the profile execution was started */
|
|
||||||
uint32_t step; /**< @brief Current execution step. Starts at 0 */
|
|
||||||
uint32_t profile_steps; /**< @brief Number of steps (commands) in profile */
|
|
||||||
enum pl_command_type current_command; /**< @brief The currently executed command */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Start a temperature profile execution from a file on SD card.
|
|
||||||
* @param filename Filename of the temperature profile
|
|
||||||
* @return Status. PL_RET_SUCCESS id profile was parsed and started successfully
|
|
||||||
*/
|
|
||||||
enum pl_ret_val temp_profile_executer_start(const char *filename);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Handle the profile execution
|
|
||||||
*
|
|
||||||
* The function checks if since the last time it ran, 100 ms have passed. If yes,
|
|
||||||
* it proceeds with the command execution.
|
|
||||||
*
|
|
||||||
* @note This must be periodically called.
|
|
||||||
* @return 0 if successul, negative if profile not running or aborted or temperature set and PID not configured.
|
|
||||||
*/
|
|
||||||
int temp_profile_executer_handle(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the curretn execution state of the temperature profile executer
|
|
||||||
* @warning The returned state structure is static and used internally. You must not modify it.
|
|
||||||
* @return Execution state
|
|
||||||
*/
|
|
||||||
const struct tpe_exec_state *temp_profile_executer_status(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Stop the temperature profile execution.
|
|
||||||
*
|
|
||||||
* The profile execution is stopped and the beeper is deactivated.
|
|
||||||
*
|
|
||||||
* @return always 0. This function cannot fail.
|
|
||||||
*/
|
|
||||||
int temp_profile_executer_stop(void);
|
|
||||||
|
|
||||||
#endif /* __TEMP_PROFILE_EXECUTER_H__ */
|
|
||||||
|
|
||||||
/** @} */
|
|
@ -1,105 +0,0 @@
|
|||||||
/* Reflow Oven Controller
|
|
||||||
*
|
|
||||||
* Copyright (C) 2021 Mario Hüttel <mario.huettel@gmx.net>
|
|
||||||
*
|
|
||||||
* This file is part of the Reflow Oven Controller Project.
|
|
||||||
*
|
|
||||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with the reflow oven controller project.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @defgroup temp-profile Temperature Profile Parser and Executer
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __CONFIG_PARSER_TEMP_PROFILE_PARSER_H__
|
|
||||||
#define __CONFIG_PARSER_TEMP_PROFILE_PARSER_H__
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <linklist-lib/singly-linked-list.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Command types the temperature profile language supports
|
|
||||||
*/
|
|
||||||
enum pl_command_type {
|
|
||||||
PL_PID_CONF = 0, /**< @brief Configure the PID parameters and start PID controller */
|
|
||||||
PL_SET_TEMP, /**< @brief Set the target temperature of the PID controller */
|
|
||||||
PL_SET_RAMP, /**< @brief Perform a temperature ramp */
|
|
||||||
PL_WAIT_FOR_TEMP, /**< @brief Wait until a temperature is reached */
|
|
||||||
PL_WAIT_FOR_TIME, /**< @brief Wait for a specific amount of time */
|
|
||||||
PL_LOUDSPEAKER_SET, /**< @brief Set the loudspeaker/beeper */
|
|
||||||
PL_OFF, /**< @brief Disable the temperature output and shutdown the PID controller */
|
|
||||||
PL_CLEAR_FLAGS, /**< @brief Try clear all flags */
|
|
||||||
PL_DIGIO_CONF, /**< @brief Configure a DIGIO pin */
|
|
||||||
PL_DIGIO_SET, /**< @brief Set a DIGIO pin */
|
|
||||||
PL_DIGIO_WAIT, /**< @brief Wait until a DIGIO pin is set to the specified level */
|
|
||||||
_PL_NUM_CMDS, /**< @brief Sentinel to determine the total amount of commands */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Profile language parser return value
|
|
||||||
*/
|
|
||||||
enum pl_ret_val {
|
|
||||||
PL_RET_SUCCESS = 0, /**< @brief Profile parsed successfully */
|
|
||||||
PL_RET_DISK_ERR, /**< @brief Disk I/O error */
|
|
||||||
PL_RET_PARAM_ERR, /**< @brief Function parameter error */
|
|
||||||
PL_RET_LIST_FULL, /**< @brief Command list is full. Temperature profile is longer than the specified maximum */
|
|
||||||
PL_RET_SCRIPT_ERR, /**< @brief Syntax error in temperature profile */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Maximum parameter count of a command.
|
|
||||||
*/
|
|
||||||
#define PROFILE_LANG_MAX_NUM_ARGS (8)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Structure representing a command in a temperature profile.
|
|
||||||
*/
|
|
||||||
struct pl_command {
|
|
||||||
enum pl_command_type cmd; /**< @brief Command */
|
|
||||||
float params[PROFILE_LANG_MAX_NUM_ARGS]; /**< @brief Parameters */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Parse a temperature profile from file and generate the command list
|
|
||||||
*
|
|
||||||
* Commands are parsed into the list given by \p command_list. If \p max_len is reached,
|
|
||||||
* the function returns with @ref PL_RET_LIST_FULL
|
|
||||||
*
|
|
||||||
* In any case, the command list not cleared afterwards. The user has to clear the command list manually
|
|
||||||
* using @ref temp_profile_free_command_list.
|
|
||||||
*
|
|
||||||
* @param filename File to parse
|
|
||||||
* @param[in, out] command_list Command list to output @ref pl_command elements in.
|
|
||||||
* @param max_len maximum number of commands.
|
|
||||||
* @param cmds_parsed Number of parsed commands
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
enum pl_ret_val temp_profile_parse_from_file(const char *filename,
|
|
||||||
SlList **command_list,
|
|
||||||
uint32_t max_len,
|
|
||||||
uint32_t *cmds_parsed);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Fully free a comamnd list including hte stored command structures.
|
|
||||||
*
|
|
||||||
* \p list's destination is set to NULL to indicate the empty list.
|
|
||||||
*
|
|
||||||
* @param[in, out] list Pointer to list.
|
|
||||||
*/
|
|
||||||
void temp_profile_free_command_list(SlList **list);
|
|
||||||
|
|
||||||
#endif /* __CONFIG_PARSER_TEMP_PROFILE_PARSER_H__ */
|
|
||||||
|
|
||||||
/** @} */
|
|
@ -21,48 +21,12 @@
|
|||||||
#ifndef _GUI_H_
|
#ifndef _GUI_H_
|
||||||
#define _GUI_H_
|
#define _GUI_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Handle the reflow controller's LCD Menu
|
* @brief Handle the reflow controller's LCD Menu
|
||||||
* @return 0 if no delay is requested, 1 if delay is requested
|
* @return 0 if no delay is requested, 1 if delay is requested
|
||||||
*/
|
*/
|
||||||
int gui_handle(void);
|
int gui_handle(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the GUI (LCD, button, and rotary encoder)
|
|
||||||
*/
|
|
||||||
void gui_init(void);
|
void gui_init(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set a overlay message displayed on top of the root menu
|
|
||||||
* @param heading Heading of the overlay message (1st line)
|
|
||||||
* @param text Text of the overlay (the two bottom lines, 2 times 16 chars)
|
|
||||||
*/
|
|
||||||
void gui_root_menu_message_set(const char *heading, const char *text);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Directly write to the LCD
|
|
||||||
*
|
|
||||||
* This function writes directly to the LCD and doesn't use the handling FSM in the
|
|
||||||
* background. Therefore, the function will block until all data is written to the LCD.
|
|
||||||
*
|
|
||||||
* @param line line to write to. Starts at 0
|
|
||||||
* @param text Text to write to the line
|
|
||||||
*/
|
|
||||||
void gui_lcd_write_direct_blocking(uint8_t line, const char *text);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the vertical size of the display
|
|
||||||
* @return Count of rows
|
|
||||||
*/
|
|
||||||
size_t gui_get_line_count(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the const char disp[][21] array contianing all display rows
|
|
||||||
* @note This directly returns the working buffer pointer. Do not change it!
|
|
||||||
*/
|
|
||||||
const char (*gui_get_current_display_content(void))[21];
|
|
||||||
|
|
||||||
#endif /* _GUI_H_ */
|
#endif /* _GUI_H_ */
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#ifndef __LCD_H__
|
#ifndef __LCD_H__
|
||||||
#define __LCD_H__
|
#define __LCD_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define LCD_DPORT (GPIOD)
|
#define LCD_DPORT (GPIOD)
|
||||||
#define LCD_RCC_MASK RCC_AHB1ENR_GPIODEN
|
#define LCD_RCC_MASK RCC_AHB1ENR_GPIODEN
|
||||||
#define LCD_DATA_BIT_OFFSET (8)
|
#define LCD_DATA_BIT_OFFSET (8)
|
||||||
@ -50,8 +48,6 @@ void lcd_init(void);
|
|||||||
|
|
||||||
void lcd_string(const char *data);
|
void lcd_string(const char *data);
|
||||||
|
|
||||||
void lcd_setcursor(uint8_t x, uint8_t y);
|
|
||||||
|
|
||||||
void lcd_home(void);
|
void lcd_home(void);
|
||||||
|
|
||||||
enum lcd_fsm_ret lcd_fsm_write_buffer(const char (*display_buffer)[21]);
|
enum lcd_fsm_ret lcd_fsm_write_buffer(const char (*display_buffer)[21]);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#define __MENU_H__
|
#define __MENU_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <reflow-controller/ui/button.h>
|
#include <reflow-controller/button.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
struct lcd_menu;
|
struct lcd_menu;
|
||||||
@ -87,6 +87,4 @@ void menu_list_scroll_up(struct menu_list *list);
|
|||||||
|
|
||||||
void menu_list_enter_selected_entry(struct menu_list *list, struct lcd_menu *menu);
|
void menu_list_enter_selected_entry(struct menu_list *list, struct lcd_menu *menu);
|
||||||
|
|
||||||
uint32_t menu_list_get_currently_selected(struct menu_list *list);
|
|
||||||
|
|
||||||
#endif /* __MENU_H__ */
|
#endif /* __MENU_H__ */
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
/* Reflow Oven Controller
|
|
||||||
*
|
|
||||||
* Copyright (C) 2021 Mario Hüttel <mario.huettel@gmx.net>
|
|
||||||
*
|
|
||||||
* This file is part of the Reflow Oven Controller Project.
|
|
||||||
*
|
|
||||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with the reflow oven controller project.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __SHELL_UART_H__
|
|
||||||
|
|
||||||
#include <shellmatta.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Configure the UART for the shellmatta shell.
|
|
||||||
*
|
|
||||||
* This will configure the UART for use with a DMA ring buffer.
|
|
||||||
* @param uart
|
|
||||||
*/
|
|
||||||
void shell_uart_setup(void);
|
|
||||||
|
|
||||||
shellmatta_retCode_t shell_uart_write_callback(const char *data, uint32_t len);
|
|
||||||
|
|
||||||
int shell_uart_receive_data_with_dma(const char **data, size_t *len);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Configure a new connection speed.
|
|
||||||
* @param new_baud Baudrate. E.g: 115200
|
|
||||||
* @return Error in permille (1/1000). A return value of 2 means a baudrate error of: 0.002 or 0.2%.
|
|
||||||
* Return value is negative in case of a hard error.
|
|
||||||
*/
|
|
||||||
int32_t shell_uart_reconfig_baud(uint32_t new_baud);
|
|
||||||
|
|
||||||
uint32_t shell_uart_get_current_baudrate(void);
|
|
||||||
|
|
||||||
#define __SHELL_UART_H__
|
|
||||||
|
|
||||||
#endif /* __SHELL_UART_H__ */
|
|
@ -25,14 +25,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Start the RAM Code of the updater. This function will never return!
|
* @brief Start the RAM Code of the updater. This function will never return!
|
||||||
*
|
|
||||||
* This function is called at startup when the controller detects, that an update should
|
|
||||||
* be performed.
|
|
||||||
*
|
|
||||||
* @note You prabably want to call @ref start_updater function to update.
|
|
||||||
*/
|
*/
|
||||||
void __attribute__((noreturn)) start_updater_ram_code(void);
|
void __attribute__((noreturn)) start_updater(void);
|
||||||
|
|
||||||
void __attribute__((noreturn)) updater_update_from_file(const char *filename);
|
|
||||||
|
|
||||||
#endif /* __UPDATER_UPDATER_H__ */
|
#endif /* __UPDATER_UPDATER_H__ */
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
/* Reflow Oven Controller
|
|
||||||
*
|
|
||||||
* Copyright (C) 2022 Mario Hüttel <mario.huettel@gmx.net>
|
|
||||||
*
|
|
||||||
* This file is part of the Reflow Oven Controller Project.
|
|
||||||
*
|
|
||||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with the reflow oven controller project.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _VERSION_H_
|
|
||||||
#define _VERSION_H_
|
|
||||||
|
|
||||||
extern const char *version_git_version_string;
|
|
||||||
extern const char *version_git_full_commit_string;
|
|
||||||
extern const char *version_compile_date;
|
|
||||||
extern const char *version_compile_time;
|
|
||||||
|
|
||||||
#endif /* _VERSION_H_ */
|
|
@ -1,45 +0,0 @@
|
|||||||
/* Reflow Oven Controller
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
|
||||||
*
|
|
||||||
* This file is part of the Reflow Oven Controller Project.
|
|
||||||
*
|
|
||||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with the reflow oven controller project.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _OPTION_BYTES_H_
|
|
||||||
#define _OPTION_BYTES_H_
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
struct option_bytes {
|
|
||||||
/* Word 1 */
|
|
||||||
uint32_t read_protection;// : 8;
|
|
||||||
uint32_t nrst_standby;// : 1;
|
|
||||||
uint32_t nrst_stop;// : 1;
|
|
||||||
uint32_t wdg_sw;// : 1;
|
|
||||||
uint32_t brown_out_level;// : 2;
|
|
||||||
/* Word 2 */
|
|
||||||
uint32_t nwrpi;// : 12;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Read out the option bytes to structs
|
|
||||||
* @param opts
|
|
||||||
*/
|
|
||||||
void stm_option_bytes_read(struct option_bytes *opts);
|
|
||||||
|
|
||||||
int stm_option_bytes_program(const struct option_bytes *opts);
|
|
||||||
|
|
||||||
#endif /* _OPTION_BYTES_H_ */
|
|
@ -33,7 +33,7 @@ enum random_number_error {
|
|||||||
|
|
||||||
void random_number_gen_init(bool int_enable);
|
void random_number_gen_init(bool int_enable);
|
||||||
|
|
||||||
void random_number_gen_deinit(void);
|
void random_number_gen_deinit();
|
||||||
|
|
||||||
void random_number_gen_reset(bool int_en);
|
void random_number_gen_reset(bool int_en);
|
||||||
|
|
||||||
|
@ -50,8 +50,6 @@ int uart_init(struct stm_uart *uart);
|
|||||||
|
|
||||||
void uart_change_brr(struct stm_uart *uart, uint32_t brr);
|
void uart_change_brr(struct stm_uart *uart, uint32_t brr);
|
||||||
|
|
||||||
uint32_t uart_get_brr(struct stm_uart *uart);
|
|
||||||
|
|
||||||
void uart_disable(struct stm_uart *uart);
|
void uart_disable(struct stm_uart *uart);
|
||||||
|
|
||||||
void uart_send_char(struct stm_uart *uart, char c);
|
void uart_send_char(struct stm_uart *uart, char c);
|
||||||
|
@ -29,10 +29,6 @@
|
|||||||
* @param mid mid word of ID
|
* @param mid mid word of ID
|
||||||
* @param low low word of ID
|
* @param low low word of ID
|
||||||
*/
|
*/
|
||||||
void stm_unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low);
|
void unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low);
|
||||||
|
|
||||||
void stm_dev_rev_id_get(uint32_t *device_id, uint32_t *revision_id);
|
|
||||||
|
|
||||||
void stm_cpuid_get(uint8_t *implementer, uint8_t *variant, uint16_t *part_no, uint8_t *rev);
|
|
||||||
|
|
||||||
#endif /* __UNIQUE_ID_H__ */
|
#endif /* __UNIQUE_ID_H__ */
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 18b3ab377ac30516f977e9831813ea37189d4028
|
|
@ -1,77 +0,0 @@
|
|||||||
/* Reflow Oven Controller
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
|
||||||
*
|
|
||||||
* This file is part of the Reflow Oven Controller Project.
|
|
||||||
*
|
|
||||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with the reflow oven controller project.
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @addtogroup main-cycle-counter
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <reflow-controller/main-cycle-counter.h>
|
|
||||||
#include <helper-macros/helper-macros.h>
|
|
||||||
#include <stm32/stm32f4xx.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Variable storing the main cycle counter.
|
|
||||||
* @note This variable should not be accessed directly.
|
|
||||||
* Use the main_cycle_counter_get() or main_cycle_counter_inc() functions.
|
|
||||||
*/
|
|
||||||
static uint64_t IN_SECTION(.ccm.bss) main_cycle_counter;
|
|
||||||
|
|
||||||
void main_and_core_cycle_counter_init(void)
|
|
||||||
{
|
|
||||||
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
|
||||||
|
|
||||||
/* Enable the core cycle counter if available on current processor */
|
|
||||||
if (!(DWT->CTRL & DWT_CTRL_NOCYCCNT_Msk)) {
|
|
||||||
/* Cycle counter is available. Enable */
|
|
||||||
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset the counters to 0 */
|
|
||||||
main_cycle_counter_reset();
|
|
||||||
core_cycle_counter_reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void main_cycle_counter_reset(void)
|
|
||||||
{
|
|
||||||
main_cycle_counter = 0ULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main_cycle_counter_inc(void)
|
|
||||||
{
|
|
||||||
main_cycle_counter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t main_cycle_counter_get(void)
|
|
||||||
{
|
|
||||||
return main_cycle_counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
void core_cycle_counter_reset(void)
|
|
||||||
{
|
|
||||||
DWT->CYCCNT = 0UL;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t core_cycle_counter_get(void)
|
|
||||||
{
|
|
||||||
return DWT->CYCCNT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @} */
|
|
@ -23,7 +23,6 @@
|
|||||||
* @brief Main file for firmware
|
* @brief Main file for firmware
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "reflow-controller/safety/safety-config.h"
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -32,26 +31,23 @@
|
|||||||
#include <setup/system_stm32f4xx.h>
|
#include <setup/system_stm32f4xx.h>
|
||||||
#include <reflow-controller/systick.h>
|
#include <reflow-controller/systick.h>
|
||||||
#include <reflow-controller/adc-meas.h>
|
#include <reflow-controller/adc-meas.h>
|
||||||
|
#include <reflow-controller/shell.h>
|
||||||
#include <reflow-controller/digio.h>
|
#include <reflow-controller/digio.h>
|
||||||
|
#include "fatfs/shimatta_sdio_driver/shimatta_sdio.h"
|
||||||
#include <stm-periph/stm32-gpio-macros.h>
|
#include <stm-periph/stm32-gpio-macros.h>
|
||||||
#include <stm-periph/rcc-manager.h>
|
#include <stm-periph/rcc-manager.h>
|
||||||
#include <stm-periph/uart.h>
|
#include <stm-periph/uart.h>
|
||||||
#include <reflow-controller/periph-config/shell-uart-config.h>
|
#include <reflow-controller/shell-uart-config.h>
|
||||||
#include <reflow-controller/oven-driver.h>
|
#include <reflow-controller/oven-driver.h>
|
||||||
#include <fatfs/ff.h>
|
#include <fatfs/ff.h>
|
||||||
#include <reflow-controller/sd.h>
|
|
||||||
#include <reflow-controller/ui/gui.h>
|
#include <reflow-controller/ui/gui.h>
|
||||||
#include <reflow-controller/ui/shell.h>
|
|
||||||
#include <reflow-controller/ui/shell-uart.h>
|
|
||||||
#include <reflow-controller/safety/safety-controller.h>
|
#include <reflow-controller/safety/safety-controller.h>
|
||||||
#include <reflow-controller/settings/settings.h>
|
#include <reflow-controller/settings/settings.h>
|
||||||
#include <reflow-controller/safety/safety-memory.h>
|
#include <reflow-controller/safety/safety-memory.h>
|
||||||
#include <reflow-controller/safety/fault.h>
|
#include <reflow-controller/safety/fault.h>
|
||||||
#include <reflow-controller/updater/updater.h>
|
#include <reflow-controller/updater/updater.h>
|
||||||
#include <reflow-controller/temp-profile/temp-profile-executer.h>
|
|
||||||
#include <reflow-controller/settings/spi-eeprom.h>
|
#include <reflow-controller/settings/spi-eeprom.h>
|
||||||
#include <reflow-controller/main-cycle-counter.h>
|
|
||||||
#include <stm-periph/option-bytes.h>
|
|
||||||
|
|
||||||
static void setup_nvic_priorities(void)
|
static void setup_nvic_priorities(void)
|
||||||
{
|
{
|
||||||
@ -70,13 +66,13 @@ static void setup_nvic_priorities(void)
|
|||||||
FATFS fs;
|
FATFS fs;
|
||||||
#define fs_ptr (&fs)
|
#define fs_ptr (&fs)
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Configure UART GPIOs
|
|
||||||
* In case the application is build in debug mode, use the TX/RX Pins on the debug header
|
|
||||||
* else the Pins on the DIGIO header are configured in the digio module and this function does nothing.
|
|
||||||
*/
|
|
||||||
static inline void uart_gpio_config(void)
|
static inline void uart_gpio_config(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* In case the application is build in debug mode, use the TX/RX Pins on the debug header
|
||||||
|
* else the Pins on the DIGIO header are configured in the digio module
|
||||||
|
*/
|
||||||
|
|
||||||
#if defined(DEBUGBUILD) || defined(UART_ON_DEBUG_HEADER)
|
#if defined(DEBUGBUILD) || defined(UART_ON_DEBUG_HEADER)
|
||||||
rcc_manager_enable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(SHELL_UART_PORT_RCC_MASK));
|
rcc_manager_enable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(SHELL_UART_PORT_RCC_MASK));
|
||||||
SHELL_UART_PORT->MODER &= MODER_DELETE(SHELL_UART_TX_PIN) & MODER_DELETE(SHELL_UART_RX_PIN);
|
SHELL_UART_PORT->MODER &= MODER_DELETE(SHELL_UART_TX_PIN) & MODER_DELETE(SHELL_UART_RX_PIN);
|
||||||
@ -89,13 +85,68 @@ static inline void uart_gpio_config(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Process the boot status structure in the safety (backup) RAM
|
static char shell_uart_tx_buff[256];
|
||||||
* Depending on the flags set there, this function will:
|
static char shell_uart_rx_buff[48];
|
||||||
* - Reboot into the ram code for reflashing
|
struct stm_uart shell_uart;
|
||||||
* - Display the PANIC message
|
|
||||||
* - Display if the flash has been successfully updated
|
static shellmatta_retCode_t write_shell_callback(const char *data, uint32_t len)
|
||||||
*/
|
{
|
||||||
|
uart_send_array_with_dma(&shell_uart, data, len);
|
||||||
|
return SHELLMATTA_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void setup_shell_uart(struct stm_uart *uart)
|
||||||
|
{
|
||||||
|
uart->rx = 1;
|
||||||
|
uart->tx = 1;
|
||||||
|
uart->brr_val = SHELL_UART_BRR_REG_VALUE;
|
||||||
|
uart->rcc_reg = &SHELL_UART_RCC_REG;
|
||||||
|
uart->rcc_bit_no = BITMASK_TO_BITNO(SHELL_UART_RCC_MASK);
|
||||||
|
uart->uart_dev = SHELL_UART_PERIPH;
|
||||||
|
uart->dma_rx_buff = shell_uart_rx_buff;
|
||||||
|
uart->dma_tx_buff = shell_uart_tx_buff;
|
||||||
|
uart->rx_buff_count = sizeof(shell_uart_rx_buff);
|
||||||
|
uart->tx_buff_count = sizeof(shell_uart_tx_buff);
|
||||||
|
uart->base_dma_num = 2;
|
||||||
|
uart->dma_rx_stream = SHELL_UART_RECEIVE_DMA_STREAM;
|
||||||
|
uart->dma_tx_stream = SHELL_UART_SEND_DMA_STREAM;
|
||||||
|
uart->dma_rx_trigger_channel = SHELL_UART_RX_DMA_TRIGGER;
|
||||||
|
uart->dma_tx_trigger_channel = SHELL_UART_TX_DMA_TRIGGER;
|
||||||
|
|
||||||
|
uart_init(uart);
|
||||||
|
NVIC_EnableIRQ(DMA2_Stream7_IRQn);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool mount_sd_card_if_avail(bool mounted)
|
||||||
|
{
|
||||||
|
FRESULT res;
|
||||||
|
static uint8_t IN_SECTION(.ccm.bss) inserted_counter = 0;
|
||||||
|
|
||||||
|
if (sdio_check_inserted() && mounted) {
|
||||||
|
memset(fs_ptr, 0, sizeof(FATFS));
|
||||||
|
sdio_stop_clk();
|
||||||
|
inserted_counter = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sdio_check_inserted() && inserted_counter < 255)
|
||||||
|
inserted_counter++;
|
||||||
|
|
||||||
|
if (!sdio_check_inserted() && !mounted && inserted_counter > 4) {
|
||||||
|
inserted_counter = 0;
|
||||||
|
res = f_mount(fs_ptr, "0:/", 1);
|
||||||
|
if (res == FR_OK) {
|
||||||
|
led_set(1, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mounted;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void handle_boot_status(void)
|
static inline void handle_boot_status(void)
|
||||||
{
|
{
|
||||||
struct safety_memory_boot_status status;
|
struct safety_memory_boot_status status;
|
||||||
@ -104,12 +155,6 @@ static inline void handle_boot_status(void)
|
|||||||
res = safety_memory_get_boot_status(&status);
|
res = safety_memory_get_boot_status(&status);
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
panic_mode();
|
panic_mode();
|
||||||
|
|
||||||
if (status.reset_from_panic) {
|
|
||||||
/* We've seen a panic */
|
|
||||||
gui_root_menu_message_set("!! PANIC !!", "Check error me- mory!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status.reboot_to_bootloader) {
|
if (status.reboot_to_bootloader) {
|
||||||
status.reboot_to_bootloader = 0UL;
|
status.reboot_to_bootloader = 0UL;
|
||||||
safety_memory_set_boot_status(&status);
|
safety_memory_set_boot_status(&status);
|
||||||
@ -117,118 +162,39 @@ static inline void handle_boot_status(void)
|
|||||||
led_set(0, 1);
|
led_set(0, 1);
|
||||||
led_set(1, 1);
|
led_set(1, 1);
|
||||||
|
|
||||||
gui_lcd_write_direct_blocking(0, "Updating...");
|
start_updater();
|
||||||
|
|
||||||
start_updater_ram_code();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status.code_updated) {
|
|
||||||
status.code_updated = 0x0UL;
|
|
||||||
safety_memory_set_boot_status(&status);
|
|
||||||
|
|
||||||
/* Display notification on GUI */
|
|
||||||
gui_root_menu_message_set("Firmware updated", "[Press Key]");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Read out the option bytes of the STM32 and program them to the desired values.
|
|
||||||
*
|
|
||||||
* - This function currently forces the brown out level to Level 3.
|
|
||||||
*/
|
|
||||||
static void check_and_program_opt_bytes(void)
|
|
||||||
{
|
|
||||||
struct option_bytes opts;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
/** - Read option bytes */
|
|
||||||
stm_option_bytes_read(&opts);
|
|
||||||
|
|
||||||
|
|
||||||
if (opts.brown_out_level != 0) {
|
|
||||||
/* Set the brown out level to level 3 => highest brown out limit. */
|
|
||||||
opts.brown_out_level = 0;
|
|
||||||
/** - Program the option bytes if brown out level was not set correctly */
|
|
||||||
err = stm_option_bytes_program(&opts);
|
|
||||||
|
|
||||||
/** - If programming failes, enter panic mode */
|
|
||||||
if (err)
|
|
||||||
panic_mode();
|
|
||||||
|
|
||||||
/** - If programming is successful, reset the system to apply new settings */
|
|
||||||
NVIC_SystemReset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Setup the system.
|
|
||||||
*
|
|
||||||
* This function does all basic initializations of the MCU and its peripherals
|
|
||||||
*/
|
|
||||||
static inline void setup_system(void)
|
static inline void setup_system(void)
|
||||||
{
|
{
|
||||||
float tmp;
|
float tmp;
|
||||||
|
|
||||||
/** - Read the option bytes and if necessary program them to the desired values */
|
|
||||||
check_and_program_opt_bytes();
|
|
||||||
|
|
||||||
/** - Setup the NVIC priorities of the core peripherals using interrupts */
|
|
||||||
setup_nvic_priorities();
|
setup_nvic_priorities();
|
||||||
|
|
||||||
/** - Init safety controller and safety memory */
|
/* Init safety controller and safety memory */
|
||||||
safety_controller_init();
|
safety_controller_init();
|
||||||
|
|
||||||
/** - Setup the systick module generating the 100us tick fort the GUI and
|
|
||||||
* the 1ms tick for the global systick timestamp
|
|
||||||
*/
|
|
||||||
systick_setup();
|
systick_setup();
|
||||||
|
|
||||||
/** - Initialize the oven output driver outputting the wavepacket control signal for the SSR and */
|
|
||||||
oven_driver_init();
|
oven_driver_init();
|
||||||
|
digio_setup_default_all();
|
||||||
/** - Initialize all DIGIO Pins to their default state and pin functions */
|
|
||||||
digio_init();
|
|
||||||
|
|
||||||
/** - Set-up the LED outputs */
|
|
||||||
led_setup();
|
led_setup();
|
||||||
|
|
||||||
/** - Set-up the loudspeaker / beeper output */
|
|
||||||
loudspeaker_setup();
|
loudspeaker_setup();
|
||||||
|
|
||||||
/** - Initialize the GUI */
|
|
||||||
gui_init();
|
gui_init();
|
||||||
|
|
||||||
/** - Initialize the pins for the uart interface. */
|
|
||||||
uart_gpio_config();
|
uart_gpio_config();
|
||||||
|
|
||||||
/** - Set-up the settings module */
|
|
||||||
settings_setup();
|
settings_setup();
|
||||||
|
|
||||||
/** - Load the overtemperature limit from eeprom if available. Otherwise the default value will be used */
|
/* Load the overtemperature limit from eeprom if available. Otherwise the default value will be used */
|
||||||
if (settings_load_overtemp_limit(&tmp) == SETT_LOAD_SUCCESS)
|
if (settings_load_overtemp_limit(&tmp) == SETT_LOAD_SUCCESS) {
|
||||||
safety_controller_set_overtemp_limit(tmp);
|
safety_controller_set_overtemp_limit(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
/** - Handle the boot status struct in the safety memory */
|
|
||||||
handle_boot_status();
|
handle_boot_status();
|
||||||
|
|
||||||
/** - Initialize the shell UART */
|
setup_shell_uart(&shell_uart);
|
||||||
shell_uart_setup();
|
|
||||||
|
|
||||||
/** - Enable the ADC for PT1000 measurement */
|
|
||||||
adc_pt1000_setup_meas();
|
adc_pt1000_setup_meas();
|
||||||
|
|
||||||
/** - Enable the misc CRC config monitor to supervise clock, systick and flash settings */
|
|
||||||
(void)safety_controller_set_crc_monitor(ERR_CRC_MON_MISC, SAFETY_CRC_MON_MISC_PW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Handle the input for the shell instance.
|
|
||||||
*
|
|
||||||
* This function will check if the RX ring buffer of the UART contains data.
|
|
||||||
* If so, it will prowvide it to the shellmatta shell.
|
|
||||||
*
|
|
||||||
* @param shell_handle Handle to the shellmatta instance
|
|
||||||
*/
|
|
||||||
static void handle_shell_uart_input(shellmatta_handle_t shell_handle)
|
static void handle_shell_uart_input(shellmatta_handle_t shell_handle)
|
||||||
{
|
{
|
||||||
int uart_receive_status;
|
int uart_receive_status;
|
||||||
@ -236,15 +202,11 @@ static void handle_shell_uart_input(shellmatta_handle_t shell_handle)
|
|||||||
size_t uart_input_len;
|
size_t uart_input_len;
|
||||||
|
|
||||||
/* Handle UART input for shell */
|
/* Handle UART input for shell */
|
||||||
uart_receive_status = shell_uart_receive_data_with_dma(&uart_input, &uart_input_len);
|
uart_receive_status = uart_receive_data_with_dma(&shell_uart, &uart_input, &uart_input_len);
|
||||||
if (uart_receive_status >= 0)
|
if (uart_receive_status >= 0)
|
||||||
shell_handle_input(shell_handle, uart_input, uart_input_len);
|
shell_handle_input(shell_handle, uart_input, uart_input_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This is the main function containing the initilizations and the cyclic main loop
|
|
||||||
* @return Don't care. This function will never return. We're on an embedded device...
|
|
||||||
*/
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
bool cal_active;
|
bool cal_active;
|
||||||
@ -256,99 +218,71 @@ int main(void)
|
|||||||
shellmatta_handle_t shell_handle;
|
shellmatta_handle_t shell_handle;
|
||||||
int menu_wait_request;
|
int menu_wait_request;
|
||||||
uint64_t quarter_sec_timestamp = 0ULL;
|
uint64_t quarter_sec_timestamp = 0ULL;
|
||||||
enum config_weight worst_safety_flag = SAFETY_FLAG_CONFIG_WEIGHT_NONE;
|
|
||||||
|
|
||||||
/** - Setup all the peripherals and external componets like LCD, EEPROM etc. and the safety controller */
|
|
||||||
setup_system();
|
setup_system();
|
||||||
|
|
||||||
/** - Try load the calibration. This will only succeed if there's an EEPROM */
|
/* Try load the calibration. This will only succeed if there's an EEPROM */
|
||||||
status = settings_load_calibration(&sens, &offset);
|
status = settings_load_calibration(&sens, &offset);
|
||||||
if (!status)
|
if (!status) {
|
||||||
adc_pt1000_set_resistance_calibration(offset, sens, true);
|
adc_pt1000_set_resistance_calibration(offset, sens, true);
|
||||||
|
}
|
||||||
|
|
||||||
/** - Initialize the shellmatta shell */
|
shell_handle = shell_init(write_shell_callback);
|
||||||
shell_handle = shell_init(shell_uart_write_callback);
|
|
||||||
|
|
||||||
/** - Print motd to shell */
|
|
||||||
shell_print_motd(shell_handle);
|
shell_print_motd(shell_handle);
|
||||||
|
|
||||||
/** - Set the main cycle counter to 0 and activate the core cycle counter if available */
|
|
||||||
main_and_core_cycle_counter_init();
|
|
||||||
|
|
||||||
/** - Do a loop over the following */
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
/** - If 250 ms have passed since the last time this step was reached, we try to initialize the
|
|
||||||
* SD card. If the card has been mounted and there is no current resistance calibration,
|
|
||||||
* it is tried to load it from SD card.
|
|
||||||
*/
|
|
||||||
if (systick_ticks_have_passed(quarter_sec_timestamp, 250)) {
|
if (systick_ticks_have_passed(quarter_sec_timestamp, 250)) {
|
||||||
led_set(1u, 0);
|
led_set(1, 0);
|
||||||
sd_old = sd_card_mounted;
|
sd_old = sd_card_mounted;
|
||||||
sd_card_mounted = mount_sd_card_if_avail(fs_ptr);
|
sd_card_mounted = mount_sd_card_if_avail(sd_card_mounted);
|
||||||
|
|
||||||
if (sd_card_mounted && !sd_old) {
|
if (sd_card_mounted && !sd_old) {
|
||||||
adc_pt1000_get_resistance_calibration(NULL, NULL, &cal_active);
|
adc_pt1000_get_resistance_calibration(NULL, NULL, &cal_active);
|
||||||
if (!cal_active) {
|
if (!cal_active) {
|
||||||
status = settings_load_calibration(&sens, &offset);
|
status = settings_load_calibration(&sens, &offset);
|
||||||
if (!status)
|
if (!status) {
|
||||||
adc_pt1000_set_resistance_calibration(offset, sens, true);
|
adc_pt1000_set_resistance_calibration(offset, sens, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* Check if any flags are present, that disable the PID controller. Blink
|
|
||||||
* LED 0 in this case
|
|
||||||
*/
|
|
||||||
if (worst_safety_flag >= SAFETY_FLAG_CONFIG_WEIGHT_PID)
|
|
||||||
led_set(0u, led_get(0u) ? 0 : 1);
|
|
||||||
else
|
|
||||||
led_set(0u, 0);
|
|
||||||
|
|
||||||
quarter_sec_timestamp = systick_get_global_tick();
|
quarter_sec_timestamp = systick_get_global_tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** - Handle the GUI */
|
|
||||||
menu_wait_request = gui_handle();
|
menu_wait_request = gui_handle();
|
||||||
|
|
||||||
/** - Handle the uart input for the shell */
|
|
||||||
handle_shell_uart_input(shell_handle);
|
handle_shell_uart_input(shell_handle);
|
||||||
|
|
||||||
/** - Execute current profile step, if a profile is active */
|
safety_controller_handle();
|
||||||
temp_profile_executer_handle();
|
if (oven_pid_get_status() == OVEN_PID_RUNNING) {
|
||||||
|
|
||||||
/** - Handle the safety controller. This must be called! Otherwise a watchdog reset will occur */
|
|
||||||
worst_safety_flag = safety_controller_handle();
|
|
||||||
|
|
||||||
/** - If the Oven PID controller is running, we handle its sample function */
|
|
||||||
if (oven_pid_get_status() == OVEN_PID_RUNNING)
|
|
||||||
oven_pid_handle();
|
oven_pid_handle();
|
||||||
|
}
|
||||||
/** - Apply the power level of the oven driver */
|
|
||||||
oven_driver_apply_power_level();
|
oven_driver_apply_power_level();
|
||||||
|
|
||||||
/** - Report the main loop timing to the timing monitor to detect a slowed down main loop */
|
|
||||||
safety_controller_report_timing(ERR_TIMING_MAIN_LOOP);
|
safety_controller_report_timing(ERR_TIMING_MAIN_LOOP);
|
||||||
|
|
||||||
/** - If the menu requests a directly following loop run, the main loop will continue.
|
|
||||||
* Otherwise it will wait for the next interrupt
|
|
||||||
*/
|
|
||||||
if (menu_wait_request)
|
if (menu_wait_request)
|
||||||
__WFI();
|
__WFI();
|
||||||
else
|
else
|
||||||
__NOP();
|
__NOP();
|
||||||
/** - Increment the main cycle counter */
|
|
||||||
main_cycle_counter_inc();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Callback function for the SDIO driver to wait \p ms milliseconds
|
|
||||||
* @param ms
|
|
||||||
* @warning This function relies on the systick and must not be used in interrupt context.
|
|
||||||
*/
|
|
||||||
void sdio_wait_ms(uint32_t ms)
|
void sdio_wait_ms(uint32_t ms)
|
||||||
{
|
{
|
||||||
systick_wait_ms(ms);
|
systick_wait_ms(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles the TX of UART1 (Shellmatta)
|
||||||
|
*/
|
||||||
|
void DMA2_Stream7_IRQHandler(void)
|
||||||
|
{
|
||||||
|
uint32_t hisr = DMA2->HISR & (0x3F << 22);
|
||||||
|
|
||||||
|
DMA2->HIFCR = hisr;
|
||||||
|
|
||||||
|
if (hisr & DMA_HISR_TCIF7)
|
||||||
|
uart_tx_dma_complete_int_callback(&shell_uart);
|
||||||
|
}
|
||||||
|
3
stm-firmware/obj/.gitignore
vendored
Normal file
3
stm-firmware/obj/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*
|
||||||
|
*.*
|
||||||
|
!.gitignore
|
@ -18,11 +18,6 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @addtogroup oven-driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <reflow-controller/oven-driver.h>
|
#include <reflow-controller/oven-driver.h>
|
||||||
#include <reflow-controller/periph-config/oven-driver-hwcfg.h>
|
#include <reflow-controller/periph-config/oven-driver-hwcfg.h>
|
||||||
#include <stm-periph/rcc-manager.h>
|
#include <stm-periph/rcc-manager.h>
|
||||||
@ -33,42 +28,13 @@
|
|||||||
#include <reflow-controller/safety/safety-controller.h>
|
#include <reflow-controller/safety/safety-controller.h>
|
||||||
#include <reflow-controller/hw-version-detect.h>
|
#include <reflow-controller/hw-version-detect.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief PID controller instance of the oven driver
|
|
||||||
*/
|
|
||||||
static struct pid_controller IN_SECTION(.ccm.bss) oven_pid;
|
static struct pid_controller IN_SECTION(.ccm.bss) oven_pid;
|
||||||
|
static bool oven_pid_running;
|
||||||
/**
|
static bool oven_pid_aborted;
|
||||||
* @brief Oven PID is currently running
|
|
||||||
*/
|
|
||||||
static bool IN_SECTION(.ccm.bss) oven_pid_running;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Oven PID has been aborted / abnormally stopped.
|
|
||||||
*/
|
|
||||||
static bool IN_SECTION(.ccm.bss) oven_pid_aborted;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Power level [0..100] of the oven to be applied
|
|
||||||
*/
|
|
||||||
static uint8_t IN_SECTION(.ccm.bss) oven_driver_power_level;
|
static uint8_t IN_SECTION(.ccm.bss) oven_driver_power_level;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Current target temperature of the oven PID controller in degC
|
|
||||||
*/
|
|
||||||
static float IN_SECTION(.ccm.bss) target_temp;
|
static float IN_SECTION(.ccm.bss) target_temp;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The millisecond timestamp of the last run of the PID controller
|
|
||||||
*/
|
|
||||||
static uint64_t IN_SECTION(.ccm.bss) timestamp_last_run;
|
static uint64_t IN_SECTION(.ccm.bss) timestamp_last_run;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable or disable the safety enable line of the oven control relay.
|
|
||||||
* @param enable
|
|
||||||
* @note This function is only working for hardware revisions >= v1.3. Below,
|
|
||||||
* the safety enable is unavailable.
|
|
||||||
*/
|
|
||||||
static void ssr_safety_en(bool enable)
|
static void ssr_safety_en(bool enable)
|
||||||
{
|
{
|
||||||
if (get_pcb_hardware_version() >= HW_REV_V1_3) {
|
if (get_pcb_hardware_version() >= HW_REV_V1_3) {
|
||||||
@ -199,5 +165,3 @@ enum oven_pid_status oven_pid_get_status(void)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
|
||||||
|
@ -18,10 +18,6 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @addtogroup pid-controller
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <reflow-controller/pid-controller.h>
|
#include <reflow-controller/pid-controller.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -69,8 +65,8 @@ static void calculate_integral(struct pid_controller *pid, float deviation)
|
|||||||
/* Saturate integral term to specified maximum */
|
/* Saturate integral term to specified maximum */
|
||||||
if (pid->integral > pid->integral_max)
|
if (pid->integral > pid->integral_max)
|
||||||
pid->integral = pid->integral_max;
|
pid->integral = pid->integral_max;
|
||||||
else if (pid->integral < 0.0f)
|
else if (pid->integral < -pid->integral_max)
|
||||||
pid->integral = 0.0f;
|
pid->integral = -pid->integral_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
float pid_sample(struct pid_controller *pid, float deviation)
|
float pid_sample(struct pid_controller *pid, float deviation)
|
||||||
@ -89,8 +85,7 @@ float pid_sample(struct pid_controller *pid, float deviation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate derivative part */
|
/* Calculate derivative part */
|
||||||
pid->derivate = pid->k_deriv_t * (deviation - pid->last_in) +
|
pid->derivate = pid->k_deriv_t * (deviation - pid->last_in) - pid->k_inv_deriv_t * pid->derivate;
|
||||||
pid->k_inv_deriv_t * pid->derivate;
|
|
||||||
|
|
||||||
output += pid->derivate;
|
output += pid->derivate;
|
||||||
output += pid->integral;
|
output += pid->integral;
|
||||||
@ -114,5 +109,3 @@ float pid_get_control_output(const struct pid_controller *pid)
|
|||||||
|
|
||||||
return pid->control_output;
|
return pid->control_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <reflow-controller/ui/rotary-encoder.h>
|
#include <reflow-controller/rotary-encoder.h>
|
||||||
#include <stm-periph/rcc-manager.h>
|
#include <stm-periph/rcc-manager.h>
|
||||||
#include <stm-periph/stm32-gpio-macros.h>
|
#include <stm-periph/stm32-gpio-macros.h>
|
||||||
#include <helper-macros/helper-macros.h>
|
#include <helper-macros/helper-macros.h>
|
@ -24,15 +24,10 @@
|
|||||||
#include <reflow-controller/safety/safety-memory.h>
|
#include <reflow-controller/safety/safety-memory.h>
|
||||||
#include <helper-macros/helper-macros.h>
|
#include <helper-macros/helper-macros.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Handler for hard faults.
|
|
||||||
*
|
|
||||||
* This hard fault handler will turn of the oven output and go to panic mode.
|
|
||||||
* @note Depending on the fault condition some of the things done here could fail.
|
|
||||||
*/
|
|
||||||
void HardFault_Handler(void)
|
void HardFault_Handler(void)
|
||||||
{
|
{
|
||||||
/* This is a non recoverable fault. Stop the oven */
|
/* This is a non recoverable fault. Stop the oven */
|
||||||
|
|
||||||
oven_driver_set_power(0);
|
oven_driver_set_power(0);
|
||||||
oven_driver_apply_power_level();
|
oven_driver_apply_power_level();
|
||||||
|
|
||||||
@ -44,26 +39,11 @@ void HardFault_Handler(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Overwrite default handler. Go to panic mode */
|
/* Overwrite default handler. Go to panic mode */
|
||||||
/**
|
|
||||||
* @brief Default interrupt handler. This will trigger a panic.
|
|
||||||
* @note This function should never be called during normal operation.
|
|
||||||
*/
|
|
||||||
void __int_default_handler(void)
|
void __int_default_handler(void)
|
||||||
{
|
{
|
||||||
panic_mode();
|
panic_mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Put the device into panic mode.
|
|
||||||
*
|
|
||||||
* This function can be used when a irrecoverable error is encountered.
|
|
||||||
* The function will:
|
|
||||||
* - Disable the oven output
|
|
||||||
* - Set the panic flag in the safety memory
|
|
||||||
* - Hang and wait for the watchdog to trigger a system reset.
|
|
||||||
*
|
|
||||||
* The panic state will be entered after the reset due to the set panic flag in the safety memory
|
|
||||||
*/
|
|
||||||
void panic_mode(void)
|
void panic_mode(void)
|
||||||
{
|
{
|
||||||
/* This variable is static, because I don't want it to be on the stack */
|
/* This variable is static, because I don't want it to be on the stack */
|
||||||
@ -78,6 +58,5 @@ void panic_mode(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Let the watchdog do the rest */
|
/* Let the watchdog do the rest */
|
||||||
while (1)
|
while (1);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user