diff options
| author | hathach <[email protected]> | 2019-03-30 23:01:23 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-03-30 23:01:23 +0700 |
| commit | eabfc53f38dc538b44615aed32db66484a3acca4 (patch) | |
| tree | e1ad77937c1ed4b2f3d81636d4f94fe2d25647e3 /src/device/usbd.h | |
| parent | f3a954e7deaa33db5fed8e807cd146e65aaeb104 (diff) | |
added tud_suspended() and tud_ready()
Diffstat (limited to 'src/device/usbd.h')
| -rw-r--r-- | src/device/usbd.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/device/usbd.h b/src/device/usbd.h index d9b9cb8a7..13c282e91 100644 --- a/src/device/usbd.h +++ b/src/device/usbd.h @@ -66,6 +66,15 @@ void tud_task (void); // Check if device is connected and configured
bool tud_mounted(void);
+// Check if device is suspended
+bool tud_suspended(void);
+
+// Check if device is ready to transfer
+static inline bool tud_ready(void)
+{
+ return tud_mounted() && !tud_suspended();
+}
+
// Remote wake up host, only if suspended and enabled by host
bool tud_remote_wakeup(void);
@@ -79,7 +88,8 @@ ATTR_WEAK void tud_mount_cb(void); // Invoked when device is unmounted
ATTR_WEAK void tud_umount_cb(void);
-// Invoked when usb bus is suspended, max bus current draw is 2.5 mA
+// Invoked when usb bus is suspended
+// Within 7ms, device must draw an average of current less than 2.5 mA from bus
ATTR_WEAK void tud_suspend_cb(bool remote_wakeup_en);
// Invoked when usb bus is resumed
|
