- 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.
26 lines
635 B
C++
26 lines
635 B
C++
#ifndef DEVICE_SPI_COMMAND_HANDLER_H
|
|
#define DEVICE_SPI_COMMAND_HANDLER_H
|
|
|
|
#include <cstdint>
|
|
|
|
class AppSpiCommand;
|
|
|
|
struct SpiCommandContext {
|
|
uint8_t frame_type;
|
|
const uint8_t *payload;
|
|
uint16_t payload_len;
|
|
uint8_t *tx_buf;
|
|
uint16_t tx_buf_size;
|
|
uint16_t *tx_len;
|
|
};
|
|
|
|
class ISpiCommandHandler {
|
|
public:
|
|
virtual bool canHandle(uint8_t frame_type) const = 0;
|
|
virtual void handle(AppSpiCommand &bus, const SpiCommandContext &ctx) = 0;
|
|
protected:
|
|
~ISpiCommandHandler() = default; /* 接口基类,不允许通过基类指针 delete;裸机不退出。 */
|
|
};
|
|
|
|
#endif /* DEVICE_SPI_COMMAND_HANDLER_H */
|