Kaynağa Gözat

Changes to be compatible with USB lib 1.3.0

Thomas Buck 7 yıl önce
ebeveyn
işleme
98b36403b7
No account linked to committer's email address
6 değiştirilmiş dosya ile 10 ekleme ve 8 silme
  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 Dosyayı Görüntüle

@@ -2,6 +2,8 @@
2 2
 
3 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 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 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 Dosyayı Görüntüle

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

+ 1
- 1
parser.cpp Dosyayı Görüntüle

@@ -22,7 +22,7 @@ JoystickReportParser::JoystickReportParser(JoystickEvents* evt)
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 26
     // Ugly hack for too small packet size in USB Host library...
27 27
     if (len == 8) {
28 28
         // First part of buffer, store and do nothing

+ 2
- 2
parser.h Dosyayı Görüntüle

@@ -13,7 +13,7 @@
13 13
 #ifndef __PARSER_H__
14 14
 #define __PARSER_H__
15 15
 
16
-#include <hid.h>
16
+#include <usbhid.h>
17 17
 #include "data.h"
18 18
 
19 19
 #define RPT_GEMEPAD_LEN 8
@@ -24,7 +24,7 @@ class JoystickEvents;
24 24
 class JoystickReportParser : public HIDReportParser {
25 25
   public:
26 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 29
   private:
30 30
     uint8_t buf[BUFFER_SIZE];

+ 1
- 1
x52.cpp Dosyayı Görüntüle

@@ -16,7 +16,7 @@
16 16
 
17 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 21
 void X52::initialize() {
22 22
     ready = 0;

+ 3
- 3
x52.h Dosyayı Görüntüle

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

Loading…
İptal
Kaydet