From 2289569e7dc0d61b1b0fcd8979f78966002dc937 Mon Sep 17 00:00:00 2001 From: Nico Date: Sat, 28 Feb 2015 10:42:41 +0100 Subject: [PATCH] Integrated System wakeup into API --- Readme.md | 1 + avr/cores/hid/USB-Core/System.h | 7 ++++++- examples/HID_Basic/HID_System/HID_System.ino | 4 ++-- examples/Readme.md | 4 ---- 4 files changed, 9 insertions(+), 7 deletions(-) delete mode 100644 examples/Readme.md diff --git a/Readme.md b/Readme.md index 2d0ddf8..cee132e 100644 --- a/Readme.md +++ b/Readme.md @@ -72,6 +72,7 @@ Version History * Arduino as ISP fix for 328 * Upload verification on USB hubs fix for HL2.0.4 * No USB workaround for Leonardo integrated into variants +* Changed USB Wakeup in System API 2.1 Release (28.01.2015) * Reworked the whole USB-Core from scratch diff --git a/avr/cores/hid/USB-Core/System.h b/avr/cores/hid/USB-Core/System.h index c8f3a8e..03dca7d 100644 --- a/avr/cores/hid/USB-Core/System.h +++ b/avr/cores/hid/USB-Core/System.h @@ -59,7 +59,12 @@ public: release(); } inline void press(uint8_t s){ - HID_SendReport(HID_REPORTID_SYSTEMCONTROL, &s, sizeof(s)); +#ifdef USBCON + if (s == SYSTEM_WAKE_UP) + USBDevice.wakeupHost(); + else +#endif + HID_SendReport(HID_REPORTID_SYSTEMCONTROL, &s, sizeof(s)); } inline void release(void){ begin(); diff --git a/examples/HID_Basic/HID_System/HID_System.ino b/examples/HID_Basic/HID_System/HID_System.ino index 1e8db53..0531cb2 100644 --- a/examples/HID_Basic/HID_System/HID_System.ino +++ b/examples/HID_Basic/HID_System/HID_System.ino @@ -39,10 +39,10 @@ void loop() { // tries to wake up the PC // this might fail on some PCs where USB wakeup isnt supported - USBDevice.wakeupHost(); + System.write(SYSTEM_WAKE_UP); // simple debounce delay(300); digitalWrite(pinLed, LOW); } -} +} \ No newline at end of file diff --git a/examples/Readme.md b/examples/Readme.md deleted file mode 100644 index 30a01d3..0000000 --- a/examples/Readme.md +++ /dev/null @@ -1,4 +0,0 @@ -Examples -======== - -Just try these examples once the HID Source is installed. Its pretty much self explaining. \ No newline at end of file