2 ms·
For toy tinkering, to replicate something like the old ability to just write a byte to an IO memory location and have it appear on the pins of a parallel port,
by dspillett 1y ago
For toy tinkering, to replicate something like the old ability to just write a byte to an IO memory location and have it appear on the pins of a parallel port, you could design a simple USB peripheral that did similar. Give it a set of DIP switches to pick a number (4 for 0-f, more would probably be overkill but feel free) and have the driver present something like /proc/simpleio/device<num>/in and /proc/simpleio/device<num>/out/pin<num> for reading & writing¹. If you use the same set of pins for in and out, /proc/simpleio/device<num>/config to state which direction each is expected to work, and perhaps set voltage options (probably per device, per pin sounds overkill for this). Release the full design and let people make their own, sell pre-made boards and cases and/or let others do that (or just the boards and have people 3D-print their own cases). Devices could have as many pins as the maker likes.
That would only cover the real basics: reading/writing the hi/low status of pins. Other things people might want is analogue voltage control/read (for many sensors) or pulse control (for controlling servos and such). Things like that could be mapped into the /proc/simpleio/device<num>/{in|out}/pin<num> files. Perhaps for setting/reading multiple pins at a time perhaps have something like /proc/simpleio/device<num>/{in|out}/allpins. You could expand the feature in many ways, though TBH beyond the simple hi/low thing people are probably better off getting an rPi or microcontroller and using all the available devices and plans there are out there already for their IO pins and using something newer.
--------
[1] Not sure what you'd do for Windows, I'd be inclined to release a Linux driver and let the Windows community worry about one for their platform.
- colechristensen 1y agoUSB parallel ports, data acquisition peripherals, or modern boards that run linux and have GPIO pins are already a thing and don't need to be created. What I'm talking about is a whole computer system + systems programming language + OS which is as simple to understand and program as computers were in the 80s. With modern speedups, without modern layers of abstraction.
- smj-edison 1y agoMaybe something like Oberon 2?
- rkagerer 1y agoThanks for the info! I actually bought a real parallel port card years ago that plugs into a PCI port on my motherboard. Incidentally it also provides 4 serial ports. Only tried it on Windows, but it works great. If I recall there was some kind of library I have to use in modern Windows versions due to a permissions or kernel isolation thing.