A fully-Android-compatible two joysticks USB driver for LPC1768. The joysticks have 1 hat, 6 buttons, and there are 1P, 2P buttons.

Dependencies:   mbed

Fork of app-board-Joystick by Chris Styles

Committer:
Alberto_Wino
Date:
Fri Dec 16 18:17:42 2016 +0000
Revision:
1:76c47d2ba442
Child:
2:84ea6e2fb4b6
Import for dual joystick support, suitable for an arcade machine.; Based on code from Phil Wright.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Alberto_Wino 1:76c47d2ba442 1 /* usbhid.h */
Alberto_Wino 1:76c47d2ba442 2 /* USB HID class device */
Alberto_Wino 1:76c47d2ba442 3 /* Copyright (c) Phil Wright 2008 */
Alberto_Wino 1:76c47d2ba442 4
Alberto_Wino 1:76c47d2ba442 5 #ifndef USBHID_H
Alberto_Wino 1:76c47d2ba442 6 #define USBHID_H
Alberto_Wino 1:76c47d2ba442 7
Alberto_Wino 1:76c47d2ba442 8 #include "usbdevice.h"
Alberto_Wino 1:76c47d2ba442 9
Alberto_Wino 1:76c47d2ba442 10 class usbhid : public usbdevice
Alberto_Wino 1:76c47d2ba442 11 {
Alberto_Wino 1:76c47d2ba442 12 public:
Alberto_Wino 1:76c47d2ba442 13 usbhid();
Alberto_Wino 1:76c47d2ba442 14
Alberto_Wino 1:76c47d2ba442 15 protected:
Alberto_Wino 1:76c47d2ba442 16 virtual void deviceEventReset();
Alberto_Wino 1:76c47d2ba442 17 virtual void endpointEventEP1In();
Alberto_Wino 1:76c47d2ba442 18 virtual bool requestGetDescriptor();
Alberto_Wino 1:76c47d2ba442 19 virtual bool requestSetConfiguration();
Alberto_Wino 1:76c47d2ba442 20 };
Alberto_Wino 1:76c47d2ba442 21
Alberto_Wino 1:76c47d2ba442 22 #define JOYSTICK_UP (1<<0)
Alberto_Wino 1:76c47d2ba442 23 #define JOYSTICK_DOWN (1<<1)
Alberto_Wino 1:76c47d2ba442 24 #define JOYSTICK_LEFT (1<<2)
Alberto_Wino 1:76c47d2ba442 25 #define JOYSTICK_RIGHT (1<<3)
Alberto_Wino 1:76c47d2ba442 26
Alberto_Wino 1:76c47d2ba442 27 class USBJoystick : public usbhid
Alberto_Wino 1:76c47d2ba442 28 {
Alberto_Wino 1:76c47d2ba442 29 public:
Alberto_Wino 1:76c47d2ba442 30 USBJoystick();
Alberto_Wino 1:76c47d2ba442 31 bool update(unsigned char gamepad_id, unsigned char stick, unsigned char buttons);
Alberto_Wino 1:76c47d2ba442 32 protected:
Alberto_Wino 1:76c47d2ba442 33 virtual bool requestGetDescriptor();
Alberto_Wino 1:76c47d2ba442 34 };
Alberto_Wino 1:76c47d2ba442 35
Alberto_Wino 1:76c47d2ba442 36 #endif /* USBHID_H */