本次重构完成了 433MHz 全链路协议统一:实现了 AA TYPE LEN ID PAYLOAD SUM 统一帧格式;引入了基于 AUX 的 LBT 避让与 TX 优先调度,确保高频发送稳定;完成了端口语义化重命名;并成功集成了 IO 监控、RS485 及 W5500 以太网 的标准化打包转发,实现了多源数据的高效、稳定透传。
This commit is contained in:
@ -48,7 +48,6 @@ extern "C" {
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* 硬件模块启用/禁用宏定义 */
|
||||
#ifndef USE_W5500
|
||||
#define USE_W5500 1 /* 默认启用W5500以太网模块 */
|
||||
#endif
|
||||
@ -56,6 +55,20 @@ extern "C" {
|
||||
#ifndef USE_RS485
|
||||
#define USE_RS485 1 /* 默认启用RS485通信模块 */
|
||||
#endif
|
||||
|
||||
#ifndef USE_IO_MONITOR
|
||||
#define USE_IO_MONITOR 1 /* 启用IO监控与心跳上报 */
|
||||
#endif
|
||||
|
||||
/* =========================================================
|
||||
🚀 核心协议常量定义 (RF433)
|
||||
========================================================= */
|
||||
#define PROTO_START_BYTE 0xAA
|
||||
#define PROTO_TYPE_IO 0x10
|
||||
#define PROTO_TYPE_NET 0x55
|
||||
#define PROTO_TYPE_485 0x48
|
||||
#define PROTO_TYPE_HB 0xAA
|
||||
|
||||
/* =========================================================
|
||||
🚀 核心身份标识:烧录不同设备时,请务必修改这个数字!
|
||||
比如:设备A烧录时改为 0x01,设备B烧录时改为 0x02
|
||||
|
||||
@ -31,9 +31,9 @@ extern "C" {
|
||||
#define UART_TX_BUFFER_SIZE 256
|
||||
|
||||
typedef enum {
|
||||
PORT_UART1 = 0,
|
||||
PORT_UART2 = 1,
|
||||
PORT_UART3 = 2,
|
||||
PORT_433 = 0, /* UART1 */
|
||||
PORT_DEBUG = 1, /* UART2 */
|
||||
PORT_RS485 = 2, /* UART3 */
|
||||
PORT_COUNT
|
||||
} port_id_t;
|
||||
|
||||
@ -89,6 +89,7 @@ uint16_t MultiUART_ReadByte(port_id_t port_id, uint8_t *byte);
|
||||
uint16_t MultiUART_GetTxAvailable(port_id_t port_id);
|
||||
|
||||
uint32_t MultiUART_GetOverflowCount(port_id_t port_id);
|
||||
bool MultiUART_IsBusy(uint8_t port_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user