Commit 630883c7ad7b7db4b59b3a8a9fa5a975408d3278
authorMichel Pollet <buserror@gmail.com>
Tue, 11 May 2010 11:36:26 +0000 (12:36 +0100)
committerMichel Pollet <buserror@gmail.com>
Tue, 11 May 2010 11:36:26 +0000 (12:36 +0100)
New function simplifies clearing pending bits

Signed-off-by: Michel Pollet <buserror@gmail.com>
simavr/sim/avr_uart.c

index ee306da635b60a86a9649fa14e283dc9961c5cc1..c1e82f61439f28951d8c5d25988528a1291084c7 100644 (file)
@@ -147,11 +147,8 @@ static void avr_uart_write(struct avr_t * avr, avr_io_addr_t addr, uint8_t v, vo
 
                avr_core_watch_write(avr, addr, v);
 
-               // if writing one to a one, clear bit
-               if (udre && avr_regbit_get(avr, p->udrc.raised))
-                       avr_regbit_clear(avr, p->udrc.raised);
-               if (txc && avr_regbit_get(avr, p->txc.raised))
-                       avr_regbit_clear(avr, p->txc.raised);
+               avr_clear_interupt_if(avr, &p->udrc, udre);
+               avr_clear_interupt_if(avr, &p->txc, txc);
        }
 }