Based on USBKeyboardMouse example. I added USB String Descriptor so mbed reports itself to host not only with VID & PID but also with name of manufacturer, product name, serial number, configuration number and interface name. These can be changed to matching Yours in USBhid.cpp file on lines 88 - 122.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers usbhid.h Source File

usbhid.h

00001 /* usbhid.h */
00002 /* USB HID class device */
00003 /* Copyright (c) Phil Wright 2008 */
00004 
00005 #ifndef USBHID_H
00006 #define USBHID_H
00007 
00008 #include "usbdevice.h"
00009 
00010 /* Mouse buttons */
00011 #define MOUSE_L (1<<0)
00012 #define MOUSE_M (1<<1)
00013 #define MOUSE_R (1<<2)
00014 
00015 class usbhid : public usbdevice
00016 {
00017 public:
00018     usbhid();
00019     bool keyboard(char c);
00020     bool keyboard(char *string);
00021     bool mouse(signed char x, signed char y, unsigned char buttons=0, signed char wheel=0);
00022 protected:
00023     virtual bool requestSetConfiguration();
00024     virtual void endpointEventEP1In(void);
00025     virtual void deviceEventReset(void);
00026     virtual bool requestGetDescriptor(void);
00027     virtual bool requestSetup(void);
00028 private:
00029     bool sendInputReport(unsigned char id, unsigned char *data, unsigned char size);
00030 };
00031 
00032 #endif