Le support aux utilisateurs et les demandes de création de comptes externes doivent être faites depuis les issues du projet GitLab HEFR (https://gitlab.forge.hefr.ch/forge-hefr/gitlab-hefr)

Commit 1f86ec11 authored by Nicolas Maier's avatar Nicolas Maier
Browse files

Bouton S4 plutôt que S5

parent 90a55a19
Pipeline #7266 passed with stage
in 40 seconds
......@@ -32,11 +32,11 @@
// i/o pin definition --------------------------------------------------------
#define SW_GPIO AM335X_GPIO1
#define SW_GPIO_5 AM335X_GPIO0
#define SW_GPIO_4 AM335X_GPIO2
#define S1_PIN 15
#define S2_PIN 16
#define S3_PIN 17
#define S5_PIN 2
#define S4_PIN 8
#define FIRST_BUTTON BUTTONS_1
#define NB_BUTTONS BUTTONS_COUNT
......@@ -45,7 +45,7 @@ static const uint32_t button[NB_BUTTONS] = {
[BUTTONS_1] = S1_PIN,
[BUTTONS_2] = S2_PIN,
[BUTTONS_3] = S3_PIN,
[BUTTONS_5] = S5_PIN,
[BUTTONS_4] = S4_PIN,
};
static const enum buttons_states buttons_states[2][2] = {
......@@ -72,17 +72,17 @@ void buttons_init()
{
// initialize gpio module
am335x_gpio_init(SW_GPIO);
am335x_gpio_init(SW_GPIO_5);
am335x_gpio_init(SW_GPIO_4);
// configure gpio pins as input
for (int i=0; i<NB_BUTTONS-1;i++) {
am335x_gpio_setup_pin_in(i==BUTTONS_5 ? SW_GPIO_5 : SW_GPIO, button[i],
am335x_gpio_setup_pin_in(i==BUTTONS_4 ? SW_GPIO_4 : SW_GPIO, button[i],
AM335X_GPIO_PULL_NONE, true);
former_state[i] = am335x_gpio_get_state(
i==BUTTONS_5 ? SW_GPIO_5 : SW_GPIO, button[i]);
i==BUTTONS_4 ? SW_GPIO_4 : SW_GPIO, button[i]);
gpio_on_event(i==BUTTONS_5 ? SW_GPIO_5 : SW_GPIO, button[i],
gpio_on_event(i==BUTTONS_4 ? SW_GPIO_4 : SW_GPIO, button[i],
GPIO_FALLING | GPIO_DEBOUNCED, buttons_handler, (void*)i);
}
}
......@@ -90,7 +90,7 @@ void buttons_init()
enum buttons_states buttons_get_state(enum buttons_set btn)
{
bool new_state = am335x_gpio_get_state(
btn==BUTTONS_5 ? SW_GPIO_5 : SW_GPIO, button[btn]);
btn==BUTTONS_4 ? SW_GPIO_4 : SW_GPIO, button[btn]);
enum buttons_states state
= buttons_states[former_state[btn]][new_state];
former_state[btn] = new_state;
......
......@@ -42,7 +42,7 @@ enum buttons_set {
BUTTONS_1,
BUTTONS_2,
BUTTONS_3,
BUTTONS_5,
BUTTONS_4,
BUTTONS_COUNT,
};
......
......@@ -78,6 +78,10 @@ int main()
isJ1 = false;
break;
}
if (buttons_get_state(BUTTONS_4) == BUTTONS_CLOSED) {
display_clear_game_area();
}
}
display_clear_game_area();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment