Refactor and clean up codebase

- Removed unused constants and type aliases in app_spi_command_defs.h and temp_sensor.h.
- Simplified ISpiCommandHandler destructor to default.
- Eliminated redundant methods and comments in temp_sensor and usart0 files.
- Consolidated writeU32Le function to app_spi_command_defs.h for reuse.
- Updated comments for clarity and accuracy in task_manager.h and task_runner.cpp.
- Removed hardfault.h as it contained no declarations.
- Cleaned up CANFD and watchdog implementations by removing dead code and unnecessary comments.
- Updated version numbers in config.h to reflect recent changes.
- Enhanced error handling and diagnostics in hardfault handling.
This commit is contained in:
cbb
2026-07-15 02:49:37 +08:00
parent a52d94687b
commit 76da7a3dd6
37 changed files with 1401 additions and 1955 deletions
+9 -13
View File
@@ -132,7 +132,6 @@ public:
/** @brief 查询当前 CANFD 接收过滤模式。 */
static Mode mode();
static void poll();
static bool hasRxFrame();
static bool consumeRxFrame(uint32_t *id, uint8_t *data, uint8_t *length, uint8_t *channel = nullptr);
static CanTxResult transmitFrame(uint8_t channelIndex, uint32_t ext_id,
@@ -152,13 +151,6 @@ public:
*/
static void refreshFeedbackSnapshot();
/**
* @brief 保留的手动 BUS_OFF 恢复诊断入口。
* @note 正常周期任务不调用;控制器已启用硬件自动 BUS_OFF 恢复,避免在
* 发送重试期间切换收发器 S 脚而人为制造额外位错误。
*/
static void recoverBusOffIfNeeded();
/**
* @brief 拷贝指定通道的最新反馈快照到调用方缓冲。
* @param[in] channelIndex 目标 CAN 通道号(0/1/2)。
@@ -175,9 +167,6 @@ public:
*/
static bool copyIdSnapshotTable(uint8_t channelIndex, IdSnapshotTable *out);
static void setNormalMode();
static void setSilentMode();
static void onRx0Interrupt();
static void handleRxInterrupt(uint8_t channelIndex);
static void handleTxInterrupt(uint8_t channelIndex);
@@ -209,6 +198,15 @@ private:
static bool initNominalTiming(uint32_t canPeriph);
static bool initFdMode(uint32_t canPeriph);
static void printClockInfo();
static void initChannelHardware(uint8_t i);
static void configureAllFilters();
static void printInitResult();
static void printErrorState();
static void runSelfTest();
static void runLoopbackTest();
static void dumpRegisters();
static Diag s_diag;
static RxQueue s_rxQueues[3];
static uint8_t s_nextConsumeChannel;
@@ -219,6 +217,4 @@ private:
static IdSnapshotTable s_idSnapshot[3];
};
using canfd_diag_t = CanFd::Diag;
#endif /* DEVICE_CANFD_H */