aboutsummaryrefslogtreecommitdiff
path: root/src/peripherals/timer.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/peripherals/timer.ts')
-rw-r--r--src/peripherals/timer.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/peripherals/timer.ts b/src/peripherals/timer.ts
index b597d07..53777e2 100644
--- a/src/peripherals/timer.ts
+++ b/src/peripherals/timer.ts
@@ -576,6 +576,14 @@ export class AVRTimer {
if (this.tcntUpdated) {
this.tcnt = this.tcntNext;
this.tcntUpdated = false;
+ if (
+ (this.tcnt === 0 && this.ocrUpdateMode === OCRUpdateMode.Bottom) ||
+ (this.tcnt === this.TOP && this.ocrUpdateMode === OCRUpdateMode.Top)
+ ) {
+ this.ocrA = this.nextOcrA;
+ this.ocrB = this.nextOcrB;
+ this.ocrC = this.nextOcrC;
+ }
}
if (this.updateDivider) {
const { CS } = this;