31#define MAX_LOG_SIZE (size_t)200
32#define LOG_TIMEOUT_MS 10
34#define UARTPORT UART_PORT_1
39#define IN_ORDER_LOGS 1
49extern char g_log_buffer[MAX_LOG_SIZE];
50extern Mutex s_log_mutex;
53#define LOG_DEBUG(fmt, ...) LOG(LOG_LEVEL_DEBUG, fmt, ##__VA_ARGS__)
54#define LOG_WARN(fmt, ...) LOG(LOG_LEVEL_WARN, fmt, ##__VA_ARGS__)
55#define LOG_CRITICAL(fmt, ...) LOG(LOG_LEVEL_CRITICAL, fmt, ##__VA_ARGS__)
58 { uart_init(UART_PORT_1, &log_uart_settings); }
61#define LOG(level, fmt, ...) printf("[%u] %s:%u: " fmt, (level), __FILE__, __LINE__, ##__VA_ARGS__)
63#define LOG(level, fmt, ...) \
65 if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) { \
66 size_t msg_size = (size_t)snprintf(g_log_buffer, MAX_LOG_SIZE, "\r[%u] %s:%u: " fmt, (level), __FILE__, __LINE__, ##__VA_ARGS__); \
67 uart_tx(UART_PORT_1, (uint8_t *)g_log_buffer, msg_size); \
LogLevel
Definition: log.h:42
@ LOG_LEVEL_CRITICAL
Definition: log.h:45
@ NUM_LOG_LEVELS
Definition: log.h:46
@ LOG_LEVEL_DEBUG
Definition: log.h:43
@ LOG_LEVEL_WARN
Definition: log.h:44
Semaphore object with handle and buffer.
Definition: semaphore.h:32
UART Settings.
Definition: uart.h:53