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.
USBKeyboard.h
00001 #include "usbhid.h" 00002 00003 #ifndef MBED_USBKEYBOARD_H 00004 #define MBED_USBKEYBOARD_H 00005 00006 /* Class: USBKeyboard 00007 * Emulate a USB Keyboard HID device 00008 * 00009 * Example: 00010 * > #include "mbed.h" 00011 * > #include "USBKeyboard.h" 00012 * > 00013 * > USBKeyboard kb; 00014 * > 00015 * > int main() { 00016 * > while(1) { 00017 * > kb.sendKeys("Foo goes here!"); 00018 * > wait(2); 00019 * > } 00020 * > } 00021 */ 00022 class USBKeyboard : private usbhid { 00023 public: 00024 /* Constructor: USBKeyboard 00025 * Create a USB Keyboard using the mbed USB Device interface 00026 */ 00027 USBKeyboard(); 00028 00029 void sendKeys(char *szString); 00030 void sendKey(char c); 00031 00032 00033 private: 00034 00035 }; 00036 00037 #endif
Generated on Fri Jul 15 2022 16:43:53 by 1.7.2