1 #include "le3dp_rptparser.h"
3 JoystickReportParser::JoystickReportParser(JoystickEvents *evt) :
7 void JoystickReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
11 // Checking if there are changes in report since the method was last called
12 for (uint8_t i=0; i<RPT_GAMEPAD_LEN; i++) {
13 if( buf[i] != oldPad[i] ) {
18 // Calling Game Pad event handler
19 if (!match && joyEvents) {
20 joyEvents->OnGamePadChanged((const GamePadEventData*)buf);
22 for (uint8_t i=0; i<RPT_GAMEPAD_LEN; i++) oldPad[i] = buf[i];
26 void JoystickEvents::OnGamePadChanged(const GamePadEventData *evt)
29 PrintHex<uint16_t>(evt->x, 0x80);
31 PrintHex<uint16_t>(evt->y, 0x80);
32 Serial.print(" Hat Switch: ");
33 PrintHex<uint8_t>(evt->hat, 0x80);
34 Serial.print(" Twist: ");
35 PrintHex<uint8_t>(evt->twist, 0x80);
36 Serial.print(" Slider: ");
37 PrintHex<uint8_t>(evt->slider, 0x80);
38 Serial.print(" Buttons A: ");
39 PrintHex<uint8_t>(evt->buttons_a, 0x80);
40 Serial.print(" Buttons B: ");
41 PrintHex<uint8_t>(evt->buttons_b, 0x80);