summaryrefslogtreecommitdiff
path: root/src/utils/buttons.cpp
diff options
context:
space:
mode:
authorkrolyxon <me@krolyxon.com>2026-05-11 15:00:40 +0530
committerkrolyxon <me@krolyxon.com>2026-05-11 15:00:40 +0530
commit75eea47140e22f86fb23631e4fb436d8a09c8695 (patch)
treeb1ffd59ac1910c6bf2fade7241fb98af63dedc30 /src/utils/buttons.cpp
parent278646bad87f9c85090a6b5921c360c1c86493b5 (diff)
move bluetooth, nfc, and utils into subfolders
Diffstat (limited to 'src/utils/buttons.cpp')
-rw-r--r--src/utils/buttons.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/utils/buttons.cpp b/src/utils/buttons.cpp
new file mode 100644
index 0000000..d3d1020
--- /dev/null
+++ b/src/utils/buttons.cpp
@@ -0,0 +1,20 @@
+#include "buttons.h"
+#include <Arduino.h>
+#include "../config.h"
+
+void buttonsInit()
+{
+ pinMode(BTN_UP, INPUT_PULLUP);
+ pinMode(BTN_DOWN, INPUT_PULLUP);
+ pinMode(BTN_SELECT, INPUT_PULLUP);
+ pinMode(BTN_BACK, INPUT_PULLUP);
+ pinMode(BTN_RIGHT, INPUT_PULLUP);
+ pinMode(BTN_LEFT, INPUT_PULLUP);
+}
+
+bool btnUp() { return !digitalRead(BTN_UP); }
+bool btnDown() { return !digitalRead(BTN_DOWN); }
+bool btnSelect() { return !digitalRead(BTN_SELECT); }
+bool btnBack() { return !digitalRead(BTN_BACK); }
+bool btnRight() { return !digitalRead(BTN_RIGHT); }
+bool btnLeft() { return !digitalRead(BTN_LEFT); }