Add USBDevice.isSuspended()

Based on code originally by Rob van der Veer <rob.c.veer@gmail.com>, this adds
USBDevice.isSuspended(), so user sketches can run custom code in their `loop`
methods after checking if the device is suspended or not.
Signed-off-by: default avatarGergely Nagy <algernon@keyboard.io>
parent 2663be17
......@@ -65,6 +65,8 @@ public:
void detach(); // Serial port goes down too...
void poll();
bool wakeupHost(); // returns false, when wakeup cannot be processed
bool isSuspended();
};
extern USBDevice_ USBDevice;
......
......@@ -855,4 +855,10 @@ bool USBDevice_::wakeupHost()
return false;
}
bool USBDevice_::isSuspended()
{
return (_usbSuspendState & (1 << SUSPI));
}
#endif /* if defined(USBCON) */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment