summaryrefslogtreecommitdiff
path: root/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h')
m---------tmk_core/protocol/usb_hid/USB_Host_Shield_2.00
-rw-r--r--tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h42
2 files changed, 42 insertions, 0 deletions
diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0 b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0
deleted file mode 160000
-Subproject 7c2e6c1bcdcc22cfdbd82edd9d8fc4c4276ead4
diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h
new file mode 100644
index 0000000000..2400364e65
--- /dev/null
+++ b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h
@@ -0,0 +1,42 @@
+#if !defined(__HIDJOYSTICKRPTPARSER_H__)
+#define __HIDJOYSTICKRPTPARSER_H__
+
+#include <hid.h>
+
+struct GamePadEventData
+{
+ union { //axes and hut switch
+ uint32_t axes;
+ struct {
+ uint32_t x : 10;
+ uint32_t y : 10;
+ uint32_t hat : 4;
+ uint32_t twist : 8;
+ };
+ };
+ uint8_t buttons_a;
+ uint8_t slider;
+ uint8_t buttons_b;
+};
+
+class JoystickEvents
+{
+public:
+ virtual void OnGamePadChanged(const GamePadEventData *evt);
+};
+
+#define RPT_GAMEPAD_LEN sizeof(GamePadEventData)/sizeof(uint8_t)
+
+class JoystickReportParser : public HIDReportParser
+{
+ JoystickEvents *joyEvents;
+
+ uint8_t oldPad[RPT_GAMEPAD_LEN];
+
+public:
+ JoystickReportParser(JoystickEvents *evt);
+
+ virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
+};
+
+#endif // __HIDJOYSTICKRPTPARSER_H__