46 uint32_t mask = 1UL << pgm_read_byte(&
PS4_BUTTONS[(uint8_t)b]);
47 bool click = buttonClickState.
val & mask;
48 buttonClickState.
val &= ~mask;
67 Notify(PSTR(
"\r\n"), 0x80);
68 for (uint8_t i = 0; i < len; i++) {
69 D_PrintHex<uint8_t > (buf[i], 0x80);
75 memcpy(&ps4Data, buf + 1, min(len - 1,
sizeof(ps4Data)));
76 else if (buf[0] == 0x11)
77 memcpy(&ps4Data, buf + 3, min(len - 3,
sizeof(ps4Data)));
80 Notify(PSTR(
"\r\nUnknown report id: "), 0x80);
81 D_PrintHex<uint8_t > (buf[0], 0x80);
86 if (ps4Data.
btn.
val != oldButtonState.
val) {
87 buttonClickState.
val = ps4Data.
btn.
val & ~oldButtonState.
val;
95 newDpad |= 1 <<
RIGHT;
100 if (newDpad != oldDpad) {
101 buttonClickState.
dpad = newDpad & ~oldDpad;
bool getButtonPress(ButtonEnum b)
void Parse(uint8_t len, uint8_t *buf)
const uint8_t PS4_BUTTONS[]
virtual void sendOutputReport(PS4Output *output)=0
uint8_t getAnalogButton(ButtonEnum b)
bool getButtonClick(ButtonEnum b)
uint8_t getAnalogHat(AnalogHatEnum a)