USB_Host_Shield_2.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
le3dp_rptparser.h
Go to the documentation of this file.
1 #if !defined(__HIDJOYSTICKRPTPARSER_H__)
2 #define __HIDJOYSTICKRPTPARSER_H__
3 
4 #include <inttypes.h>
5 #include <avr/pgmspace.h>
6 #include "avrpins.h"
7 #include "max3421e.h"
8 #include "usbhost.h"
9 #include "usb_ch9.h"
10 #include "Usb.h"
11 
12 #if defined(ARDUINO) && ARDUINO >=100
13 #include "Arduino.h"
14 #else
15 #include <WProgram.h>
16 #endif
17 
18 #include "printhex.h"
19 #include "hexdump.h"
20 #include "message.h"
21 #include "confdescparser.h"
22 #include "hid.h"
23 
25 {
26  union { //axes and hut switch
27  uint32_t axes;
28  struct {
29  uint32_t x : 10;
30  uint32_t y : 10;
31  uint32_t hat : 4;
32  uint32_t twist : 8;
33  };
34  };
35  uint8_t buttons_a;
36  uint8_t slider;
37  uint8_t buttons_b;
38 };
39 
41 {
42 public:
43  virtual void OnGamePadChanged(const GamePadEventData *evt);
44 };
45 
46 #define RPT_GAMEPAD_LEN sizeof(GamePadEventData)/sizeof(uint8_t)
47 
49 {
50  JoystickEvents *joyEvents;
51 
52  uint8_t oldPad[RPT_GAMEPAD_LEN];
53 
54 public:
56 
57  virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
58 };
59 
60 #endif // __HIDJOYSTICKRPTPARSER_H__