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.
main.cpp@0:f97b1f255167, 2011-09-08 (annotated)
- Committer:
- llumpu
- Date:
- Thu Sep 08 15:01:33 2011 +0000
- Revision:
- 0:f97b1f255167
Added USB String Descriptor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
llumpu | 0:f97b1f255167 | 1 | #include "mbed.h" |
llumpu | 0:f97b1f255167 | 2 | #include "USBMouse.h" |
llumpu | 0:f97b1f255167 | 3 | #include "USBKeyboard.h" |
llumpu | 0:f97b1f255167 | 4 | |
llumpu | 0:f97b1f255167 | 5 | DigitalOut led(LED1); |
llumpu | 0:f97b1f255167 | 6 | USBMouse mouse; |
llumpu | 0:f97b1f255167 | 7 | USBKeyboard keyboard; |
llumpu | 0:f97b1f255167 | 8 | |
llumpu | 0:f97b1f255167 | 9 | int main() { |
llumpu | 0:f97b1f255167 | 10 | while(1) { |
llumpu | 0:f97b1f255167 | 11 | mouse.move(18, 10); //moves the mouse down and to the left |
llumpu | 0:f97b1f255167 | 12 | keyboard.sendKeys("mbed"); //sends the word "foo" through the keyboard |
llumpu | 0:f97b1f255167 | 13 | |
llumpu | 0:f97b1f255167 | 14 | led = !led; //cycles the LED on/off |
llumpu | 0:f97b1f255167 | 15 | wait(2); //waits 2 seconds, then repeats |
llumpu | 0:f97b1f255167 | 16 | } |
llumpu | 0:f97b1f255167 | 17 | } |