diff options
author | Andreas Auras <yak54@gmx.net> | 2010-03-06 20:23:11 +0100 |
---|---|---|
committer | Andreas Auras <yak54@gmx.net> | 2010-03-06 20:23:11 +0100 |
commit | b2df3a81a938c2bd4a508924b7fc97da9ee0b13c (patch) | |
tree | 5f33dd86050c5e8f40d62454a5ffb36c70b172ae | |
parent | 8782389a1b25b78deaac8cb101140b243ff7293e (diff) | |
download | df10ch-atmolight-controller-b2df3a81a938c2bd4a508924b7fc97da9ee0b13c.tar.gz df10ch-atmolight-controller-b2df3a81a938c2bd4a508924b7fc97da9ee0b13c.tar.bz2 |
Improved error status handling
-rw-r--r-- | pwm_appl/df10ch_pwm_appl.c | 18 |
1 files 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)); |