summaryrefslogtreecommitdiff
path: root/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp')
-rw-r--r--tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp.ino42
-rw-r--r--tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.cpp43
-rw-r--r--tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h42
3 files changed, 0 insertions, 127 deletions
diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp.ino b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp.ino
deleted file mode 100644
index 837d7f5a70..0000000000
--- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp.ino
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Simplified Logitech Extreme 3D Pro Joystick Report Parser */
-
-#include <hid.h>
-#include <hiduniversal.h>
-#include <usbhub.h>
-
-#include "le3dp_rptparser.h"
-
-// Satisfy the IDE, which needs to see the include statment in the ino too.
-#ifdef dobogusinclude
-#include <spi4teensy3.h>
-#include <SPI.h>
-#endif
-
-USB Usb;
-USBHub Hub(&Usb);
-HIDUniversal Hid(&Usb);
-JoystickEvents JoyEvents;
-JoystickReportParser Joy(&JoyEvents);
-
-void setup()
-{
- Serial.begin( 115200 );
-#if !defined(__MIPSEL__)
- while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
-#endif
- Serial.println("Start");
-
- if (Usb.Init() == -1)
- Serial.println("OSC did not start.");
-
- delay( 200 );
-
- if (!Hid.SetReportParser(0, &Joy))
- ErrorMessage<uint8_t>(PSTR("SetReportParser"), 1 );
-}
-
-void loop()
-{
- Usb.Task();
-}
-
diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.cpp b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.cpp
deleted file mode 100644
index baece13b2c..0000000000
--- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "le3dp_rptparser.h"
-
-JoystickReportParser::JoystickReportParser(JoystickEvents *evt) :
- joyEvents(evt)
-{}
-
-void JoystickReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
-{
- bool match = true;
-
- // Checking if there are changes in report since the method was last called
- for (uint8_t i=0; i<RPT_GAMEPAD_LEN; i++) {
- if( buf[i] != oldPad[i] ) {
- match = false;
- break;
- }
- }
- // Calling Game Pad event handler
- if (!match && joyEvents) {
- joyEvents->OnGamePadChanged((const GamePadEventData*)buf);
-
- for (uint8_t i=0; i<RPT_GAMEPAD_LEN; i++) oldPad[i] = buf[i];
- }
-}
-
-void JoystickEvents::OnGamePadChanged(const GamePadEventData *evt)
-{
- Serial.print("X: ");
- PrintHex<uint16_t>(evt->x, 0x80);
- Serial.print(" Y: ");
- PrintHex<uint16_t>(evt->y, 0x80);
- Serial.print(" Hat Switch: ");
- PrintHex<uint8_t>(evt->hat, 0x80);
- Serial.print(" Twist: ");
- PrintHex<uint8_t>(evt->twist, 0x80);
- Serial.print(" Slider: ");
- PrintHex<uint8_t>(evt->slider, 0x80);
- Serial.print(" Buttons A: ");
- PrintHex<uint8_t>(evt->buttons_a, 0x80);
- Serial.print(" Buttons B: ");
- PrintHex<uint8_t>(evt->buttons_b, 0x80);
- Serial.println("");
-}
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
deleted file mode 100644
index 2400364e65..0000000000
--- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#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__