Inital commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#define NUM_KEYS 12
|
||||
|
||||
class Gamepad{
|
||||
public:
|
||||
enum Button {
|
||||
B = 0x1,
|
||||
Y = 0x2,
|
||||
Select = 0x4,
|
||||
Start = 0x8,
|
||||
Up = 0x10,
|
||||
Down = 0x20,
|
||||
Left = 0x40,
|
||||
Right = 0x80,
|
||||
A = 0x100,
|
||||
X = 0x200,
|
||||
LeftShoulder = 0x400,
|
||||
RightShoulder = 0x800
|
||||
};
|
||||
|
||||
Gamepad(uint8_t latch, uint8_t clock, uint8_t data);
|
||||
|
||||
bool isPressed(Button button);
|
||||
bool isPressedLast(Button button);
|
||||
uint16_t getState();
|
||||
uint16_t getLastState();
|
||||
|
||||
private:
|
||||
uint16_t readCon();
|
||||
|
||||
uint16_t lastState = 0;
|
||||
|
||||
uint8_t latch;
|
||||
uint8_t clock;
|
||||
uint8_t data;
|
||||
};
|
||||
Reference in New Issue
Block a user