From 20d86bf1e3dfdfb4c0a3ea557b54f0bea0f5c214 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 8 Feb 2026 16:18:49 +0530 Subject: Handle button state --- src/button.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/button.h (limited to 'src/button.h') diff --git a/src/button.h b/src/button.h new file mode 100644 index 0000000..bb41eb6 --- /dev/null +++ b/src/button.h @@ -0,0 +1,20 @@ +#ifndef _LOADED_BUTTON +#define _LOADED_BUTTON +#include +#include + +#define DEBOUNCE_TICK_COUNT 10 +#define LONG_PRESS_TICK_COUNT 60 +#define MAX_TICK_COUNT 80 + +enum ButtonState { + BUTTON_IDLE = 0, + BUTTON_PRESSED = 1, + BUTTON_LONG_PRESSED = 2, +}; + +uint16_t extern button_tick_count; + +void button_tick(); +enum ButtonState check_button_state(); +#endif -- cgit v1.3.1