A fully-Android-compatible two joysticks USB driver for LPC1768. The joysticks have 1 hat, 6 buttons, and there are 1P, 2P buttons.
Fork of app-board-Joystick by
Diff: usbhid.h
- Revision:
- 1:76c47d2ba442
- Child:
- 2:84ea6e2fb4b6
diff -r 0e4db18afd77 -r 76c47d2ba442 usbhid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbhid.h Fri Dec 16 18:17:42 2016 +0000 @@ -0,0 +1,36 @@ +/* usbhid.h */ +/* USB HID class device */ +/* Copyright (c) Phil Wright 2008 */ + +#ifndef USBHID_H +#define USBHID_H + +#include "usbdevice.h" + +class usbhid : public usbdevice +{ +public: + usbhid(); + +protected: + virtual void deviceEventReset(); + virtual void endpointEventEP1In(); + virtual bool requestGetDescriptor(); + virtual bool requestSetConfiguration(); +}; + +#define JOYSTICK_UP (1<<0) +#define JOYSTICK_DOWN (1<<1) +#define JOYSTICK_LEFT (1<<2) +#define JOYSTICK_RIGHT (1<<3) + +class USBJoystick : public usbhid +{ +public: + USBJoystick(); + bool update(unsigned char gamepad_id, unsigned char stick, unsigned char buttons); +protected: + virtual bool requestGetDescriptor(); +}; + +#endif /* USBHID_H */ \ No newline at end of file