aboutsummaryrefslogtreecommitdiff
path: root/src/peripherals/timer.ts
diff options
context:
space:
mode:
authorUri Shaked2020-08-01 16:45:42 +0300
committerUri Shaked2020-08-01 16:45:42 +0300
commit78377f7ce59ffc2d1be9870909033cf6df15421d (patch)
tree36c14f93203b77f61294ef638bc2d2e1e1e23c22 /src/peripherals/timer.ts
parenttest(timer): use TestProgramRunner (diff)
downloadavr8js-78377f7ce59ffc2d1be9870909033cf6df15421d.tar.gz
avr8js-78377f7ce59ffc2d1be9870909033cf6df15421d.tar.bz2
avr8js-78377f7ce59ffc2d1be9870909033cf6df15421d.zip
fix(timer): keeps counting even when stopped #41
Diffstat (limited to 'src/peripherals/timer.ts')
-rw-r--r--src/peripherals/timer.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/peripherals/timer.ts b/src/peripherals/timer.ts
index c6bf742..315d725 100644
--- a/src/peripherals/timer.ts
+++ b/src/peripherals/timer.ts
@@ -247,6 +247,7 @@ export class AVRTimer {
this.cpu.writeHooks[config.TCNT] = (value: u8) => {
this.tcnt = (this.highByteTemp << 8) | value;
+ this.countingUp = true;
this.tcntUpdated = true;
this.timerUpdated();
};
@@ -281,6 +282,7 @@ export class AVRTimer {
};
cpu.writeHooks[config.TCCRB] = (value) => {
this.cpu.data[config.TCCRB] = value;
+ this.tcntUpdated = true;
this.updateWGMConfig();
return true;
};