Hi,
HardwareSerial_flush won't flush all characters from the serial buffer. I believe the error is in this line:
while (transmitting && !(UARTx->SR & UARTx_FLAG_TC));
which should be :
while (transmitting || !(UARTx->SR & UARTx_FLAG_TC));
Current implementation will flush until first character is transmitted (TC flag set) and ignoring buffer empty condition (transmitting variable)
I had the issue when using flush() before sleeping the STM8.
Cheers,
Stefaan.
Hi, HardwareSerial_flush won't flush all characters from the serial buffer. I believe the error is in this line: while (transmitting && !(UARTx->SR & UARTx_FLAG_TC)); which should be : while (transmitting || !(UARTx->SR & UARTx_FLAG_TC)); Current implementation will flush until first character is transmitted (TC flag set) and ignoring buffer empty condition (transmitting variable) I had the issue when using flush() before sleeping the STM8. Cheers, Stefaan.