MARIOS SATANAS / Mbed 2 deprecated USBJoystick_mod

Dependencies:   USBDevice mbed

Files at this revision

API Documentation at this revision

Comitter:
eimaiosatanas
Date:
Mon Apr 20 14:58:21 2015 +0000
Parent:
1:6b3335ac3862
Commit message:
Support for FRDM-KL25Z; ; This board has better usb functionality, no it works on a PS3 too! (..minus the "PS" button...)

Changed in this revision

USBJoystick.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/USBJoystick.cpp	Mon Dec 08 09:13:59 2014 +0000
+++ b/USBJoystick.cpp	Mon Apr 20 14:58:21 2015 +0000
@@ -104,24 +104,26 @@
              LOGICAL_MINIMUM(1), 0x00,      // Logical_Minimum (0)             
              USAGE(1), 0x04,                // Usage (Joystick)
              COLLECTION(1), 0x01,           // Application
-               USAGE_PAGE(1), 0x02,            // Simulation Controls
-               USAGE(1), 0xBB,                 // Throttle             
-               USAGE(1), 0xBA,                 // Rudder               
-               LOGICAL_MINIMUM(1), 0x81,       // -127
-               LOGICAL_MAXIMUM(1), 0x7f,       // 127
-               REPORT_SIZE(1), 0x08,
-               REPORT_COUNT(1), 0x02,
-               INPUT(1), 0x02,                 // Data, Variable, Absolute               
+             //  USAGE_PAGE(1), 0x02,            // Simulation Controls
+             //  USAGE(1), 0xBB,                 // Throttle             
+             //  USAGE(1), 0xBA,                 // Rudder               
+             //  LOGICAL_MINIMUM(1), 0x81,       // -127
+             //  LOGICAL_MAXIMUM(1), 0x7f,       // 127
+             //  REPORT_SIZE(1), 0x08,
+             //  REPORT_COUNT(1), 0x02,
+             //  INPUT(1), 0x02,                 // Data, Variable, Absolute               
                USAGE_PAGE(1), 0x01,            // Generic Desktop
                USAGE(1), 0x01,                 // Usage (Pointer)
                COLLECTION(1), 0x00,            // Physical
                  USAGE(1), 0x30,                 // X
                  USAGE(1), 0x31,                 // Y
+                 USAGE(1), 0x32,                 //R
+                 USAGE(1), 0x35,                 //Rz?
 //  8 bit values
                  LOGICAL_MINIMUM(1), 0x81,       // -127
                  LOGICAL_MAXIMUM(1), 0x7f,       // 127
                  REPORT_SIZE(1), 0x08,
-                 REPORT_COUNT(1), 0x02,
+                 REPORT_COUNT(1), 0x04,
                  INPUT(1), 0x02,                 // Data, Variable, Absolute                  
 // 16 bit values
 //                 LOGICAL_MINIMUM(1), 0x00,       // 0
--- a/main.cpp	Mon Dec 08 09:13:59 2014 +0000
+++ b/main.cpp	Mon Apr 20 14:58:21 2015 +0000
@@ -16,9 +16,18 @@
 #define RIGHT 0x02
 #define DOWN 0x04
 #define LEFT 0x08
+#ifdef TARGET_STM32F4
 BusIn hatin(PC_0, PC_1, PB_0, PA_4);
 BusIn buttonin(PH_0, PA_15, PB_7, PH_1, PC_3, PC_2, PC_15, PC_14, PA_13, PA_14);
 DigitalIn psbutton(PC_12);
+#endif
+#ifdef TARGET_KL25Z
+BusIn hatin(PTC1, PTC2, PTB3, PTB2);
+BusIn buttonin(PTE30, PTE29, PTE23, PTE22, PTE21, PTE20, PTE5, PTE4, PTE3, PTE2);
+DigitalIn psbutton(PTB8);
+DigitalOut extraGround(PTD3);
+#endif
+
 //Ticker heartbeat;
 
 // Heartbeat monitor
@@ -40,6 +49,9 @@
     hatin.mode(PullUp);
     buttonin.mode(PullUp);
     psbutton.mode(PullUp);
+    #ifdef TARGET_KL25Z
+    extraGround.write(0);
+    #endif
     heartbeatLED = 0;
     #define UPDATEINTERVAL 0.002
     int i = 0;