USB Keyboard and mouse Example. Based on USBMouse
Fork of USBKeyboardMouse by
USBKeyboardMouse/USBKeyboard.h@1:9c83250ce43b, 2013-05-08 (annotated)
- Committer:
- Wabouz
- Date:
- Wed May 08 09:33:27 2013 +0000
- Revision:
- 1:9c83250ce43b
- Parent:
- 0:86603687efec
Un petit programme.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
zackc | 0:86603687efec | 1 | #include "usbhid.h" |
zackc | 0:86603687efec | 2 | |
zackc | 0:86603687efec | 3 | #ifndef MBED_USBKEYBOARD_H |
zackc | 0:86603687efec | 4 | #define MBED_USBKEYBOARD_H |
zackc | 0:86603687efec | 5 | |
zackc | 0:86603687efec | 6 | /* Class: USBKeyboard |
zackc | 0:86603687efec | 7 | * Emulate a USB Keyboard HID device |
zackc | 0:86603687efec | 8 | * |
zackc | 0:86603687efec | 9 | * Example: |
zackc | 0:86603687efec | 10 | * > #include "mbed.h" |
zackc | 0:86603687efec | 11 | * > #include "USBKeyboard.h" |
zackc | 0:86603687efec | 12 | * > |
zackc | 0:86603687efec | 13 | * > USBKeyboard kb; |
zackc | 0:86603687efec | 14 | * > |
zackc | 0:86603687efec | 15 | * > int main() { |
zackc | 0:86603687efec | 16 | * > while(1) { |
zackc | 0:86603687efec | 17 | * > kb.sendKeys("Foo goes here!"); |
zackc | 0:86603687efec | 18 | * > wait(2); |
zackc | 0:86603687efec | 19 | * > } |
zackc | 0:86603687efec | 20 | * > } |
zackc | 0:86603687efec | 21 | */ |
zackc | 0:86603687efec | 22 | class USBKeyboard : private usbhid { |
zackc | 0:86603687efec | 23 | public: |
zackc | 0:86603687efec | 24 | /* Constructor: USBKeyboard |
zackc | 0:86603687efec | 25 | * Create a USB Keyboard using the mbed USB Device interface |
zackc | 0:86603687efec | 26 | */ |
zackc | 0:86603687efec | 27 | USBKeyboard(); |
zackc | 0:86603687efec | 28 | |
zackc | 0:86603687efec | 29 | void sendKeys(char *szString); |
zackc | 0:86603687efec | 30 | void sendKey(char c); |
zackc | 0:86603687efec | 31 | |
zackc | 0:86603687efec | 32 | |
zackc | 0:86603687efec | 33 | private: |
zackc | 0:86603687efec | 34 | |
zackc | 0:86603687efec | 35 | }; |
zackc | 0:86603687efec | 36 | |
zackc | 0:86603687efec | 37 | #endif |