From 3ee0fa126506c623bf45ddcfccce1bf2abd2e41e Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Fri, 26 Jun 2015 15:05:57 +0200 Subject: Add support for waking up a host via USB HID this is a rework of commit fbcf94801b8bba7f1c8c79cc7ae402b6b9dbb2d3 --- cores/arduino/USBCore.cpp | 161 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 139 insertions(+), 22 deletions(-) (limited to 'cores/arduino/USBCore.cpp') diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index b0160e2..9095d79 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -78,6 +78,8 @@ const DeviceDescriptor USB_DeviceDescriptorB = //================================================================== volatile u8 _usbConfiguration = 0; +volatile u8 _usbCurrentStatus = 0; // meaning of bits see usb_20.pdf, Figure 9-4. Information Returned by a GetStatus() Request to a Device +volatile u8 _usbSuspendState = 0; // copy of UDINT to check SUSPI and WAKEUPI bits static inline void WaitIN(void) { @@ -329,7 +331,7 @@ static void InitEP(u8 index, u8 type, u8 size) { UENUM = index; - UECONX = 1; + UECONX = (1<