feat(usb): add usb wakeup from light sleep example

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
JiangGuangMing
2026-06-11 09:24:04 +08:00
co-authored by Cursor
parent 33f65d3ff2
commit a2e5d0b23f
9 changed files with 303 additions and 2 deletions
+14 -1
View File
@@ -1,11 +1,12 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "esp_err.h"
#include "soc/soc_caps.h"
@@ -158,6 +159,18 @@ esp_err_t __attribute__((deprecated)) usb_phy_otg_dev_set_speed(usb_phy_handle_t
*/
esp_err_t __attribute__((deprecated)) usb_phy_action(usb_phy_handle_t handle, usb_phy_action_t action);
/**
* @brief Set the USB OTG suspend state for USB wakeup logic
*
* @param in_suspend True if the USB OTG bus is suspended
*/
void usb_phy_set_otg_suspend_state(bool in_suspend);
/**
* @brief Clear USB OTG wakeup status from the USB wakeup logic
*/
void usb_phy_clear_otg_wakeup_status(void);
/**
* @brief Delete a USB PHY
*
+17 -1
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -265,6 +265,22 @@ esp_err_t usb_phy_action(usb_phy_handle_t handle, usb_phy_action_t action)
return ret;
}
void usb_phy_set_otg_suspend_state(bool in_suspend)
{
#if SOC_USB_UTMI_PHY_NUM
usb_utmi_hal_set_suspend_state(in_suspend);
#else
(void)in_suspend;
#endif
}
void usb_phy_clear_otg_wakeup_status(void)
{
#if SOC_USB_UTMI_PHY_NUM
usb_utmi_hal_clear_wakeup_status();
#endif
}
static esp_err_t usb_phy_install(void)
{
PHY_ENTER_CRITICAL();