Skip to content
Snippets Groups Projects
Commit 4bbe7169 authored by Cabestaing François's avatar Cabestaing François
Browse files

Improve debouncing (ensure falling edge)

parent 6ce798c7
No related branches found
No related tags found
No related merge requests found
......@@ -78,14 +78,14 @@ def send(symbol: dict):
with open('/dev/hidg0', 'wb+') as fd:
for i in range(0, len(symbol['scancodes']), 2):
scancodes = symbol['scancodes'][i] + chr(
0) + symbol['scancodes'][i + 1] + 5 * chr(0)
0) + symbol['scancodes'][i + 1] + 13 * chr(0)
fd.write(scancodes.encode())
else:
print(symbol['output'])
with open('output.bin', 'ab+') as fd:
for i in range(0, len(symbol['scancodes']), 2):
scancodes = symbol['scancodes'][i] + chr(
0) + symbol['scancodes'][i + 1] + 5 * chr(0)
0) + symbol['scancodes'][i + 1] + 13 * chr(0)
fd.write(scancodes.encode())
......@@ -226,6 +226,7 @@ class Speller(wx.Frame):
def falling(channel):
if not GPIO.input(pin):
pub.sendMessage("listener", message="falling")
......@@ -236,7 +237,7 @@ def main():
GPIO.add_event_detect(pin,
GPIO.FALLING,
callback=falling,
bouncetime=100)
bouncetime=200)
app = wx.App()
sp = Speller(None)
sp.Show()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment