aboutsummaryrefslogtreecommitdiff
path: root/demo/src/execute.ts
diff options
context:
space:
mode:
authorUri Shaked2019-11-25 22:03:40 +0200
committerUri Shaked2019-11-25 22:03:40 +0200
commit9b399811c07cc2ab881abacf6ca35107fc6bc658 (patch)
tree4200735eeec384baae148c37cca8d0438e274a67 /demo/src/execute.ts
parentdoc: README for demo, explain about running tests (diff)
downloadavr8js-9b399811c07cc2ab881abacf6ca35107fc6bc658.tar.gz
avr8js-9b399811c07cc2ab881abacf6ca35107fc6bc658.tar.bz2
avr8js-9b399811c07cc2ab881abacf6ca35107fc6bc658.zip
feat: GPIO peripheral implementation
Add new AVRIOPort class, implements GPIO output logic
Diffstat (limited to 'demo/src/execute.ts')
-rw-r--r--demo/src/execute.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/demo/src/execute.ts b/demo/src/execute.ts
index 96a0411..4568839 100644
--- a/demo/src/execute.ts
+++ b/demo/src/execute.ts
@@ -1,4 +1,13 @@
-import { avrInstruction, AVRTimer, CPU, timer0Config } from 'avr8js';
+import {
+ avrInstruction,
+ AVRTimer,
+ CPU,
+ timer0Config,
+ AVRIOPort,
+ portBConfig,
+ portCConfig,
+ portDConfig
+} from 'avr8js';
import { loadHex } from './intelhex';
// ATmega328p params
@@ -8,6 +17,9 @@ export class AVRRunner {
readonly program = new Uint16Array(FLASH);
readonly cpu: CPU;
readonly timer: AVRTimer;
+ readonly portB: AVRIOPort;
+ readonly portC: AVRIOPort;
+ readonly portD: AVRIOPort;
private stopped = false;
@@ -15,6 +27,9 @@ export class AVRRunner {
loadHex(hex, new Uint8Array(this.program.buffer));
this.cpu = new CPU(this.program);
this.timer = new AVRTimer(this.cpu, timer0Config);
+ this.portB = new AVRIOPort(this.cpu, portBConfig);
+ this.portC = new AVRIOPort(this.cpu, portCConfig);
+ this.portD = new AVRIOPort(this.cpu, portDConfig);
}
async execute(callback: (cpu: CPU) => void) {