Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
usbhid.h
00001 /* usbhid.h */ 00002 /* USB HID class device */ 00003 /* Copyright (c) Phil Wright 2008 */ 00004 00005 /* modified by Shinichiro Oba <http://mbed.org/users/bricklife/> */ 00006 00007 #ifndef USBHID_H 00008 #define USBHID_H 00009 00010 #include "usbdevice.h" 00011 00012 /* Mouse buttons */ 00013 #define MOUSE_L (1<<0) 00014 #define MOUSE_M (1<<1) 00015 #define MOUSE_R (1<<2) 00016 00017 class usbhid : public usbdevice 00018 { 00019 public: 00020 usbhid(); 00021 bool keyboard(char c); 00022 bool keyboard(char *string); 00023 bool mouse(signed char x, signed char y, unsigned char buttons=0, signed char wheel=0); 00024 protected: 00025 virtual bool requestSetConfiguration(); 00026 virtual void endpointEventEP1In(void); 00027 virtual void deviceEventReset(void); 00028 virtual bool requestGetDescriptor(void); 00029 virtual bool requestSetup(void); 00030 private: 00031 bool sendInputReport(unsigned char id, unsigned char *data, unsigned char size); 00032 }; 00033 00034 00035 // 00036 // USBJoystick 00037 // 00038 00039 #define JOYSTICK_UP (1<<0) 00040 #define JOYSTICK_DOWN (1<<1) 00041 #define JOYSTICK_LEFT (1<<2) 00042 #define JOYSTICK_RIGHT (1<<3) 00043 00044 class USBJoystick : public usbhid 00045 { 00046 public: 00047 USBJoystick(); 00048 bool joystick(unsigned char throttle=0, unsigned char rudder=0, unsigned char x=0, unsigned char y=0, bool button1=0, bool button2 =0); 00049 protected: 00050 virtual bool requestGetDescriptor(void); 00051 private: 00052 bool sendInputReport(unsigned char *data, unsigned char size); 00053 }; 00054 00055 #endif
Generated on Tue Jul 12 2022 20:25:32 by
1.7.2