feat: 增加CRC-16校验(顺便添加了缺少的厂家设备驱动)

feat: 增加第三方模块 lwrb
feat: 增加麦轮逆解部分
feat: 增加LOG输出格式
This commit is contained in:
bmy
2024-04-22 11:34:39 +08:00
parent af1b9dc867
commit 838c8bb81e
44 changed files with 15100 additions and 516 deletions

View File

@@ -52,10 +52,10 @@ extern "C" {
/* module define -------------------------------------------------------------*/
/*#define ACC_MODULE_ENABLED----------------------*/
#define ADC_MODULE_ENABLED
/*#define ADC_MODULE_ENABLED----------------------*/
/*#define BPR_MODULE_ENABLED----------------------*/
#define CAN_MODULE_ENABLED
/*#define CRC_MODULE_ENABLED----------------------*/
#define CRC_MODULE_ENABLED
#define CRM_MODULE_ENABLED
/*#define DAC_MODULE_ENABLED----------------------*/
#define DEBUG_MODULE_ENABLED

View File

@@ -71,9 +71,6 @@ extern "C" {
/* init gpio function. */
void wk_gpio_config(void);
/* init adc1 function. */
void wk_adc1_init(void);
/* init i2c1 function. */
void wk_i2c1_init(void);
@@ -107,6 +104,9 @@ extern "C" {
/* init tmr12 function. */
void wk_tmr12_init(void);
/* init crc function. */
void wk_crc_init(void);
/* add user code begin exported functions */
/* add user code end exported functions */

8
project/inc/by_crc16.h Normal file
View File

@@ -0,0 +1,8 @@
#ifndef _BY_CRC16_H_
#define _BY_CRC16_H_
#include "at32f403a_407.h"
uint16_t by_crc16_calculate(void *pbuffer, uint32_t length);
#endif

View File

@@ -6,6 +6,25 @@
#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
void by_debug_init(void);
#endif