]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/hidjoystickrptparser.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 / USBHIDJoystick / hidjoystickrptparser.h
1 #if !defined(__HIDJOYSTICKRPTPARSER_H__)
2 #define __HIDJOYSTICKRPTPARSER_H__
3
4 #include <hid.h>
5
6 struct GamePadEventData {
7         uint8_t X, Y, Z1, Z2, Rz;
8 };
9
10 class JoystickEvents {
11 public:
12         virtual void OnGamePadChanged(const GamePadEventData *evt);
13         virtual void OnHatSwitch(uint8_t hat);
14         virtual void OnButtonUp(uint8_t but_id);
15         virtual void OnButtonDn(uint8_t but_id);
16 };
17
18 #define RPT_GEMEPAD_LEN         5
19
20 class JoystickReportParser : public HIDReportParser {
21         JoystickEvents *joyEvents;
22
23         uint8_t oldPad[RPT_GEMEPAD_LEN];
24         uint8_t oldHat;
25         uint16_t oldButtons;
26
27 public:
28         JoystickReportParser(JoystickEvents *evt);
29
30         virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
31 };
32
33 #endif // __HIDJOYSTICKRPTPARSER_H__