From ce9cfedc1f696d6937f519668f0f23305bc2c0b8 Mon Sep 17 00:00:00 2001 From: Michael Dreher Date: Tue, 2 Jul 2013 21:48:57 +0200 Subject: [PATCH] Added first part of SUSPEND / WAKEUP handling; store SUSPI in _usbSuspendState --- .../keyboardio/cores/keyboardio/USBCore.cpp | 82 ++++++++++++++----- 1 file changed, 63 insertions(+), 19 deletions(-) diff --git a/hardware/keyboardio/cores/keyboardio/USBCore.cpp b/hardware/keyboardio/cores/keyboardio/USBCore.cpp index 1d4b1d40..cb9bf040 100644 --- a/hardware/keyboardio/cores/keyboardio/USBCore.cpp +++ b/hardware/keyboardio/cores/keyboardio/USBCore.cpp @@ -93,6 +93,7 @@ const DeviceDescriptor USB_DeviceDescriptorA = 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) { @@ -614,11 +615,39 @@ void USB_Flush(u8 ep) ReleaseTX(); } +static inline void USB_ClockDisable() +{ + USBCON = (USBCON & ~(1<