amiro-os / periphery-lld / periphAL.c @ 7de0cc90
History | View | Annotate | Download (1.6 KB)
1 |
/*
|
---|---|
2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
|
3 |
Copyright (C) 2016..2019 Thomas Schöpping et al.
|
4 |
|
5 |
This program is free software: you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License as published by
|
7 |
the Free Software Foundation, either version 3 of the License, or
|
8 |
(at your option) any later version.
|
9 |
|
10 |
This program is distributed in the hope that it will be useful,
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
GNU General Public License for more details.
|
14 |
|
15 |
You should have received a copy of the GNU General Public License
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
*/
|
18 |
|
19 |
#include <amiro-lld.h> |
20 |
|
21 |
#if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__) |
22 |
|
23 |
#include <amiroos.h> |
24 |
#include <chprintf.h> |
25 |
|
26 |
/**
|
27 |
* @brief Assert function to check a given condition and print a message string.
|
28 |
*
|
29 |
* @param[in] c The condition to check.
|
30 |
* @param[in] fmt Formatted message string to print.
|
31 |
*/
|
32 |
void _apalDbgAssertMsg(const bool c, const char* fmt, ...) |
33 |
{ |
34 |
if (!c) {
|
35 |
va_list ap; |
36 |
|
37 |
va_start(ap, fmt); |
38 |
chvprintf((BaseSequentialStream*)&aos.iostream, fmt, ap); |
39 |
va_end(ap); |
40 |
chThdExit(MSG_RESET); |
41 |
} |
42 |
return;
|
43 |
} |
44 |
|
45 |
/**
|
46 |
* @brief Printf function for messages printed only in debug builds.
|
47 |
*
|
48 |
* @param[in] fmt Formatted string to print.
|
49 |
*/
|
50 |
void apalDbgPrintf(const char* fmt, ...) |
51 |
{ |
52 |
va_list ap; |
53 |
|
54 |
va_start(ap, fmt); |
55 |
chvprintf((BaseSequentialStream*)&aos.iostream, fmt, ap); |
56 |
va_end(ap); |
57 |
|
58 |
return;
|
59 |
} |
60 |
|
61 |
#endif /* (AMIROOS_CFG_DBG == true) */ |