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:
@@ -7,7 +7,8 @@
|
||||
|
||||
class DfPlayer {
|
||||
public:
|
||||
explicit DfPlayer(UART_HandleTypeDef* uart) : serialPort(std::make_unique<SerialPort>(uart, kLength, kTimeout)) {}
|
||||
explicit DfPlayer(UART_HandleTypeDef* uart)
|
||||
: serialPort(std::make_unique<SerialPort>(uart, kBaudRate, kLength, kTimeout)) {}
|
||||
|
||||
~DfPlayer() = default;
|
||||
|
||||
@@ -49,8 +50,9 @@ private:
|
||||
kQueryFlashCurrentTrack = 0x4D,
|
||||
};
|
||||
|
||||
static constexpr uint32_t kLength = 128;
|
||||
static constexpr uint32_t kTimeout = 10;
|
||||
static constexpr uint32_t kBaudRate = 9600;
|
||||
static constexpr uint32_t kLength = 128;
|
||||
static constexpr uint32_t kTimeout = 10;
|
||||
std::unique_ptr<SerialPort> serialPort;
|
||||
|
||||
void SendCommand(Command cmd, uint16_t param = 0);
|
||||
|
||||
Reference in New Issue
Block a user