Files
BLE-USB_Dongle/apps/usr_le_code/usr_usb_jb.h
T
wuchuyuan 2260768167 1、新增Dengle定时参数下发功能,支持最多10条配置,断电保存到Flash,COM打开时暂停发送、关闭后恢复
2、新增USB查询产品码(0x66)和查询Dengle配置(0x74)命令
3、修复bleproto组包栈溢出导致设置Dengle后复位的问题,并完善CDC的DTR状态判断
2026-07-31 14:54:26 +08:00

69 lines
2.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/******************************************************************************
* @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 设置产品码;ACK=0x65 */
#define USR_JB_CMD_GET_PRODCODE (0x66) /**< USB 查询产品码;RSP=0x67 */
#define USR_JB_CMD_DENGLE_SET (0x70) /**< USB 设置 Dengle 定时;ACK=0x71 */
#define USR_JB_CMD_DENGLE_CLR (0x72) /**< USB 清除全部 DengleACK=0x73 */
#define USR_JB_CMD_DENGLE_QRY (0x74) /**< USB 查询 Dengle 配置;RSP=0x75 */
/*============================================================================*/
/* 外部接口 */
/*============================================================================*/
/**
* @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 记录最近一次 BLE 收到的 msgid(供 USB 回包复用)
* @param msgid BLE 包头 msgid4bit
* @return void
*/
void usr_ble_rx_msgid_save(uint8_t msgid);
/**
* @brief 获取最近一次 BLE 收到的 msgid
* @return msgid
*/
uint8_t usr_ble_rx_msgid_get(void);
/**
* @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__ */