22 lines
635 B
C
Raw Normal View History

#include "hid.h"
2016-05-30 01:54:09 +02:00
#include "timer.h"
u32 InputWait() {
u32 pad_state_old = HID_STATE;
2016-05-30 01:54:09 +02:00
timer_start();
while (true) {
u32 pad_state = HID_STATE;
2016-04-05 23:19:29 +02:00
if (!(~pad_state & BUTTON_ANY)) { // no buttons pressed
pad_state_old = pad_state;
continue;
}
2016-05-30 01:54:09 +02:00
if ((pad_state == pad_state_old) && (!(pad_state & BUTTON_ARROW) || timer_msec() < 120))
2016-04-05 23:19:29 +02:00
continue;
//Make sure the key is pressed
u32 t_pressed = 0;
for(; (t_pressed < 0x13000) && (pad_state == HID_STATE); t_pressed++);
if (t_pressed >= 0x13000)
return ~pad_state;
}
}