generated from Template/H563ZI-HAL-CMake-Template
新增 CommonCenter 类和 Config 结构体,提供超声波测距功能的配置和实例化支持
All checks were successful
Build and Upload Artifact / build and upload-artifact (push) Successful in 20m2s
All checks were successful
Build and Upload Artifact / build and upload-artifact (push) Successful in 20m2s
This commit is contained in:
16
Core/App/Center/common_center.hpp
Normal file
16
Core/App/Center/common_center.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "../Common/ultrasonic.hpp"
|
||||
#include "../config.hpp"
|
||||
|
||||
class CommonCenter {
|
||||
public:
|
||||
static Ultrasonic& GetUltrasonic() {
|
||||
static Ultrasonic* instance = nullptr;
|
||||
if (instance == nullptr) {
|
||||
instance = new Ultrasonic(
|
||||
Config::kCaptureConfig.trigger, Config::kCaptureConfig.timer, Config::kCaptureConfig.channel);
|
||||
}
|
||||
return *instance;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user