46 lines
1.2 KiB
C
46 lines
1.2 KiB
C
/******************************************************************************
|
|
* @file jb_port.h
|
|
* @brief 协议硬件对接层(与自动生成的 jb_product 解耦)
|
|
* @author cyWu <1917507415@qq.com>
|
|
* @date 2026.08.10
|
|
* @version V1.0.0
|
|
* @history
|
|
* - V1.0.0, 2026.08.10, cyWu, 首次发布
|
|
*
|
|
* @note
|
|
* 移植新协议生成代码时:
|
|
* 1. 覆盖 Protocol/jb_*.c/h(保留本文件不改)
|
|
* 2. 在 jb_product.c 的 uartInit/timerInit/uartWrite 中各填一行 jb_port_xxx
|
|
* 3. jbTimerIrq / jbGetTimerCount / timerMs 保持生成模板原样
|
|
******************************************************************************/
|
|
|
|
#ifndef __JB_PORT_H__
|
|
#define __JB_PORT_H__
|
|
|
|
#include <stdint.h>
|
|
|
|
/**
|
|
* @brief 初始化协议串口(含 RX→jbPutData 回调注册)
|
|
*/
|
|
void jb_port_uart_init(void);
|
|
|
|
/**
|
|
* @brief 协议串口发送
|
|
* @param buf 数据
|
|
* @param len 长度
|
|
* @return 成功返回 len,失败返回 -1
|
|
*/
|
|
int32_t jb_port_uart_write(uint8_t *buf, uint32_t len);
|
|
|
|
/**
|
|
* @brief 主循环调用:串口调试日志等
|
|
*/
|
|
void jb_port_uart_run(void);
|
|
|
|
/**
|
|
* @brief 初始化协议用 1ms 定时器硬件(TIM6)
|
|
*/
|
|
void jb_port_timer_init(void);
|
|
|
|
#endif /* __JB_PORT_H__ */
|