diff options
| author | Uri Shaked | 2021-10-29 13:04:38 +0300 |
|---|---|---|
| committer | Uri Shaked | 2021-10-29 13:04:38 +0300 |
| commit | 4eaf664653e7f2f4397f24d881ec4bf2032473ce (patch) | |
| tree | 864dece0fdae6e37f8f8c38af27bd02b2749469f /src/peripherals/timer.ts | |
| parent | 0.18.4 (diff) | |
| download | avr8js-4eaf664653e7f2f4397f24d881ec4bf2032473ce.tar.gz avr8js-4eaf664653e7f2f4397f24d881ec4bf2032473ce.tar.bz2 avr8js-4eaf664653e7f2f4397f24d881ec4bf2032473ce.zip | |
fix(timer): setting TCNT doesn't update OCRA #111
Diffstat (limited to 'src/peripherals/timer.ts')
| -rw-r--r-- | src/peripherals/timer.ts | 8 |
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; |
