An I/O controller for virtual pinball machines: accelerometer nudge sensing, analog plunger input, button input encoding, LedWiz compatible output controls, and more.
Fork of Pinscape_Controller by
This requirement is for V3.
This requirement affects the configuration tool, the FW, and boards. Each board needs a bit more intelligence. Currently the only information available to the FW is the number of outputs (via either TLC5940 or via 595) and that information is provided by the user.
A better way is needed to "discover" the boards and what they are. There are several approaches to solving this problem. All of them rely on giving each type of board a unique type. Each board could also be given an ID in the range of 0 to 15 as well.
The simplest approach is to hard-code the type of each board as pullups or pulldowns on a 8 bit serial-in shift register (74HC165). An additional 4-bit DIP-switch could be used to encode the ID # of the board. Now Pinscape has access to the exact order of ports and can prevent misconfiguration by the user. This does take up extra I/O pins on the KL25Z and would need some of the pins on the IDC cable which are currently grounded to help reduce signal interference. As this is board query is only down on startup, it could be possible to keep some wires connected to ground using enabling and disabling of the inbound or outbound data.
One other advantage of this approach is discovery if a user plugs in another board or removes a board (on purpose or by accident). The configurator can scan the boards on startup and compare with the last stored configuration.
There are more sophisticated approaches such as using on-board microcontrollers. With this capability, the hard-coded board type can tell the microcontroller how to function and it can manage a whole range of I/O with the KL25Z using a bus like I2C. The microcontroller can monitor the output voltages and send those back to Pinscape so it knows what power is on each board. The range of possibly function is huge. The downside is that users would need to program their own chips or they would need to be purchased from a supplier with a minimum of a bootloader installed. Pinscape could download software over the bus both for initial setup and for upgrades. The bootloader would need to be unbreakable.