Open
Description
Hi, i would like to add a function to the UART, to empty the Buffer manually. I hade some problems with the DebugStream while using FreeRTOS, because the Interrupts didn't got time and so the Buffer just filled until the System breaks. I added a function to clear the Buffer manually. I think this gives the user more flexibility to handle the UART and wanted to ask you about feedback.
In modm/platform/uart/stm32/uart.hpp.in:
%% if options["buffer.tx"]
static void
emptyBuffer();
%% endif
In modm/platform/uart/stm32/uart.cpp.in:
%% if options["buffer.tx"]
void
{{ name }}::emptyBuffer()
{
while(!txBuffer.isEmpty())
{
if ({{ hal }}::isTransmitRegisterEmpty()) {
{{ hal }}::write(txBuffer.get());
txBuffer.pop();
}
}
{{ hal }}::disableInterrupt({{ hal }}::Interrupt::TxEmpty);
{{ hal }}::acknowledgeInterruptFlags({{ hal }}::InterruptFlag::OverrunError);
}
%% endif
Metadata
Metadata
Assignees
Labels
No labels