initial commit

This commit is contained in:
bmy
2024-06-10 18:04:53 +08:00
commit 3c525b4cfd
115 changed files with 54092 additions and 0 deletions

35
project/inc/by_debug.h Normal file
View 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