Skip to content

Commit 947a07a

Browse files
feat(uac_host): Add global suspend/resume
1 parent ff739ce commit 947a07a

File tree

4 files changed

+537
-54
lines changed

4 files changed

+537
-54
lines changed

host/class/uac/usb_host_uac/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog for USB Host UAC
22

3+
## [unreleased]
4+
5+
1. Added global suspend/resume support
6+
37
## 1.3.0
48

59
1. Added Linux target build for the UAC component, host tests (https://github.com/espressif/esp-usb/issues/143)

host/class/uac/usb_host_uac/include/usb/uac_host.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <stdint.h>
1111
#include "freertos/FreeRTOS.h"
1212
#include "esp_err.h"
13+
#include "usb/usb_host.h"
1314
#include "uac.h"
1415

1516
#ifdef __cplusplus
@@ -36,6 +37,11 @@ extern "C" {
3637
*/
3738
#define FLAG_STREAM_SUSPEND_AFTER_START (1 << 0)
3839

40+
// For backward compatibility with older idf versions without suspend/resume API
41+
#ifdef USB_HOST_LIB_EVENT_FLAGS_AUTO_SUSPEND
42+
#define UAC_HOST_SUSPEND_RESUME_API_SUPPORTED
43+
#endif
44+
3945
typedef struct uac_interface *uac_host_device_handle_t; /*!< Logic Device Handle. Handle to a particular UAC interface */
4046

4147
// ------------------------ USB UAC Host events --------------------------------
@@ -55,6 +61,10 @@ typedef enum {
5561
UAC_HOST_DEVICE_EVENT_TX_DONE, /*!< TX Done: the transmit buffer data size falls below the threshold */
5662
UAC_HOST_DEVICE_EVENT_TRANSFER_ERROR, /*!< UAC Device transfer error */
5763
UAC_HOST_DRIVER_EVENT_DISCONNECTED, /*!< UAC Device has been disconnected */
64+
#ifdef UAC_HOST_SUSPEND_RESUME_API_SUPPORTED
65+
UAC_HOST_DEVICE_EVENT_SUSPENDED, /*!< UAC Device has been suspended */
66+
UAC_HOST_DEVICE_EVENT_RESUMED, /*!< UAC Device has been resumed */
67+
#endif // UAC_HOST_SUSPEND_RESUME_API_SUPPORTED
5868
} uac_host_device_event_t;
5969

6070
// ------------------------ USB UAC Host events callbacks -----------------------------

0 commit comments

Comments
 (0)