]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp.ino
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.ino
1 /* Simplified Logitech Extreme 3D Pro Joystick Report Parser */
2
3 #include <hid.h>
4 #include <hiduniversal.h>
5 #include <usbhub.h>
6
7 #include "le3dp_rptparser.h"
8
9 // Satisfy the IDE, which needs to see the include statment in the ino too.
10 #ifdef dobogusinclude
11 #include <spi4teensy3.h>
12 #include <SPI.h>
13 #endif
14
15 USB                                             Usb;
16 USBHub                                          Hub(&Usb);
17 HIDUniversal                                    Hid(&Usb);
18 JoystickEvents                                  JoyEvents;
19 JoystickReportParser                            Joy(&JoyEvents);
20
21 void setup()
22 {
23   Serial.begin( 115200 );
24 #if !defined(__MIPSEL__)
25   while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
26 #endif
27   Serial.println("Start");
28
29   if (Usb.Init() == -1)
30       Serial.println("OSC did not start.");
31
32   delay( 200 );
33
34   if (!Hid.SetReportParser(0, &Joy))
35       ErrorMessage<uint8_t>(PSTR("SetReportParser"), 1  );
36 }
37
38 void loop()
39 {
40     Usb.Task();
41 }
42