From: cskarai Date: Wed, 7 Jan 2015 22:21:23 +0000 (+0100) Subject: Reconfigure fast pwm timer at OCRA write if OCRA is the top X-Git-Tag: v1.3~56^2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=948bbf97657d91dfac0a8d899e378f29abcdf9b5;p=sx%2Fsimavr.git Reconfigure fast pwm timer at OCRA write if OCRA is the top --- 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;