From a08ace13341c0e6961cdf8c685e7f13c1fbbc52b Mon Sep 17 00:00:00 2001 From: c vw Date: Wed, 5 Jan 2022 15:40:54 +0100 Subject: [PATCH] Activate "helper functions" for debouncing in GPIO case only. --- gpio.c | 2 ++ gpio.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/gpio.c b/gpio.c index 7bf0fef..9d97f78 100644 --- a/gpio.c +++ b/gpio.c @@ -341,6 +341,7 @@ static GThread *rotary_encoder_thread_id; static uint64_t epochMilli; +#ifdef GPIO static void initialiseEpoch() { struct timespec ts ; @@ -355,6 +356,7 @@ unsigned int millis () { now = (uint64_t)ts.tv_sec * (uint64_t)1000 + (uint64_t)(ts.tv_nsec / 1000000L) ; return (uint32_t)(now - epochMilli) ; } +#endif static gpointer rotary_encoder_thread(gpointer data) { int i; diff --git a/gpio.h b/gpio.h index 00bf52a..e6e926d 100644 --- a/gpio.h +++ b/gpio.h @@ -79,7 +79,9 @@ extern void gpio_save_state(void); extern void gpio_save_actions(void); extern int gpio_init(void); extern void gpio_close(void); +#ifdef GPIO extern unsigned int millis(void); // to allow debouncing in i2c.c +#endif #ifdef LOCALCW extern int CWL_BUTTON; -- 2.45.2