changed 2 functions to press and release keys

Fork of USBDevice by mbed official

Files at this revision

API Documentation at this revision

Comitter:
jgensel3
Date:
Sun Apr 23 19:57:54 2017 +0000
Parent:
64:9b8eb1c0f7d5
Commit message:
changed return type

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	Sun Apr 23 19:56:19 2017 +0000
+++ b/USBHID/USBKeyboard.cpp	Sun Apr 23 19:57:54 2017 +0000
@@ -495,7 +495,7 @@
     return true;
 }
 
-void USBKeyboard::releaseAllKeys(){
+bool USBKeyboard::releaseAllKeys(){
     HID_REPORT report;
     report.data[0] = REPORT_ID_KEYBOARD;
     report.data[1] = 0;
@@ -508,7 +508,10 @@
     report.data[8] = 0;
     
     report.length = 9;
-    send(&report);
+     if (!send(&report)) {
+        return false;
+    }
+    return true;
 }
 
 bool USBKeyboard::mediaControl(MEDIA_KEY key) {
--- a/USBHID/USBKeyboard.h	Sun Apr 23 19:56:19 2017 +0000
+++ b/USBHID/USBKeyboard.h	Sun Apr 23 19:57:54 2017 +0000
@@ -124,7 +124,7 @@
     
     bool pressKey(uint8_t key, uint8_t modifier = 0);
     
-    void releaseAllKeys();
+    bool releaseAllKeys();
 
     /**
     * Send a character