105#define CTRL_CLK_HIGH 5
106#define CTRL_BYTE_DELAY 18
109#define PSB_SELECT 0x0001
112#define PSB_START 0x0008
113#define PSB_PAD_UP 0x0010
114#define PSB_PAD_RIGHT 0x0020
115#define PSB_PAD_DOWN 0x0040
116#define PSB_PAD_LEFT 0x0080
121#define PSB_GREEN 0x1000
122#define PSB_RED 0x2000
123#define PSB_BLUE 0x4000
124#define PSB_PINK 0x8000
125#define PSB_TRIANGLE 0x1000
126#define PSB_CIRCLE 0x2000
127#define PSB_CROSS 0x4000
128#define PSB_SQUARE 0x8000
131#define UP_STRUM 0x0010
132#define DOWN_STRUM 0x0040
133#define LEFT_STRUM 0x0080
134#define RIGHT_STRUM 0x0020
135#define STAR_POWER 0x0100
136#define GREEN_FRET 0x0200
137#define YELLOW_FRET 0x1000
138#define RED_FRET 0x2000
139#define BLUE_FRET 0x4000
140#define ORANGE_FRET 0x8000
150#define PSAB_PAD_RIGHT 9
151#define PSAB_PAD_UP 11
152#define PSAB_PAD_DOWN 12
153#define PSAB_PAD_LEFT 10
162#define PSAB_TRIANGLE 13
163#define PSAB_CIRCLE 14
165#define PSAB_SQUARE 16
167#define SET(x, y) (x |= (1 << y))
168#define CLR(x, y) (x &= (~(1 << y)))
169#define CHK(x, y) (x & (1 << y))
170#define TOG(x, y) (x ^= (1 << y))
273 byte config_gamepad(uint8_t, uint8_t, uint8_t, uint8_t,
bool,
bool);
301 inline void CLK_SET(
void);
302 inline void CLK_CLR(
void);
303 inline void CMD_SET(
void);
304 inline void CMD_CLR(
void);
305 inline void ATT_SET(
void);
306 inline void ATT_CLR(
void);
307 inline bool DAT_CHK(
void);
309 unsigned char _gamepad_shiftinout(
char);
310 unsigned char PS2data[21];
311 void sendCommandString(
byte string[],
byte len);
313 unsigned int last_buttons;
314 unsigned int buttons;
321 unsigned long last_read;
323 byte controller_type;
325 boolean en_Pressures;
Class to interface with the MJ2 or PS2 controller.
byte Analog(byte)
Reads the analog value from the specified analog stick.
byte config_gamepad(uint8_t, uint8_t, uint8_t, uint8_t)
Configures the gamepad.
boolean NewButtonState()
Checks for new button state.
boolean Button(uint16_t)
Checks if a button is currently pressed.
unsigned int ButtonDataByte()
Reads the button data byte.
bool enablePressures()
Enables pressure sensitivity on the controller.
void reconfig_gamepad()
Reconfigures the gamepad.
boolean ButtonPressed(unsigned int)
Checks if a button was just pressed.
boolean ButtonReleased(unsigned int)
Checks if a button was just released.
void read_gamepad()
Reads the gamepad state.
void enableRumble()
Enables rumble functionality on the controller.
byte readType()
Returns the controller type.