Files
DCU_APP/GD32E508_DCU_APP/sys/task_runner.h
T
cbb 76da7a3dd6 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.
2026-07-15 02:49:37 +08:00

53 lines
1.6 KiB
C++

#ifndef SYS_TASK_RUNNER_H
#define SYS_TASK_RUNNER_H
/**
* @brief 任务执行器。
* @note 负责消费 TaskManager 置位的任务,并驱动各模块完成实际工作。
*/
class TaskRunner {
public:
/**
* @brief 初始化任务执行器运行时上下文。
* @param[in] 无。
* @param[out] 无。
* @retval 无返回值。
* @note 执行一次初始 ADC 采样,填充运行时数据的起点。
*/
static void init();
/**
* @brief 执行当前所有已置位的待处理任务。
* @param[in] 无。
* @param[out] 无。
* @retval 无返回值。
* @note 若当前没有待执行任务,直接返回。
*/
static void runPending();
private:
struct Runtime;
static Runtime s_runtime;
/** @brief 采样 VIN/VREF 原始值。 */
static void taskAdcVrefSample();
/** @brief 采样内部温度原始值。 */
static void taskAdcTempSample();
/** @brief 根据采样值计算工程量。 */
static void taskAdcProcess();
/** @brief 解析并消费接收帧。 */
static void taskCanRxParse();
/** @brief CAN 周期发送任务;每 1ms 每通道发送一帧测试报文。 */
static void taskCanTxSend();
/** @brief 状态灯维护任务(当前预留)。 */
static void taskStatusLed();
/** @brief 心跳维护任务(当前预留)。 */
static void taskHeartbeat();
/** @brief 诊断打印任务。 */
static void taskDiagnosticPrint();
/** @brief EtherCAT 周期/事件处理(非实时应用层 PDO 映射)。 */
static void taskEthercatProcess();
};
#endif /* SYS_TASK_RUNNER_H */