auto-sync

This commit is contained in:
rusEfi 2015-03-09 10:07:02 -05:00
parent d36297c800
commit 68a53fd9c8
1 changed files with 7 additions and 2 deletions

View File

@ -166,11 +166,16 @@ static void serve_interrupt(SerialDriver *sdp) {
/* Data available.*/
chSysLockFromIsr();
while (sr & USART_SR_RXNE) {
while (sr & (USART_SR_RXNE | USART_SR_ORE | USART_SR_NE | USART_SR_FE |
USART_SR_PE)) {
uint8_t b;
/* Error condition detection.*/
if (sr & (USART_SR_ORE | USART_SR_NE | USART_SR_FE | USART_SR_PE))
set_error(sdp, sr);
sdIncomingDataI(sdp, u->DR);
b = u->DR;
if (sr & USART_SR_RXNE)
sdIncomingDataI(sdp, b);
sr = u->SR;
}
chSysUnlockFromIsr();