新增 DebugSerialPort 支持,CommonCenter、CanMv 和 DfPlayer 改用智能指针
Some checks failed
Build and Upload Artifact / build and upload-artifact (push) Has been cancelled

This commit is contained in:
2025-05-12 13:17:44 +08:00
parent 21eec9089e
commit a7485fca40
5 changed files with 48 additions and 25 deletions

View File

@@ -1,19 +1,18 @@
#pragma once
#include <cstdint>
#include <memory>
#include "../Common/serial_port.hpp"
class CanMv {
public:
explicit CanMv(UART_HandleTypeDef* uart) : serialPort(new SerialPort(uart, kLength, kTimeout)) {}
explicit CanMv(UART_HandleTypeDef* uart) : serialPort(std::make_unique<SerialPort>(uart, kLength, kTimeout)) {}
~CanMv() {
delete serialPort;
}
~CanMv() = default;
private:
static constexpr uint32_t kLength = 128;
static constexpr uint32_t kTimeout = 10;
SerialPort* serialPort;
std::unique_ptr<SerialPort> serialPort;
};