feat(canfd): 添加收发器静默模式支持和SPI命令接口
添加了CAN FD收发器静默模式功能,允许通过硬件引脚控制发送使能: - 新增setTxSilent/isTxSilent接口控制TCAN1057收发器Silent模式 - 静默时驱动器关断但接收机继续工作,支持只听不发场景 - 添加SPI命令0xC8用于ESP32远程控制静默模式切换 - 在总线状态位图中增加bit5表示静默状态 - 新增canBusyWaitUs函数用于ISR安全的微秒延时 fix(esc_lan9252): 改进warm jump后LAN9252探测逻辑 修复warm jump导致的LAN9252初始化问题: - 识别warm jump后芯片非POR状态(idx0!=0x1234)的情况 - 自动补发硬件复位对齐到POR状态后再进行正常探测 - 改进调试信息输出,区分POR状态和warm jump残值情况 - 修正失败路径的复位标志初始化逻辑 refactor(spi): 整理SPI命令文件结构 调整SPI命令相关文件的组织结构: - 移动诊断相关文件到更合适的位置 - 重新整理SPI命令处理文件的分组
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include "sys/config.h"
|
||||
#include "device/spi/app_spi_diag.h"
|
||||
|
||||
class ISpiCommandHandler;
|
||||
|
||||
@@ -51,6 +52,9 @@ public:
|
||||
/** @brief 记录一条带 1 字节参数的待输出日志。 */
|
||||
void postLogFmt(const char *fmt, uint8_t val);
|
||||
|
||||
/** @brief 记录一条带双 32 位参数的待输出日志。 */
|
||||
void postLogFmt32(const char *fmt, uint32_t v1, uint32_t v2);
|
||||
|
||||
/**
|
||||
* @brief 将应答帧构建到指定发送缓冲区。
|
||||
* @param[out] tx_buf 发送缓冲区。
|
||||
@@ -85,6 +89,21 @@ public:
|
||||
/** @brief 查询当前是否有未读按铃(ESP32 尚未来读)。 */
|
||||
bool isRingPending() const { return m_ringPending; }
|
||||
|
||||
/** @brief 查询 v2 会话是否已建立。 */
|
||||
bool isV2Active() const;
|
||||
|
||||
/** @brief 查询当前 v2 会话 ID。 */
|
||||
uint32_t getSessionId() const;
|
||||
|
||||
/** @brief 查询当前 local credit。 */
|
||||
uint8_t getLocalCredit() const;
|
||||
|
||||
/** @brief 查询 CS 是否当前处于激活(低电平)状态。 */
|
||||
bool isCsActive() const { return m_csActive; }
|
||||
|
||||
/** @brief 打印完整 ASCII SPI 链路诊断报告。 */
|
||||
void dumpDiag() const;
|
||||
|
||||
/** @brief 取消未完成的按铃(释放 SPIready、清 m_ringPending)。
|
||||
* 0xB0 进 BOOT 等路径需公开调用,避免 0xC1 残留盖住 ACK。 */
|
||||
void cancelRing();
|
||||
@@ -111,7 +130,12 @@ private:
|
||||
/** 本笔 CS 实际收到的字节数(CS 上升沿时由 RX DMA CHCNT 反算得到)。 */
|
||||
volatile uint16_t m_rxLen = 0U;
|
||||
volatile uint16_t m_txLen = 0U;
|
||||
volatile bool m_logPending = false;
|
||||
/** 日志环形缓冲区:避免高频/多事件并发时单缓冲覆盖丢日志。 */
|
||||
static constexpr uint8_t kLogSlotCount = 8U;
|
||||
static constexpr uint8_t kLogSlotLen = 128U;
|
||||
char m_logQueue[kLogSlotCount][kLogSlotLen] = {};
|
||||
volatile uint8_t m_logHead = 0U;
|
||||
volatile uint8_t m_logTail = 0U;
|
||||
/** RX DMA 接收缓冲(替代旧 RBNE 逐字节累积的 m_rxBuf)。
|
||||
* CS 上升沿时 m_rxLen 为本笔实际收到的字节数,本缓冲前 m_rxLen 字节有效。 */
|
||||
uint8_t m_rxBuf[kRxBufSize] = {};
|
||||
|
||||
Reference in New Issue
Block a user