新增 DfPlayer 和 CanMv 类,优化 UART 读写方法,更新 CommonCenter 以支持新类实例化

This commit is contained in:
2025-05-10 19:37:31 +08:00
parent b4ecf03e95
commit 83d9a263a4
7 changed files with 159 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
#pragma once
#include "../Common/can_mv.hpp"
#include "../Common/df_player.hpp"
#include "../Common/ultrasonic.hpp"
#include "../config.hpp"
@@ -13,4 +15,20 @@ public:
}
return *instance;
}
static DfPlayer& GetDfPlayer() {
static DfPlayer* instance = nullptr;
if (instance == nullptr) {
instance = new DfPlayer(Config::kDfPlayerUart);
}
return *instance;
}
static CanMv& GetCanMv() {
static CanMv* instance = nullptr;
if (instance == nullptr) {
instance = new CanMv(Config::kCanMvUart);
}
return *instance;
}
};