diff options
| author | Uri Shaked | 2021-07-07 19:51:10 +0300 |
|---|---|---|
| committer | Uri Shaked | 2021-07-07 19:51:10 +0300 |
| commit | 688eba38b5998bc9b6edab80418dc344f3431200 (patch) | |
| tree | 0e26a9e6d8ba25b47bd6a30230af5fef2ce6ec3e | |
| parent | 0.16.0 (diff) | |
| download | avr8js-688eba38b5998bc9b6edab80418dc344f3431200.tar.gz avr8js-688eba38b5998bc9b6edab80418dc344f3431200.tar.bz2 avr8js-688eba38b5998bc9b6edab80418dc344f3431200.zip | |
fix(timer): only set ICR hook for 16-bit timers
The ICR (Input Capture Register) only exists for 16-bit timers.
| -rw-r--r-- | src/peripherals/timer.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/peripherals/timer.ts b/src/peripherals/timer.ts index c79cc7c..cd55f12 100644 --- a/src/peripherals/timer.ts +++ b/src/peripherals/timer.ts @@ -320,10 +320,10 @@ export class AVRTimer { this.ocrB = this.nextOcrB; } }; - this.cpu.writeHooks[config.ICR] = (value: u8) => { - this.icr = (this.highByteTemp << 8) | value; - }; if (this.config.bits === 16) { + this.cpu.writeHooks[config.ICR] = (value: u8) => { + this.icr = (this.highByteTemp << 8) | value; + }; const updateTempRegister = (value: u8) => { this.highByteTemp = value; }; |
