diff options
Diffstat (limited to 'cores/arduino/USBCore.cpp')
-rw-r--r-- | cores/arduino/USBCore.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index 44dce72..ddc4812 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -1,6 +1,7 @@ -/* Copyright (c) 2010, Peter Barrett +/* Copyright (c) 2010, Peter Barrett +** Sleep/Wakeup support added by Michael Dreher ** ** Permission to use, copy, modify, and/or distribute this software for ** any purpose with or without fee is hereby granted, provided that the @@ -266,6 +267,11 @@ int USB_Send(u8 ep, const void* d, int len) if (!_usbConfiguration) return -1; + if (_usbSuspendState & (1<<SUSPI)) { + //send a remote wakeup + UDCON |= (1 << RMWKUP); + } + int r = len; const u8* data = (const u8*)d; u8 timeout = 250; // 250ms timeout on send? TODO @@ -733,7 +739,7 @@ static inline void USB_ClockEnable() ISR(USB_GEN_vect) { u8 udint = UDINT; - UDINT = UDINT &= ~((1<<EORSTI) | (1<<SOFI)); // clear the IRQ flags for the IRQs which are handled here, except WAKEUPI and SUSPI (see below) + UDINT &= ~((1<<EORSTI) | (1<<SOFI)); // clear the IRQ flags for the IRQs which are handled here, except WAKEUPI and SUSPI (see below) // End of Reset if (udint & (1<<EORSTI)) |