
I’m reading the keyboard from scratch this time (unlike RAIN-PSP which used an existing but modified kernel module), but the logic is fairly straightforward.
The keyboard is made up of four rows and twelve columns. Each row is connected to a GPIO configured for “open drain” which allows it to connect the row to ground. On the other end each column is connected to a GPIO configured for input with a pull-up resistor enabled. The pin for each row is set to False in turn, essentially shorting the row to ground. Then each column pin is read. If a key is pressed in a row that is shorted to ground, the corresponding column pin will read low (or in CircuitPython parlance, False). By looping over each row and each column in each row all keys can be read.

So far I’ve only done four keys to test the wiring and code but now that this is working it’s just a matter of wiring-up the rest and extending the code. There will be some additional logic to handle modifier keys like Shift, Control, etc. but for the most part the software for the keyboard is just more of what’s been done today.
Next step is probably to start implementing the coroutines so I can scan the keyboard and output the keypresses asynchronously instead of doing everything in lock-step under a single loop.