修复多连接的问题

This commit is contained in:
2026-07-19 15:27:49 +08:00
parent 9ed4c22022
commit e06d849007
38 changed files with 2475 additions and 1953 deletions

View File

@@ -50,9 +50,9 @@ typedef struct {
* 限定条件UART 和 GPIO 须先由 CubeMX 完成初始化
* 函数说明初始化后默认处于接收状态DE 引脚拉低)
*/
void rs485_init(rs485_handle_t *handle,
UART_HandleTypeDef *huart,
GPIO_TypeDef *dir_port,
void rs485_init(rs485_handle_t *p_handle,
UART_HandleTypeDef *p_huart,
GPIO_TypeDef *p_dir_port,
uint16_t dir_pin);
/*
@@ -66,8 +66,8 @@ void rs485_init(rs485_handle_t *handle,
* 函数说明:发送前自动拉高 DE发送完成后等待 TC 标志再拉低 DE
* 确保最后一字节完全移出后再切换到接收状态
*/
HAL_StatusTypeDef rs485_transmit(rs485_handle_t *handle,
const uint8_t *data,
HAL_StatusTypeDef rs485_transmit(rs485_handle_t *p_handle,
const uint8_t *p_data,
uint16_t len,
uint32_t timeout);
@@ -82,8 +82,8 @@ HAL_StatusTypeDef rs485_transmit(rs485_handle_t *handle,
* 收到完整帧后在 RxEventCallback 中通知用户。
* 用户须在回调中重新调用本函数重新开启接收
*/
HAL_StatusTypeDef rs485_receive_start(rs485_handle_t *handle,
uint8_t *buf,
HAL_StatusTypeDef rs485_receive_start(rs485_handle_t *p_handle,
uint8_t *p_buf,
uint16_t buf_size);
/*
@@ -93,7 +93,7 @@ HAL_StatusTypeDef rs485_receive_start(rs485_handle_t *handle,
* 限定条件:须在 HAL_UART_RxCpltCallback / HAL_UARTEx_RxEventCallback 中调用
* 函数说明:将 HAL 回调中接收到的数据大小回写到句柄的 rx_size 字段
*/
void rs485_rx_set_size(rs485_handle_t *handle, uint16_t size);
void rs485_rx_set_size(rs485_handle_t *p_handle, uint16_t size);
/*
* 函数功能:获取最近一次接收的字节数
@@ -101,7 +101,7 @@ void rs485_rx_set_size(rs485_handle_t *handle, uint16_t size);
* 返回值:最近一次接收的字节数
* 限定条件:须在 HAL_UARTEx_RxEventCallback 触发后调用
*/
uint16_t rs485_rx_get_size(const rs485_handle_t *handle);
uint16_t rs485_rx_get_size(const rs485_handle_t *p_handle);
#ifdef __cplusplus
}