部分驱动代码完成,待测试

This commit is contained in:
lmx
2025-11-20 09:24:11 +08:00
parent 054ea8644a
commit 2bfdc81991
11 changed files with 944 additions and 63 deletions

View File

@ -1,8 +1,12 @@
/*
发送数据给上位机的,需要将log打印出口关闭
*/
#include "ano_protocol.h"
#include "asm/uart_dev.h"
#include "app_config.h" // 需要包含这个头文件来获取 TCFG_ONLINE_TX_PORT 等宏定义
#include "app_config.h"
// 定义匿名协议常量
// 定义协议常量
#define ANO_FRAME_HEADER 0xAA
#define ANO_TO_COMPUTER_ADDR 0xFF
@ -10,7 +14,7 @@
static const uart_bus_t *ano_uart_dev = NULL;
/**
* @brief 计算并填充匿名协议的校验和
* @brief 计算并填充协议的校验和
* @param frame_buffer 指向数据帧缓冲区的指针
*/
static void ano_calculate_checksum(u8 *frame_buffer) {
@ -35,7 +39,7 @@ static void ano_calculate_checksum(u8 *frame_buffer) {
}
/**
* @brief 初始化用于匿名上位机通信的串口
* @brief 初始化用于上位机通信的串口
*/
int ano_protocol_init(u32 baudrate) {
#if TCFG_UART0_ENABLE==0
@ -47,7 +51,6 @@ int ano_protocol_init(u32 baudrate) {
struct uart_platform_data_t ut_arg = {0};
// TCFG_ONLINE_TX_PORT 和 TCFG_ONLINE_RX_PORT 通常在 app_config.h 中定义
// 请确保您的 app_config.h 中有正确的引脚配置
ut_arg.tx_pin = TCFG_ONLINE_TX_PORT;
ut_arg.rx_pin = (u8)-1; // -1 表示不使用该引脚,因为我们只发送数据
ut_arg.baud = baudrate;