summaryrefslogtreecommitdiff
path: root/src/gpio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpio.cpp')
-rw-r--r--src/gpio.cpp12
1 files changed, 10 insertions, 2 deletions
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;
}
}
}