From b28cc6ddb11ef233b6e6ee25b4a305b4b76cc03c Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 30 Mar 2019 14:47:11 +0700 Subject: added dcd_remote_wakeup() stub for all ports --- src/device/usbd.c | 2 +- src/device/usbd.h | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src/device') diff --git a/src/device/usbd.c b/src/device/usbd.c index f90c6b4df..dde98939f 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -189,7 +189,7 @@ void tud_set_self_powered(bool self_powered) bool tud_remote_wakeup(void) { // only wake up host if this feature is enabled - if (_usbd_dev.remote_wakeup_en ) dcd_remote_wakeup(TUD_OPT_RHPORT); + if (_usbd_dev.suspended && _usbd_dev.remote_wakeup_en ) dcd_remote_wakeup(TUD_OPT_RHPORT); return _usbd_dev.remote_wakeup_en; } diff --git a/src/device/usbd.h b/src/device/usbd.h index ebf166821..27bfe305b 100644 --- a/src/device/usbd.h +++ b/src/device/usbd.h @@ -59,12 +59,19 @@ extern tud_desc_set_t tud_desc_set; //--------------------------------------------------------------------+ // Application API //--------------------------------------------------------------------+ -bool tud_mounted(void); + +// Task function should be called in main/rtos loop void tud_task (void); -bool tud_remote_wakeup(void); +// Check if device is connected and configured +bool tud_mounted(void); + +// Tell stack that device is self or bus powered (default = bus) void tud_set_self_powered(bool self_powered); +// Remote wake up host, only if suspended and enabled by host +bool tud_remote_wakeup(void); + //--------------------------------------------------------------------+ // Application Callbacks (WEAK is optional) //--------------------------------------------------------------------+ -- cgit v1.3.1