Skip to content

Commit cf7769b

Browse files
committed
[stm32] Fix UART transmission with buffer
1 parent 8c43f84 commit cf7769b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/modm/platform/uart/stm32/uart_buffer.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ class BufferedUart<Hal, UartTxBuffer<SIZE>, Buffers...>: public BufferedUart<Hal
8989
static bool
9090
write(uint8_t data)
9191
{
92-
if (transmitBufferSize() == 0 and txBuffer.isEmpty())
93-
Hal::write(data);
92+
if (isWriteFinished()) Hal::write(data);
9493
else
9594
{
9695
if (not txBuffer.push(data)) return false;
@@ -148,14 +147,15 @@ class BufferedUart<Hal, UartRxBuffer<SIZE>, Buffers...>: public BufferedUart<Hal
148147
static bool
149148
InterruptCallback(bool first)
150149
{
151-
if constexpr (Parent::TxBufferSize) Parent::InterruptCallback(false);
152-
153150
if (Hal::isReceiveRegisterNotEmpty())
154151
{
155152
uint8_t data;
156153
Hal::read(data);
157154
rxBuffer.push(data);
158155
}
156+
157+
if constexpr (Parent::TxBufferSize) Parent::InterruptCallback(false);
158+
159159
if (first) Hal::acknowledgeInterruptFlags(Hal::InterruptFlag::OverrunError);
160160
return true;
161161
}

0 commit comments

Comments
 (0)