新增电脑通过USB发送产品code,然后dongle根据新的code重新发起广播的功能

This commit is contained in:
2026-07-27 15:00:47 +08:00
parent c843fb24e0
commit df37ff1b23
51 changed files with 2326 additions and 1812 deletions
+51
View File
@@ -0,0 +1,51 @@
/******************************************************************************
* @file usr_usb_jb.h
* @brief USB CDC 见宝帧解析:设置 ProdtCode / productCode 并落盘重广播
* @author cyWu <1917507415@qq.com>
* @date 2026.07.24
* @version V1.0.0
* @history
* - V1.0.0, 2026.07.24, cyWu, 首次发布
******************************************************************************/
#ifndef __USR_USB_JB_H__
#define __USR_USB_JB_H__
#include <stdint.h>
/*============================================================================*/
/* 宏定义 */
/*============================================================================*/
#define USR_PRODCODE_LEN (4)
#define USR_PCODE_LEN (6)
#define USR_JB_CMD_SET_PRODCODE (0x64) /**< USB 下发产品码命令 */
/*============================================================================*/
/* 外部接口 */
/*============================================================================*/
/**
* @brief 上电加载产品码(flash 优先,否则默认值)
* @return void
*/
void usr_prodcode_init(void);
/**
* @brief 获取当前产品码缓存
* @param prodcode 输出 ProdtCode,长度 USR_PRODCODE_LEN,可为 NULL
* @param pcode 输出 productCode,长度 USR_PCODE_LEN,可为 NULL
* @return void
*/
void usr_prodcode_get(uint8_t *prodcode, uint8_t *pcode);
/**
* @brief USB CDC 喂数:仅入环并挂定时器(可在中断调用)
* @note 帧解析 / syscfg_write / ACK / 重广播在定时器任务中执行
* @param buf 接收缓冲
* @param len 长度
* @return void
*/
void usr_usb_jb_feed(uint8_t *buf, uint32_t len);
#endif /* __USR_USB_JB_H__ */