From cde2c46b4fcc027e7e64510a3241c196f6fe5ba0 Mon Sep 17 00:00:00 2001 From: uvok Date: Sat, 19 Jul 2025 13:21:56 +0200 Subject: Add very ugly prev/next navigation --- src/gpio.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/gpio.cpp') diff --git a/src/gpio.cpp b/src/gpio.cpp index 1bf50a0..a419d99 100644 --- a/src/gpio.cpp +++ b/src/gpio.cpp @@ -11,9 +11,7 @@ // Elecrow #define EXIT_KEY 1 #define HOME_KEY 2 -#define NEXT_KEY 4 #define OK_KEY 5 -#define PRV_KEY 6 #endif #define GPIO_STACK 2048 @@ -76,6 +74,8 @@ void de::uvok::badge::gpio_init(void) #endif } +static volatile uint8_t event; + // "Poll task", for button 0. long de::uvok::badge::gpio_poll(void) { @@ -101,6 +101,13 @@ long de::uvok::badge::gpio_poll(void) pressDuration = releasedTime - pressedTime; }; + if (event) + { + uint8_t r = event; + event = 0; + return r; + } + return pressDuration; } @@ -128,6 +135,7 @@ static void gpio_loop(void *ctx) continue; LOG_F(" Handling\n"); + event = pin; } } } -- cgit v1.2.3