Initial for Condor Simulator

Dependents:   USBJoystick_2 USBJoystick_NEW

Fork of USBJoystick by Wim Huiskamp

Revision:
2:265e03bf82af
Parent:
1:92574cf6e9af
Child:
3:550cca870c98
--- a/USBJoystick.h	Sun Jul 22 10:34:23 2018 +0000
+++ b/USBJoystick.h	Sat Sep 15 07:46:30 2018 +0000
@@ -30,10 +30,15 @@
 
 #define REPORT_ID_JOYSTICK  4
 
-//Configure Joystick
-#define HAT4      1
+//Configure Joystick Slider Resolution
+#define SBYTE      1                // 1 Byte, 8 Bit Resolution
+#define SWORD      0                // 2 Byte, 16 Bit Resolution
+//Configure Joystick Hat Buttons
+#define HAT4      1                 // 4 Hat Buttons; 4 Positions if HAT4_8 = 0
+#define HAT4_8    0                 // 4 Hat Buttons giving 8 Positions if 1; DO NOT USE WITH HAT8!
 #define HAT8      0
 
+//Configure Joystick Buttons
 #define BUTTONS4  0
 #define BUTTONS8  0
 #define BUTTONS32 1
@@ -47,7 +52,7 @@
     JOY_B3 = 8,
 };
 
-#if (HAT4 == 1)
+#if (HAT4 == 1 && HAT4_8 == 0)
 enum JOY_HAT {
     JOY_HAT_UP      = 0,
     JOY_HAT_RIGHT   = 1,
@@ -56,16 +61,16 @@
     JOY_HAT_NEUTRAL = 4,
 };
 #endif
-#if (HAT8 == 1)
+#if (HAT8 == 1 || (HAT4 == 1 && HAT4_8 == 1))
 enum JOY_HAT {
     JOY_HAT_UP         = 0,
     JOY_HAT_UP_RIGHT   = 1,
     JOY_HAT_RIGHT      = 2,
-    JOY_HAT_RIGHT_DOWN = 3,
+    JOY_HAT_DOWN_RIGHT = 3,
     JOY_HAT_DOWN       = 4,
     JOY_HAT_DOWN_LEFT  = 5,
     JOY_HAT_LEFT       = 6,
-    JOY_HAT_LEFT_UP    = 7,
+    JOY_HAT_UP_LEFT    = 7,
     JOY_HAT_NEUTRAL    = 8,
 };
 #endif
@@ -147,7 +152,7 @@
       *   Constructor
       *
       * @param vendor_id Your vendor_id (default: 0x1234)
-      * @param product_id Your product_id (default: 0x0002)
+      * @param product_id Your product_id (default: 0x0604)
       * @param product_release Your product_release (default: 0x0001)
       */
 //     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
@@ -244,12 +249,12 @@
     virtual uint8_t * reportDesc();
 
 private:
-    int8_t _t;
-    int8_t _r;
-    int8_t _d;
-    int8_t _w;
-    int8_t _x;
-    int8_t _y;
+    int16_t _t;
+    int16_t _r;
+    int16_t _d;
+    int16_t _w;
+    int16_t _x;
+    int16_t _y;
     uint32_t _buttons;
     uint8_t _hat;