/*
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
Copyright (C) 2016..2019 Thomas Schöpping et al.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#include
#if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__)
#include
#include
/**
* @brief Assert function to check a given condition and print a message string.
*
* @param[in] c The condition to check.
* @param[in] fmt Formatted message string to print.
*/
void _apalDbgAssertMsg(const bool c, const char* fmt, ...)
{
if (!c) {
va_list ap;
va_start(ap, fmt);
chvprintf((BaseSequentialStream*)&aos.iostream, fmt, ap);
va_end(ap);
chThdExit(MSG_RESET);
}
return;
}
/**
* @brief Printf function for messages printed only in debug builds.
*
* @param[in] fmt Formatted string to print.
*/
void apalDbgPrintf(const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
chvprintf((BaseSequentialStream*)&aos.iostream, fmt, ap);
va_end(ap);
return;
}
#endif /* (AMIROOS_CFG_DBG == true) */