From: Philip Ã…kesson Date: Mon, 28 Nov 2016 15:02:02 +0000 (+0100) Subject: Workaround for UART issues when polling in some cases X-Git-Tag: v1.5~18^2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=8467783d44dc5b36a7b1fcb8c70403238f41ce1a;p=sx%2Fsimavr.git Workaround for UART issues when polling in some cases Clear interrupt instead of just the rxc bit --- diff --git a/simavr/sim/avr_uart.c b/simavr/sim/avr_uart.c index 0fff236..2a69c16 100644 --- a/simavr/sim/avr_uart.c +++ b/simavr/sim/avr_uart.c @@ -98,8 +98,9 @@ static uint8_t avr_uart_read(struct avr_t * avr, avr_io_addr_t addr, void * para { avr_uart_t * p = (avr_uart_t *)param; - // clear the rxc bit in case the code is using polling - avr_regbit_clear(avr, p->rxc.raised); + // clear the rxc interrupt in case the code is using polling + uint8_t rxc = avr_regbit_get(avr, p->rxc.raised); + avr_clear_interrupt_if(avr, &p->rxc, rxc); if (!avr_regbit_get(avr, p->rxen)) { avr->data[addr] = 0;