Skip to content

Commit ce81675

Browse files
authored
Merge pull request #5135 from facchinm/usbsuspend_resume
Send an USB remote wakeup if data need to be written
2 parents 21ec821 + 003d22f commit ce81675

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

hardware/arduino/avr/cores/arduino/USBCore.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22

3-
/* Copyright (c) 2010, Peter Barrett
3+
/* Copyright (c) 2010, Peter Barrett
4+
** Sleep/Wakeup support added by Michael Dreher
45
**
56
** Permission to use, copy, modify, and/or distribute this software for
67
** 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)
266267
if (!_usbConfiguration)
267268
return -1;
268269

270+
if (_usbSuspendState & (1<<SUSPI)) {
271+
//send a remote wakeup
272+
UDCON |= (1 << RMWKUP);
273+
}
274+
269275
int r = len;
270276
const u8* data = (const u8*)d;
271277
u8 timeout = 250; // 250ms timeout on send? TODO

0 commit comments

Comments
 (0)