]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h
lufa: usb-usb: Use LUFA startup instead of cusotom
[max/tmk_keyboard.git] / tmk_core / protocol / usb_hid / USB_Host_Shield_2.0 / examples / HID / le3dp / le3dp_rptparser.h
1 #if !defined(__HIDJOYSTICKRPTPARSER_H__)
2 #define __HIDJOYSTICKRPTPARSER_H__
3
4 #include <hid.h>
5
6 struct GamePadEventData
7 {
8   union { //axes and hut switch
9     uint32_t axes;
10     struct {
11       uint32_t x : 10;
12       uint32_t y : 10;
13       uint32_t hat : 4;
14       uint32_t twist : 8;      
15     };
16   };
17   uint8_t buttons_a;
18   uint8_t slider;
19   uint8_t buttons_b;
20 };
21
22 class JoystickEvents
23 {
24 public:
25         virtual void OnGamePadChanged(const GamePadEventData *evt);
26 };
27
28 #define RPT_GAMEPAD_LEN sizeof(GamePadEventData)/sizeof(uint8_t)
29
30 class JoystickReportParser : public HIDReportParser
31 {
32         JoystickEvents          *joyEvents;
33
34   uint8_t oldPad[RPT_GAMEPAD_LEN];
35
36 public:
37         JoystickReportParser(JoystickEvents *evt);
38
39         virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
40 };
41
42 #endif // __HIDJOYSTICKRPTPARSER_H__