From 948bbf97657d91dfac0a8d899e378f29abcdf9b5 Mon Sep 17 00:00:00 2001 From: cskarai Date: Wed, 7 Jan 2015 23:21:23 +0100 Subject: [PATCH] Reconfigure fast pwm timer at OCRA write if OCRA is the top --- simavr/sim/avr_timer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/simavr/sim/avr_timer.c b/simavr/sim/avr_timer.c index 6e0b17e..8e1290b 100644 --- a/simavr/sim/avr_timer.c +++ b/simavr/sim/avr_timer.c @@ -316,6 +316,8 @@ static void avr_timer_write_ocr(struct avr_t * avr, avr_io_addr_t addr, uint8_t case avr_timer_wgm_pwm: if (timer->mode.top != avr_timer_wgm_reg_ocra) { avr_raise_irq(timer->io.irq + TIMER_IRQ_OUT_PWM0, _timer_get_ocr(timer, AVR_TIMER_COMPA)); + } else { + avr_timer_reconfigure(timer); // if OCRA is the top, reconfigure needed } avr_raise_irq(timer->io.irq + TIMER_IRQ_OUT_PWM1, _timer_get_ocr(timer, AVR_TIMER_COMPB)); break; -- 2.39.5