Homepage › Forums › RetroPie Project › Everything else related to the RetroPie Project › Change RetroPie GPIO button coding to 1 press › Reply To: Change RetroPie GPIO button coding to 1 press
12/08/2013 at 23:08
#3492
Participant
If all you want is ESC, try this:
if (confres.button_enabled) {
btn_read(&button);
switch (button.state) {
case BTN_STATE_IDLE:
break;
case BTN_STATE_PRESSED:
if (button.pressedCtr == 1 && button.duration >= 1) {
uinput_kbd_write(&uinp_kbd, KEY_ESC, 1, EV_KEY);
}
break;
case BTN_STATE_RELEASED:
if (button.pressedCtr == 1 && button.duration >= 1) {
uinput_kbd_write(&uinp_kbd, KEY_ESC, 0, EV_KEY);
}
break;
}
}
/* wait for some time to keep the CPU load low */