Krolyxon
Commit bad888f

Branches

Tags

Refs →

orion-rfsrcutilsbuttons.cpp

19 lines · 612 B · C++

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