generated from Template/H563ZI-HAL-CMake-Template
新增 DebugSerialPort 支持,CommonCenter、CanMv 和 DfPlayer 改用智能指针
Some checks failed
Build and Upload Artifact / build and upload-artifact (push) Has been cancelled
Some checks failed
Build and Upload Artifact / build and upload-artifact (push) Has been cancelled
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user