pad4pi
pad4pi copied to clipboard
Possible brief direct short if multiple keys are pressed at one time
The problem arises in this piece of code here:
# Scan columns for pressed key
colVal = None
if rowVal is not None:
for i in range(len(self._col_pins)):
GPIO.output(self._col_pins[i], GPIO.HIGH)
if GPIO.input(self._row_pins[rowVal]) == GPIO.HIGH:
GPIO.output(self._col_pins[i], GPIO.LOW)
colVal = i
break
GPIO.output(self._col_pins[i], GPIO.LOW)
Suppose we have a 2x2 matrix, and someone pushes A1, connecting the first column and first row. All is well.
Now, they later press B1, which doesn't trigger a new row that wasn't already low, no interrupt, all is well.
Keeping those pressed, they press A2 or B2. getKey is triggered, and the first column is driven high for the test, but it is connected to the second column(which is a low output), and you get a short.
Then we do the same for the second column and get a short again. If the repeat timer is doing stuff, this happens over and over again.