新增 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

@@ -4,6 +4,7 @@
#include "../Common/df_player.hpp"
#include "../Common/ultrasonic.hpp"
#include "../config.hpp"
#include "Common/serial_port.hpp"
class CommonCenter {
public:
@@ -31,4 +32,14 @@ public:
}
return *instance;
}
static SerialPort& GetDebugSerialPort() {
static constexpr auto kLength = 256;
static constexpr auto kTimeout = 1000;
static SerialPort* instance = nullptr;
if (instance == nullptr) {
instance = new SerialPort(Config::kDebugUart, kLength, kTimeout);
}
return *instance;
}
};