70 } __attribute__((packed));
72 } __attribute__((packed));
81 } __attribute__((packed))
finger[2];
82 } __attribute__((packed));
90 } __attribute__((packed));
114 } __attribute__((packed));
121 } __attribute__((packed));
184 return ps4Data.xy[xyId].finger[
finger].x;
196 return ps4Data.xy[xyId].finger[
finger].y;
208 return !(ps4Data.xy[xyId].finger[
finger].touching);
220 return ps4Data.xy[xyId].finger[
finger].counter;
230 return (atan2(ps4Data.accY, ps4Data.accZ) + PI) * RAD_TO_DEG;
232 return (atan2(ps4Data.accX, ps4Data.accZ) + PI) * RAD_TO_DEG;
243 return ps4Data.gyroX;
245 return ps4Data.gyroY;
247 return ps4Data.gyroZ;
264 return ps4Data.status.battery;
272 return ps4Data.status.usb;
280 return ps4Data.status.audio;
288 return ps4Data.status.mic;
308 setRumbleOn(0x00, 0xFF);
310 setRumbleOn(0xFF, 0x00);
319 ps4Output.bigRumble = bigRumble;
320 ps4Output.smallRumble = smallRumble;
321 ps4Output.reportChanged =
true;
333 void setLed(uint8_t r, uint8_t g, uint8_t b) {
337 ps4Output.reportChanged =
true;
345 setLed((uint8_t)(color >> 16), (uint8_t)(color >> 8), (uint8_t)(color));
354 ps4Output.flashOn = flashOn;
355 ps4Output.flashOff = flashOff;
356 ps4Output.reportChanged =
true;
366 void Parse(uint8_t len, uint8_t *buf);
371 for (i = 0; i <
sizeof(ps4Data.hatValue); i++)
372 ps4Data.hatValue[i] = 127;
374 oldButtonState.val = 0;
375 for (i = 0; i <
sizeof(ps4Data.trigger); i++)
376 ps4Data.trigger[i] = 0;
377 for (i = 0; i <
sizeof(ps4Data.xy)/
sizeof(ps4Data.xy[0]); i++) {
378 for (uint8_t j = 0; j <
sizeof(ps4Data.xy[0].finger)/
sizeof(ps4Data.xy[0].finger[0]); j++)
379 ps4Data.xy[i].finger[j].touching = 1;
384 buttonClickState.dpad = 0;
387 ps4Output.bigRumble = ps4Output.smallRumble = 0;
388 ps4Output.r = ps4Output.g = ps4Output.b = 0;
389 ps4Output.flashOn = ps4Output.flashOff = 0;
390 ps4Output.reportChanged =
false;
397 virtual void sendOutputReport(
PS4Output *output) = 0;
uint8_t getBatteryLevel()
uint16_t getY(uint8_t finger=0, uint8_t xyId=0)
double getAngle(AngleEnum a)
void setLed(uint8_t r, uint8_t g, uint8_t b)
void setLed(ColorsEnum color)
void setRumbleOn(uint8_t bigRumble, uint8_t smallRumble)
int16_t getSensor(SensorEnum s)
void setRumbleOn(RumbleEnum mode)
bool isTouching(uint8_t finger=0, uint8_t xyId=0)
struct touchpadXY::@24 finger[2]
const uint8_t PS4_BUTTONS[]
uint16_t getX(uint8_t finger=0, uint8_t xyId=0)
uint8_t getTouchCounter(uint8_t finger=0, uint8_t xyId=0)
void setLedFlash(uint8_t flashOn, uint8_t flashOff)