Krolyxon
Commit 3fdbc97

Branches

Tags

Refs →

orion-rffirmwarebuttons.cpp

20 lines · 492 B · C++

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