Part of the Pi interface. Effectively they're converting totem-pole outputs to open-drain ones... but you can effectively program the GPIOs to be open-drain outputs. Admittedly, adding the diode removes the possibility of a low output being connection to a high output due to a programming error.
Not just a programming error. Running any other gpio program on that hardware which configures those gpio as output risks damage. If the hardware is dedicated to a single task it's not a problem, but having a keyboard hints at a more general purpose approach. The diodes are not essential but they seem to me to be a reasonable safety measure. 100R resistors would work as an alternative, just limiting short circuit current. It's a good idea to never connect a switch contact between two outputs. It's no bad thing to put a resistor in series with a switch to GND or VCC for the same reason. The gpio you intended to always be an input might get configured as an output of opposite polarity and result in an over-current condition.
OK. You've convinced me.
Making it indestructible does get a bit ridiculous for such a cheap SBC. It wouldn't be unreasonable to connect it directly and accept the small risk that you later do something that kills something on the Pi.
I'm less convinced. Diodes may provide protection for the GPIO driving rows but there's no equivalent protection for reading columns.
Indeed. My first paying job was designing embedded computers, so it still seems weird to me to use unnecessary components. (I was told my first product would retail for £100. "Oh, that's OK," I thought... then they told me what a pitiful fraction of that I could spend on components!)hippy wrote: ↑Mon Feb 26, 2018 12:20 pmThe diodes are needed, as noted, if the rows are always driven high and low, are a necessity to avoid damage, and I think that's why they are there. Looking at the source code will show how the author implemented their scan routine, whether it mandates diodes or not.
Users browsing this forum: No registered users and 3 guests