Joystick enabled version of USBHID -library. Has full Playstation 3 functionality including button pressures and a working home-button implementation, while maintaining full PC/MAC/linux -compatibility. basic operation of the lib: #include "mbed.h" #include "usbhid.h" USBJoystick joystick; int main() { while(1) { char dpad = 0xf; /*only the rightmost 4 bits matter*/ short button = 0xff; /*only the rightmost 13 bits matter*/ /*buttons are square, cross, circle, triangle, l1, r1, l2, r2, l3, r3, home.*/ char stick1x = 0; char stick1y = 0; char stick2x = 0; char stick2y = 0; joystick.joystick(dpad, buttons, stick1x, stick1y, stick2x, stick2y); wait_ms(5); } }

Revision:
0:237d5ef643e9
diff -r 000000000000 -r 237d5ef643e9 USBMouse.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBMouse.cpp	Fri May 11 13:35:59 2012 +0000
@@ -0,0 +1,51 @@
+#include "USBMouse.h"
+
+USBMouse::USBMouse() {
+    _buttons = 0;
+}
+
+void USBMouse::move(int x, int y) {
+    while(x > 127) {
+        mouse(127, 0, _buttons, 0);
+        x = x - 127;
+    }
+    while(x < -128) {
+        mouse(-128, 0, _buttons, 0);
+        x = x + 128;
+    }
+    while(y > 127) {
+        mouse(0, 127, _buttons, 0);
+        y = y - 127;
+    }
+    while(y < -128) {
+        mouse(0, -128, _buttons, 0);
+        y = y + 128;
+    }
+    mouse(x, y, _buttons, 0);
+}
+
+void USBMouse::scroll(int z) {
+    while(z > 127) {
+        mouse(0, 0, _buttons, 127);
+        z = z - 127;
+    }
+    while(z < -128) {
+        mouse(0, 0, _buttons, -128);
+        z = z + 128;
+    }
+    mouse(0, 0, _buttons, z);
+}
+
+void USBMouse::buttons(int left, int middle, int right) {
+    int _buttons = 0;
+    if(left) {
+        _buttons |= MOUSE_L;
+    }
+    if(middle) {
+        _buttons |= MOUSE_M;
+    }
+    if(right) {
+        _buttons |= MOUSE_R;
+    }
+    mouse(0,0, _buttons, 0);    
+}