aboutsummaryrefslogtreecommitdiff
path: root/src/peripherals/timer.ts
diff options
context:
space:
mode:
authorUri Shaked2020-12-29 20:33:25 +0200
committerUri Shaked2020-12-29 20:33:25 +0200
commit19e53fa42473b13271768894b250cd897edcd1f5 (patch)
treeb72d3b97a11d22ff1ef0f307c96edcbbecb3cba2 /src/peripherals/timer.ts
parent0.14.8 (diff)
downloadavr8js-19e53fa42473b13271768894b250cd897edcd1f5.tar.gz
avr8js-19e53fa42473b13271768894b250cd897edcd1f5.tar.bz2
avr8js-19e53fa42473b13271768894b250cd897edcd1f5.zip
fix(timer): delay() is inaccurate #81
fix #81
Diffstat (limited to '')
-rw-r--r--src/peripherals/timer.ts9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/peripherals/timer.ts b/src/peripherals/timer.ts
index b1a64d9..e620459 100644
--- a/src/peripherals/timer.ts
+++ b/src/peripherals/timer.ts
@@ -481,20 +481,13 @@ export class AVRTimer {
// OCRUpdateMode.Bottom only occurs in Phase Correct modes, handled by phasePwmCount().
// Thus we only handle TOVUpdateMode.Top or TOVUpdateMode.Max here.
- if (
- (newVal === TOP || (overflow && val < TOP)) &&
- (this.tovUpdateMode == TOVUpdateMode.Top || TOP === this.MAX)
- ) {
+ if (overflow && (this.tovUpdateMode == TOVUpdateMode.Top || TOP === this.MAX)) {
cpu.setInterruptFlag(this.OVF);
}
}
}
if (this.tcntUpdated) {
- const { TOP } = this;
this.tcnt = this.tcntNext;
- if (this.tcnt === TOP && (this.tovUpdateMode == TOVUpdateMode.Top || TOP === this.MAX)) {
- cpu.setInterruptFlag(this.OVF);
- }
this.tcntUpdated = false;
}
if (this.updateDivider) {