#ifndef _BY_DEBUG_H__ #define _BY_DEBUG_H__ #include #include "at32f413.h" #include "lwprintf.h" #define BY_DEBUG_USART_INDEX (USART2) #define BY_DEBUG_LOG_MODE (2) // 0-not log, 1-no debug log, 2-all #if (BY_DEBUG_LOG_MODE == 2) #define LOGI(format, ...) lwprintf("[INFO] " format "\r\n", ##__VA_ARGS__) #define LOGW(format, ...) lwprintf("[WARN] " format "\r\n", ##__VA_ARGS__) #define LOGE(format, ...) lwprintf("[ERR] " format "\r\n", ##__VA_ARGS__) #define LOGD(format, ...) lwprintf("[DEBUG] " format "\r\n", ##__VA_ARGS__) #elif (BY_DEBUG_LOG_MODE == 1) #define LOGI(format, ...) lwprintf("[INFO] " format "\r\n", ##__VA_ARGS__) #define LOGW(format, ...) lwprintf("[WARN] " format "\r\n", ##__VA_ARGS__) #define LOGE(format, ...) lwprintf("[ERR] " format "\r\n", ##__VA_ARGS__) #define LOGD(format, ...) #elif (BY_DEBUG_LOG_MODE == 0) #define LOGI(format, ...) #define LOGW(format, ...) #define LOGE(format, ...) #define LOGD(format, ...) #endif extern void by_debug_init(void); #endif