generated from Template/H563ZI-HAL-CMake-Template
新增 Hc05 类,支持 HC-05 蓝牙模块的串口通信,增加串口设置波特率函数
All checks were successful
Build and Upload Artifact / build and upload-artifact (push) Successful in 20m1s
All checks were successful
Build and Upload Artifact / build and upload-artifact (push) Successful in 20m1s
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "../Common/can_mv.hpp"
|
||||
#include "../Common/df_player.hpp"
|
||||
#include "../Common/hc05.hpp"
|
||||
#include "../Common/ultrasonic.hpp"
|
||||
#include "../config.hpp"
|
||||
#include "Common/serial_port.hpp"
|
||||
@@ -33,12 +34,21 @@ public:
|
||||
return *instance;
|
||||
}
|
||||
|
||||
static SerialPort& GetDebugSerialPort() {
|
||||
static constexpr auto kLength = 256;
|
||||
static constexpr auto kTimeout = 1000;
|
||||
static SerialPort* instance = nullptr;
|
||||
static Hc05& GetHc05() {
|
||||
static Hc05* instance = nullptr;
|
||||
if (instance == nullptr) {
|
||||
instance = new SerialPort(Config::kDebugUart, kLength, kTimeout);
|
||||
instance = new Hc05(Config::kHc05Uart);
|
||||
}
|
||||
return *instance;
|
||||
}
|
||||
|
||||
static SerialPort& GetDebugSerialPort() {
|
||||
static constexpr auto kBaudRate = 115200;
|
||||
static constexpr auto kLength = 256;
|
||||
static constexpr auto kTimeout = 1000;
|
||||
static SerialPort* instance = nullptr;
|
||||
if (instance == nullptr) {
|
||||
instance = new SerialPort(Config::kDebugUart, kBaudRate, kLength, kTimeout);
|
||||
}
|
||||
return *instance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user