Added formatted printing

This commit is contained in:
dario
2023-11-21 21:34:07 +01:00
committed by carlwachter
parent 7cec0aafdf
commit f8b3bc1e47
3 changed files with 33 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ namespace sta
*
* @ingroup sta_core_debug
*/
# define STA_DEBUG_PRINT(...) sta::Debug->print(__VA_ARGS__)
# define STA_DEBUG_PRINT(...) sta::Debug->print(__VA_ARGS__)
/**
* @brief Debug print message followed by new-line to UART.
@@ -28,12 +28,21 @@ namespace sta
*
* @ingroup sta_core_debug
*/
# define STA_DEBUG_PRINTLN(...) sta::Debug->println(__VA_ARGS__)
# define STA_DEBUG_PRINTLN(...) sta::Debug->println(__VA_ARGS__)
/**
* @brief Formatted debug printing with new-line.
*
* @param fmt See @ref sta::PrintableUART::printf
* @param ... See @ref sta::PrintableUART::printf
*/
# define STA_DEBUG_PRINTF(fmt, ...) sta::Debug->printf(fmt, __VA_ARGS__)
#else // !STA_DEBUGGING_ENABLED
# define STA_DEBUG_PRINT(...) ((void)0)
# define STA_DEBUG_PRINTLN(...) ((void)0)
# define STA_DEBUG_PRINT(...) ((void)0)
# define STA_DEBUG_PRINTLN(...) ((void)0)
# define STA_DEBUG_PRINTF(fmt, ...) ((void)0)
#endif // STA_DEBUGGING_ENABLED

View File

@@ -26,6 +26,12 @@ namespace sta
class Printable
{
public:
/**
* @brief fmt The string defining the desired format.
* @breif ... The parameters for the formatted string.
*/
void printf(const char * fmt, ...);
/**
* @brief Print single character.
*