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.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/peripherals/timer.ts b/src/peripherals/timer.ts
index e620459..c79cc7c 100644
--- a/src/peripherals/timer.ts
+++ b/src/peripherals/timer.ts
@@ -548,13 +548,13 @@ export class AVRTimer {
private timerUpdated(value: number, prevValue: number) {
const { ocrA, ocrB } = this;
const overflow = prevValue > value;
- if ((prevValue < ocrA || overflow) && value >= ocrA) {
+ if (((prevValue < ocrA || overflow) && value >= ocrA) || (prevValue < ocrA && overflow)) {
this.cpu.setInterruptFlag(this.OCFA);
if (this.compA) {
this.updateCompPin(this.compA, 'A');
}
}
- if ((prevValue < ocrB || overflow) && value >= ocrB) {
+ if (((prevValue < ocrB || overflow) && value >= ocrB) || (prevValue < ocrB && overflow)) {
this.cpu.setInterruptFlag(this.OCFB);
if (this.compB) {
this.updateCompPin(this.compB, 'B');