Browse Source

Changes to be compatible with USB lib 1.3.0

Thomas Buck 7 years ago
parent
commit
98b36403b7
No account linked to committer's email address
6 changed files with 10 additions and 8 deletions
  1. 2
    0
      README.md
  2. 1
    1
      Saitek-X52-PPM.ino
  3. 1
    1
      parser.cpp
  4. 2
    2
      parser.h
  5. 1
    1
      x52.cpp
  6. 3
    3
      x52.h

+ 2
- 0
README.md View File

2
 
2
 
3
 This sketch allows connecting a [Saitek X52](http://www.saitek.com/uk/prod/x52.html) or [Saitek X52 Pro](http://www.saitek.com/uk/prod/x52pro.html) to an [Arduino](https://www.arduino.cc/en/Main/ArduinoBoardUno) with a [USB Host Shield](https://www.arduino.cc/en/Main/ArduinoUSBHostShield). It uses the [USB_Host_Shield_2.0 Library](https://github.com/felis/USB_Host_Shield_2.0).
3
 This sketch allows connecting a [Saitek X52](http://www.saitek.com/uk/prod/x52.html) or [Saitek X52 Pro](http://www.saitek.com/uk/prod/x52pro.html) to an [Arduino](https://www.arduino.cc/en/Main/ArduinoBoardUno) with a [USB Host Shield](https://www.arduino.cc/en/Main/ArduinoUSBHostShield). It uses the [USB_Host_Shield_2.0 Library](https://github.com/felis/USB_Host_Shield_2.0).
4
 
4
 
5
+**!!Warning!!:** This software has been written for the USB Host Shield library 2.0, Version 1.2.1. There have been some changes with the library for version 1.3.0 renaming symbols used by this project. I've made the required changes, but these are _untested_! If you have any problems, I'd suggest using an older version of the library and the code in this repository.
6
+
5
 [![Multicopter flight with Saitek X52](http://img.youtube.com/vi/De_Ld6MerNo/0.jpg)](http://www.youtube.com/watch?v=De_Ld6MerNo "Multicopter flight with Saitek X52")
7
 [![Multicopter flight with Saitek X52](http://img.youtube.com/vi/De_Ld6MerNo/0.jpg)](http://www.youtube.com/watch?v=De_Ld6MerNo "Multicopter flight with Saitek X52")
6
 
8
 
7
 A CPPM signal is generated on a configurable pin and can be fed into a transmitter module or directly into a flight controller.
9
 A CPPM signal is generated on a configurable pin and can be fed into a transmitter module or directly into a flight controller.

+ 1
- 1
Saitek-X52-PPM.ino View File

10
  * published by the Free Software Foundation, version 2.
10
  * published by the Free Software Foundation, version 2.
11
  */
11
  */
12
 
12
 
13
-#include <hid.h>
13
+#include <usbhid.h>
14
 #include <hiduniversal.h>
14
 #include <hiduniversal.h>
15
 #include <usbhub.h>
15
 #include <usbhub.h>
16
 #include <avr/wdt.h>
16
 #include <avr/wdt.h>

+ 1
- 1
parser.cpp View File

22
     }
22
     }
23
 }
23
 }
24
 
24
 
25
-void JoystickReportParser::Parse(HID* hid, bool is_rpt_id, uint8_t len, uint8_t* bufPart) {
25
+void JoystickReportParser::Parse(USBHID* hid, bool is_rpt_id, uint8_t len, uint8_t* bufPart) {
26
     // Ugly hack for too small packet size in USB Host library...
26
     // Ugly hack for too small packet size in USB Host library...
27
     if (len == 8) {
27
     if (len == 8) {
28
         // First part of buffer, store and do nothing
28
         // First part of buffer, store and do nothing

+ 2
- 2
parser.h View File

13
 #ifndef __PARSER_H__
13
 #ifndef __PARSER_H__
14
 #define __PARSER_H__
14
 #define __PARSER_H__
15
 
15
 
16
-#include <hid.h>
16
+#include <usbhid.h>
17
 #include "data.h"
17
 #include "data.h"
18
 
18
 
19
 #define RPT_GEMEPAD_LEN 8
19
 #define RPT_GEMEPAD_LEN 8
24
 class JoystickReportParser : public HIDReportParser {
24
 class JoystickReportParser : public HIDReportParser {
25
   public:
25
   public:
26
     JoystickReportParser(JoystickEvents* evt);
26
     JoystickReportParser(JoystickEvents* evt);
27
-    virtual void Parse(HID* hid, bool is_rpt_id, uint8_t len, uint8_t* bufPart);
27
+    virtual void Parse(USBHID* hid, bool is_rpt_id, uint8_t len, uint8_t* bufPart);
28
 
28
 
29
   private:
29
   private:
30
     uint8_t buf[BUFFER_SIZE];
30
     uint8_t buf[BUFFER_SIZE];

+ 1
- 1
x52.cpp View File

16
 
16
 
17
 #define TIME_24H_FORMAT
17
 #define TIME_24H_FORMAT
18
 
18
 
19
-X52::X52(USB* u, HID* h) : usb(u), hid(h), ready(0) { }
19
+X52::X52(USB* u, USBHID* h) : usb(u), hid(h), ready(0) { }
20
 
20
 
21
 void X52::initialize() {
21
 void X52::initialize() {
22
     ready = 0;
22
     ready = 0;

+ 3
- 3
x52.h View File

13
 #ifndef __X52_H__
13
 #ifndef __X52_H__
14
 #define __X52_H__
14
 #define __X52_H__
15
 
15
 
16
-#include <hid.h>
16
+#include <usbhid.h>
17
 
17
 
18
 #define X52_VENDOR_REQUEST 0x91
18
 #define X52_VENDOR_REQUEST 0x91
19
 #define X52_MFD_BRIGHTNESS 0xB1
19
 #define X52_MFD_BRIGHTNESS 0xB1
37
 
37
 
38
 class X52 {
38
 class X52 {
39
   public:
39
   public:
40
-    X52(USB* u, HID* h);
40
+    X52(USB* u, USBHID* h);
41
 
41
 
42
     /*
42
     /*
43
      * Check if a valid PID/VID device has been found.
43
      * Check if a valid PID/VID device has been found.
84
     uint8_t sendCommand(uint16_t command, uint16_t val);
84
     uint8_t sendCommand(uint16_t command, uint16_t val);
85
     
85
     
86
     USB* usb;
86
     USB* usb;
87
-    HID* hid;
87
+    USBHID* hid;
88
     uint8_t ready;
88
     uint8_t ready;
89
 };
89
 };
90
 
90
 

Loading…
Cancel
Save