#include #include "Kernel.h" bool debounce_a = false; bool debounce_b = false; int UserInput(int pid, unsigned int signal) { if (signal & SIGNAL_START) { Kernel_signal_mask(pid, SIGNAL_START | SIGNAL_STOP | SIGNAL_TICK); } if (signal & SIGNAL_STOP) { return 255; } if (signal & SIGNAL_TICK) { if (Kernel_read_input(KERNEL_INPUT_BUTTON_A)) { if (!debounce_a) { Kernel_signal(SIGNAL_INPUT_A); debounce_a = true; } } else { debounce_a = false; } if (Kernel_read_input(KERNEL_INPUT_BUTTON_B)) { if (!debounce_b) { Kernel_signal(SIGNAL_INPUT_B); debounce_b = true; } } else { debounce_b = false; } } return 0; }