- synchronize STM8 application and external flash layout updates\n- add assembly bootloader and assembly application test projects\n- add UART1 interrupt receive ring buffer\n- parse JDY-28M Mesh outer frames and source addresses\n- add CRC-16/MODBUS validation\n- implement relay control command 0x01 and response 0x81\n- support unicast and broadcast relay control frames\n- update host protocol, OTA documents, and serial tools
37 lines
1.1 KiB
C
37 lines
1.1 KiB
C
/**
|
|
* @file mesh_frame.h
|
|
* @brief JDY-28M Mesh 外层帧解析和发送接口。
|
|
*/
|
|
#ifndef MESH_FRAME_H
|
|
#define MESH_FRAME_H
|
|
|
|
#include <stdint.h>
|
|
|
|
/** JDY-28M 外层完整帧最大长度,包含帧头、双地址、数据和结束符。 */
|
|
#define JDY_MESH_FRAME_MAX_LENGTH 20u
|
|
|
|
/** 初始化 JDY-28M 外层帧状态机。 */
|
|
void MeshFrame_Init(void);
|
|
|
|
/** 从 UART 接收并解析 JDY-28M 外层帧。 */
|
|
void MeshFrame_Task(void);
|
|
|
|
/** 返回最近一帧合法外层数据携带的目标短地址,仅用于诊断。 */
|
|
uint16_t MeshFrame_GetLastTargetAddress(void);
|
|
|
|
/**
|
|
* 封装并发送一帧 Mesh 业务数据。
|
|
*
|
|
* @param target_address 目标短地址,0xFFFF 表示广播。
|
|
* @param command 业务命令。
|
|
* @param data 业务数据,可为 NULL(此时 length 必须为 0)。
|
|
* @param length 业务数据长度,当前不能超过 4 字节。
|
|
* @return 1 表示已发送,0 表示参数超出 20 字节外层限制。
|
|
*/
|
|
uint8_t MeshFrame_SendBusiness(uint16_t target_address,
|
|
uint8_t command,
|
|
const uint8_t *data,
|
|
uint8_t length);
|
|
|
|
#endif
|