Fix UART random stop when sending data really fast

This commit is contained in:
Daniel Fekete 2017-04-24 17:42:39 +02:00
parent 4ce9c07fa5
commit 3df3a5fede
1 changed files with 1 additions and 1 deletions

View File

@ -137,7 +137,7 @@ size_t SerialUART::write(const uint8_t c) {
txBuffer[txEnd % BUFFER_SIZE] = c;
txEnd++;
if (txEnd == txStart + 1) {
if (txEnd % BUFFER_SIZE == (txStart + 1) % BUFFER_SIZE) {
HAL_UART_Transmit_IT(handle, &txBuffer[txStart % BUFFER_SIZE], 1);
}
return 1;