Skip to content

Commit

Permalink
fix(timer): only set ICR hook for 16-bit timers
Browse files Browse the repository at this point in the history
The ICR (Input Capture Register) only exists for 16-bit timers.
  • Loading branch information
urish committed Jul 7, 2021
1 parent 4bca2f6 commit 688eba3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/peripherals/timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit 688eba3

Please sign in to comment.