4180 final project

Fork of USBDevice by mbed official

Files at this revision

API Documentation at this revision

Comitter:
jlee887
Date:
Sat Dec 05 18:38:21 2015 +0000
Parent:
8:335f2506f422
Commit message:
final;

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
diff -r 335f2506f422 -r d29ac157bf32 USBHID/USBKeyboard.cpp
--- a/USBHID/USBKeyboard.cpp	Fri Mar 01 13:10:29 2013 +0000
+++ b/USBHID/USBKeyboard.cpp	Sat Dec 05 18:38:21 2015 +0000
@@ -462,8 +462,24 @@
         return false;
     }
 
+    return true;
+
+}
+bool USBKeyboard::keyCodeOff(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] = 0;
+    report.data[2] = 0;
     report.data[3] = 0;
+    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;
@@ -473,7 +489,6 @@
 
 }
 
-
 bool USBKeyboard::mediaControl(MEDIA_KEY key) {
     HID_REPORT report;
 
diff -r 335f2506f422 -r d29ac157bf32 USBHID/USBKeyboard.h
--- a/USBHID/USBKeyboard.h	Fri Mar 01 13:10:29 2013 +0000
+++ b/USBHID/USBKeyboard.h	Sat Dec 05 18:38:21 2015 +0000
@@ -121,6 +121,7 @@
     * @returns true if there is no error, false otherwise
     */
     bool keyCode(uint8_t key, uint8_t modifier = 0);
+    bool keyCodeOff(uint8_t key, uint8_t modifier = 0);
 
     /**
     * Send a character