I have an 8bitdo NES controller that I have hooked up to a Raspberry Pi and am using it to interact with some various demos I'm working on.
I'm trying to figure out a good way to grab multiple keypresses with evdev
while debouncing so that a single keypress doesn't trigger twice. I could set a flag and check the next loop, but thought this might be taken care of with the library.
I'm using the active_keys
function to get a list of all keypresses as using the for event in device.read_loop():
call appears to be blocking and only grabs a single key per loop.
This is where I'm currently at:
# define key values
KEY_L = 294
while not done:
keys = gamepad.active_keys()
if KEY_L:
# handle L bumper
...
As I mentioned, I could set a flag per key to handle a debounce which would get quickly redundant and thought there was a more elegant way to handle this. I didn't notice it in the API documentation though.