Port command protocol framework from E23x (RS485 data link)

This commit is contained in:
2026-10-09 19:47:49 +08:00
parent cda8f482d2
commit 5771fee576
8 changed files with 694 additions and 26 deletions
+6 -7
View File
@@ -23,13 +23,6 @@ void rs485_init(void);
*/
void rs485_send(const uint8_t *data, uint16_t len);
/**
* @brief RS485 主循环处理(拉通阶段:原样回显)。
* @details 从接收环形缓冲取字节并回发到 RS485,同时转发到 debug 串口。
* 在主循环中周期调用。
*/
void rs485_process(void);
/**
* @brief 获取当前 RS485 接收环形缓冲区可读字节数。
*/
@@ -41,6 +34,12 @@ uint8_t rs485_rx_available(void);
*/
int rs485_rx_get(void);
/**
* @brief 清空 RS485 接收环形缓冲区(丢弃已接收数据)。
* @note 内部关中断保护,与 ISR 无竞争。
*/
void rs485_rx_clear(void);
/**
* @brief USART0 接收中断处理(由 gd32f4xx_it.c 的 USART0_IRQHandler 调用)。
*/