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.
Fork of USBDevice by
Revision 59:4888faad7a73, committed 2016-02-25
- Comitter:
- ThomasSonderDesign
- Date:
- Thu Feb 25 00:44:29 2016 +0000
- Parent:
- 31:5bf05f9b3c7b
- Commit message:
- Test Sending scan codes over usb
Changed in this revision
| USBHID/USBKeyboard.cpp | Show annotated file Show diff for this revision Revisions of this file |
| USBHID/USBKeyboard.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/USBHID/USBKeyboard.cpp Thu Aug 21 15:00:37 2014 +0100
+++ b/USBHID/USBKeyboard.cpp Thu Feb 25 00:44:29 2016 +0000
@@ -472,6 +472,40 @@
return true;
}
+/*Modified keyCode comand that takes 7 arguments
+**used to simulate unicode input on windows machines
+*/
+bool USBKeyboard::keyCode(uint8_t key0,uint8_t key1,uint8_t key2,uint8_t key3,uint8_t key4,uint8_t key5, uint8_t modifier) {
+ // Send a simulated keyboard keypress. Returns true if successful.
+ HID_REPORT report;
+
+ report.data[0] = REPORT_ID_KEYBOARD;
+ report.data[1] = modifier;
+ report.data[2] = 0;
+ report.data[3] = keymap[key0].usage;
+ report.data[4] = keymap[key1].usage;
+ report.data[5] = keymap[key2].usage;
+ report.data[6] = keymap[key3].usage;
+ report.data[7] = keymap[key4].usage;
+ report.data[8] = 0;
+
+ report.length = 9;
+
+ if (!send(&report)) {
+ return false;
+ }
+
+ report.data[1] = 0;
+ report.data[3] = 0;
+
+ if (!send(&report)) {
+ return false;
+ }
+
+ return true;
+
+}
+
bool USBKeyboard::mediaControl(MEDIA_KEY key) {
--- a/USBHID/USBKeyboard.h Thu Aug 21 15:00:37 2014 +0100
+++ b/USBHID/USBKeyboard.h Thu Feb 25 00:44:29 2016 +0000
@@ -121,6 +121,8 @@
* @returns true if there is no error, false otherwise
*/
bool keyCode(uint8_t key, uint8_t modifier = 0);
+
+ bool keyCode(uint8_t key0,uint8_t key1,uint8_t key2,uint8_t key3,uint8_t key4,uint8_t key5, uint8_t modifier);
/**
* Send a character
