-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDPad.h
More file actions
35 lines (27 loc) · 658 Bytes
/
Copy pathDPad.h
File metadata and controls
35 lines (27 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef DARKWAD_DPAD_H
#define DARKWAD_DPAD_H
#include "Control.h"
class DPad: public Control {
private:
enum States { CENTER, UP, DOWN, LEFT, RIGHT };
static const int num_pins = 4;
int _pins[num_pins];
int _state;
int _pressed;
int _count;
public:
DPad() :
Control { "DPad", CTL_DIGITAL, DEFAULT_SAMPLE_RATE }
{ };
DPad(String name, int* pins) :
Control { name, CTL_DIGITAL, DEFAULT_SAMPLE_RATE }
{
for (int i=0; i<num_pins; i++) {
pinMode(pins[i], INPUT);
_pins[i] = pins[i];
}
};
int getState();
void update();
};
#endif //DARKWAD_DPAD_H