Commit 35f27285b51784ecee0e51518fb2a6c0b3c152d2
authorTibor Peluch <messani@gmail.com>
Thu, 1 Sep 2016 20:33:24 +0000 (22:33 +0200)
committerTibor Peluch <messani@gmail.com>
Thu, 1 Sep 2016 20:33:24 +0000 (22:33 +0200)
- bsekisser was right, there must be ocr+1

simavr/sim/avr_timer.c

index dba4e9bc0a36b9a60f0f6163b8cd7f439ffa4e77..779ce66ce06632ae3f6e67a97e912839e660114c 100644 (file)
@@ -299,7 +299,7 @@ avr_timer_configure(
                if (!p->comp[compi].r_ocr)
                        continue;
                uint32_t ocr = _timer_get_ocr(p, compi);
-               uint32_t comp_cycles = clock * ocr;
+               uint32_t comp_cycles = clock * (ocr + 1);
 
                p->comp[compi].comp_cycles = 0;