From 44a1381b283e7d2fc446581866c408748d82b1e5 Mon Sep 17 00:00:00 2001 From: Terence Boldt Date: Fri, 4 Dec 2020 00:28:10 +0000 Subject: [PATCH] Add non-functional server code for RPi --- .gitignore | 1 + README.md | 18 +++++++++++++ RaspberryPi/package-lock.json | 49 +++++++++++++++++++++++++++++++++++ RaspberryPi/package.json | 14 ++++++++++ RaspberryPi/server.js | 22 ++++++++++++++++ 5 files changed, 104 insertions(+) create mode 100644 RaspberryPi/package-lock.json create mode 100644 RaspberryPi/package.json create mode 100644 RaspberryPi/server.js diff --git a/.gitignore b/.gitignore index 77748a4..31086e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *-bak +node_modules diff --git a/README.md b/README.md index 06b3dc9..adaede9 100644 --- a/README.md +++ b/README.md @@ -9,5 +9,23 @@ This is a very early stage project. Currently one partially completed hand wired ## Purpose The purpose of this project is to provide I/O for an Apple II series 8 bit computer via a Raspberry Pi Zero W which is powered by the Apple II expansion bus. Initially this would be storage via virtual ProDOS compatible drive. Next might be adding virtual serial card support over wifi. Future enhancements could use the RPi for more complex processing as per request from the Apple II. For example, the Apple II could request a web page or application and the RPi could calculate this in Apple II hi-res graphics mode and send the image data back to the II for display purposes. +## Setup +1. Have PCBs made from the gerber and drill files in the Hardware folder +2. Solder chips, header and capacitors in place +3. Attach Raspberry Pi Zero W facing outward from the card +4. Install Raspberry Pi OS on microSD card +5. Configure wifi in boot/wpa_supplicant.conf +6. Add empty ssh file boot (for ssh access over wifi) +7. Put microSD card in the RPi +8. Install the expansion card into the Apple II +9. Power on the Apple II +10. Install NodeJS 11 for ARMv6 on the RPi over ssh +11. sudo npm install -g pm2 +12. pm2 startup systemd +13. Run the command from the output of the previous step +14. pm2 start server.js + ## Similar Project If you're looking for complete hardware design or prefer having Apple II peripherals control a control a Raspberry Pi rather than simply using the Raspberry Pi to provide storage and network access to the Apple II, have a look at David Schmenk's excellent [Apple2Pi](https://github.com/dschmenk/apple2pi) project. + + diff --git a/RaspberryPi/package-lock.json b/RaspberryPi/package-lock.json new file mode 100644 index 0000000..85cf0dc --- /dev/null +++ b/RaspberryPi/package-lock.json @@ -0,0 +1,49 @@ +{ + "name": "apple2-io-rpi", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "requires": { + "file-uri-to-path": "1.0.0" + } + }, + "epoll": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/epoll/-/epoll-4.0.0.tgz", + "integrity": "sha512-dENZbykco5w/vsFHuhD/5zla9VHm3htP1ROoX9MCc6L/7LVqGPFfcGS/g+/+pQLUclKw4uR9HnaZmsZ6fi5n+Q==", + "requires": { + "bindings": "^1.5.0", + "nan": "^2.14.1" + } + }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=" + }, + "nan": { + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==" + }, + "onoff": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/onoff/-/onoff-6.0.1.tgz", + "integrity": "sha512-lqnVyUiWLbb4T6sWTaOeCJn682EPyxaTyfJ5bP5LiTa0KMDlVPQR0ngVgzV3SkRkd0JnNxPvwTNj7QVvZTZsAw==", + "requires": { + "epoll": "^4.0.0", + "lodash.debounce": "^4.0.8" + } + } + } +} diff --git a/RaspberryPi/package.json b/RaspberryPi/package.json new file mode 100644 index 0000000..eef8b6a --- /dev/null +++ b/RaspberryPi/package.json @@ -0,0 +1,14 @@ +{ + "name": "apple2-io-rpi", + "version": "0.0.1", + "description": "Apple2 I/O Card with Raspberry Pi Zero W", + "main": "server.js", + "scripts": { + "test": "jest" + }, + "author": "Terence J. Boldt", + "license": "GPL-3.0-or-later", + "dependencies": { + "onoff": "^6.0.1" + } +} diff --git a/RaspberryPi/server.js b/RaspberryPi/server.js new file mode 100644 index 0000000..b1a8b77 --- /dev/null +++ b/RaspberryPi/server.js @@ -0,0 +1,22 @@ +var fs = require('fs'); +var gpio = require('onoff').Gpio; + +var output = new gpio(4, 'high', {activeLow: true}); +var input = new gpio(6, 'in', 'both'); + +function onCleanUp() { + output.unwatchAll(); + output.unexport(); + input.unexport(); +} + +function onStatusChanged(err, value) { + if (err) { + } + else { + } +} + +input.watch(onStatusChanged); + +process.on('SIGINT', onCleanUp);