aboutsummaryrefslogtreecommitdiff
path: root/demo/src/execute.ts
diff options
context:
space:
mode:
authorUri Shaked2020-04-04 15:21:54 +0300
committerUri Shaked2020-04-12 22:56:10 +0300
commit44df53e74cdd72dea405e17db3ba97af2cb4835d (patch)
treef0b594b0612812b363f358861d67fc71338317b8 /demo/src/execute.ts
parentchore(deps): jest 25.3.0, ts-jest 25.3.1 (diff)
downloadavr8js-44df53e74cdd72dea405e17db3ba97af2cb4835d.tar.gz
avr8js-44df53e74cdd72dea405e17db3ba97af2cb4835d.tar.bz2
avr8js-44df53e74cdd72dea405e17db3ba97af2cb4835d.zip
feat(demo): add 16-bit timer (timer1)
Diffstat (limited to '')
-rw-r--r--demo/src/execute.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/demo/src/execute.ts b/demo/src/execute.ts
index ee5278e..2ba9ee0 100644
--- a/demo/src/execute.ts
+++ b/demo/src/execute.ts
@@ -3,6 +3,7 @@ import {
AVRTimer,
CPU,
timer0Config,
+ timer1Config,
AVRIOPort,
AVRUSART,
portBConfig,
@@ -19,7 +20,8 @@ const FLASH = 0x8000;
export class AVRRunner {
readonly program = new Uint16Array(FLASH);
readonly cpu: CPU;
- readonly timer: AVRTimer;
+ readonly timer0: AVRTimer;
+ readonly timer1: AVRTimer;
readonly portB: AVRIOPort;
readonly portC: AVRIOPort;
readonly portD: AVRIOPort;
@@ -31,7 +33,8 @@ export class AVRRunner {
constructor(hex: string) {
loadHex(hex, new Uint8Array(this.program.buffer));
this.cpu = new CPU(this.program);
- this.timer = new AVRTimer(this.cpu, timer0Config);
+ this.timer0 = new AVRTimer(this.cpu, timer0Config);
+ this.timer1 = new AVRTimer(this.cpu, timer1Config);
this.portB = new AVRIOPort(this.cpu, portBConfig);
this.portC = new AVRIOPort(this.cpu, portCConfig);
this.portD = new AVRIOPort(this.cpu, portDConfig);
@@ -44,7 +47,8 @@ export class AVRRunner {
const cyclesToRun = this.cpu.cycles + this.workUnitCycles;
while (this.cpu.cycles < cyclesToRun) {
avrInstruction(this.cpu);
- this.timer.tick();
+ this.timer0.tick();
+ this.timer1.tick();
this.usart.tick();
}