Norbert S / Mbed 2 deprecated joykey

Dependencies:   mbed

Committer:
norberts
Date:
Sun Aug 28 14:37:47 2011 +0000
Revision:
0:207850946233
Child:
2:1a24252c8cb1
initial, sends ijkm<sp> on atari joystick movements

Who changed what in which revision?

UserRevisionLine numberNew contents of line
norberts 0:207850946233 1 /* usbhid.h */
norberts 0:207850946233 2 /* USB HID class device */
norberts 0:207850946233 3 /* Copyright (c) Phil Wright 2008 */
norberts 0:207850946233 4
norberts 0:207850946233 5 /* modified by Shinichiro Oba <http://mbed.org/users/bricklife/> */
norberts 0:207850946233 6
norberts 0:207850946233 7 #ifndef USBHID_H
norberts 0:207850946233 8 #define USBHID_H
norberts 0:207850946233 9
norberts 0:207850946233 10 #include "usbdevice.h"
norberts 0:207850946233 11
norberts 0:207850946233 12 /* Mouse buttons */
norberts 0:207850946233 13 #define MOUSE_L (1<<0)
norberts 0:207850946233 14 #define MOUSE_M (1<<1)
norberts 0:207850946233 15 #define MOUSE_R (1<<2)
norberts 0:207850946233 16
norberts 0:207850946233 17 class usbhid : public usbdevice
norberts 0:207850946233 18 {
norberts 0:207850946233 19 public:
norberts 0:207850946233 20 usbhid();
norberts 0:207850946233 21 bool keyboard(char c);
norberts 0:207850946233 22 bool keyboard(char *string);
norberts 0:207850946233 23 bool mouse(signed char x, signed char y, unsigned char buttons=0, signed char wheel=0);
norberts 0:207850946233 24 protected:
norberts 0:207850946233 25 virtual bool requestSetConfiguration();
norberts 0:207850946233 26 virtual void endpointEventEP1In(void);
norberts 0:207850946233 27 virtual void deviceEventReset(void);
norberts 0:207850946233 28 virtual bool requestGetDescriptor(void);
norberts 0:207850946233 29 virtual bool requestSetup(void);
norberts 0:207850946233 30 private:
norberts 0:207850946233 31 bool sendInputReport(unsigned char id, unsigned char *data, unsigned char size);
norberts 0:207850946233 32 };
norberts 0:207850946233 33
norberts 0:207850946233 34
norberts 0:207850946233 35 //
norberts 0:207850946233 36 // USBJoystick
norberts 0:207850946233 37 //
norberts 0:207850946233 38
norberts 0:207850946233 39 #define JOYSTICK_UP (1<<0)
norberts 0:207850946233 40 #define JOYSTICK_DOWN (1<<1)
norberts 0:207850946233 41 #define JOYSTICK_LEFT (1<<2)
norberts 0:207850946233 42 #define JOYSTICK_RIGHT (1<<3)
norberts 0:207850946233 43
norberts 0:207850946233 44 class USBJoystick : public usbhid
norberts 0:207850946233 45 {
norberts 0:207850946233 46 public:
norberts 0:207850946233 47 USBJoystick();
norberts 0:207850946233 48 bool joystick(unsigned char stick, unsigned short buttons=0, signed char x=0, signed char y=0, signed char z=0, signed char rz=0);
norberts 0:207850946233 49 protected:
norberts 0:207850946233 50 virtual bool requestGetDescriptor(void);
norberts 0:207850946233 51 private:
norberts 0:207850946233 52 bool sendInputReport(unsigned char *data, unsigned char size);
norberts 0:207850946233 53 };
norberts 0:207850946233 54
norberts 0:207850946233 55 #endif