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.
Dependents: idd_hw3_ddrew73_fil_clashLHC
Fork of USBDevice by
Revision 32:52eb548396ee, committed 2014-09-29
- Comitter:
- fil
- Date:
- Mon Sep 29 01:52:10 2014 +0000
- Parent:
- 31:5bf05f9b3c7b
- Commit message:
- usbdevice with press/release improvement.
Changed in this revision
| USBHID/USBMouseKeyboard.cpp | Show annotated file Show diff for this revision Revisions of this file |
| USBHID/USBMouseKeyboard.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/USBHID/USBMouseKeyboard.cpp Thu Aug 21 15:00:37 2014 +0100
+++ b/USBHID/USBMouseKeyboard.cpp Mon Sep 29 01:52:10 2014 +0000
@@ -675,6 +675,38 @@
return false;
}
+ //report.data[1] = 0;
+ //report.data[3] = 0;
+
+ if (!send(&report)) {
+ return false;
+ }
+
+ return true;
+
+}
+
+bool USBMouseKeyboard::releaseKey(uint8_t key, 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[key].usage;
+ report.data[4] = 0;
+ report.data[5] = 0;
+ report.data[6] = 0;
+ report.data[7] = 0;
+ report.data[8] = 0;
+
+ report.length = 9;
+
+ if (!send(&report)) {
+ return false;
+ }
+
report.data[1] = 0;
report.data[3] = 0;
@@ -686,7 +718,6 @@
}
-
bool USBMouseKeyboard::mediaControl(MEDIA_KEY key) {
HID_REPORT report;
--- a/USBHID/USBMouseKeyboard.h Thu Aug 21 15:00:37 2014 +0100
+++ b/USBHID/USBMouseKeyboard.h Mon Sep 29 01:52:10 2014 +0000
@@ -163,6 +163,8 @@
* @returns true if there is no error, false otherwise
*/
bool keyCode(uint8_t key, uint8_t modifier = 0);
+ bool releaseKey(uint8_t key, uint8_t modifier = 0);
+
/**
* Send a character
