Skip to content

Commit 688eba3

Browse files
committed
fix(timer): only set ICR hook for 16-bit timers
The ICR (Input Capture Register) only exists for 16-bit timers.
1 parent 4bca2f6 commit 688eba3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/peripherals/timer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ export class AVRTimer {
320320
this.ocrB = this.nextOcrB;
321321
}
322322
};
323-
this.cpu.writeHooks[config.ICR] = (value: u8) => {
324-
this.icr = (this.highByteTemp << 8) | value;
325-
};
326323
if (this.config.bits === 16) {
324+
this.cpu.writeHooks[config.ICR] = (value: u8) => {
325+
this.icr = (this.highByteTemp << 8) | value;
326+
};
327327
const updateTempRegister = (value: u8) => {
328328
this.highByteTemp = value;
329329
};

0 commit comments

Comments
 (0)