aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartino Facchin <m.facchin@arduino.cc>2018-12-19 15:34:29 +0100
committerGitHub <noreply@github.com>2018-12-19 15:34:29 +0100
commit6ba4fd363f8dcd704b73d6b4dd897fce6e7bfa72 (patch)
tree12d85497b9580d35a419bcfd1bc2fbe354cd15c9
parent4efd68677303c77dcafff37b5f2d8a66bb062a43 (diff)
parentc87bc7ba9a94cbeca3b652ea068c4bdb38c76b6c (diff)
Merge pull request #54 from algernon/pull/wakeup-suspend-hooks
Add USBDevice.isSuspended()
-rw-r--r--cores/arduino/USBAPI.h2
-rw-r--r--cores/arduino/USBCore.cpp6
2 files changed, 8 insertions, 0 deletions
diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h
index 479ced9..701a14f 100644
--- a/cores/arduino/USBAPI.h
+++ b/cores/arduino/USBAPI.h
@@ -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;
diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp
index 81f689d..c0a4c7c 100644
--- a/cores/arduino/USBCore.cpp
+++ b/cores/arduino/USBCore.cpp
@@ -855,4 +855,10 @@ bool USBDevice_::wakeupHost()
return false;
}
+bool USBDevice_::isSuspended()
+{
+ return (_usbSuspendState & (1 << SUSPI));
+}
+
+
#endif /* if defined(USBCON) */