diff options
| author | krolyxon <me@krolyxon.com> | 2026-06-20 00:24:34 +0530 |
|---|---|---|
| committer | krolyxon <me@krolyxon.com> | 2026-06-20 00:24:34 +0530 |
| commit | 7e4cfad53699fabbecb6696508e5addcffc1b095 (patch) | |
| tree | ebff581b0989df578c312247e1dad514c956572b /src-arduino/utils/buttons.cpp | |
| parent | 1f800b74329d4f8b1511b4cf2a0d031439e1038d (diff) | |
restructure to use rust source tree primarily
Diffstat (limited to 'src-arduino/utils/buttons.cpp')
| -rw-r--r-- | src-arduino/utils/buttons.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src-arduino/utils/buttons.cpp b/src-arduino/utils/buttons.cpp new file mode 100644 index 0000000..166ee41 --- /dev/null +++ b/src-arduino/utils/buttons.cpp @@ -0,0 +1,19 @@ +#include "buttons.h" +#include "config.h" +#include <Arduino.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); } |
