From b2df3a81a938c2bd4a508924b7fc97da9ee0b13c Mon Sep 17 00:00:00 2001 From: Andreas Auras Date: Sat, 6 Mar 2010 20:23:11 +0100 Subject: Improved error status handling --- pwm_appl/df10ch_pwm_appl.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/pwm_appl/df10ch_pwm_appl.c b/pwm_appl/df10ch_pwm_appl.c index f31240a..25623b3 100644 --- a/pwm_appl/df10ch_pwm_appl.c +++ b/pwm_appl/df10ch_pwm_appl.c @@ -321,19 +321,17 @@ ISR(USART0_RXC_vect) uint8_t i = rxwpos; uint8_t p = i + 1; CHECK_RXBUF_END(p); - - if (bit_is_set(UCSR0A, FE0)) - set_bit(rx_err_status, COMM_ERR_FRAME); - else if (bit_is_set(UCSR0A, DOR0)) - set_bit(rx_err_status, COMM_ERR_OVERRUN); - else if (p == rxrpos) + if (p == rxrpos) set_bit(rx_err_status, COMM_ERR_OVERFLOW); else - { - if (bit_is_set(UCSR0B, RXB80)) - rxspos = i; // save start of request message rxwpos = p; // set data valid - } + + if (bit_is_set(UCSR0A, DOR0)) + set_bit(rx_err_status, COMM_ERR_OVERRUN); + if (bit_is_set(UCSR0A, FE0)) + set_bit(rx_err_status, COMM_ERR_FRAME); + if (bit_is_set(UCSR0B, RXB80)) + rxspos = i; // save start of request message rxbuf[i] = UDR0; // read data } while (bit_is_set(UCSR0A, RXC0)); -- cgit v1.2.3