Krolyxon
Commit 0b8b30d

Branches

Tags

Refs →

orion-rfsrcutilsbuttons.cpp

20 lines · 615 B · C++

1#include "buttons.h"
2#include <Arduino.h>
3#include "../config.h"
4
5void 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
15bool btnUp() { return !digitalRead(BTN_UP); }
16bool btnDown() { return !digitalRead(BTN_DOWN); }
17bool btnSelect() { return !digitalRead(BTN_SELECT); }
18bool btnBack() { return !digitalRead(BTN_BACK); }
19bool btnRight() { return !digitalRead(BTN_RIGHT); }
20bool btnLeft() { return !digitalRead(BTN_LEFT); }