initial commit
This commit is contained in:
35
project/inc/by_debug.h
Normal file
35
project/inc/by_debug.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef _BY_DEBUG_H__
|
||||
#define _BY_DEBUG_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include "at32f425.h"
|
||||
#include "lwprintf.h"
|
||||
|
||||
#define BY_DEBUG_USART_INDEX (USART1)
|
||||
|
||||
#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);
|
||||
extern void delay_init(void);
|
||||
extern void delay_us(uint32_t nus);
|
||||
extern void delay_ms(uint16_t nms);
|
||||
extern void delay_sec(uint16_t sec);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user