aboutsummaryrefslogtreecommitdiff
path: root/cores
diff options
context:
space:
mode:
authorMartino Facchin <m.facchin@arduino.cc>2016-07-21 10:42:40 +0200
committerGitHub <noreply@github.com>2016-07-21 10:42:40 +0200
commita03982445a085821bbf8893c0b7f626e440433ad (patch)
treee80854c2bee05a19883862017182688b5194c384 /cores
parent0f86786b477edeec8df8109e51f80b6d91ae246d (diff)
parent7874386ce23a7b7383f587e6bf6ae665756024ba (diff)
Merge pull request #5135 from facchinm/usbsuspend_resume
Send an USB remote wakeup if data need to be written
Diffstat (limited to 'cores')
-rw-r--r--cores/arduino/USBCore.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp
index 6c8ae63..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