51 0, 0, 0, 0, 0, 0, 0, 0,
57 return ps4Buttons.
dpad == b;
61 uint8_t button = pgm_read_byte(&
PS4_BUTTONS[(uint8_t)b]);
65 uint8_t index = button < 8 ? 0 : button < 16 ? 1 : 2;
66 uint8_t mask = (1 << (button - 8 * index));
67 return ps4Data.
btn.
val[index] & mask;
72 uint8_t button = pgm_read_byte(&
PS4_BUTTONS[(uint8_t)b]);
74 if (checkDpad(buttonClickState, (
DPADEnum)button)) {
80 uint8_t index = button < 8 ? 0 : button < 16 ? 1 : 2;
81 uint8_t mask = (1 << (button - 8 * index));
83 bool click = buttonClickState.
val[index] & mask;
84 buttonClickState.
val[index] &= ~mask;
98 if (len ==
sizeof(
PS4Data) && buf) {
99 memcpy(&ps4Data, buf, len);
101 for (uint8_t i = 0; i <
sizeof(ps4Data.
btn); i++) {
102 if (ps4Data.
btn.
val[i] != oldButtonState.
val[i]) {
103 buttonClickState.
val[i] = ps4Data.
btn.
val[i] & ~oldButtonState.
val[i];
104 oldButtonState.
val[i] = ps4Data.
btn.
val[i];
110 for (uint8_t i = 0; i < len; i++) {
111 D_PrintHex<uint8_t > (buf[i], 0x80);
114 Notify(PSTR(
"\r\n"), 0x80);
const uint8_t PS4_ANALOG_BUTTONS[]
virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
const uint8_t PS4_BUTTONS[]
bool getButtonPress(ButtonEnum b)
uint8_t getAnalogHat(AnalogHatEnum a)
uint8_t getAnalogButton(ButtonEnum a)
bool getButtonClick(ButtonEnum b)