Fix button events so interface is no more sensible to small electro-static discharges
authorNathael Pajani <nathael.pajani@ed3l.fr>
Mon, 7 Feb 2022 10:39:32 +0000 (11:39 +0100)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Tue, 8 Nov 2022 11:07:29 +0000 (12:07 +0100)
v10/interface.c

index 2629901..0814636 100644 (file)
@@ -58,7 +58,7 @@ const struct pio button_ok = LPC_GPIO_0_12;
 
 /* Led control data pin */
 const struct pio ws2812_data_out_pin = LPC_GPIO_0_20;
- /* Oled Reset */
+/* Oled Reset */
 const struct pio oled_reset = LPC_GPIO_0_21;
 
 
@@ -165,12 +165,12 @@ struct ws2812_conf ws2812_leds = {
 int interface_config(uint32_t uart)
 {
        /* Buttons inputs on front panel */
-       /* Activate on Rising edge (button release) */
-       set_gpio_callback(button_callback, &button_up, EDGE_RISING);
-       set_gpio_callback(button_callback, &button_left, EDGE_RISING);
-       set_gpio_callback(button_callback, &button_right, EDGE_RISING);
-       set_gpio_callback(button_callback, &button_down, EDGE_RISING);
-       set_gpio_callback(button_callback, &button_ok, EDGE_RISING);
+       /* Activate on Falling edge (button press) */
+       set_gpio_callback(button_callback, &button_up, EDGE_FALLING);
+       set_gpio_callback(button_callback, &button_left, EDGE_FALLING);
+       set_gpio_callback(button_callback, &button_right, EDGE_FALLING);
+       set_gpio_callback(button_callback, &button_down, EDGE_FALLING);
+       set_gpio_callback(button_callback, &button_ok, EDGE_FALLING);
 
        /* WS2812B Leds on display board */
        ws2812_config(&ws2812_leds, &ws2812_data_out_pin);