aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorUri Shaked2021-07-07 19:51:10 +0300
committerUri Shaked2021-07-07 19:51:10 +0300
commit688eba38b5998bc9b6edab80418dc344f3431200 (patch)
tree0e26a9e6d8ba25b47bd6a30230af5fef2ce6ec3e /src
parent0.16.0 (diff)
downloadavr8js-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.
Diffstat (limited to '')
-rw-r--r--src/peripherals/timer.ts6
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;
};