aboutsummaryrefslogtreecommitdiff
path: root/src/button.h
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2026-02-08 16:18:49 +0530
committerAkshay Nair <phenax5@gmail.com>2026-02-08 16:18:49 +0530
commit20d86bf1e3dfdfb4c0a3ea557b54f0bea0f5c214 (patch)
tree86a7a23ac0b49bb9ff6d29f6c6f5e45209d42d94 /src/button.h
parenteef689b2e209dcf84c149ee4866c2a007676dc71 (diff)
downloaddaft-watch-20d86bf1e3dfdfb4c0a3ea557b54f0bea0f5c214.tar.gz
daft-watch-20d86bf1e3dfdfb4c0a3ea557b54f0bea0f5c214.zip
Handle button state
Diffstat (limited to 'src/button.h')
-rw-r--r--src/button.h20
1 files changed, 20 insertions, 0 deletions
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 <stdbool.h>
+#include <stdint.h>
+
+#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