From 44df53e74cdd72dea405e17db3ba97af2cb4835d Mon Sep 17 00:00:00 2001 From: Uri Shaked Date: Sat, 4 Apr 2020 15:21:54 +0300 Subject: feat(demo): add 16-bit timer (timer1) --- demo/src/execute.ts | 10 +++++++--- 1 file 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(); } -- cgit v1.2.3