Commit 948bbf97657d91dfac0a8d899e378f29abcdf9b5
authorcskarai <cskarai@freemail.hu>
Wed, 7 Jan 2015 22:21:23 +0000 (23:21 +0100)
committercskarai <cskarai@freemail.hu>
Wed, 7 Jan 2015 22:21:23 +0000 (23:21 +0100)
simavr/sim/avr_timer.c

index 6e0b17e0917730a0a582c8e7a697f0945d90b91e..8e1290b4bf3a56168f9cb31ec4d9f6e5c965d3af 100644 (file)
@@ -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;