USB Joystick library, modified to work as a 6 DOF joystick.

Dependents:   USBJoystick_Test

Fork of USBJoystick by Wim Huiskamp

Files at this revision

API Documentation at this revision

Comitter:
smartsystemdesign
Date:
Fri Jan 13 17:11:32 2017 +0000
Parent:
3:f8be03f31e6c
Child:
5:767e64df3776
Commit message:
Fixed the joystick axes' LOGICAL_MINIMUM to be -32768, according to the USB HID Descriptor Tool.

Changed in this revision

USBJoystick.cpp Show annotated file Show diff for this revision Revisions of this file
USBJoystick.h Show annotated file Show diff for this revision Revisions of this file
--- a/USBJoystick.cpp	Fri Jan 13 08:15:48 2017 +0000
+++ b/USBJoystick.cpp	Fri Jan 13 17:11:32 2017 +0000
@@ -148,7 +148,7 @@
                  USAGE(1), 0x33,                 // RX
                  USAGE(1), 0x34,                 // RY
                  USAGE(1), 0x35,                 // RZ
-                 LOGICAL_MINIMUM(2), 0xff, 0xff, // -32768 (using 2's complement)
+                 LOGICAL_MINIMUM(2), 0x00, 0x80, // -32768 (using 2's complement)
                  LOGICAL_MAXIMUM(2), 0xff, 0x7f, // 32767 (0x7fff, least significant byte first)
                  REPORT_SIZE(1), 0x10,  // REPORT_SIZE describes the number of bits in this element (16, in this case)
                  REPORT_COUNT(1), 0x06,
--- a/USBJoystick.h	Fri Jan 13 08:15:48 2017 +0000
+++ b/USBJoystick.h	Fri Jan 13 17:11:32 2017 +0000
@@ -92,7 +92,7 @@
      */
 //     USBJoystick(uint16_t vendor_id = 0x1234, uint16_t product_id = 0x0100, uint16_t product_release = 0x0001, int waitForConnect = true):    // 4 buttons, no padding on buttons
 //     USBJoystick(uint16_t vendor_id = 0x1234, uint16_t product_id = 0x0500, uint16_t product_release = 0x0001, int waitForConnect = true):    // 8 buttons, no padding on buttons
-     USBJoystick(uint16_t vendor_id = 0x1234, uint16_t product_id = 0x0700, uint16_t product_release = 0x0001, int waitForConnect = true):    // 32 buttons, no padding on buttons
+     USBJoystick(uint16_t vendor_id = 0x1234, uint16_t product_id = 0x0702, uint16_t product_release = 0x0001, int waitForConnect = true):    // 32 buttons, no padding on buttons
        USBHID(0, 0, vendor_id, product_id, product_release, false) {
          _init();
          connect(waitForConnect);
@@ -155,7 +155,7 @@
      int16_t _y;
      int16_t _z;
      int16_t _rx;
-     int16_t _ry;              
+     int16_t _ry;
      int16_t _rz;
      uint32_t _buttons;
      uint8_t _hat;