59 bool click = buttonClickState.
val & mask;
60 buttonClickState.
val &= ~mask;
80 for (uint8_t i = 0; i < len; i++) {
81 D_PrintHex<uint8_t > (buf[i], 0x80);
87 memcpy(&ps4Data, buf + 1, min((uint8_t)(len - 1),
MFK_CASTUINT8T sizeof(ps4Data)));
88 else if (buf[0] == 0x11) {
91 Notify(
PSTR(
"\r\nReport is too short: "), 0x80);
92 D_PrintHex<uint8_t > (len, 0x80);
96 memcpy(&ps4Data, buf + 3, min((uint8_t)(len - 3),
MFK_CASTUINT8T sizeof(ps4Data)));
100 D_PrintHex<uint8_t > (buf[0], 0x80);
105 if (ps4Data.
btn.
val != oldButtonState.
val) {
106 buttonClickState.
val = ps4Data.
btn.
val & ~oldButtonState.
val;
113 if (checkDpad(
RIGHT))
114 newDpad |= 1 <<
RIGHT;
116 newDpad |= 1 <<
DOWN;
118 newDpad |= 1 <<
LEFT;
119 if (newDpad != oldDpad) {
120 buttonClickState.
dpad = newDpad & ~oldDpad;
132 for (i = 0; i <
sizeof(ps4Data.
hatValue); i++)
135 oldButtonState.
val = 0;
136 for (i = 0; i <
sizeof(ps4Data.
trigger); i++)
138 for (i = 0; i <
sizeof(ps4Data.
xy)/
sizeof(ps4Data.
xy[0]); i++) {
139 for (uint8_t j = 0; j <
sizeof(ps4Data.
xy[0].
finger)/
sizeof(ps4Data.
xy[0].
finger[0]); j++)
145 buttonClickState.
dpad = 0;
149 ps4Output.
r = ps4Output.
g = ps4Output.
b = 0;
bool getButtonPress(ButtonEnum b)
struct touchpadXY::@28 finger[2]
#define pgm_read_byte(addr)
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)