From 5fee45055728bcbee85adc252509d4efaa495fd5 Mon Sep 17 00:00:00 2001 From: chauyin Date: Wed, 7 May 2025 16:03:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=B2=E5=8F=A3?= =?UTF-8?q?=E5=86=99=E5=85=A5=E5=87=BD=E6=95=B0=E4=BB=A5=E5=8F=8D=E6=98=A0?= =?UTF-8?q?DMA=E4=BD=BF=E7=94=A8=EF=BC=8C=E5=B9=B6=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E7=A8=8B=E5=BA=8F=E4=B8=AD=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/App/Common/serial_port.hpp | 6 +++--- Core/App/app.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/App/Common/serial_port.hpp b/Core/App/Common/serial_port.hpp index a3abe7f..550ce44 100644 --- a/Core/App/Common/serial_port.hpp +++ b/Core/App/Common/serial_port.hpp @@ -49,7 +49,7 @@ public: return result; } - static void WriteLine(const char* format, ...) { + static void WriteLineDMA(const char* format, ...) { WaitTransmit(); isTransmitting = true; va_list args; @@ -79,7 +79,7 @@ public: HAL_UART_Transmit(kHandle, reinterpret_cast(buffer), len, kTransmitTimeout); } - static void Write(const char* format, ...) { + static void WriteDMA(const char* format, ...) { WaitTransmit(); isTransmitting = true; va_list args; @@ -105,7 +105,7 @@ public: HAL_UART_Transmit(kHandle, reinterpret_cast(buffer), strlen(buffer), kTransmitTimeout); } - static void WriteBytes(const uint8_t* data, size_t size) { + static void WriteBytesDMA(const uint8_t* data, size_t size) { WaitTransmit(); isTransmitting = true; HAL_UART_Transmit_DMA(kHandle, const_cast(data), size); diff --git a/Core/App/app.cpp b/Core/App/app.cpp index e7efc6e..d2ef5f1 100644 --- a/Core/App/app.cpp +++ b/Core/App/app.cpp @@ -15,7 +15,7 @@ extern "C" void AppStart() { auto gpio = GpioHelper::GpioInit(GPIOB, GPIO_PIN_0, GPIO_MODE_OUTPUT_PP, GPIO_NOPULL, GPIO_PIN_SET); while (true) { gpio.Toggle(); - SerialPort::WriteLine("LED is toggled,current state: %s", gpio.Read() ? "OFF" : "ON"); + SerialPort::WriteBlocking("LED is toggled,current state: %s", gpio.Read() ? "OFF" : "ON"); DelayS(1); } }