| 1 | #include "buttons.h" |
| 2 | #include <Arduino.h> |
| 3 | #include "config.h" |
| 4 | |
| 5 | void buttonsInit() |
| 6 | { |
| 7 | pinMode(BTN_UP, INPUT_PULLUP); |
| 8 | pinMode(BTN_DOWN, INPUT_PULLUP); |
| 9 | pinMode(BTN_SELECT, INPUT_PULLUP); |
| 10 | pinMode(BTN_BACK, INPUT_PULLUP); |
| 11 | pinMode(BTN_RIGHT, INPUT_PULLUP); |
| 12 | pinMode(BTN_LEFT, INPUT_PULLUP); |
| 13 | } |
| 14 | |
| 15 | bool btnUp() { return !digitalRead(BTN_UP); } |
| 16 | bool btnDown() { return !digitalRead(BTN_DOWN); } |
| 17 | bool btnSelect() { return !digitalRead(BTN_SELECT); } |
| 18 | bool btnBack() { return !digitalRead(BTN_BACK); } |
| 19 | bool btnRight() { return !digitalRead(BTN_RIGHT); } |
| 20 | bool btnLeft() { return !digitalRead(BTN_LEFT); } |