aboutsummaryrefslogtreecommitdiff
path: root/src/peripherals/timer.ts
diff options
context:
space:
mode:
authorUri Shaked2021-06-19 23:47:35 +0300
committerUri Shaked2021-06-19 23:47:35 +0300
commita774df984fe156a037b338000cc03f723f968224 (patch)
tree93e0c43b0efd39ba5415c2beb8d4599fd891ef75 /src/peripherals/timer.ts
parentchore(deps): husky 6.0.0 (diff)
downloadavr8js-a774df984fe156a037b338000cc03f723f968224.tar.gz
avr8js-a774df984fe156a037b338000cc03f723f968224.tar.bz2
avr8js-a774df984fe156a037b338000cc03f723f968224.zip
fix(timer): Timer1 PWM issues #94
close #94
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');