stm32f103 neopixel demo simulating water / waving based on ultrasonic stimulus. This is an earlier version of what later became the "spatial-rgb" project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
f103-wave-sim/project/com/debug.h

73 lines
1.6 KiB

#pragma once
#include "main.h"
#include "com_iface.h"
#include "com_fileio.h"
#include "bus/event_queue.h"
// helper to mark printf functions
#define PRINTF_LIKE __attribute__((format(printf, 1, 2)))
#define DBG_BUF_LEN 256
#define ESCAPE_DEBUG_MESSAGES 1
// formatting symbols
#define DEBUG_EOL "\r\n"
#define DEBUG_TAG_WARN "[W] "
#define DEBUG_TAG_ERROR "[E] "
#define DEBUG_TAG_BASE "[ ] "
#define DEBUG_TAG_INFO "[i] "
/** Print a log message with no tag and no newline */
void dbg_printf(const char *fmt, ...) PRINTF_LIKE;
/** Print via va_list */
void dbg_va_base(const char *fmt, const char *tag, va_list va);
/** Print a string to the debug interface (length not limited) */
static inline void dbg_raw(const char *str)
{
com_tx_str(debug_iface, str);
}
/** Print a char to the debug interface */
static inline void dbg_raw_c(char c)
{
com_tx(debug_iface, (uint8_t)c);
}
#if VERBOSE_LOGGING
/** Print a log message with a "debug" tag and newline */
void dbg(const char *fmt, ...) PRINTF_LIKE;
/** Print a log message with an "info" tag and newline */
void info(const char *fmt, ...) PRINTF_LIKE;
#else
#define dbg(fmt, ...)
#define info(fmt, ...)
#endif
/** Print a log message with an "info" tag and newline */
void banner_info(const char *fmt, ...) PRINTF_LIKE;
/** Print a log message with a "banner" tag and newline */
void banner(const char *fmt, ...) PRINTF_LIKE;
/** Print a log message with a "warning" tag and newline */
void warn(const char *fmt, ...) PRINTF_LIKE;
/** Print a log message with an "error" tag and newline */
void error(const char *fmt, ...) PRINTF_LIKE;