Skip to content

Commit 6ba4fd3

Browse files
authored
Merge pull request #54 from algernon/pull/wakeup-suspend-hooks
Add USBDevice.isSuspended()
2 parents 4efd686 + c87bc7b commit 6ba4fd3

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Diff for: cores/arduino/USBAPI.h

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ class USBDevice_
6565
void detach(); // Serial port goes down too...
6666
void poll();
6767
bool wakeupHost(); // returns false, when wakeup cannot be processed
68+
69+
bool isSuspended();
6870
};
6971
extern USBDevice_ USBDevice;
7072

Diff for: cores/arduino/USBCore.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -855,4 +855,10 @@ bool USBDevice_::wakeupHost()
855855
return false;
856856
}
857857

858+
bool USBDevice_::isSuspended()
859+
{
860+
return (_usbSuspendState & (1 << SUSPI));
861+
}
862+
863+
858864
#endif /* if defined(USBCON) */

0 commit comments

Comments
 (0)