-
-
Notifications
You must be signed in to change notification settings - Fork 1
Buttons
There are two functions which can be used to read the button state: btnState()
and btnStateDebounced()
, it is recommended to use btnStateDebounced()
unless you wish to implement your own debouncing logic. Debouncing ensures you won't get phantom keypresses while the signals settle into a consistent state after pressing a button. The default debouncing logic keeps polling the buttons until they have been in a consistent state for 5ms.
The aforementioned functions return a uint32_t
with specific bits set for each button. One can test for a specific button being pressed by using a bitwise &
on the result of the function.
For example:
uint32_t buttons = btnStateDebounced();
if((buttons & A) || (buttons & B)) {
printf("Button A or B was pressed");
}
The following buttons are available (note, the joystick is digital and behaves as if it were a series of buttons representing each direction - the F200 has no diagonals):
A
, B
, X
, Y
, START
, SELECT
, UP
, DOWN
, LEFT
, RIGHT
, UP_LEFT
, UP_RIGHT
, DOWN_LEFT
, DOWN_RIGHT
, VOL_UP
, VOL_DOWN
, STICK
, L
, R